From add0bcc4c9191cb8980d0b6935ca5d51a9928d82 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Mon, 30 Nov 2009 21:24:21 +0000 Subject: Trim trailing space & reduce space+tab. --- Makefile.am | 4 +- debian/README.Debian | 6 +- debian/changelog | 32 +- debian/control | 4 +- debian/copyright | 2 +- debian/rules | 2 +- doc/README.MINGWCROSS | 6 +- doc/README.dvb | 2 +- doc/README.dxr3 | 46 +- doc/README.freebsd | 6 +- doc/README.network_dvd | 6 +- doc/README.solaris | 14 +- doc/README.syncfb | 68 +- doc/faq/faq.sgml | 196 +- doc/hackersguide/README | 2 +- doc/hackersguide/architecture.fig | 2 +- doc/hackersguide/internals.sgml | 60 +- doc/hackersguide/intro.sgml | 2 +- doc/hackersguide/library.fig | 2 +- doc/hackersguide/library.sgml | 94 +- doc/hackersguide/output.sgml | 18 +- doc/hackersguide/overlays.fig | 2 +- doc/hackersguide/overview.sgml | 24 +- doc/hackersguide/post_frame.fig | 2 +- doc/hackersguide/stream.sgml | 8 +- doc/internal/HOWTO.release | 8 +- include/Makefile.am | 2 +- lib/Makefile.am | 2 +- lib/asprintf.c | 6 +- lib/dirent_msvc.c | 2 +- lib/os_types.h | 4 +- lib/strsep.c | 2 +- m4/_xine.m4 | 10 +- m4/aa.m4 | 38 +- m4/arts.m4 | 10 +- m4/attributes.m4 | 6 +- m4/directx.m4 | 4 +- m4/dl.m4 | 2 +- m4/dvdnav.m4 | 20 +- m4/getopt_long.m4 | 4 +- m4/ioctl_request.m4 | 2 +- m4/libFLAC.m4 | 4 +- m4/libfame.m4 | 10 +- m4/misc.m4 | 2 +- m4/opengl.m4 | 4 +- m4/pkg.m4 | 6 +- m4/symbol.m4 | 2 +- m4/xine.m4 | 24 +- m4/xv.m4 | 6 +- misc/cdda_server.c | 62 +- misc/fonts/Makefile.am | 2 +- misc/xine-fontconv.c | 110 +- src/audio_out/Makefile.am | 6 +- src/audio_out/audio_alsa_out.c | 322 +-- src/audio_out/audio_arts_out.c | 30 +- src/audio_out/audio_coreaudio_out.c | 68 +- src/audio_out/audio_directx2_out.c | 34 +- src/audio_out/audio_directx_out.c | 70 +- src/audio_out/audio_esd_out.c | 86 +- src/audio_out/audio_file_out.c | 18 +- src/audio_out/audio_fusionsound_out.c | 76 +- src/audio_out/audio_irixal_out.c | 28 +- src/audio_out/audio_jack_out.c | 2 +- src/audio_out/audio_none_out.c | 24 +- src/audio_out/audio_oss_out.c | 162 +- src/audio_out/audio_sun_out.c | 64 +- src/combined/combined_wavpack.c | 2 +- src/combined/decoder_flac.c | 76 +- src/combined/decoder_wavpack.c | 18 +- src/combined/demux_flac.c | 106 +- src/combined/demux_flac.h | 10 +- src/combined/demux_wavpack.c | 14 +- src/combined/ffmpeg/ff_audio_decoder.c | 82 +- src/combined/ffmpeg/ff_dvaudio_decoder.c | 48 +- src/combined/ffmpeg/ff_mpeg_parser.c | 32 +- src/combined/ffmpeg/ff_mpeg_parser.h | 2 +- src/combined/ffmpeg/ff_video_decoder.c | 286 +-- src/combined/ffmpeg/ffmpeg_decoder.c | 10 +- src/combined/ffmpeg/ffmpeg_decoder.h | 10 +- src/combined/ffmpeg/ffmpeg_encoder.c | 58 +- src/demuxers/Makefile.am | 4 +- src/demuxers/demux.h | 34 +- src/demuxers/demux_4xm.c | 8 +- src/demuxers/demux_aac.c | 4 +- src/demuxers/demux_ac3.c | 4 +- src/demuxers/demux_aiff.c | 8 +- src/demuxers/demux_asf.c | 170 +- src/demuxers/demux_aud.c | 2 +- src/demuxers/demux_avi.c | 106 +- src/demuxers/demux_cdda.c | 2 +- src/demuxers/demux_dts.c | 14 +- src/demuxers/demux_eawve.c | 2 +- src/demuxers/demux_elem.c | 16 +- src/demuxers/demux_film.c | 32 +- src/demuxers/demux_flac.c | 22 +- src/demuxers/demux_fli.c | 4 +- src/demuxers/demux_flv.c | 138 +- src/demuxers/demux_idcin.c | 6 +- src/demuxers/demux_image.c | 14 +- src/demuxers/demux_ipmovie.c | 18 +- src/demuxers/demux_matroska-chapters.c | 8 +- src/demuxers/demux_matroska.c | 158 +- src/demuxers/demux_matroska.h | 14 +- src/demuxers/demux_mng.c | 2 +- src/demuxers/demux_mod.c | 42 +- src/demuxers/demux_mpc.c | 82 +- src/demuxers/demux_mpeg.c | 84 +- src/demuxers/demux_mpeg_block.c | 200 +- src/demuxers/demux_mpeg_pes.c | 230 +-- src/demuxers/demux_mpgaudio.c | 50 +- src/demuxers/demux_nsf.c | 4 +- src/demuxers/demux_nsv.c | 56 +- src/demuxers/demux_ogg.c | 72 +- src/demuxers/demux_pva.c | 10 +- src/demuxers/demux_qt.c | 166 +- src/demuxers/demux_rawdv.c | 30 +- src/demuxers/demux_real.c | 252 +-- src/demuxers/demux_realaudio.c | 72 +- src/demuxers/demux_roq.c | 20 +- src/demuxers/demux_shn.c | 4 +- src/demuxers/demux_slave.c | 14 +- src/demuxers/demux_smjpeg.c | 2 +- src/demuxers/demux_snd.c | 18 +- src/demuxers/demux_str.c | 10 +- src/demuxers/demux_ts.c | 186 +- src/demuxers/demux_tta.c | 2 +- src/demuxers/demux_vmd.c | 12 +- src/demuxers/demux_voc.c | 6 +- src/demuxers/demux_vox.c | 4 +- src/demuxers/demux_vqa.c | 4 +- src/demuxers/demux_wc3movie.c | 28 +- src/demuxers/demux_yuv4mpeg2.c | 40 +- src/demuxers/demux_yuv_frames.c | 18 +- src/demuxers/ebml.c | 30 +- src/demuxers/ebml.h | 4 +- src/demuxers/group_audio.c | 2 +- src/demuxers/group_audio.h | 10 +- src/demuxers/group_games.c | 2 +- src/demuxers/group_games.h | 10 +- src/demuxers/id3.c | 66 +- src/demuxers/matroska.h | 2 +- src/demuxers/qtpalette.h | 4 +- src/dxr3/Makefile.am | 6 +- src/dxr3/dxr3.h | 10 +- src/dxr3/dxr3_decode_spu.c | 152 +- src/dxr3/dxr3_decode_video.c | 178 +- src/dxr3/dxr3_mpeg_encoders.c | 136 +- src/dxr3/dxr3_scr.c | 58 +- src/dxr3/dxr3_scr.h | 16 +- src/dxr3/dxr3_spu_encoder.c | 38 +- src/dxr3/em8300.h | 48 +- src/dxr3/video_out_dxr3.c | 304 +-- src/dxr3/video_out_dxr3.h | 30 +- src/input/Makefile.am | 2 +- src/input/base64.c | 6 +- src/input/base64.h | 6 +- src/input/dvb/Makefile.am | 2 +- src/input/dvb/dmx.h | 6 +- src/input/http_helper.c | 20 +- src/input/input_cdda.c | 362 ++-- src/input/input_dvb.c | 508 ++--- src/input/input_dvd.c | 258 +-- src/input/input_file.c | 172 +- src/input/input_gnome_vfs.c | 10 +- src/input/input_http.c | 182 +- src/input/input_mms.c | 76 +- src/input/input_net.c | 92 +- src/input/input_plugin.h | 66 +- src/input/input_pnm.c | 38 +- src/input/input_pvr.c | 412 ++-- src/input/input_rtp.c | 128 +- src/input/input_rtsp.c | 40 +- src/input/input_smb.c | 76 +- src/input/input_stdin_fifo.c | 28 +- src/input/input_v4l.c | 680 +++---- src/input/input_vcd.c | 210 +- src/input/libdvdnav/Makefile.am | 2 +- src/input/libreal/asmrp.c | 38 +- src/input/libreal/real.c | 106 +- src/input/libreal/real.h | 2 +- src/input/libreal/rmff.c | 64 +- src/input/libreal/rmff.h | 10 +- src/input/libreal/sdpplin.c | 32 +- src/input/libreal/sdpplin.h | 4 +- src/input/librtsp/rtsp.c | 86 +- src/input/librtsp/rtsp.h | 2 +- src/input/librtsp/rtsp_session.c | 36 +- src/input/media_helper.c | 24 +- src/input/mms.c | 122 +- src/input/mms.h | 8 +- src/input/mmsh.c | 90 +- src/input/mmsh.h | 8 +- src/input/net_buf_ctrl.c | 28 +- src/input/net_buf_ctrl.h | 8 +- src/input/pnm.c | 124 +- src/input/pnm.h | 2 +- src/input/sha1.c | 14 +- src/input/sha1.h | 2 +- src/input/vcd/libcdio/cdio/Makefile.am | 2 +- src/input/vcd/libvcd/Makefile.am | 2 +- src/input/vcd/xine-extra.c | 34 +- src/input/vcd/xine-extra.h | 30 +- src/input/vcd/xineplug_inp_vcd.c | 596 +++--- src/input/videodev2.h | 136 +- src/liba52/bit_allocate.c | 2 +- src/liba52/bitstream.c | 2 +- src/liba52/bitstream.h | 4 +- src/liba52/crc.c | 12 +- src/liba52/imdct.c | 4 +- src/liba52/parse.c | 10 +- src/liba52/xine_a52_decoder.c | 24 +- src/libdts/Makefile.am | 2 +- src/libdts/parse.c | 12 +- src/libdts/tables_huffman.h | 1326 ++++++------- src/libdts/tables_quantization.h | 62 +- src/libdts/tables_vq.h | 2048 ++++++++++---------- src/libdts/xine_dts_decoder.c | 72 +- src/libfaad/codebook/Makefile.am | 2 +- src/libfaad/xine_faad_decoder.c | 120 +- src/libffmpeg/libavcodec/Makefile.am | 2 +- src/libffmpeg/libavcodec/armv4l/Makefile.am | 2 +- src/libffmpeg/libavcodec/i386/dsputil_mmx.c | 6 +- src/libffmpeg/libavcodec/libpostproc/Makefile.am | 2 +- src/libffmpeg/libavcodec/swscale.h | 12 +- src/libmad/fixed.h | 2 +- src/libmad/synth.h | 2 +- src/libmad/xine_mad_decoder.c | 62 +- src/libmpeg2/xine_mpeg2_decoder.c | 16 +- src/libmpeg2new/Makefile.am | 2 +- src/libmpeg2new/xine_mpeg2new_decoder.c | 28 +- src/libmusepack/Makefile.am | 2 +- src/libmusepack/xine_musepack_decoder.c | 122 +- src/libreal/real_common.c | 18 +- src/libreal/real_common.h | 10 +- src/libreal/xine_real_audio_decoder.c | 58 +- src/libreal/xine_real_video_decoder.c | 94 +- src/libspucc/cc_decoder.c | 88 +- src/libspucc/cc_decoder.h | 12 +- src/libspucc/xine_cc_decoder.c | 52 +- src/libspucmml/xine_cmml_decoder.c | 50 +- src/libspudec/spu.c | 136 +- src/libspudec/spu.h | 12 +- src/libspudec/xine_spu_decoder.c | 44 +- src/libspudvb/xine_spudvb_decoder.c | 112 +- src/libsputext/Makefile.am | 2 +- src/libsputext/demux_sputext.c | 270 +-- src/libsputext/xine_sputext_decoder.c | 190 +- src/libw32dll/DirectShow/DS_AudioDecoder.c | 16 +- src/libw32dll/DirectShow/DS_VideoDecoder.c | 88 +- src/libw32dll/DirectShow/iunk.h | 28 +- src/libw32dll/common.c | 4 +- src/libw32dll/dmo/DMO_AudioDecoder.c | 18 +- src/libw32dll/dmo/DMO_VideoDecoder.c | 42 +- src/libw32dll/dmo/Makefile.am | 2 +- src/libw32dll/dmo/dmo.c | 2 +- src/libw32dll/libwin32.h | 28 +- src/libw32dll/qt_decoder.c | 150 +- src/libw32dll/qtx/qtxsdk/components.h | 4 +- src/libw32dll/w32codec.c | 430 ++-- src/libw32dll/w32codec.h | 10 +- src/libw32dll/wine/Makefile.am | 2 +- src/libxineadec/fooaudio.c | 18 +- src/libxineadec/nosefart/Makefile.am | 2 +- src/libxineadec/nsf.c | 8 +- src/libxineadec/xine_lpcm_decoder.c | 64 +- src/libxineadec/xine_speex_decoder.c | 44 +- src/libxineadec/xine_vorbis_decoder.c | 98 +- src/libxinevdec/foovideo.c | 6 +- src/libxinevdec/gdkpixbuf.c | 32 +- src/libxinevdec/image.c | 36 +- src/libxinevdec/rgb.c | 72 +- src/libxinevdec/xine_theora_decoder.c | 36 +- src/libxinevdec/yuv.c | 38 +- src/post/audio/audio_filters.c | 10 +- src/post/audio/audio_filters.h | 8 +- src/post/audio/dsp.h | 4 +- src/post/audio/filter.c | 66 +- src/post/audio/filter.h | 6 +- src/post/audio/stretch.c | 194 +- src/post/audio/upmix.c | 44 +- src/post/audio/upmix_mono.c | 56 +- src/post/audio/volnorm.c | 44 +- src/post/audio/window.c | 26 +- src/post/audio/window.h | 2 +- src/post/deinterlace/Makefile.am | 4 +- src/post/deinterlace/plugins/greedy.c | 6 +- .../deinterlace/plugins/greedy2frame_template.c | 32 +- src/post/deinterlace/plugins/greedyhmacros.h | 26 +- src/post/deinterlace/plugins/linearblend.c | 2 +- .../plugins/tomsmocomp/tomsmocompmacros.h | 26 +- src/post/deinterlace/pulldown.c | 10 +- src/post/deinterlace/speedy.c | 26 +- src/post/deinterlace/speedy.h | 4 +- src/post/deinterlace/tvtime.h | 2 +- src/post/deinterlace/xine_plugin.c | 200 +- src/post/goom/xine_goom.c | 120 +- src/post/mosaico/mosaico.c | 86 +- src/post/mosaico/switch.c | 38 +- src/post/planar/boxblur.c | 62 +- src/post/planar/denoise3d.c | 50 +- src/post/planar/eq.c | 42 +- src/post/planar/eq2.c | 54 +- src/post/planar/expand.c | 78 +- src/post/planar/fill.c | 44 +- src/post/planar/invert.c | 36 +- src/post/planar/noise.c | 62 +- src/post/planar/planar.c | 10 +- src/post/planar/pp.c | 54 +- src/post/planar/unsharp.c | 58 +- src/post/visualizations/fft.c | 6 +- src/post/visualizations/fft.h | 6 +- src/post/visualizations/fftgraph.c | 54 +- src/post/visualizations/fftscope.c | 42 +- src/post/visualizations/fooviz.c | 80 +- src/post/visualizations/oscope.c | 88 +- src/video_out/deinterlace.c | 22 +- src/video_out/libdha/Makefile.am | 2 +- src/video_out/libdha/sysdep/Makefile.am | 2 +- src/video_out/macosx/video_window.h | 2 +- src/video_out/myglext.h | 8 +- src/video_out/video_out_aa.c | 52 +- src/video_out/video_out_caca.c | 36 +- src/video_out/video_out_directfb.c | 618 +++--- src/video_out/video_out_directfb_fb.c | 6 +- src/video_out/video_out_directfb_x.c | 6 +- src/video_out/video_out_directx.c | 74 +- src/video_out/video_out_fb.c | 158 +- src/video_out/video_out_none.c | 60 +- src/video_out/video_out_opengl.c | 124 +- src/video_out/video_out_pgx32.c | 24 +- src/video_out/video_out_pgx64.c | 22 +- src/video_out/video_out_raw.c | 22 +- src/video_out/video_out_sdl.c | 36 +- src/video_out/video_out_stk.c | 60 +- src/video_out/video_out_syncfb.c | 258 +-- src/video_out/video_out_syncfb.h | 28 +- src/video_out/video_out_vidix.c | 330 ++-- src/video_out/video_out_xcbshm.c | 146 +- src/video_out/video_out_xcbxv.c | 92 +- src/video_out/video_out_xshm.c | 190 +- src/video_out/video_out_xv.c | 110 +- src/video_out/video_out_xvmc.c | 294 +-- src/video_out/video_out_xxmc.c | 440 ++--- src/video_out/vidix/drivers/Makefile.am | 2 +- src/video_out/x11osd.c | 62 +- src/video_out/x11osd.h | 2 +- src/video_out/xcbosd.c | 38 +- src/video_out/xcbosd.h | 2 +- src/video_out/xvmc_mocomp.c | 44 +- src/video_out/xvmc_vld.c | 38 +- src/video_out/xxmc.h | 36 +- src/video_out/yuv2rgb.c | 260 +-- src/video_out/yuv2rgb.h | 6 +- src/video_out/yuv2rgb_mlib.c | 10 +- src/video_out/yuv2rgb_mmx.c | 102 +- src/xine-engine/accel_xvmc.h | 12 +- src/xine-engine/alphablend.c | 302 +-- src/xine-engine/alphablend.h | 2 +- src/xine-engine/audio_decoder.c | 130 +- src/xine-engine/audio_decoder.h | 22 +- src/xine-engine/audio_out.c | 248 +-- src/xine-engine/audio_out.h | 40 +- src/xine-engine/broadcaster.c | 96 +- src/xine-engine/broadcaster.h | 2 +- src/xine-engine/bswap.h | 4 +- src/xine-engine/buffer.c | 20 +- src/xine-engine/buffer.h | 36 +- src/xine-engine/buffer_types.c | 34 +- src/xine-engine/configfile.c | 70 +- src/xine-engine/configfile.h | 6 +- src/xine-engine/demux.c | 108 +- src/xine-engine/events.c | 32 +- src/xine-engine/info_helper.c | 46 +- src/xine-engine/info_helper.h | 2 +- src/xine-engine/input_cache.c | 46 +- src/xine-engine/input_rip.c | 72 +- src/xine-engine/io_helper.c | 46 +- src/xine-engine/load_plugins.c | 210 +- src/xine-engine/lrb.c | 18 +- src/xine-engine/lrb.h | 8 +- src/xine-engine/metronom.c | 186 +- src/xine-engine/metronom.h | 46 +- src/xine-engine/osd.c | 300 +-- src/xine-engine/osd.h | 58 +- src/xine-engine/plugin_catalog.h | 14 +- src/xine-engine/post.c | 202 +- src/xine-engine/post.h | 82 +- src/xine-engine/refcounter.c | 14 +- src/xine-engine/refcounter.h | 8 +- src/xine-engine/resample.c | 82 +- src/xine-engine/resample.h | 28 +- src/xine-engine/scratch.c | 12 +- src/xine-engine/scratch.h | 8 +- src/xine-engine/spu_decoder.h | 20 +- src/xine-engine/tvmode.c | 10 +- src/xine-engine/video_decoder.c | 148 +- src/xine-engine/video_decoder.h | 22 +- src/xine-engine/video_out.c | 330 ++-- src/xine-engine/video_out.h | 88 +- src/xine-engine/video_overlay.c | 166 +- src/xine-engine/video_overlay.h | 18 +- src/xine-engine/vo_scale.c | 76 +- src/xine-engine/vo_scale.h | 40 +- src/xine-engine/xine.c | 238 +-- src/xine-engine/xine_interface.c | 138 +- src/xine-engine/xine_internal.h | 88 +- src/xine-engine/xine_plugin.h | 10 +- src/xine-engine/xineintl.h | 8 +- src/xine-utils/array.c | 10 +- src/xine-utils/array.h | 10 +- src/xine-utils/attributes.h | 2 +- src/xine-utils/color.c | 116 +- src/xine-utils/compat.h | 10 +- src/xine-utils/copy.c | 20 +- src/xine-utils/cpu_accel.c | 12 +- src/xine-utils/list.c | 10 +- src/xine-utils/list.h | 10 +- src/xine-utils/mangle.h | 4 +- src/xine-utils/memcpy.c | 2 +- src/xine-utils/monitor.c | 10 +- src/xine-utils/pool.c | 12 +- src/xine-utils/pool.h | 10 +- src/xine-utils/ring_buffer.c | 10 +- src/xine-utils/ring_buffer.h | 10 +- src/xine-utils/sorted_array.c | 10 +- src/xine-utils/sorted_array.h | 12 +- src/xine-utils/utils.c | 38 +- src/xine-utils/xine_buffer.c | 26 +- src/xine-utils/xine_buffer.h | 10 +- src/xine-utils/xine_check.c | 26 +- src/xine-utils/xine_mmx.h | 2 +- src/xine-utils/xine_mutex.c | 16 +- src/xine-utils/xineutils.h | 2 +- src/xine-utils/xmllexer.c | 2 +- src/xine-utils/xmlparser.c | 6 +- src/xine-utils/xmlparser.h | 4 +- win32/config.h | 2 +- 437 files changed, 13930 insertions(+), 13930 deletions(-) diff --git a/Makefile.am b/Makefile.am index c585434d6..8c1d8b790 100644 --- a/Makefile.am +++ b/Makefile.am @@ -94,7 +94,7 @@ install-data-hook: mostlyclean-generic: - -rm -f *~ \#* .*~ .\#* + -rm -f *~ \#* .*~ .\#* -rm -f $(PACKAGE)_$(VERSION).tar.gz $(PACKAGE)_$(VERSION).tar.bz2 -rm -f $(distdir).tar.gz $(PACKAGE).tgz package_descriptions -rm -rf $(distdir) @@ -108,7 +108,7 @@ maintainer-clean-generic: -rm -f config.guess config.sub install-sh missing mkinstalldirs -rm -f depcomp config.log -maintainer-clean-generic-hook: +maintainer-clean-generic-hook: rm -f config.status $(top_srcdir)/configure: $(am__configure_deps) diff --git a/debian/README.Debian b/debian/README.Debian index ba052459d..ad2c77537 100644 --- a/debian/README.Debian +++ b/debian/README.Debian @@ -1,7 +1,7 @@ The CSS plugin story... ======================= -xine does support playing unencrypted and encrypted dvd using the library +xine does support playing unencrypted and encrypted dvd using the library libdvdread/libdvdcss. Due to legal reasons, it is not possible for debian nor derivatives to ship a libdvdcss, which would be needed to play encrypted dvds. @@ -22,8 +22,8 @@ conceivable setup. (Systems that run a sound daemon usually do so because otherwise they would only have one sound channel. So in those cases the daemon should be used, unless explicitly configured otherwise.) -So, if you are experiencing instant crashes with the error message -'can't create mcop directory', please start xine (xine-ui or gxine) with parameter +So, if you are experiencing instant crashes with the error message +'can't create mcop directory', please start xine (xine-ui or gxine) with parameter "-A auto" diff --git a/debian/changelog b/debian/changelog index 7386ffb78..c71e640f1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -44,7 +44,7 @@ xine-lib (1.1.2+dfsg-1) unstable; urgency=medium * apply patch from http://bugzilla.gnome.org/show_bug.cgi?id=344592 to fix title menu if there is no DVD menu. (Closes: #369319) * rename to XS-X-Vcs-Bzr field - + -- Reinhard Tartler Thu, 26 Oct 2006 23:16:12 +0200 xine-lib (1.1.2-6) unstable; urgency=low @@ -56,7 +56,7 @@ xine-lib (1.1.2-6) unstable; urgency=low - [xine-lib @ 2006-07-12 21:08:46 by dsalt] Tidy up the formatting of tvtime method help texts to allow better wrapping by the front end. - + -- Reinhard Tartler Fri, 22 Sep 2006 21:49:56 +0200 xine-lib (1.1.2-5) unstable; urgency=low @@ -96,13 +96,13 @@ xine-lib (1.1.2-5) unstable; urgency=low potato!) * Dropping Conflicts on sinek and xine-ui (<< 0.9.10) (all only woody) * cleaning m4/caca.m4, no longer used - * removing doc/faq/faq.html doc/faq/faq.txt doc/hackersguide/hackersguide.html + * removing doc/faq/faq.html doc/faq/faq.txt doc/hackersguide/hackersguide.html on clean, missed by build system * include some targets to build 'orig' tarballs from the current branch. This mainly for my convinience for bootstrapping cvs versions of xine and preparing tarballs for the 'main' section of ubuntu, which I carry here in - order to minimize divergence - + order to minimize divergence + -- Reinhard Tartler Thu, 14 Sep 2006 21:27:27 +0200 xine-lib (1.1.2-4) unstable; urgency=low @@ -154,7 +154,7 @@ xine-lib (1.1.2-2) unstable; urgency=high + src/xine-utils/xine_mutex.c * Imported security fix for included copy of libmms from upstream CVS, (e.g. USN-315-1) - + -- Reinhard Tartler Thu, 13 Jul 2006 21:51:46 +0200 xine-lib (1.1.2-1) unstable; urgency=low @@ -314,11 +314,11 @@ xine-lib (1.1.1-1) unstable; urgency=low * Acknowledge NMUs. - Backports and gcc 4.0 fixes dropped since they're already in this version. - Closes: #288189, #318838 + Closes: #288189, #318838 - slang transition: Closes: #315986 - aalib transition: Closes: #320317, #323276 - - flac transition: Closes: #325960 - - fix of dependency generation script debian/shlibdeps.sh: + - flac transition: Closes: #325960 + - fix of dependency generation script debian/shlibdeps.sh: Closes: #326935, #327203, #328168, #328184, #328265, #328454 - fix bashism in debian/rules: Closes: #337996 @@ -361,9 +361,9 @@ xine-lib (1.0.1-1.3) unstable; urgency=low * Non-maintainer upload. * Backport patch from 1.0.2 that fixes hard hang-ups when a plugin listed in - ~/.xine/catalog.cache becomes unloadable (closes: #328454). Plugins can + ~/.xine/catalog.cache becomes unloadable (closes: #328454). Plugins can become unloadable if DT_NEEDED libraries get uninstalled, which is - possible because the package lists many of these libraries in the + possible because the package lists many of these libraries in the Recommends or Suggests fields only. With this fix, amarok should not freeze with the XINE engine anymore (closes: #327203), and totem either (closes: #328265). @@ -378,7 +378,7 @@ xine-lib (1.0.1-1.3) unstable; urgency=low This means that now the package now suggests libgnomevfs2-0 (closes: #326935) and libflac7 (closes: #328168). Submitters may wish to reopen if - they want a discussion with the maintainer about the need of these being + they want a discussion with the maintainer about the need of these being strong Depends instead of Suggests. * xineplug_flac.so now links against libflac7 instead of libflac6, which @@ -401,19 +401,19 @@ xine-lib (1.0.1-1.1) unstable; urgency=medium * Multiple fixes for compatibility with gcc 4.0 strictness (closes: #288189, #318838) * This rebuild also gets rid of the dependency on libslang1 - (closes: #315986); it only trades it for libslang2 unfortunately, + (closes: #315986); it only trades it for libslang2 unfortunately, since libcaca is a static lib. * Build-Depend on libaa1-dev instead of the removed aalib1-dev (closes: #320317). * Build-Depend on libxinerama-dev instead of on xlibs-static-dev, which no longer provides this lib; it should be rolled back into - xlibs-dev as a dependency eventually, but build-depending on it + xlibs-dev as a dependency eventually, but build-depending on it directly is sensible anyway. * Disentangle xine from libraries it doesn't actually use directly, so that the dependency tree is less brittle and requires fewer rebuilds in the future (e.g., it currently has a dependency on libstdc++5 that it shouldn't need at all); this is doubly important since some - plugins aren't mentioned at all in the dependencies, and so can be + plugins aren't mentioned at all in the dependencies, and so can be left unusable by library changes: - relibtoolize the package to use the Debian version of libtool, with support for pruning indirect dependencies from the linker @@ -421,7 +421,7 @@ xine-lib (1.0.1-1.1) unstable; urgency=medium - as part of the above, add AM_MAINTAINER_MODE to configure.ac to avoid any need for autotools build-dependencies - hard-code -lmodplug, -lartsc, and -lgnomevfs-2, because pkg-config, - artsc-config, etc. spit out lib dependencies that are spurious on + artsc-config, etc. spit out lib dependencies that are spurious on GNU/* systems. -- Steve Langasek Wed, 3 Aug 2005 04:21:06 -0700 diff --git a/debian/control b/debian/control index 36260d233..0a54b20b6 100644 --- a/debian/control +++ b/debian/control @@ -73,7 +73,7 @@ Conflicts: libxine1-all-plugins, libxine1-bin, libxine1-console, libxine1-ffmpeg Replaces: libxine1-all-plugins, libxine1-bin, libxine1-console, libxine1-ffmpeg, libxine1-gnome, libxine1-misc-plugins, libxine1-plugins, libxine1-x Provides: libxine1-all-plugins, libxine1-bin, libxine1-console, libxine1-ffmpeg, libxine1-gnome, libxine1-misc-plugins, libxine1-plugins, libxine1-x Description: the xine video/media player library, binary files - This is the xine media player library (libxine). + This is the xine media player library (libxine). . Libxine provides the complete infrastructure for a video/media player. It supports MPEG 1/2 and some AVI and Quicktime videos out of the box, so you @@ -91,7 +91,7 @@ Priority: extra Architecture: any Depends: libxine1 (= ${Source-Version}) Description: the xine video/media player library, debug data - This is the xine media player library (libxine). + This is the xine media player library (libxine). . Libxine provides the complete infrastructure for a video/media player. It supports MPEG 1/2 and some AVI and Quicktime videos out of the box, so you diff --git a/debian/copyright b/debian/copyright index 982ebc98c..f2cf85a8d 100644 --- a/debian/copyright +++ b/debian/copyright @@ -21,6 +21,6 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -On Debian systems, the full text of the GPL can be found in +On Debian systems, the full text of the GPL can be found in /usr/share/common-licenses/GPL diff --git a/debian/rules b/debian/rules index 47f4a73e7..85565e115 100755 --- a/debian/rules +++ b/debian/rules @@ -141,7 +141,7 @@ binary-arch: build install dh_testroot mkdir -p debian/tmp/usr/share/bug/libxine${major}/ cp debian/reportbug.presubj debian/tmp/usr/share/bug/libxine${major}/presubj -# ugly hack, documentation should never have been in /u/s/d/xine/... +# ugly hack, documentation should never have been in /u/s/d/xine/... mv debian/tmp/usr/share/doc/xine-lib debian/tmp/usr/share/doc/libxine${major} # build libxine${major} package by moving files from libxine-dev dh_install --autodest --sourcedir=debian/tmp --list-missing diff --git a/doc/README.MINGWCROSS b/doc/README.MINGWCROSS index 87ae57b60..d721ca941 100644 --- a/doc/README.MINGWCROSS +++ b/doc/README.MINGWCROSS @@ -81,7 +81,7 @@ In the following text are used symbols $PREFIX and $USER with this meaning: # # compile and install the compiler # - # if you'll want rerun this step, I recommend delete + # if you'll want rerun this step, I recommend delete # $PREFIX/i386-mingw32/sys-include # tar xzf gcc-core-3.3.1-20030804-1-src.tar.gz @@ -107,7 +107,7 @@ In the following text are used symbols $PREFIX and $USER with this meaning: 4. recompile w32api and mingw-runtime from sources (optional) - + # # installing must be into $PREFIX/i386-mingw32 # @@ -153,7 +153,7 @@ In the following text are used symbols $PREFIX and $USER with this meaning: tar xzf pthreads-w32-2-7-0-release.tar.gz cd pthreads-w32-2-7-0-release/ - make CROSS=i386-mingw32- PTHREAD_DEF=pthreadGC2.def clean GC + make CROSS=i386-mingw32- PTHREAD_DEF=pthreadGC2.def clean GC # # possibility to use pthread library in M$ Visual C (optional) # diff --git a/doc/README.dvb b/doc/README.dvb index 38ea6613d..e32b980dd 100644 --- a/doc/README.dvb +++ b/doc/README.dvb @@ -130,7 +130,7 @@ file name the recorded stream is being written to. You can select the directory to save to in the xine configuration under the MISC tab, otherwise the plugin will record to your home directory. You can pause the recording at any time by pressing MENU4 (F3 in xine-ui, F4 in gxine). An OSD in the -top left hand corner will notify you of the status of the recording. +top left hand corner will notify you of the status of the recording. Pressing MENU4 again will resume recording. Have fun. diff --git a/doc/README.dxr3 b/doc/README.dxr3 index 41fe9ad74..2800067ff 100644 --- a/doc/README.dxr3 +++ b/doc/README.dxr3 @@ -41,45 +41,45 @@ here: XINE dxr3 plugin ================= -There are two different ways in which xine can make use of the dxr3 +There are two different ways in which xine can make use of the dxr3 card. -1. mpeg-1/mpeg-2 (DVD, VCD, ...) decoding and displaying. +1. mpeg-1/mpeg-2 (DVD, VCD, ...) decoding and displaying. This is the normal use. Instead of doing the mpeg decoding in software, xine sets up the display (TV or overlay) and sends the mpeg data via the kernel driver to the mpeg decoder on the dxr3 card, very much like the Windows player that you problably got with the card. In this mode, you should be using the dxr3 video decoder plugin together -with the dxr3 video out plugin. +with the dxr3 video out plugin. Xine should select the dxr3 video decoder plugin automatically when it encounters an mpeg stream, but it is possible it does not use the dxr3 -video out plugin by default. In that case, start xine with the +video out plugin by default. In that case, start xine with the "-V dxr3" argument to specify the dxr3 video out plugin. If you use another video out driver, such as Xv or XShm, xine won't be able to use the mpeg decoding capability of the dxr3 hardware and will -use libmpeg2 instead. +use libmpeg2 instead. Here's a short overview what happens when you play a dvd with xine using the dxr3 video out driver: -DVD -> split mpeg video and audio and audio streams +DVD -> split mpeg video and audio and audio streams -> send mpeg video to dxr3 -> image appears on screen -2. displaying non-mpeg video on dxr3 hardware. +2. displaying non-mpeg video on dxr3 hardware. -Non-mpeg video may be AVI, quicktime, windows media files or whatever -else xine can decode. +Non-mpeg video may be AVI, quicktime, windows media files or whatever +else xine can decode. -This option must be compiled in and requires a supported mpeg encoder. +This option must be compiled in and requires a supported mpeg encoder. At the moment there are three: - libavcodec from xine-lib's ffmpeg plugin (good quality, quite fast) - libfame from fame.sourceforge.net (very fast, good quality) (currently the 0.9 versions of libfame don't work, use the 0.8 versions) - librte (version 0.4) from zapping.sourceforge.net (fast, very good quality) If configure finds one or both it will compile in encoding support into -the dxr3 driver. +the dxr3 driver. In order to use this driver for output instead of, say, Xv, just start xine with the command line option "-V dxr3", for example @@ -102,7 +102,7 @@ system with at least 128 MB of RAM and a P-III/Athlon at 800 MHz. Here's an overview what happens when you play an AVI this way (compare this with the previous overview!) --> split video and audio streams -> decode video stream +-> split video and audio streams -> decode video stream -> encode video as mpeg-1 -> send mpeg-1 stream to dxr3 -> image appears on screen @@ -146,16 +146,16 @@ engine.decoder_priorities.dxr3-mpeg2: Zooming Feature (TVout Only) ============================ -Pressing the 'z' key enables another tv-only mode which zooms into the -centre of a 16:9 video to display much smaller (or none) black bars -top & bottom. It crops the video on the left and right sides to +Pressing the 'z' key enables another tv-only mode which zooms into the +centre of a 16:9 video to display much smaller (or none) black bars +top & bottom. It crops the video on the left and right sides to maintain the correct aspect ratio. Use SHIFT-z to disable. TV mode Cycling Feature ====================== -Pressing CTRL-o repeatedly will allow you to cycle between tv modes PAL, -PAL60, & NTSC. The format selected will only remain valid for the +Pressing CTRL-o repeatedly will allow you to cycle between tv modes PAL, +PAL60, & NTSC. The format selected will only remain valid for the current xine session, on startup the tv mode will revert to the default in .xine/config @@ -166,7 +166,7 @@ VGA overlay feature In previous versions of xine support, one had to use dxr3view in order to use the em8300 overlay mechanism. Now, since the xine 0.5 version, it is possible to output the em8300 overlay directly in the video -out window. +out window. In order to activate it, "dxr3.output.mode" must be set to "overlay". But it won't work until the old dxr3view works too (just a check). Before @@ -174,11 +174,11 @@ a first use, "autocal" has to be run. This will store the right overlay parameters in "~/.overlay". For more information, please consult the dxr3 howto too. -As of version 0.9.5, you can now switch between overlay and tv-out modes -on-the-fly, simply by hiding the video_out window ('h' key by default, -see the README file). If you want to start xine with video on the tv, -you can run xine with the -H option to auto-hide the vo window, instead -of changing the configuration (although you can still do that instead if you +As of version 0.9.5, you can now switch between overlay and tv-out modes +on-the-fly, simply by hiding the video_out window ('h' key by default, +see the README file). If you want to start xine with video on the tv, +you can run xine with the -H option to auto-hide the vo window, instead +of changing the configuration (although you can still do that instead if you prefer, of course). Have a look at the previous explained configuration options dxr3.output.keycolor diff --git a/doc/README.freebsd b/doc/README.freebsd index 900f60aa1..68dd5d84b 100644 --- a/doc/README.freebsd +++ b/doc/README.freebsd @@ -87,12 +87,12 @@ the file you have to patch is /sys/dev/ata/atapi-cd.c: ! case 2048: ! ccb[0] = ATAPI_READ_BIG; ! break; -! -! case 2352: +! +! case 2352: ! ccb[0] = ATAPI_READ_CD; ! ccb[9] = 0xf8; ! break; -! +! ! default: ! ccb[0] = ATAPI_READ_CD; ! ccb[9] = 0x10; diff --git a/doc/README.network_dvd b/doc/README.network_dvd index 4798b79f8..41c7750ff 100644 --- a/doc/README.network_dvd +++ b/doc/README.network_dvd @@ -86,7 +86,7 @@ installation for dvds (don't forget the trailing slash) - + protocol details ---------------- @@ -110,13 +110,13 @@ cdda commands: cdda_read - + cdda_tochdr 0 cdda_tocentry 0 - + dvd commands: dvd_open diff --git a/doc/README.solaris b/doc/README.solaris index 9e78287a9..fb1fb408e 100644 --- a/doc/README.solaris +++ b/doc/README.solaris @@ -23,19 +23,19 @@ building xine on solaris GNU C compiler and as a standalone assembler command. A quick workaround when using the GCC from Sun's - "Software Companion" CD is to replace /usr/ccs/bin/as with a + "Software Companion" CD is to replace /usr/ccs/bin/as with a link to GNU as, for example like this: cd /usr/ccs/bin ln -s /opt/sfw/bin/gas gnu-as mv as sun-as ln -s gnu-as as - + (Use "ln -s gnu-as as" or "ln -s sun-as as" to switch between the two assemblers) -* To get VIS accelerated video decoding and colour space conversion +* To get VIS accelerated video decoding and colour space conversion on Solaris SPARC with an UltraSPARC cpu, download and install Sun's mediaLib 2.0 before compiling xine. mediaLib is available here: @@ -101,15 +101,15 @@ Known Problems If you have the solaris 8 companion CD installed, an Imlib package is already installed on your system, but it uses the "prefix" /opt/sfw. - + To work around the problem: - + - install a symbolic link /etc/imrc, pointing to /opt/sfw/etc/imrc (needs root permission) # ln -s /opt/sfw/etc/imrc /etc - or + or - install an ".imrc" file in your home directory, with the following contents: @@ -123,7 +123,7 @@ Known Problems block >4GB on a device using a logical blocksize != DEV_BSIZE (i.e. CDROM and DVD media). Due to a 32bit int overflow, a disk address modulo 4GB is accessed. - + There's no workaround available. See the following message for more details about this bug: diff --git a/doc/README.syncfb b/doc/README.syncfb index fc90ff586..be8c2565d 100644 --- a/doc/README.syncfb +++ b/doc/README.syncfb @@ -5,7 +5,7 @@ * WHAT IS THIS PLUGIN ABOUT and WHY SHOULD I EVEN CONSIDER TO USE IT? :) - + This xine video output plugin uses the so called SyncFB driver (from the Teletux project) which provides special hardware features of Matrox G200 and newer cards like hardware deinterlacing, scaling and @@ -14,19 +14,19 @@ available to xine and because all this tasks are done by the graphic card there is no need for xine to do them in software -- so you save precious CPU time which you may gonna need for other things. :-) - + Ok ok -- why should you want to have your video output synchronized to something called the vertical retrace of your monitor?! Well... :) - + In order to have an optimal DVD playback the update of the image needs to be syncronized with the vertical refresh of the screen. Otherwise you will sometimes see part of frame n and part of frame n+1 during playback of a movie. Resulting in tearing artefacts on moving objects. - + When using this plugin the update of the screen is done during the vertical retrace of your monitor and those tearing artefacts are gone forever. - + Also the SyncFB kernel module and this plugin totally by-pass XFree86 for anything else but some data gathering routines needed to place the overlay at the right spot. So on some machines you will gain some @@ -36,7 +36,7 @@ Last but not least, you may ask what's so special about deinterlacing? There are already several deinterlacing methods available in xine and why should you care about another one? Well (again)... ;-)) - + All current deinterlacers in xine are done in software and therefore will cost you some CPU power. The SyncFB video out plugin will use the hardware deinterlacing support of your graphic card, thus saving your @@ -48,16 +48,16 @@ So far the plugin and the kernel module itself are only being tested on G400 cards by its developers thus we cannot tell about newer or older generation chips. - + Nevertheless we have received positive feedback that the SyncFB kernel module and this plugin work fine with G450 cards too. - + If you have got things working on older/newer chips, please let us know about your success and we will place a note here... :-) - + * AND HOW DOES IT WORK? - + The SyncFB driver is a kernel module you will have to load that makes a special device (e.g. /dev/syncfb) available which is opened by the plugin and controlled with certain ioctl calls. Easy, isn't it? ;-) @@ -79,7 +79,7 @@ Back to the original subject. In order to install and use the SyncFB kernel module, you *will* need a fresh CVS checkout of the sources because the last official release is rather outdated. - + This sounds more complicated than it actually is. You will only have to execute the following two commands to get the sources in a sub-dir called teletux. When you are asked for password, just press return. @@ -90,14 +90,14 @@ Now enter the directory teletux/syncfb, that's where the actual kernel modul sources are located. Before you can compile the module, you will have to change two lines in the Makefile itself to make it work. - + In the second line, there is a phrase like "-I/usr/include" which you have to change to "-I/usr/src/linux/include". In line seven, you need to remove syncfbtv and syncfb_test from the OBJ list. Now execute a "make" and the module will be compiled. Place the resulting syncfb.o in your modules dir which is usually... - + /lib/modules/KERNEL_VERSION/ ... and issue a "depmod -a" after it. That's it - the kernel module is @@ -106,7 +106,7 @@ required /dev/syncfb device if you have devfs support, otherwise you need to issue a "mknod /dev/syncfb c 178 0" once to create the device yourself permanently. - + Once the module is loaded, you can start xine with the "-V SyncFB" option to use this plugin. xine automatically remembers the video out plugin you last used, so you only have to use this option once too. :) @@ -125,14 +125,14 @@ refresh rates (e.g. 50/75/100 Hz for PAL, 60/90/120 Hz for NTSC). You will need to add so called modelines to your XFree86 config to make those modes available, if you don't already have them. - + Here is is a short listing of some sample modelines. Please add only those two lines (for NTSC and PAL) which exactly fit the screensize you are running your X Server with. You need to add those lines to the monitor section of your XF86Config file as well as include their names in the screen section (subsection display of the color depth your are using). - + USE THE FOLLOWING MODELINES AT YOUR OWN RISK. THEY COULD DAMAGE YOUR MONITOR PERMANTELY - PLEASE TAKE CAUTION AND DON'T BLAME US. YOU HAVE BEEN WARNED. @@ -141,22 +141,22 @@ Note: If you want to be on the safe side, generate your very own modelines with an application like kvideogen for example. - + Also the modelines may need some fine tuning for your setup. You can use xvidtune (comes with XFree86) to do that. - + # 1024x768 - + Modeline "1024x768pal" 64.94 1024 1040 1216 1328 768 768 775 802 - Modeline "1024x768ntsc" 54.32 1024 1040 1216 1328 768 768 774 802 - + Modeline "1024x768ntsc" 54.32 1024 1040 1216 1328 768 768 774 802 + # 1152x864 - + Modeline "1152x864pal" 68.82 1152 1168 1384 1496 864 864 871 902 - Modeline "1152x864ntsc" 80.93 1152 1168 1384 1496 864 864 872 902 + Modeline "1152x864ntsc" 80.93 1152 1168 1384 1496 864 864 872 902 # 1280x1024 - + none yet - might be added in the future So before you run xine just turn to the appropriate refresh rate and @@ -166,7 +166,7 @@ * WHAT SCREENSIZE SHOULD I PREFER? - + Well. It is important that the screensize you choose for DVD playback is exactly the same screensize you're starting up your X Server with if you are not using the XF86VidMode extension which will properly do @@ -192,18 +192,18 @@ Pressing 'i' during playback will toggle hardware deinterlacing. A decrease in picture quality is a known side effect, yet you won't see any artefacts caused by interlacing anymore. :-) - + One more note, hardware deinterlacing uses BOB as deinterlacing method and is totally independent from the software deinterlacing in xine. So specifing a different deinterlacing method in your .xinerc won't have any effect on this feature. - + Nevertheless we are thinking about making software deinterlacing also available as an option. It's on the TODO list... :) * HEY! THE OVERLAY TURNS OFF WHEN THE WINDOW IS PARTLY OFF THE DESKTOP!? - + That's done on purpose. It prevents possible yet harmless screen corruption. And by the way - why would you want to see a movie just partly?! ;-) @@ -227,7 +227,7 @@ the actual overlay from SyncFB is being displayed because this area in your video memory is constantly over written - so are the changes done by your X Server (like a window graphic that is placed there). - + This is just cosmetical and harmless, so no need to worry. If you want to do something with the xine panel when the video overlay is taking all your screen, just switch back to window mode and do what you have @@ -257,20 +257,20 @@ * WHAT IS ON THE TODO LIST? + fix above listed bugs in the SyncFB kernel module - + + make software deinterlacing available as an option - + + RGB support (unlikely at the moment because there is no need for it) - + + check if the video source is not too big in terms of dimensions for the video memory left (video memory - X reserved video memory) - + + bug fixes + more sanity checks + new features + optimizations - + * CONTACTS and FEEDBACK diff --git a/doc/faq/faq.sgml b/doc/faq/faq.sgml index 48f9b2416..b3490ea2a 100644 --- a/doc/faq/faq.sgml +++ b/doc/faq/faq.sgml @@ -17,7 +17,7 @@ What is the xine engine? - + The xine engine is a free media player engine. It comes in the form of a shared libarary and is typically used by media player frontends and other multimedia applications for playback of multimedia streams @@ -64,7 +64,7 @@ may have installed on your system. - + How do I pronounce "xine"? @@ -103,7 +103,7 @@ Other modules in CVS are: xine-plugin a mozilla browser plugin - for streaming media playback using xine, + for streaming media playback using xine, xine_www the xine project website sources. @@ -215,8 +215,8 @@ What do I need to compile everything properly? - First of all an official and stable release of gcc. Also be aware - that patched gcc versions may break parts of xine and are therefore + First of all an official and stable release of gcc. Also be aware + that patched gcc versions may break parts of xine and are therefore not supported by the xine project. @@ -269,7 +269,7 @@    make install - Make sure your /etc/ld.so.conf contains + Make sure your /etc/ld.so.conf contains /usr/local/lib and continue with:    ldconfig @@ -279,7 +279,7 @@    ./configure    make install - + Complete build instructions @@ -309,7 +309,7 @@    make    make install - + @@ -454,7 +454,7 @@ The Xv video-out plugin fails to compile! If you want to have Xv support compiled in, make sure you either have - a shared Xv library on your system, e.g. + a shared Xv library on your system, e.g. ls /usr/X11R6/lib/libXv* should give you some .so libs, like this: @@ -463,7 +463,7 @@    /usr/X11R6/lib/libXv.so.1 - Alternatively you need to have libtool 1.4 or newer installed, then + Alternatively you need to have libtool 1.4 or newer installed, then libXv.a is sufficient. Otherwise you can create the shared versions yourself:    ld --whole-archive -shared -o libXv.so.1 libXv.a @@ -481,7 +481,7 @@ I have installed xine-lib but the frontend complains about not finding it! - First of all take a closer look at the compilation instructions above again. + First of all take a closer look at the compilation instructions above again. You will probably find your answer there right away. @@ -511,7 +511,7 @@    export LD_LIBRARY_PATH="$HOME/xine/lib:$LD_LIBRARY_PATH" - Now you can unpack tarballs e.g. in ~/xine/src + Now you can unpack tarballs e.g. in ~/xine/src (mkdir ~/xine/src if necessary) and do a    ./configure --prefix=$HOME/xine @@ -564,7 +564,7 @@ /dev/scd1, … in that case). Also make sure you (as a user) have sufficient (read and write) permissions on your DVD drive. This could mean you either have to change the device - permissions or add your user to a special group + permissions or add your user to a special group (e.g. addgroup cdrom username), depending on your setup and/or distribution. @@ -574,7 +574,7 @@ smooth video output). Use a command like hdparm -d 1 <device> on your DVD device. Please note that even if you're using ide-scsi - you will have to set the dma flag on the ide device node (e.g. + you will have to set the dma flag on the ide device node (e.g. /dev/hdc), not the mapped /dev/scd scsi device. @@ -612,7 +612,7 @@ Once you have everything set up, try something like gxine dvd:/ or xine -p dvd:/ to start dvd playback. Some frontend also offer so-called autoplay - buttons or menu entries that start dvd playback immediately. + buttons or menu entries that start dvd playback immediately. Important: do not try to mount the DVD. Just insert it and hit the DVD autoplay @@ -643,7 +643,7 @@ drives is limited (usually about 5 times), after that your drive will stay locked to the region you last set it up for. - + I have problems setting up my RPC-2 drive for the right region! @@ -657,7 +657,7 @@ drives is limited (usually about 5 times), after that your drive will stay locked to the region you last set it up for. - + @@ -718,7 +718,7 @@ test_svcd_pal.bin. Run xine with the MRL vcd:/test_svcd_pal.cue:E0. - If you see something playing then this is a hardware problem. + If you see something playing then this is a hardware problem. You might also want to try starting playback-control with vcd:/test_svcd_pal.cue:P1. @@ -782,7 +782,7 @@ If you have the VideoCD from the last step, then run the MRL vcd:/test_svcd_pal.cue:P1 - If this shows a still frame, but it just does not show when you + If this shows a still frame, but it just does not show when you hit either the "VCD" autoscan button or give a MRL without the P1 at the end then go to the next step. @@ -797,7 +797,7 @@ - You have a VideoCD with menu at beginning and can see it using an MRL + You have a VideoCD with menu at beginning and can see it using an MRL with P1 at the end, but you want to see it by hitting the "VCD" autoscan button as well? Check to see that you have the configuration entry media.vcd.autoplay set to playlist. @@ -833,7 +833,7 @@ Can I watch Quicktime (.mov, .mp4) files using xine? - Quicktime is just a system layer (container format) which can contain various + Quicktime is just a system layer (container format) which can contain various different audio and video formats. The system layer itself is fully supported in xine. However, some quicktime audio/video codecs are not natively supported yet. Luckily, if you are using a x86 compatible machine (any recent PC hardware should do) @@ -852,7 +852,7 @@ have to set decoder.external.win32_codecs_path in your xine config file accordingly). Restart xine then and you should be able to watch Quicktime trailers. - + @@ -1013,7 +1013,7 @@ Try to use the Xv driver, it greatly improves performance and quality because your graphics card does image scaling and colourspace conversion. The video section contains important information - about several Xv drivers. + about several Xv drivers. If Xv cannot be used for some reason, make sure your display is set up @@ -1085,13 +1085,13 @@ Have your X-server (usually X.org or XFree86) running with higher priority. Most recent linux distributions (like RedHat 8.0 or Mandrake 9.0) should do that for you, improving not only xine but desktop responsiveness - in general. + in general. Use the "top" utility and verify under the "NI" column if the X process has a negative value, this indicates a higher priority. - See "The X Window User HOWTO – Performance considerations" for - further instructions + See "The X Window User HOWTO – Performance considerations" for + further instructions http://www.tldp.org/HOWTO/XWindow-User-HOWTO/performance.html . @@ -1115,7 +1115,7 @@ xine needs high speed memory access which depends on your chip set. - Make sure you enable all speed-improving options. + Make sure you enable all speed-improving options. Especially the via apollo pro chipset is known to be quite weird, @@ -1128,7 +1128,7 @@ This website centers around a windows-tool to tweak the chipset, you - can do the same on FreeBSD with pciconf. + can do the same on FreeBSD with pciconf. On some linux distributions there are similar tools. @@ -1173,7 +1173,7 @@ engine.buffers.video_num_buffers:500 to a higher value (e.g. 1000 or 2500). - + @@ -1225,7 +1225,7 @@ To use it make sure you have aalib installed correctly before you configure/build xine-lib and xine-ui. In addition to the xine binary a binary named aaxine should get built and installed. You can then use - something like: + something like:    aaxine foo.mpg to use aalib video output. @@ -1270,7 +1270,7 @@ You can enable xine's audio compressor. Most frontends have a settings window and in that you'll find a slider for the - compressor setting. The values are percent values, so a + compressor setting. The values are percent values, so a slider setting of 200 means that xine will double the volume of silent parts of the movie (loud parts stay the same). @@ -1297,7 +1297,7 @@ If this happens with any video, first try a different audio driver (gxine -A oss, gxine -A arts, - xine -A alsa …). + xine -A alsa …). If this problem only occurs with one specific stream, maybe switching to @@ -1307,8 +1307,8 @@ If all this doesn't help, maybe you're missing an audio codec or you found a bug. If you decide to post your problem on the xine-user mailing list, - make sure to include all console output xine produced and also clearly - state what type of stream you tried to play back or, even better, make + make sure to include all console output xine produced and also clearly + state what type of stream you tried to play back or, even better, make a test stream available somewhere for developers to download and try. @@ -1346,8 +1346,8 @@ Getting SPDIF output from a SBLive 5.1 using OSS drivers - The following explains how to get the above configuration - going with xine. Some parts of it may applicable to other + The following explains how to get the above configuration + going with xine. Some parts of it may applicable to other configurations (cards that use the EMU10k1 chip) as well. @@ -1376,24 +1376,24 @@ The OSS driver is maintained by creative and can be downloaded at http://opensource.creative.com/. - The driver package contains documentation on how to install it. + The driver package contains documentation on how to install it. Besides that I'd like to add the following notes. In order to compile and install these drivers, you need a valid kernel configuration file. For RedHat Linux's pre-compiled kernels these - configuration files can be found in + configuration files can be found in /usr/src/linux/configs. After you've located the correct config file for your kernel, you need to copy it to /usr/src/linux/.config For example, when you run the 2.4.18-i686 kernel do :    cp /usr/src/linux/configs/kernel-2.4.18-i686.config /usr/src/linux/.config - Make sure that the emu10k1 module that is currently installed is + Make sure that the emu10k1 module that is currently installed is not loaded. To unload the modules:    /sbin/modprobe -rv emu10k1.o ac97_codec.o - If this mentions that the device is busy, some program is - using the driver. Some example could be a mixer application - or sound daemon like artsd. You'll need to close down the + If this mentions that the device is busy, some program is + using the driver. Some example could be a mixer application + or sound daemon like artsd. You'll need to close down the applications before continuing. At success it should print something like: @@ -1402,15 +1402,15 @@    # delete soundcore Run make in the directory where you unpacked the driver and follow the instructions printed at the end of each step. - The last step should be: + The last step should be:    make install-tools - As the README of the driver package mentions the SPDIF AC3 - output doesn't work by default. In the directory + As the README of the driver package mentions the SPDIF AC3 + output doesn't work by default. In the directory utils/scripts an emu10k1.conf file can be found which need to be placed in the default - installation directory (/usr/local/etc). + installation directory (/usr/local/etc). After this the emu10k1.conf needs to be modified. - The following settings worked fine for me (I don't use the analog + The following settings worked fine for me (I don't use the analog outputs of the card):    CARD_IS_5_1=yes @@ -1424,20 +1424,20 @@    ANALOG_FRONT_BOOST=no    SURROUND=no    PROLOGIC=no -   ENABLE_CD_Spdif=yes -   ENABLE_OPTICAL_SPDIF=no -   ENABLE_LINE2_MIC2=no -   ENABLE_RCA_SPDIF=no +   ENABLE_CD_Spdif=yes +   ENABLE_OPTICAL_SPDIF=no +   ENABLE_LINE2_MIC2=no +   ENABLE_RCA_SPDIF=no    ENABLE_RCA_AUX=no - After modifying the emu10k1.conf, + After modifying the emu10k1.conf, you need to modify your /etc/modules.conf and make sure the following lines are in there.    alias sound-slot-0 emu10k1    post-install emu10k1 /usr/local/etc/emu-script - After saving the changes to modules.conf, run + After saving the changes to modules.conf, run    /sbin/depmod -a - Now, you're ready to load the new modules and set the correct + Now, you're ready to load the new modules and set the correct options for it. To load the modules run:    /sbin/modprobe emu10k1 @@ -1453,7 +1453,7 @@ - The cable used for the SBLive can easily be self-made + The cable used for the SBLive can easily be self-made or buy a stereo 3.5mm jack to dual RCA cable. @@ -1470,10 +1470,10 @@ In order to test it use a DVD with AC3 or DTS track - start xine and select the right audio track - from user interface or start xine as: + start xine and select the right audio track + from user interface or start xine as:    xine dvd:/1 -a 0 - The external decoder should display something like + The external decoder should display something like "Dolby Digital" in case the selected audio track contains AC3 data or "DTS" in case the selected audio track contains DTS data. Of course stereo audio also goes @@ -1494,7 +1494,7 @@ Note that recently we added support to "simulate" volume in aRts by changing sample values on-the-fly before delivering them to the driver. - Not as good as having access to sound card's mixer but at least users + Not as good as having access to sound card's mixer but at least users will not complain about lacking of volume bar anymore! :) @@ -1503,7 +1503,7 @@ Audio is stuttering and i see a lot of "metronom: fixing sound card drift by -2115 pts" on the console output Might be a soundcard problem, if it only comes in longer intervals. - Your soundcard does not keep it's sampling frequency accurately + Your soundcard does not keep it's sampling frequency accurately enough, which results in audio and video getting out of sync and xine has to compensate. If you see the message only from time to time, you might remedy it by using the resampling sync @@ -1524,7 +1524,7 @@ Occasional messages of "fixing sound card drift" may happen on start and - when playing a long stream (like a movie). This is normal behaviour, + when playing a long stream (like a movie). This is normal behaviour, nothing to worry about. @@ -1568,7 +1568,7 @@ questions. - + I only see a blue (or green or black) video image most of the time. @@ -1582,7 +1582,7 @@ /etc/X11/xorg.conf or /etc/X11/XF86Config). - + The image looks strange, it is shifted, cropped or shows weird lines! @@ -1627,18 +1627,18 @@ hardware. Here are some hints for individual gfx chips: - + 3Dfx: if all you get is a solid black window, upgrade to X.org or XFree 4.1.0 or later. - + ATI: if you only get "half a picture", try lowering your resolution - or bit depth, disable DRI (looks like you ran out of video RAM) + or bit depth, disable DRI (looks like you ran out of video RAM) - + Trident card: If you see vertical bands jumbled, upgrade to the latest xfree/experimental trident drivers (for the CyberBlade XP a driver exists here: @@ -1646,61 +1646,61 @@ - + nVidia: With newer GeForce cards, Xv should work with XFree 4.2.0 or newer, for older RivaTNT cards use the binary drivers from nvidia (of course the binary drivers work as well for GeForce cards) - + Mach64/Rage3D (not Rage128/Radeon) cards/chips get no XVideo with - standard drivers, try + standard drivers, try GATOS drivers instead - + intel: i815 has Xv support in XFree 4.x, others unknown - + Permedia 2/3 has Xv support in XFree 4.x - + Savage: at least some older drivers tend to lock up the whole machine, - try the drivers available from + try the drivers available from http://www.probo.com/timr/savage40.html . - + SIS: certain controllers (more info needed!) have Xv support in XFree 4.x - + Chips and Tech 6555x, 68554, 69000, 69030 have Xv support in XFree 4.x - + NeoMagic: certain controllers (more info needed!) have Xv support in Xfree 4.x - + SiliconMotion: certain controllers (more info needed!) have Xv support in Xfree 4.x - + Matrox: G200 or newer (but not Parhelia) have Xv support in XFree 4.x. For Parhelia, use the binary only drivers available from matrox' website. @@ -1758,12 +1758,12 @@ Usually xine discovers the screen aspect ratio by querying the X-server and then adjusts the video automatically - to make it look right. However, if that doesn't work try + to make it look right. However, if that doesn't work try pressing "a" to manually change the aspect ratio. If you have a wide screen monitor, make sure the X-server - is correctly configured. The X-server must know the physical + is correctly configured. The X-server must know the physical size of the screen, which is independent of the resolution being used. @@ -1782,7 +1782,7 @@ For XFree86, the filename is normally /etc/X11/XF86Config. - Where DisplaySize specifies, + Where DisplaySize specifies, in millimeters, the physical size of the monitor's picture area. @@ -1796,7 +1796,7 @@ The difference between these counters is a little subtle for the non developer. There are two threads running in order to display video: - the decoder thread will deliver frames to the video output thread. + the decoder thread will deliver frames to the video output thread. The latter is responsible for scheduling the frames to be displayed at the right time. @@ -1833,7 +1833,7 @@ Please note that some frontends save these settings in their config file - so when you have found a working combination, make sure you exit + so when you have found a working combination, make sure you exit xine cleanly so the values are saved. @@ -1852,13 +1852,13 @@ Xv by default. - However some users may want to explore better the available hardware + However some users may want to explore better the available hardware capabilities (eg. syncing frame drawing with monitor refresh). Also some Xv drivers contain slow copies and accessing the video card directly may yield performance gains. - Drivers that access hardware directly includes VIDIX (warning: requires + Drivers that access hardware directly includes VIDIX (warning: requires root priviledges or kernel helper) and SyncFB (requires kernel helper – Matrox only). User may try one of those, but should be warned that with root access they can cause the system to crash hard. The support is also limited to @@ -1898,7 +1898,7 @@ altogether. - Unscaled OSD usage by subtitles and xine-ui is controlled by + Unscaled OSD usage by subtitles and xine-ui is controlled by the following settings (~/.xine/config or ~/.gxine/config):    gui.osd_use_unscaled:0 @@ -1910,17 +1910,17 @@ I can't see the OSD or it leaves a black box over the image! If you are using xine-lib version 1-rc3 or newer, this is probably - due buggy XV drivers that do not support + due buggy XV drivers that do not support unscaled OSD (the XShape - extension) properly. + extension) properly. - There have being reports of some ATI drivers that don't allow + There have being reports of some ATI drivers that don't allow displaying anything over the video. The VIA Epia binary drivers is reported to leave a black box where the OSD was displayed. - The problem may be fixed by either updating the video driver, + The problem may be fixed by either updating the video driver, or disabling xine unscaled OSD support. @@ -1945,7 +1945,7 @@ Why external subtitles look so ugly? You are probably using a xine-lib version older than 1-rc3. - Try upgrading your copy and read the + Try upgrading your copy and read the section about unscaled osd. @@ -1975,7 +1975,7 @@ Also notice that DVD overlays (including subtitles) are meant to - be displayed in a fixed position, this is how the DVD menu + be displayed in a fixed position, this is how the DVD menu highlighting works. xine does not support moving them. @@ -2064,7 +2064,7 @@ Encoding of external subtitles is bad. What is wrong? - The encoding of the external subtitles is expected to be iso-8859-1 by + The encoding of the external subtitles is expected to be iso-8859-1 by default. You need to set an appropriate encoding in the config option subtitles.separate.src_encoding. Note that you also need a font which contains all characters from the given encoding. @@ -2150,7 +2150,7 @@ for more information. - + My drive doesn't work and the kernel says "status=0x51 { DriveReady SeekComplete Error }" @@ -2194,7 +2194,7 @@ have two possibilities. Either deactivate ESD (temporarily) by right clicking on the sound monitor applet and selecting "Place Esound in standby" or just kill it. Then xine will use OSS audio output. The other - method is to make xine use ESD for audio output with: + method is to make xine use ESD for audio output with:    gxine -A esd This may result in worse playback – exact syncronization is not possible with esd, so using oss should be preferred. @@ -2264,7 +2264,7 @@ Can you reproduce the bug? (e.g. do you remember what you - did and when you do it again it crashes again?) + did and when you do it again it crashes again?) @@ -2284,7 +2284,7 @@ Your X server just froze on you? unfortunately that's a known problem with some chipsets and drivers (most commonly Savage chipsets) when using Xv. You might want to try running gxine -V XShm - to see if the problem is related to the Xv driver. This will unfortunately + to see if the problem is related to the Xv driver. This will unfortunately be much slower, as lots of things are now done in software instead of hardware scaling/colour space conversion. diff --git a/doc/hackersguide/README b/doc/hackersguide/README index c0c0d944a..ef0ac825a 100644 --- a/doc/hackersguide/README +++ b/doc/hackersguide/README @@ -27,7 +27,7 @@ installed TeX system (for example teTeX). sgmltools-lite examples: ------------------------ -to generate html +to generate html $ sgmltools -b onehtml hackersguide.sgml diff --git a/doc/hackersguide/architecture.fig b/doc/hackersguide/architecture.fig index cc035149d..9e420bf42 100644 --- a/doc/hackersguide/architecture.fig +++ b/doc/hackersguide/architecture.fig @@ -2,7 +2,7 @@ Landscape Center Metric -A4 +A4 100.00 Single -2 diff --git a/doc/hackersguide/internals.sgml b/doc/hackersguide/internals.sgml index 8ffef06cd..58a5a3c37 100644 --- a/doc/hackersguide/internals.sgml +++ b/doc/hackersguide/internals.sgml @@ -15,15 +15,15 @@ - Media streams usually consist of audio and video data multiplexed + Media streams usually consist of audio and video data multiplexed into one bitstream in the so-called system-layer (e.g. AVI, Quicktime or MPEG). A demuxer plugin is used to parse the system layer and extract audio and video packages. The demuxer uses an input plugin to read the data and stores it - in pre-allocated buffers from the global buffer pool. + in pre-allocated buffers from the global buffer pool. The buffers are then added to the audio or video stream fifo. - From the other end of these fifos the audio and video decoder threads + From the other end of these fifos the audio and video decoder threads consume the buffers and hand them over to the current audio or video decoder plugin for decompression. These plugins then send the decoded data to the output layer. The buffer holding the encoded @@ -188,7 +188,7 @@ This plugin list is held in an array named xine_plugin_info":    plugin_info_t xine_plugin_info[] = { -    /* type, API, "name", version, special_info, init_function */ +    /* type, API, "name", version, special_info, init_function */     { PLUGIN_DEMUX, 20, "flac", XINE_VERSION_CODE, NULL, demux_flac_init_class },     { PLUGIN_AUDIO_DECODER, 13, "flacdec", XINE_VERSION_CODE, &dec_info_audio, init_plugin },     { PLUGIN_NONE, 0, "", 0, NULL, NULL } @@ -236,7 +236,7 @@ same plugin are possible. - If you think this is pretty much an object-oriented aproach, + If you think this is pretty much an object-oriented aproach, then you're right. @@ -278,7 +278,7 @@ Many plugins will need some additional "private" data fields. These should be simply added at the end of the plugin structure. - For example a demuxer plugin called "foo" with two private + For example a demuxer plugin called "foo" with two private fields "xine" and "count" may have a plugin structure declared in the following way: @@ -325,13 +325,13 @@ Metronom serves two purposes: - + Generate vpts (virtual presentation time stamps) from pts (presentation time stamps) for a/v output and synchronization. - + Provide a master clock (system clock reference, scr), possibly provided by external scr plugins (this can be used if some hardware decoder or network @@ -352,7 +352,7 @@ The heuristics used in metronom have always been a field of research. Current metronom's implementation tries to stick to pts values as reported from demuxers, that is, vpts may be obtained by a simple operation of vpts = pts + vpts_offset, - where vpts_offset takes into account any wraps. Whenever pts is zero, + where vpts_offset takes into account any wraps. Whenever pts is zero, metronom will estimate vpts based on previous values. If a difference is found between the estimated and calculated vpts values by above formula, it will be smoothed by using a "drift correction". @@ -369,11 +369,11 @@ delivered for drawing. Unfortunately the same isn't true for audio: all sound systems implement some amount of buffering (or fifo), any data being send to it now will only get played some time in future. audio_out thread - must take this into account for making perfect A-V sync by asking the sound latency + must take this into account for making perfect A-V sync by asking the sound latency to audio driver. - Some audio drivers can't tell the current delay introduced in playback. This is + Some audio drivers can't tell the current delay introduced in playback. This is especially true for most sound servers like ESD or aRts and explain why in such cases the sync is far from perfect. @@ -388,11 +388,11 @@ - The small sound card errors are feedbacked to metronom. The details + The small sound card errors are feedbacked to metronom. The details are given by audio_out.c comments:    /* By adding gap errors (difference between reported and expected -    * sound card clock) into metronom's vpts_offset we can use its +    * sound card clock) into metronom's vpts_offset we can use its     * smoothing algorithms to correct sound card clock drifts.     * obs: previously this error was added to xine scr.     * @@ -438,7 +438,7 @@ Overlays and OSD - The roots of xine overlay capabilities are DVD subpictures and subtitles support + The roots of xine overlay capabilities are DVD subpictures and subtitles support (also known as 'spu'). The DVD subtitles are encoded in a RLE (Run Length Encoding - the most simple compressing technique) format, with a palette of colors and transparency levels. You probably thought that subtitles were just simple text saved into DVDs, right? @@ -446,7 +446,7 @@ In order to optimize to the most common case, xine's internal format for screen overlays - is a similar representation to the 'spu' data. This brings not only performance + is a similar representation to the 'spu' data. This brings not only performance benefit (since blending functions may skip large image areas due to RLE) but also compatibility: it's possible to re-encode any xine overlay to the original spu format for displaying with mpeg hardware decoders like DXR3. @@ -456,14 +456,14 @@ is done using the same kind of pts/vpts stuff of a-v sync code. DVD subtitles, for example, may request: show this spu at pts1 and hide it at pts2. This brings the concept of the 'video overlay manager', that is a event-driven module for managing - overlay's showing and hiding. + overlay's showing and hiding. The drawback of using internal RLE format is the difficulty in manipulating it as graphic. To overcome that we created the 'OSD renderer', where OSD stands - for On Screen Display just like in TV sets. The osd renderer is a module + for On Screen Display just like in TV sets. The osd renderer is a module providing simple graphic primitives (lines, rectagles, draw text etc) over - a "virtual" bitmap area. Everytime we want to show that bitmap it will + a "virtual" bitmap area. Everytime we want to show that bitmap it will be RLE encoded and sent to the overlay manager for displaying. @@ -496,13 +496,13 @@    event.object.overlay->width = 100;    event.object.overlay->height = 100;     -   /* clipping region is mostly used by dvd menus for highlighting buttons */ +   /* clipping region is mostly used by dvd menus for highlighting buttons */    event.object.overlay->clip_top = 0;    event.object.overlay->clip_bottom = image_height;    event.object.overlay->clip_left = 0;    event.object.overlay->clip_right = image_width;     -   /* the hard part: provide a RLE image */ +   /* the hard part: provide a RLE image */    event.object.overlay->rle = your_rle;    event.object.overlay->data_size = your_size;    event.object.overlay->num_rle = your_rle_count; @@ -512,7 +512,7 @@        /* this table contains transparency levels for each color index.     0 = completely transparent, 15 - completely opaque */ -   memcpy(event.object.overlay->clip_trans, trans, sizeof(trans)); +   memcpy(event.object.overlay->clip_trans, trans, sizeof(trans));        /* set the event type and time for displaying */    event.event_type = EVENT_SHOW_SPU; @@ -527,9 +527,9 @@ to xine plugins and to frontends. - The first thing you need is to allocate a OSD object for drawing from the + The first thing you need is to allocate a OSD object for drawing from the renderer. The code below allocates a 300x200 area. This size can't be changed - during the lifetime of a OSD object, but it's possible to place it anywhere + during the lifetime of a OSD object, but it's possible to place it anywhere over the image. @@ -561,7 +561,7 @@    osd_renderer->render_text(osd, 0, 0, "white text, black border", OSD_TEXT1);    osd_renderer->render_text(osd, 0, 30, "white text, no border", OSD_TEXT2); -    +       osd_renderer->show(osd, 0); /* 0 stands for 'now' */ @@ -592,7 +592,7 @@ defined a small convention: -   /* +   /*     Palette entries as used by osd fonts:         0: not used by font, always transparent @@ -603,13 +603,13 @@     6: font border. if the font is to be displayed without border this     will probably be adjusted to font background or near.     7-9: transition between border and foreground -    10: font color (foreground) +    10: font color (foreground)    */ The so called 'transitions' are used to implement font anti-aliasing. That convention requires that any font file must use only the colors from 1 to 10. When we use the set_text_palette() function we are just copying 11 palette - entries to the specified base index. + entries to the specified base index. That base index is the same we pass to render_text() function to use the @@ -623,7 +623,7 @@    /* draws a box using font background color (translucid) */    renderer->filled_rect(osd, x1, y1, x1+width, y1+height, OSD_TEXT2 + 1);     -   /* render text */ +   /* render text */    renderer->render_text(osd, x1, y1, text, OSD_TEXT2); @@ -669,8 +669,8 @@ A: osd objects have no shadows by itself, but fonts use 11 colors to produce an anti-aliased effect. - if you set a "text palette" with entries 0-9 being transparent - and 10 being foreground you will get rid of any borders or + if you set a "text palette" with entries 0-9 being transparent + and 10 being foreground you will get rid of any borders or anti-aliasing. diff --git a/doc/hackersguide/intro.sgml b/doc/hackersguide/intro.sgml index 4e96d2de1..cd163e2ee 100644 --- a/doc/hackersguide/intro.sgml +++ b/doc/hackersguide/intro.sgml @@ -4,7 +4,7 @@ Where am I? - You are currently looking at a piece of documentation for xine. + You are currently looking at a piece of documentation for xine. xine is a free video player. It lives on http://www.xine-project.org/. Specifically this document goes under the moniker of the "xine Hackers' Guide". diff --git a/doc/hackersguide/library.fig b/doc/hackersguide/library.fig index 13dc79f0e..ec33d0f32 100644 --- a/doc/hackersguide/library.fig +++ b/doc/hackersguide/library.fig @@ -2,7 +2,7 @@ Landscape Center Metric -A4 +A4 100.00 Single -2 diff --git a/doc/hackersguide/library.sgml b/doc/hackersguide/library.sgml index 1d987d259..eb51baaaf 100644 --- a/doc/hackersguide/library.sgml +++ b/doc/hackersguide/library.sgml @@ -32,7 +32,7 @@ Details on the OSD feature can be found in the OSD section. - + Writing a new frontend to xine @@ -51,21 +51,21 @@ /* ** Copyright (C) 2003 Daniel Caujolle-Bert <segfault@club-internet.fr> -** +** ** This program 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. -** +** ** This program 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 this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -** +** */ /* @@ -127,7 +127,7 @@ static void dest_size_cb(void *data, int video_width, int video_height, double v /* this will be called by xine when it's about to draw the frame */ static void frame_output_cb(void *data, int video_width, int video_height, double video_pixel_aspect, int *dest_x, int *dest_y, - int *dest_width, int *dest_height, + int *dest_width, int *dest_height, double *dest_pixel_aspect, int *win_x, int *win_y) { *dest_x = 0; *dest_y = 0; @@ -139,7 +139,7 @@ static void frame_output_cb(void *data, int video_width, int video_height, } static void event_listener(void *user_data, const xine_event_t *event) { - switch(event->type) { + switch(event->type) { case XINE_EVENT_UI_PLAYBACK_FINISHED: running = 0; break; @@ -147,11 +147,11 @@ static void event_listener(void *user_data, const xine_event_t *event) { case XINE_EVENT_PROGRESS: { xine_progress_data_t *pevent = (xine_progress_data_t *) event->data; - + printf("%s [%d%%]\n", pevent->description, pevent->percent); } break; - + /* you can handle a lot of other interesting events here */ } } @@ -175,7 +175,7 @@ int main(int argc, char **argv) { else if (strcmp(argv[i], "-ao") == 0) { ao_driver = argv[++i]; } - else + else mrl = argv[i]; } @@ -195,7 +195,7 @@ int main(int argc, char **argv) { snprintf(configfile, sizeof(configfile), "%s%s", xine_get_homedir(), "/.xine/config"); xine_config_load(xine, configfile); xine_init(xine); - + display = XOpenDisplay(NULL); screen = XDefaultScreen(display); xpos = 0; @@ -212,7 +212,7 @@ int main(int argc, char **argv) { window[1] = XCreateSimpleWindow(display, XDefaultRootWindow(display), 0, 0, (DisplayWidth(display, screen)), (DisplayHeight(display, screen)), 0, 0, 0); - + XSelectInput(display, window[0], INPUT_MOTION); XSelectInput(display, window[1], INPUT_MOTION); @@ -223,14 +223,14 @@ int main(int argc, char **argv) { XChangeProperty(display, window[1], XA_NO_BORDER, XA_NO_BORDER, 32, PropModeReplace, (unsigned char *) &mwmhints, PROP_MWM_HINTS_ELEMENTS); - + XMapRaised(display, window[fullscreen]); - + res_h = (DisplayWidth(display, screen) * 1000 / DisplayWidthMM(display, screen)); res_v = (DisplayHeight(display, screen) * 1000 / DisplayHeightMM(display, screen)); XSync(display, False); XUnlockDisplay(display); - + /* filling in the xine visual struct */ vis.display = display; vis.screen = screen; @@ -239,7 +239,7 @@ int main(int argc, char **argv) { vis.frame_output_cb = frame_output_cb; vis.user_data = NULL; pixel_aspect = res_v / res_h; - + /* opening xine output ports */ vo_port = xine_open_video_driver(xine, vo_driver, XINE_VISUAL_TYPE_X11, (void *)&vis); ao_port = xine_open_audio_driver(xine , ao_driver, NULL); @@ -249,11 +249,11 @@ int main(int argc, char **argv) { /* hook our event handler into the streams events */ event_queue = xine_event_new_queue(stream); xine_event_create_listener_thread(event_queue, event_listener, NULL); - + /* make the video window visible to xine */ xine_port_send_gui_data(vo_port, XINE_GUI_SEND_DRAWABLE_CHANGED, (void *) window[fullscreen]); xine_port_send_gui_data(vo_port, XINE_GUI_SEND_VIDEOWIN_VISIBLE, (void *) 1); - + /* start playback */ if (!xine_open(stream, mrl) || !xine_play(stream, 0, 0)) { printf("Unable to open mrl '%s'\n", mrl); @@ -269,12 +269,12 @@ int main(int argc, char **argv) { if( got_event ) XNextEvent(display, &xevent); XUnlockDisplay(display); - + if( !got_event ) { xine_usec_sleep(20000); continue; } - + switch(xevent.type) { case KeyPress: @@ -283,27 +283,27 @@ int main(int argc, char **argv) { KeySym ksym; char kbuf[256]; int len; - + kevent = xevent.xkey; - + XLockDisplay(display); len = XLookupString(&kevent, kbuf, sizeof(kbuf), &ksym, NULL); XUnlockDisplay(display); - + switch (ksym) { - + case XK_q: case XK_Q: /* user pressed q => quit */ running = 0; break; - + case XK_f: case XK_F: { /* user pressed f => toggle fullscreen */ Window tmp_win; - + XLockDisplay(display); XUnmapWindow(display, window[fullscreen]); fullscreen = !fullscreen; @@ -313,36 +313,36 @@ int main(int argc, char **argv) { DefaultRootWindow(display), 0, 0, &xpos, &ypos, &tmp_win); XUnlockDisplay(display); - - xine_port_send_gui_data(vo_port, XINE_GUI_SEND_DRAWABLE_CHANGED, + + xine_port_send_gui_data(vo_port, XINE_GUI_SEND_DRAWABLE_CHANGED, (void*) window[fullscreen]); } break; - + case XK_Up: /* cursor up => increase volume */ xine_set_param(stream, XINE_PARAM_AUDIO_VOLUME, (xine_get_param(stream, XINE_PARAM_AUDIO_VOLUME) + 1)); break; - + case XK_Down: /* cursor down => decrease volume */ xine_set_param(stream, XINE_PARAM_AUDIO_VOLUME, (xine_get_param(stream, XINE_PARAM_AUDIO_VOLUME) - 1)); break; - + case XK_plus: /* plus => next audio channel */ - xine_set_param(stream, XINE_PARAM_AUDIO_CHANNEL_LOGICAL, + xine_set_param(stream, XINE_PARAM_AUDIO_CHANNEL_LOGICAL, (xine_get_param(stream, XINE_PARAM_AUDIO_CHANNEL_LOGICAL) + 1)); break; - + case XK_minus: /* minus => previous audio channel */ - xine_set_param(stream, XINE_PARAM_AUDIO_CHANNEL_LOGICAL, + xine_set_param(stream, XINE_PARAM_AUDIO_CHANNEL_LOGICAL, (xine_get_param(stream, XINE_PARAM_AUDIO_CHANNEL_LOGICAL) - 1)); break; - + case XK_space: /* space => toggle pause mode */ if (xine_get_param(stream, XINE_PARAM_SPEED) != XINE_SPEED_PAUSE) @@ -350,26 +350,26 @@ int main(int argc, char **argv) { else xine_set_param(stream, XINE_PARAM_SPEED, XINE_SPEED_NORMAL); break; - + } } break; - + case Expose: /* this handles (partial) occlusion of our video window */ if (xevent.xexpose.count != 0) break; xine_port_send_gui_data(vo_port, XINE_GUI_SEND_EXPOSE_EVENT, &xevent); break; - + case ConfigureNotify: { XConfigureEvent *cev = (XConfigureEvent *) &xevent; Window tmp_win; - + width = cev->width; height = cev->height; - + if ((cev->x == 0) && (cev->y == 0)) { XLockDisplay(display); XTranslateCoordinates(display, cev->window, @@ -382,26 +382,26 @@ int main(int argc, char **argv) { } } break; - + } } - + /* cleanup */ xine_close(stream); xine_event_dispose_queue(event_queue); xine_dispose(stream); - xine_close_audio_driver(xine, ao_port); - xine_close_video_driver(xine, vo_port); + xine_close_audio_driver(xine, ao_port); + xine_close_video_driver(xine, vo_port); xine_exit(xine); - + XLockDisplay(display); XUnmapWindow(display, window[fullscreen]); XDestroyWindow(display, window[0]); XDestroyWindow(display, window[1]); XUnlockDisplay(display); - + XCloseDisplay (display); - + return 0; } diff --git a/doc/hackersguide/output.sgml b/doc/hackersguide/output.sgml index 57781c05e..64adbd294 100644 --- a/doc/hackersguide/output.sgml +++ b/doc/hackersguide/output.sgml @@ -116,7 +116,7 @@    if (_x_post_dispose(this))      really_free(this); - _x_post_dispose() frees any ressources allocated by any of the + _x_post_dispose() frees any ressources allocated by any of the post plugin helper functions and returns boolean true, if the plugin is not needed any more. @@ -434,7 +434,7 @@ This function can only be called by the xine engine, plugins do not have access to it. - It ends ticket revocation and hands out new tickets to all threads that applied with a + It ends ticket revocation and hands out new tickets to all threads that applied with a acquire() or renew(). If you revoked the tickets atomic, you have to issue them atomic. @@ -499,7 +499,7 @@ _x_post_rewire() should be used in prominent locations where it is safe to be suspended. Candidates for such locations are at the beginning of the port's open() and - get_frame()/get_buffer() functions. + get_frame()/get_buffer() functions. The default pass through implementations for intercepted ports already do this. @@ -515,7 +515,7 @@ - + Video output @@ -539,13 +539,13 @@ - Most important, the ability to render/copy a given + Most important, the ability to render/copy a given frame to the output device. - Optionally the copying of the frame from a file dependant + Optionally the copying of the frame from a file dependant colour-space and depth into the frame structure. This is to allow for on-the fly colour-space conversion and scaling if required (e.g. the XShm ouput plugin uses this mechanism). @@ -569,7 +569,7 @@ The visual_type field is used by xine to determine if the GUI used by the client is supported by the plugin (e.g. X11 output plugins require the GUI to be running under the - X Windowing system) and also to determine the type of information passed to the + X Windowing system) and also to determine the type of information passed to the open_plugin() function as its visual parameter. @@ -590,7 +590,7 @@ The visual is a pointer to a visual-dependant structure/variable. For example, if you had previously claimed your plugin was of the VISUAL_TYPE_X11 type, this would be a pointer - to a x11_visual_t, which amongst other things hold the + to a x11_visual_t, which amongst other things hold the Display variable associated with the X-server xine should display to. See plugin source-code for other VISUAL_TYPE_* constants and associated structures. Note that this @@ -609,7 +609,7 @@    int get_property(vo_driver_t *self, int property);    int set_property(vo_driver_t *self, int property, int value);    void get_property_min_max(vo_driver_t *self, int property, int *min, int *max); - Handle the getting, setting of properties and define their bounds. + Handle the getting, setting of properties and define their bounds. Valid property IDs can be found in the video_out.h header file. diff --git a/doc/hackersguide/overlays.fig b/doc/hackersguide/overlays.fig index 0301aead2..78ecda61c 100644 --- a/doc/hackersguide/overlays.fig +++ b/doc/hackersguide/overlays.fig @@ -2,7 +2,7 @@ Portrait Center Metric -A4 +A4 100.00 Single -2 diff --git a/doc/hackersguide/overview.sgml b/doc/hackersguide/overview.sgml index eb62e5bd3..18cc40396 100644 --- a/doc/hackersguide/overview.sgml +++ b/doc/hackersguide/overview.sgml @@ -201,7 +201,7 @@ libmad (imported) - Mpeg audio decoder plugin (i.e. mp2 and mp3 decoding). + Mpeg audio decoder plugin (i.e. mp2 and mp3 decoding). ISO/IEC compliant decoder using fixed point math. @@ -529,7 +529,7 @@ Object oriented programming in C - xine uses a lot of design principles normally found in + xine uses a lot of design principles normally found in object oriented designs. As xine is written in C, a few basic principles shall be explained here on how xine is object oriented anyway. @@ -561,7 +561,7 @@     my_stack_t stack; /* public part */         /* private part follows here */ -    int values[MAX_STACK_SIZE]; +    int values[MAX_STACK_SIZE];     int stack_size;    } intstack_t; Each method is implemented as a static method (static to prevent @@ -646,7 +646,7 @@ - + Coding style and guidelines @@ -655,35 +655,35 @@ Contributions will not be rejected if they do not meet these rules but they will be even more appreciated if they do. - + Comment your interfaces directly in the header files. No doxygen comments, ordinary C comments will do. - + Use C-style comments (/* */), not C++-style (//). - + When in doubt, use lower case. BTW: This thing is called xine, never Xine. - + Use expressive variable and function identifiers on all public interfaces. Use underscores to seperate words in identifiers, not uppercase letters (my_function_name is ok, myFunctionName is not ok). - + Avoid macros unless they are really useful. Avoid gotos. - + use something like    printf("module: ..."[,…]); @@ -692,7 +692,7 @@ output (see example above). - + Refer to emac's C-mode for all questions of proper indentiation. That first of all means: indent with two spaces. @@ -701,7 +701,7 @@ - + The xine logging system diff --git a/doc/hackersguide/post_frame.fig b/doc/hackersguide/post_frame.fig index 4f576abdd..efafa31d5 100644 --- a/doc/hackersguide/post_frame.fig +++ b/doc/hackersguide/post_frame.fig @@ -2,7 +2,7 @@ Landscape Center Metric -A4 +A4 100.00 Single -2 diff --git a/doc/hackersguide/stream.sgml b/doc/hackersguide/stream.sgml index d9a5471bd..b9690d9fe 100644 --- a/doc/hackersguide/stream.sgml +++ b/doc/hackersguide/stream.sgml @@ -1,11 +1,11 @@ xine's stream layer - + Input layer Many media players expect streams to be stored within files on - some local medium. In actual fact, media may be streamed over a + some local medium. In actual fact, media may be streamed over a network (e.g. via HTTP or RTP), encoded onto a specialized medium (e.g. DVD), etc. To allow you to access all this media, xine supports the concept of an "input plugin". The tasks performed by an @@ -156,7 +156,7 @@ xine's demuxer layer is responsible for taking apart multimedia files or streams so that the engine can decode them and present them to the user. - "Demuxer" is short for demultiplexor, which is the opposite of + "Demuxer" is short for demultiplexor, which is the opposite of multiplexing. This refers to the process of combining 2 or more things into one. Multimedia streams usually, at a minimum, multiplex an audio stream and a video stream together into one stream. Sometimes, there are @@ -329,7 +329,7 @@    void demux_send_headers(demux_plugin_t *this_gen); This function generally reads the headers of the stream, does whatever it has to do to figure out what audio and video codecs are used in the file, - and asks the xine engine to initialize the correct decoders with the + and asks the xine engine to initialize the correct decoders with the proper parameters (like width and height for video, sample rate and channels for audio). diff --git a/doc/internal/HOWTO.release b/doc/internal/HOWTO.release index 38532aac0..2e2adff94 100644 --- a/doc/internal/HOWTO.release +++ b/doc/internal/HOWTO.release @@ -59,7 +59,7 @@ Currently, best practice to get a release out looks like this: which the subminor releases like 1.0.1, 1.0.2,... are made and an unstable branch in CVS head, which is going to become the next minor (1.1) or major (2.0) xine-lib version. - + Make sure you know - what the new release should be called (the "marketing version" part of the tarball name, for example) @@ -88,11 +88,11 @@ Currently, best practice to get a release out looks like this: - does it have the right name? - does it unpack, compile and install correctly? note: make sure to build with as many features as possible - on a Debian box, "apt-get build-dep xine-lib" and + on a Debian box, "apt-get build-dep xine-lib" and "dpkg-buildpackage -rfakeroot" are a good way to do that - test the candidate (and make sure you are running exactly the new version!) This should at least cover the [standard test parcours] - + If you find any errors: fix them (get help on xine-devel or #xine) and go back to step 4) @@ -129,7 +129,7 @@ hands. 12) write the announcement for xine-project.org: You need to have an account on alioth.debian.org and a checked-out copy - of ssh://hg.debian.org//hg/xine-lib/xine-project-www/ (using Mercurial). + of ssh://hg.debian.org//hg/xine-lib/xine-project-www/ (using Mercurial). Add the new news item near the top of pages/news/items.xml (use the provided template), run update.sh (requires xsltproc; if this fails, re-edit), check that it looks fine in a convenient browser, then commit diff --git a/include/Makefile.am b/include/Makefile.am index 09d432536..b0a7e6a91 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -18,7 +18,7 @@ install-debug: debug @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am mostlyclean-generic: - -rm -f *~ \#* .*~ .\#* + -rm -f *~ \#* .*~ .\#* maintainer-clean-generic: -@echo "This command is intended for maintainers to use;" diff --git a/lib/Makefile.am b/lib/Makefile.am index 36b695bc8..29084e996 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -6,5 +6,5 @@ noinst_LTLIBRARIES = libxineposix.la noinst_HEADERS = os_internal.h xineinclude_HEADERS = os_types.h -libxineposix_la_SOURCES = +libxineposix_la_SOURCES = libxineposix_la_LIBADD = @LTLIBOBJS@ diff --git a/lib/asprintf.c b/lib/asprintf.c index 1027e82dd..5359e51f3 100644 --- a/lib/asprintf.c +++ b/lib/asprintf.c @@ -29,7 +29,7 @@ int xine_private_vasprintf (char **buffer, const char *format, va_list ap) { char *buf = NULL; int size = 128; - + for (;;) { int ret; @@ -41,11 +41,11 @@ int xine_private_vasprintf (char **buffer, const char *format, va_list ap) return -1; } buf = newbuf; - + va_copy (cp, ap); ret = vsnprintf (buf, size, format, cp); va_end (cp); - + if (ret >= 0 && ret < size) { *buffer = realloc (buf, ret + 1); diff --git a/lib/dirent_msvc.c b/lib/dirent_msvc.c index 19ef88a66..8a3f895ea 100644 --- a/lib/dirent_msvc.c +++ b/lib/dirent_msvc.c @@ -11,7 +11,7 @@ that this copyright and permissions notice appear in all copies and derivatives, and that no charge may be made for the software and its documentation except to cover cost of distribution. - + This software is supplied "as is" without express or implied warranty. But that said, if there are any problems please get in touch. diff --git a/lib/os_types.h b/lib/os_types.h index 75ce9b8a5..aa6eddb00 100644 --- a/lib/os_types.h +++ b/lib/os_types.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * - * Platform dependent types needed by public xine.h. + * Platform dependent types needed by public xine.h. * Types not needed by xine.h are specified in os_internal.h. * * Heavily based on os_types.h from OggVorbis (BSD License), @@ -97,7 +97,7 @@ #else - /* + /* * CygWin: _WIN32 & __GNUC__ * BeOS: __BEOS__ * Linux, Solaris, Mac and others diff --git a/lib/strsep.c b/lib/strsep.c index 3170e4867..fbd5c041e 100644 --- a/lib/strsep.c +++ b/lib/strsep.c @@ -35,7 +35,7 @@ /* * Get next token from string *stringp, where tokens are possibly-empty - * strings separated by characters from delim. + * strings separated by characters from delim. * * Writes NULs into the string at *stringp to end tokens. * delim need not remain constant from call to call. diff --git a/m4/_xine.m4 b/m4/_xine.m4 index 0c840cd9d..70bbe5d8f 100644 --- a/m4/_xine.m4 +++ b/m4/_xine.m4 @@ -81,7 +81,7 @@ AC_DEFUN([AC_CHECK_LIRC], if test x"$LIRC_PREFIX" != "x"; then lirc_libprefix="$LIRC_PREFIX/lib" - LIRC_INCLUDE="-I$LIRC_PREFIX/include" + LIRC_INCLUDE="-I$LIRC_PREFIX/include" fi for llirc in $lirc_libprefix /lib /usr/lib /usr/local/lib; do AC_CHECK_FILE("$llirc/liblirc_client.a", @@ -117,14 +117,14 @@ AC_DEFUN([AC_CHECK_DXR3], AC_MSG_RESULT([*** checking for a supported mpeg encoder]) have_encoder=no have_libfame=yes - AC_CHECK_LIB(fame, fame_open, + AC_CHECK_LIB(fame, fame_open, [AC_CHECK_HEADER(fame.h, true, have_libfame=no)], have_libfame=no) if test "$have_libfame" = "yes"; then AC_DEFINE(HAVE_LIBFAME) have_encoder=yes fi have_librte=yes - AC_CHECK_LIB(rte, rte_init, + AC_CHECK_LIB(rte, rte_init, [AC_CHECK_HEADER(rte.h, true, have_librte=no)], have_librte=no) if test "$have_librte" = "yes"; then AC_DEFINE(HAVE_LIBRTE) @@ -390,7 +390,7 @@ dnl Validate the GMSGFMT program found by gettext.m4; reject old versions dnl of GNU msgfmt that do not support the "msgid_plural" extension. AC_DEFUN([AC_PROG_GMSGFMT_PLURAL], [dnl AC_REQUIRE(AM_GNU_GETTEXT) - + if test "$GMSGFMT" != ":"; then AC_MSG_CHECKING([for plural forms in GNU msgfmt]) @@ -498,7 +498,7 @@ _ACEOF AC_MSG_RESULT(no) fi fi - fi + fi else AC_MSG_RESULT(no) fi diff --git a/m4/aa.m4 b/m4/aa.m4 index bab0d9d28..f7eefd8d7 100644 --- a/m4/aa.m4 +++ b/m4/aa.m4 @@ -1,27 +1,27 @@ dnl Configure path and dependencies for aalib. dnl dnl Copyright (C) 2001 Daniel Caujolle-Bert -dnl +dnl dnl This program is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by dnl the Free Software Foundation; either version 2 of the License, or dnl (at your option) any later version. -dnl +dnl dnl This program is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the dnl GNU General Public License for more details. -dnl +dnl dnl You should have received a copy of the GNU General Public License dnl along with this program; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -dnl -dnl +dnl +dnl dnl As a special exception to the GNU General Public License, if you dnl distribute this file as part of a program that contains a configuration dnl script generated by Autoconf, you may include it under the same dnl distribution terms that you use for the rest of that program. -dnl +dnl dnl AM_PATH_AALIB([MINIMUM-VERSION, [ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND ]]]) dnl Test for AALIB, and define AALIB_CFLAGS and AALIB_LIBS, AALIB_STATIC_LIBS. dnl @@ -32,7 +32,7 @@ dnl 17/09/2001 dnl * use both aalib-config, and *last chance* aainfo for guessing. dnl 19/08/2001 dnl * use aalib-config instead of aainfo now. -dnl 17/06/2001 +dnl 17/06/2001 dnl * First shot dnl @@ -66,7 +66,7 @@ int main () { exit(1); } - if ((AA_LIB_VERSION > major) || ((AA_LIB_VERSION == major) && + if ((AA_LIB_VERSION > major) || ((AA_LIB_VERSION == major) && #ifdef AA_LIB_MINNOR (AA_LIB_MINNOR >= minor) #else @@ -89,11 +89,11 @@ int main () { return 1; } ]])],[],[no_aalib=yes],[no_aalib=cc]) - if test "x$no_aalib" = xcc; then + if test "x$no_aalib" = xcc; then AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include #include -]], [[ return ((AA_LIB_VERSION) || +]], [[ return ((AA_LIB_VERSION) || #ifdef AA_LIB_MINNOR (AA_LIB_MINNOR) #else @@ -107,7 +107,7 @@ int main () { AC_DEFUN([AM_PATH_AALIB], -[dnl +[dnl dnl AC_ARG_WITH(aalib-prefix, AS_HELP_STRING([--with-aalib-prefix=DIR], [prefix where AALIB is installed (optional)]), @@ -115,7 +115,7 @@ AC_ARG_WITH(aalib-prefix, AC_ARG_WITH(aalib-exec-prefix, AS_HELP_STRING([--with-aalib-exec-prefix=DIR], [exec prefix where AALIB is installed (optional)]), aalib_config_exec_prefix="$withval", aalib_config_exec_prefix="") -AC_ARG_ENABLE(aalibtest, +AC_ARG_ENABLE(aalibtest, AS_HELP_STRING([--disable-aalibtest], [do not try to compile and run a test AALIB program]), enable_aalibtest=$enableval, enable_aalibtest=yes) @@ -169,9 +169,9 @@ dnl aalib-config is missing, check for old aainfo AC_PATH_TOOL(AAINFO, aainfo, no) else AC_MSG_CHECKING(for $AAINFO) - if test -x $AAINFO; then + if test -x $AAINFO; then AC_MSG_RESULT(yes) - else + else AAINFO="no" AC_MSG_RESULT(no) fi @@ -189,10 +189,10 @@ dnl aalib-config is missing, check for old aainfo AALIB_CFLAGS="$AALIB_CFLAGS `echo $X_CFLAGS|sed -e 's/\-I/\-L/g;s/include/lib/g'`" x11dep="yes" fi -dnl if test $drv = "slang" -a x$slangdep = "x"; then +dnl if test $drv = "slang" -a x$slangdep = "x"; then dnl slangdep="yes" dnl fi -dnl if test $drv = "gpm" -a x$gmpdep = "x"; then +dnl if test $drv = "gpm" -a x$gmpdep = "x"; then dnl gpmdep="yes" dnl fi done @@ -218,7 +218,7 @@ dnl fi if test "x$no_aalib" = x; then AC_MSG_RESULT(yes) - ifelse([$2], , :, [$2]) + ifelse([$2], , :, [$2]) else AC_MSG_RESULT(no) if test "$AALIB_CONFIG" = "no"; then @@ -236,8 +236,8 @@ dnl fi AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include #include -]], [[ - return ((AA_LIB_VERSION) || +]], [[ + return ((AA_LIB_VERSION) || #ifdef AA_LIB_MINNOR (AA_LIB_MINNOR) #else diff --git a/m4/arts.m4 b/m4/arts.m4 index 079c21ba8..b66199be8 100644 --- a/m4/arts.m4 +++ b/m4/arts.m4 @@ -6,7 +6,7 @@ dnl AM_PATH_ARTS([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) dnl Test for ARTS, and define ARTS_CFLAGS and ARTS_LIBS dnl AC_DEFUN([AM_PATH_ARTS], -[dnl +[dnl dnl Get the cflags and libraries from the artsc-config script dnl AC_ARG_WITH(arts-prefix, AS_HELP_STRING([--with-arts-prefix=DIR], [prefix where ARTS is installed (optional)]), @@ -22,7 +22,7 @@ AC_ARG_ENABLE(artstest, AS_HELP_STRING([--disable-artstest], [do not try to comp fi AC_PATH_TOOL(ARTS_CONFIG, artsc-config, no) - + min_arts_version=ifelse([$1], ,0.9.5,$1) AC_MSG_CHECKING(for ARTS artsc - version >= $min_arts_version) no_arts="" @@ -64,7 +64,7 @@ char* my_strdup (char *str) { char *new_str; - + if (str) { new_str = malloc ((strlen (str) + 1) * sizeof(char)); @@ -72,7 +72,7 @@ my_strdup (char *str) } else new_str = NULL; - + return new_str; } @@ -122,7 +122,7 @@ int main () fi if test "x$no_arts" = x ; then AC_MSG_RESULT(yes) - ifelse([$2], , :, [$2]) + ifelse([$2], , :, [$2]) else AC_MSG_RESULT(no) if test "$ARTS_CONFIG" = "no" ; then diff --git a/m4/attributes.m4 b/m4/attributes.m4 index 4863b6bfe..c7ef73e68 100644 --- a/m4/attributes.m4 +++ b/m4/attributes.m4 @@ -25,7 +25,7 @@ dnl License when using or distributing such scripts, even though portions dnl of the text of the Macro appear in them. The GNU General Public dnl License (GPL) does govern all other use of the material that dnl constitutes the Autoconf Macro. -dnl +dnl dnl This special exception to the GPL applies to versions of the dnl Autoconf Macro released by this project. When you make and dnl distribute a modified version of the Autoconf Macro, you may extend @@ -114,7 +114,7 @@ AC_DEFUN([CC_NOUNDEFINED], [ dnl First of all check for the --no-undefined variant of GNU ld. This allows dnl for a much more readable commandline, so that people can understand what dnl it does without going to look for what the heck -z defs does. - for possible_flags in "-Wl,--no-undefined" "-Wl,-z,defs"; do + for possible_flags in "-Wl,--no-undefined" "-Wl,-z,defs"; do CC_CHECK_LDFLAGS([$possible_flags], [LDFLAGS_NOUNDEFINED="$possible_flags"]) break done @@ -257,7 +257,7 @@ AC_DEFUN([CC_FLAG_VISIBILITY], [ cc_cv_flag_visibility='yes', cc_cv_flag_visibility='no') CFLAGS="$cc_flag_visibility_save_CFLAGS"]) - + AS_IF([test "x$cc_cv_flag_visibility" = "xyes"], [AC_DEFINE([SUPPORT_FLAG_VISIBILITY], 1, [Define this if the compiler supports the -fvisibility flag]) diff --git a/m4/directx.m4 b/m4/directx.m4 index 999beff6d..743403c72 100644 --- a/m4/directx.m4 +++ b/m4/directx.m4 @@ -6,7 +6,7 @@ dnl dnl dnl AM_PATH_DIRECTX([ACTION IF FOUND [, ACTION IF NOT FOUND]])) dnl -dnl It looks for DirectX, defines DIRECTX_CPPFLAGS, DIRECTX_AUDIO_LIBS and +dnl It looks for DirectX, defines DIRECTX_CPPFLAGS, DIRECTX_AUDIO_LIBS and dnl DIRECTX_VIDEO_LIBS. dnl AC_DEFUN([AM_PATH_DIRECTX], [ @@ -39,7 +39,7 @@ AC_COMPILE_IFELSE( int main() { DirectDrawCreate(0, NULL, 0); DirectSoundCreate(0, NULL, 0); - + return 0; } ], diff --git a/m4/dl.m4 b/m4/dl.m4 index 30ea00b1c..0b6b72311 100644 --- a/m4/dl.m4 +++ b/m4/dl.m4 @@ -31,7 +31,7 @@ int main() { dlopen(NULL, 0); return 0; } -], +], [DYNAMIC_LD_LIBS=-lkernel32 have_dl=yes AC_MSG_RESULT(yes)], diff --git a/m4/dvdnav.m4 b/m4/dvdnav.m4 index 0f24080f7..c15404168 100644 --- a/m4/dvdnav.m4 +++ b/m4/dvdnav.m4 @@ -1,33 +1,33 @@ dnl Configure paths for DVDNAV dnl dnl Copyright (C) 2001 Daniel Caujolle-Bert -dnl +dnl dnl This program is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by dnl the Free Software Foundation; either version 2 of the License, or dnl (at your option) any later version. -dnl +dnl dnl This program is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the dnl GNU General Public License for more details. -dnl +dnl dnl You should have received a copy of the GNU General Public License dnl along with this program; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -dnl -dnl +dnl +dnl dnl As a special exception to the GNU General Public License, if you dnl distribute this file as part of a program that contains a configuration dnl script generated by Autoconf, you may include it under the same dnl distribution terms that you use for the rest of that program. -dnl +dnl dnl AM_PATH_DVDNAV([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]]) dnl Test for DVDNAV, and define DVDNAV_CFLAGS and DVDNAV_LIBS dnl AC_DEFUN([AM_PATH_DVDNAV], -[dnl +[dnl dnl Get the cflags and libraries from the dvdnav-config script dnl AC_ARG_WITH(dvdnav-prefix, @@ -36,7 +36,7 @@ AC_ARG_WITH(dvdnav-prefix, AC_ARG_WITH(dvdnav-exec-prefix, AS_HELP_STRING([--with-dvdnav-exec-prefix=DIR], [exec prefix where DVDNAV is installed (optional)]), dvdnav_config_exec_prefix="$withval", dvdnav_config_exec_prefix="") -AC_ARG_ENABLE(dvdnavtest, +AC_ARG_ENABLE(dvdnavtest, AS_HELP_STRING([--disable-dvdnavtest], [do not try to compile and run a test DVDNAV program]), enable_dvdnavtest=$enableval, enable_dvdnavtest=yes) @@ -89,7 +89,7 @@ dnl #include #include -int +int main () { int major, minor, sub; @@ -139,7 +139,7 @@ main () fi if test "x$no_dvdnav" = x ; then AC_MSG_RESULT(yes) - ifelse([$2], , :, [$2]) + ifelse([$2], , :, [$2]) else AC_MSG_RESULT(no) if test "$DVDNAV_CONFIG" = "no" ; then diff --git a/m4/getopt_long.m4 b/m4/getopt_long.m4 index 39f41ffc2..59e9d8148 100644 --- a/m4/getopt_long.m4 +++ b/m4/getopt_long.m4 @@ -19,13 +19,13 @@ int main (int argc, char **argv) { int option_index = 0; int c; opterr = 0; - while ((c = getopt_long (argc, argv, "?hv", + while ((c = getopt_long (argc, argv, "?hv", long_options, &option_index)) != EOF) ; return 0; } ]])], - [AC_MSG_RESULT(yes); + [AC_MSG_RESULT(yes); ac_getopt_long=yes; AC_DEFINE(HAVE_GETOPT_LONG,,[Define this if you have GNU getopt_long() implemented])], [AC_MSG_RESULT(no); ac_getopt_long=no], diff --git a/m4/ioctl_request.m4 b/m4/ioctl_request.m4 index c6d12258e..6eb3f45a6 100644 --- a/m4/ioctl_request.m4 +++ b/m4/ioctl_request.m4 @@ -24,7 +24,7 @@ dnl License when using or distributing such scripts, even though portions dnl of the text of the Macro appear in them. The GNU General Public dnl License (GPL) does govern all other use of the material that dnl constitutes the Autoconf Macro. -dnl +dnl dnl This special exception to the GPL applies to versions of the dnl Autoconf Macro released by the xine project. When you make and dnl distribute a modified version of the Autoconf Macro, you may extend diff --git a/m4/libFLAC.m4 b/m4/libFLAC.m4 index 9ecf8dd51..7ad896b05 100644 --- a/m4/libFLAC.m4 +++ b/m4/libFLAC.m4 @@ -5,7 +5,7 @@ dnl AM_PATH_LIBFLAC([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) dnl Test for libFLAC, and define LIBFLAC_CFLAGS and LIBFLAC_LIBS dnl AC_DEFUN([AM_PATH_LIBFLAC], -[dnl +[dnl dnl Get the cflags and libraries dnl AC_ARG_WITH(libFLAC-prefix, AS_HELP_STRING([--with-libFLAC-prefix=DIR], [prefix where libFLAC is installed (optional)]), libFLAC_prefix="$withval", libFLAC_prefix="") @@ -71,7 +71,7 @@ int main () if test "x$no_libFLAC" = "x" ; then AC_MSG_RESULT(yes) - ifelse([$1], , :, [$1]) + ifelse([$1], , :, [$1]) else AC_MSG_RESULT(no) if test -f conf.libFLACtest ; then diff --git a/m4/libfame.m4 b/m4/libfame.m4 index 5fc34cc56..bf54f1e80 100644 --- a/m4/libfame.m4 +++ b/m4/libfame.m4 @@ -4,7 +4,7 @@ dnl Vivien Chappelier 12/11/00 dnl stolen from ORBit autoconf dnl AC_DEFUN([AM_PATH_LIBFAME], -[dnl +[dnl dnl Get the cflags and libraries from the libfame-config script dnl AC_ARG_WITH(libfame-prefix, AS_HELP_STRING([--with-libfame-prefix=DIR], [prefix where libfame is installed (optional)]), @@ -57,7 +57,7 @@ dnl #include #include -int +int main () { int major, minor, micro; @@ -76,7 +76,7 @@ main () (libfame_minor_version != $libfame_config_minor_version) || (libfame_micro_version != $libfame_config_micro_version)) { - printf("\n*** 'libfame-config --version' returned %d.%d.%d, but Libfame (%d.%d.%d)\n", + printf("\n*** 'libfame-config --version' returned %d.%d.%d, but Libfame (%d.%d.%d)\n", $libfame_config_major_version, $libfame_config_minor_version, $libfame_config_micro_version, libfame_major_version, libfame_minor_version, libfame_micro_version); printf ("*** was found! If libfame-config was correct, then it is best\n"); @@ -87,7 +87,7 @@ main () printf("*** If libfame-config was wrong, set the environment variable LIBFAME_CONFIG\n"); printf("*** to point to the correct copy of libfame-config, and remove the file config.cache\n"); printf("*** before re-running configure\n"); - } + } #if defined (LIBFAME_MAJOR_VERSION) && defined (LIBFAME_MINOR_VERSION) && defined (LIBFAME_MICRO_VERSION) else if ((libfame_major_version != LIBFAME_MAJOR_VERSION) || (libfame_minor_version != LIBFAME_MINOR_VERSION) || @@ -137,7 +137,7 @@ main () fi if test "x$no_libfame" = x ; then AC_MSG_RESULT(yes) - ifelse([$2], , :, [$2]) + ifelse([$2], , :, [$2]) else AC_MSG_RESULT(no) if test "$LIBFAME_CONFIG" = "no" ; then diff --git a/m4/misc.m4 b/m4/misc.m4 index 83246f36c..31686b33d 100644 --- a/m4/misc.m4 +++ b/m4/misc.m4 @@ -25,7 +25,7 @@ dnl License when using or distributing such scripts, even though portions dnl of the text of the Macro appear in them. The GNU General Public dnl License (GPL) does govern all other use of the material that dnl constitutes the Autoconf Macro. -dnl +dnl dnl This special exception to the GPL applies to versions of the dnl Autoconf Macro released by this project. When you make and dnl distribute a modified version of the Autoconf Macro, you may extend diff --git a/m4/opengl.m4 b/m4/opengl.m4 index 2c12949d9..f718fc848 100644 --- a/m4/opengl.m4 +++ b/m4/opengl.m4 @@ -35,14 +35,14 @@ AC_DEFUN([AM_PATH_OPENGL], [ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include #include ]], [[ gluPerspective(45.0f,1.33f,1.0f,1000.0f); glBegin(GL_POINTS); glEnd(); return 0 ]])], [ ac_have_glu="yes" - GLU_LIBS="-lGLU" + GLU_LIBS="-lGLU" AC_DEFINE(HAVE_GLU,1,[Define this if you have GLU support available]) AC_MSG_RESULT(yes)], [ AC_MSG_RESULT(no) echo "*** GLU doesn't link with GL; GLU is disabled ***"]) LIBS="$ac_save_LIBS"] )], - [], + [], [$X_LIBS $X_PRE_LIBS $OPENGL_LIBS -lGLU $X_EXTRA_LIBS] ) fi diff --git a/m4/pkg.m4 b/m4/pkg.m4 index cbb46dbf8..4328e2e3f 100644 --- a/m4/pkg.m4 +++ b/m4/pkg.m4 @@ -1,5 +1,5 @@ # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- -# +# # Copyright © 2004 Scott James Remnant . # # This program is free software; you can redistribute it and/or modify @@ -39,7 +39,7 @@ if test -n "$PKG_CONFIG"; then AC_MSG_RESULT([no]) PKG_CONFIG="" fi - + fi[]dnl ])# PKG_PROG_PKG_CONFIG @@ -120,7 +120,7 @@ if test $pkg_failed = yes; then _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"` - else + else $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` fi # Put the nasty error message in config.log where it belongs diff --git a/m4/symbol.m4 b/m4/symbol.m4 index 7f807f1b1..54c4593d2 100644 --- a/m4/symbol.m4 +++ b/m4/symbol.m4 @@ -24,7 +24,7 @@ dnl License when using or distributing such scripts, even though portions dnl of the text of the Macro appear in them. The GNU General Public dnl License (GPL) does govern all other use of the material that dnl constitutes the Autoconf Macro. -dnl +dnl dnl This special exception to the GPL applies to versions of the dnl Autoconf Macro released by the xine project. When you make and dnl distribute a modified version of the Autoconf Macro, you may extend diff --git a/m4/xine.m4 b/m4/xine.m4 index 2842de621..6c8d980b6 100644 --- a/m4/xine.m4 +++ b/m4/xine.m4 @@ -1,33 +1,33 @@ dnl Configure paths for XINE dnl dnl Copyright (C) 2001 Daniel Caujolle-Bert -dnl +dnl dnl This program is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by dnl the Free Software Foundation; either version 2 of the License, or dnl (at your option) any later version. -dnl +dnl dnl This program is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the dnl GNU General Public License for more details. -dnl +dnl dnl You should have received a copy of the GNU General Public License dnl along with this program; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -dnl -dnl +dnl +dnl dnl As a special exception to the GNU General Public License, if you dnl distribute this file as part of a program that contains a configuration dnl script generated by Autoconf, you may include it under the same dnl distribution terms that you use for the rest of that program. -dnl +dnl dnl AM_PATH_XINE([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]]) dnl Test for XINE, and define XINE_CFLAGS and XINE_LIBS dnl AC_DEFUN([AM_PATH_XINE], -[dnl +[dnl dnl Get the cflags and libraries from the xine-config script dnl AC_ARG_WITH(xine-prefix, @@ -36,7 +36,7 @@ AC_ARG_WITH(xine-prefix, AC_ARG_WITH(xine-exec-prefix, AS_HELP_STRING([--with-xine-exec-prefix=DIR], [exec prefix where XINE is installed (optional)]), xine_config_exec_prefix="$withval", xine_config_exec_prefix="") -AC_ARG_ENABLE(xinetest, +AC_ARG_ENABLE(xinetest, AS_HELP_STRING([--disable-xinetest], [do not try to compile and run a test XINE program]), enable_xinetest=$enableval, enable_xinetest=yes) @@ -94,7 +94,7 @@ dnl #include #include -int +int main () { int major, minor, sub; @@ -113,7 +113,7 @@ main () (XINE_MINOR_VERSION != $xine_config_minor_version) || (XINE_SUB_VERSION != $xine_config_sub_version)) { - printf("\n*** 'xine-config --version' returned %d.%d.%d, but XINE (%d.%d.%d)\n", + printf("\n*** 'xine-config --version' returned %d.%d.%d, but XINE (%d.%d.%d)\n", $xine_config_major_version, $xine_config_minor_version, $xine_config_sub_version, XINE_MAJOR_VERSION, XINE_MINOR_VERSION, XINE_SUB_VERSION); printf ("*** was found! If xine-config was correct, then it is best\n"); @@ -124,7 +124,7 @@ main () printf("*** If xine-config was wrong, set the environment variable XINE_CONFIG\n"); printf("*** to point to the correct copy of xine-config, and remove the file config.cache\n"); printf("*** before re-running configure\n"); - } + } else { if ((XINE_MAJOR_VERSION > major) || @@ -160,7 +160,7 @@ main () fi if test "x$no_xine" = x ; then AC_MSG_RESULT(yes) - ifelse([$2], , :, [$2]) + ifelse([$2], , :, [$2]) else AC_MSG_RESULT(no) if test "$XINE_CONFIG" = "no" ; then diff --git a/m4/xv.m4 b/m4/xv.m4 index 91380a1de..9b37a0b6e 100644 --- a/m4/xv.m4 +++ b/m4/xv.m4 @@ -72,15 +72,15 @@ AC_DEFUN([AC_FIND_LIBXV], xv_path=/usr/X11R6/lib fi - if test "x$xv_prefer_shared" = "xyes"; then + if test "x$xv_prefer_shared" = "xyes"; then AC_PATH_LIBXV_IMPL([libXv.so]) else AC_PATH_LIBXV_IMPL([libXv.a]) fi - + # Try the other lib if prefered failed if test x$XV_LIBS = x; then - if ! test "x$xv_prefer_shared" = "xyes"; then + if ! test "x$xv_prefer_shared" = "xyes"; then AC_PATH_LIBXV_IMPL([libXv.so]) else AC_PATH_LIBXV_IMPL([libXv.a]) diff --git a/misc/cdda_server.c b/misc/cdda_server.c index 0e2817db3..0fe09c1ba 100644 --- a/misc/cdda_server.c +++ b/misc/cdda_server.c @@ -2,19 +2,19 @@ * CDDA / DVD server * * Copyright (C) 2003-2007 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -185,21 +185,21 @@ static int sock_check_opened(int socket) { fd_set readfds, writefds, exceptfds; int retval; struct timeval timeout; - + for(;;) { - FD_ZERO(&readfds); - FD_ZERO(&writefds); + FD_ZERO(&readfds); + FD_ZERO(&writefds); FD_ZERO(&exceptfds); FD_SET(socket, &exceptfds); - - timeout.tv_sec = 0; + + timeout.tv_sec = 0; timeout.tv_usec = 0; - + retval = select(socket + 1, &readfds, &writefds, &exceptfds, &timeout); - + if(retval == -1 && (errno != EAGAIN && errno != EINTR)) return 0; - + if (retval != -1) return 1; } @@ -209,7 +209,7 @@ static int sock_check_opened(int socket) { #if 0 /* - * read binary data from socket + * read binary data from socket */ static int sock_data_read (int socket, char *buf, int nlen) { int n, num_bytes; @@ -219,7 +219,7 @@ static int sock_data_read (int socket, char *buf, int nlen) { if(!sock_check_opened(socket)) return -1; - + num_bytes = 0; while (num_bytes < nlen) { @@ -259,40 +259,40 @@ static int sock_data_read (int socket, char *buf, int nlen) { #endif /* - * read a line (\n-terminated) from socket + * read a line (\n-terminated) from socket */ static int sock_string_read(int socket, char *buf, int len) { char *pbuf; int r, rr; void *nl; - + if((socket < 0) || (buf == NULL)) return -1; if(!sock_check_opened(socket)) return -1; - + if (--len < 1) return(-1); - + pbuf = buf; - + do { - + if((r = recv(socket, pbuf, len, MSG_PEEK)) <= 0) return -1; if((nl = memchr(pbuf, '\n', r)) != NULL) r = ((char *) nl) - pbuf + 1; - + if((rr = read(socket, pbuf, r)) < 0) return -1; - + pbuf += rr; len -= rr; } while((nl == NULL) && len); - + if (pbuf > buf && *(pbuf-1) == '\n'){ *(pbuf-1) = '\0'; } @@ -306,21 +306,21 @@ static int sock_string_read(int socket, char *buf, int len) { static int sock_data_write(int socket, char *buf, int len) { ssize_t size; int wlen = 0; - + if((socket < 0) || (buf == NULL)) return -1; - + if(!sock_check_opened(socket)) return -1; - + while(len) { size = write(socket, buf, len); - + if(size <= 0) { printf("error writing to socket %d\n",socket); return -1; } - + len -= size; wlen += size; buf += size; @@ -332,15 +332,15 @@ static int sock_data_write(int socket, char *buf, int len) { int sock_string_write(int socket, char *msg, ...) { char buf[_BUFSIZ]; va_list args; - + va_start(args, msg); vsnprintf(buf, _BUFSIZ - 1, msg, args); va_end(args); - + /* Each line sent is '\n' terminated */ if((buf[strlen(buf)] == '\0') && (buf[strlen(buf) - 1] != '\n')) strcat(buf, "\n"); - + return sock_data_write(socket, buf, strlen(buf)); } diff --git a/misc/fonts/Makefile.am b/misc/fonts/Makefile.am index f5b131886..2246db20d 100644 --- a/misc/fonts/Makefile.am +++ b/misc/fonts/Makefile.am @@ -37,7 +37,7 @@ font_DATA = \ serif-24.xinefont.gz \ serif-32.xinefont.gz \ serif-48.xinefont.gz \ - serif-64.xinefont.gz + serif-64.xinefont.gz # # font used for osd diff --git a/misc/xine-fontconv.c b/misc/xine-fontconv.c index e8edaae5b..19b68c7f7 100644 --- a/misc/xine-fontconv.c +++ b/misc/xine-fontconv.c @@ -1,25 +1,25 @@ /* * Copyright (C) 2001-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * OSD stuff (text and graphic primitives) * - * xine-fontconv.c + * xine-fontconv.c * * converts ttf fonts to xine osd fonts * @@ -92,7 +92,7 @@ struct osd_font_s { uint16_t num_fontchars; osd_fontchar_t *fontchar; osd_font_t *next; -}; +}; /* list */ @@ -110,7 +110,7 @@ osd_font_t font; static int gzwrite_i16(gzFile *fp, uint16_t number) { - return gzputc(fp, number & 0xFF) != -1 && + return gzputc(fp, number & 0xFF) != -1 && gzputc(fp, (number >> 8) & 0xFF) != -1; } @@ -169,7 +169,7 @@ void list_free(item_t *list) { } } -/* +/* * generate sorted list with unicodes in all given pages, * returns number of unicodes in the list */ @@ -189,7 +189,7 @@ uint16_t generate_unicodes_list(item_t **list, char **pages, int number) { continue; } printf("Used encoding \"%s\"\n", pages[page]); - + /* add new unicodes into list */ for (z = 32; z < 0xFFFF; z++) { uint16_t unicode; @@ -198,7 +198,7 @@ uint16_t generate_unicodes_list(item_t **list, char **pages, int number) { size_t inbytesleft = z <= 0xFF ? 1 : 2; size_t outbytesleft = 2; size_t count; - + /* get unicode value from index 'z' in this codepage 'pages[i]' */ count = iconv(cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft); if (count == (size_t)-1 || inbytesleft != 0) { @@ -218,7 +218,7 @@ uint16_t generate_unicodes_list(item_t **list, char **pages, int number) { void print_bitmap (FT_Bitmap *bitmap) { int x,y; - + for( y = 0; y < bitmap->rows; y++ ) { for( x = 0; x < bitmap->width; x++ ) { if( bitmap->buffer[y*bitmap->width+x] > 1 ) @@ -242,7 +242,7 @@ FT_Bitmap *create_bitmap (int width, int height) { bitmap->width = width; bitmap->buffer = malloc(width*height); memset( bitmap->buffer, 0, width*height ); - + return bitmap; } @@ -250,9 +250,9 @@ void destroy_bitmap (FT_Bitmap * bitmap) { free(bitmap->buffer); free(bitmap); } - -/* + +/* This function is called to blend a slightly deslocated version of the bitmap. This will produce the border effect. Note that the displacement may be smaller than 1 pixel @@ -264,15 +264,15 @@ void add_border_bitmap( FT_Bitmap *dst, FT_Bitmap *src, int left, int top ) int x,y; int x1, y1; int dstpos, srcpos; - + for( y = 0; y < src->rows; y++ ) { for( x = 0; x < src->width; x++ ) { srcpos = y * src->width + x; - + x1 = x + left; if( x1 < 0 || x1 >= dst->width ) continue; - + y1 = y + top; if( y1 < 0 || y1 >= dst->rows ) continue; @@ -288,9 +288,9 @@ void add_border_bitmap( FT_Bitmap *dst, FT_Bitmap *src, int left, int top ) /* Blend the final version of bitmap (the foreground color) over the already generated border. It will be antialiased to the border. - + Final palette will be: - + 0: not used by font, always transparent 1: font background, usually transparent, may be used to implement translucid boxes where the font will be printed. @@ -299,22 +299,22 @@ void add_border_bitmap( FT_Bitmap *dst, FT_Bitmap *src, int left, int top ) 6: font border. if the font is to be displayed without border this will probably be adjusted to font background or near. 7-9: transition between border and foreground - 10: font color (foreground) + 10: font color (foreground) */ void add_final_bitmap( FT_Bitmap *dst, FT_Bitmap *src, int left, int top ) { int x,y; int x1, y1; int dstpos, srcpos; - + for( y = 0; y < src->rows; y++ ) { for( x = 0; x < src->width; x++ ) { srcpos = y * src->width + x; - + x1 = x + left; if( x1 < 0 || x1 >= dst->width ) continue; - + y1 = y + top; if( y1 < 0 || y1 >= dst->rows ) continue; @@ -325,7 +325,7 @@ void add_final_bitmap( FT_Bitmap *dst, FT_Bitmap *src, int left, int top ) dst->buffer[dstpos] = src->buffer[srcpos] + 5; } } - + for( y = 0; y < dst->rows; y++ ) { for( x = 0; x < dst->width; x++ ) { dstpos = y * dst->width + x; @@ -336,7 +336,7 @@ void add_final_bitmap( FT_Bitmap *dst, FT_Bitmap *src, int left, int top ) } -void render_font (FT_Face face, char *fontname, int size, int thickness, +void render_font (FT_Face face, char *fontname, int size, int thickness, item_t *unicodes) { char filename[1024]; @@ -348,7 +348,7 @@ void render_font (FT_Face face, char *fontname, int size, int thickness, FT_Glyph glyph; FT_BitmapGlyph glyph_bitmap; FT_Vector origin; - int max_bearing_y = 0; + int max_bearing_y = 0; int i; int converted; item_t *item, *error_unicodes; @@ -358,27 +358,27 @@ void render_font (FT_Face face, char *fontname, int size, int thickness, {-1,-1},{1,-1},{-1,1},{1,1}, {0,0} }; - - /* + + /* * generate filename, open file */ - + snprintf (filename, sizeof(filename), "%s-%d.xinefont.gz", fontname, size); fp = gzopen(filename,"w"); - + if (!fp) { printf ("error opening output file %s\n", filename); return; } - /* + /* * set up font */ strncpy(font.name, fontname, sizeof(font.name)); font.name[sizeof(font.name) - 1] = '\0'; - /* changes from version 1 to version 2: + /* changes from version 1 to version 2: * 'code' in characters is defined as little endian 16-bit unicode * characters are sorted by 'code' */ @@ -389,7 +389,7 @@ void render_font (FT_Face face, char *fontname, int size, int thickness, error = FT_Set_Pixel_Sizes( face, /* handle to face object */ 0, /* pixel_width */ size ); /* pixel_height */ - + if (error) { printf("error setting size\n"); return; @@ -398,7 +398,7 @@ void render_font (FT_Face face, char *fontname, int size, int thickness, if( !thickness ) thickness = size * 64 / 30; - /* + /* * calc max bearing y. * this is needed to align all bitmaps by the upper position. */ @@ -417,7 +417,7 @@ void render_font (FT_Face face, char *fontname, int size, int thickness, error = FT_Load_Glyph (face, /* handle to face object */ glyph_index, /* glyph index */ FT_LOAD_DEFAULT ); /* load flags */ - + if (error) { error_counter++; list_insert(&error_unicodes, item->code); @@ -447,19 +447,19 @@ void render_font (FT_Face face, char *fontname, int size, int thickness, glyph_index = FT_Get_Char_Index( face, item->code); - + if (glyph_index) { - + error = FT_Load_Glyph( face, /* handle to face object */ glyph_index, /* glyph index */ FT_LOAD_DEFAULT ); /* load flags */ - + if (!error) { error = FT_Get_Glyph( face->glyph, &glyph ); - + if( i == 0 ) { out_bitmap = create_bitmap( f266CeilToInt(thickness + MAX(face->glyph->metrics.horiAdvance, face->glyph->metrics.width + face->glyph->metrics.horiBearingX)), - f266CeilToInt((max_bearing_y<<6) - face->glyph->metrics.horiBearingY + + f266CeilToInt((max_bearing_y<<6) - face->glyph->metrics.horiBearingY + face->glyph->metrics.height + thickness) ); } @@ -467,7 +467,7 @@ void render_font (FT_Face face, char *fontname, int size, int thickness, origin.y = thickness + border_pos[i][1]*thickness; error = FT_Glyph_Transform(glyph, NULL, &origin) || - FT_Glyph_To_Bitmap( &glyph, ft_render_mode_normal, NULL, 1); + FT_Glyph_To_Bitmap( &glyph, ft_render_mode_normal, NULL, 1); if (error) { printf("error generating bitmap [U+%04X]\n", item->code); @@ -483,24 +483,24 @@ void render_font (FT_Face face, char *fontname, int size, int thickness, else add_final_bitmap( out_bitmap, &glyph_bitmap->bitmap, glyph_bitmap->left, max_bearing_y - glyph_bitmap->top ); - converted = 1; - + converted = 1; + FT_Done_Glyph( glyph ); } } } - + if( converted ) { #ifdef LOG printf("[U+%04X] bitmap width: %d height: %d\n", item->code, out_bitmap->width, out_bitmap->rows ); - /* + /* print_bitmap(out_bitmap); */ #endif fontchar.code = item->code; fontchar.width = out_bitmap->width; fontchar.height = out_bitmap->rows; - + gzwrite_i16 (fp, fontchar.code); gzwrite_i16 (fp, fontchar.width); gzwrite_i16 (fp, fontchar.height); @@ -523,7 +523,7 @@ void render_font (FT_Face face, char *fontname, int size, int thickness, list_free(error_unicodes); } printf ("generated %s (%d characters)\n", filename, font.num_fontchars); -} +} int main(int argc, char *argv[]) { @@ -548,7 +548,7 @@ int main(int argc, char *argv[]) { printf ("usage: %s font.ttf fontname [encoding1 [encoding2 [...]]]\n", argv[0]); exit (1); } - + len = strlen (argv[1]); if (strncasecmp (&argv[1][len-4],".ttf",3)) { @@ -561,8 +561,8 @@ int main(int argc, char *argv[]) { printf("error initializing freetype\n"); return 1; } - - error = FT_New_Face( library, + + error = FT_New_Face( library, argv[1], 0, &face ); @@ -596,21 +596,21 @@ int main(int argc, char *argv[]) { render_font (face, argv[2], 32, thickness, unicodes); render_font (face, argv[2], 48, thickness, unicodes); render_font (face, argv[2], 64, thickness, unicodes); - } else + } else printf("No font generated\n"); list_free(unicodes); FT_Done_Face(face); - - FT_Done_FreeType(library); + + FT_Done_FreeType(library); /* * some rgb -> yuv conversion, * can be used to calc new palettes */ /* - { + { float f; for (f=1.0; f<6.0; f+=1.0) { @@ -622,7 +622,7 @@ int main(int argc, char *argv[]) { Y = 0.29900 * R + 0.58700 * G + 0.11400 * B ; Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B + 128.0; Cr = 0.50000 * R - 0.41869 * G - 0.08131 * B + 128.0; - + printf ("CLUT_Y_CR_CB_INIT(0x%x, 0x%x, 0x%x),\n", (int) Y, (int) Cr, (int) Cb); } } diff --git a/src/audio_out/Makefile.am b/src/audio_out/Makefile.am index 07ad19c8d..745fafadd 100644 --- a/src/audio_out/Makefile.am +++ b/src/audio_out/Makefile.am @@ -57,7 +57,7 @@ endif ## # IMPORTANT: # --------- -# all xine audio out plugins should be named like the +# all xine audio out plugins should be named like the # scheme "xineplug_ao_out_" # xineplug_LTLIBRARIES = xineplug_ao_out_none.la xineplug_ao_out_file.la \ @@ -94,7 +94,7 @@ xineplug_ao_out_alsa_la_LIBADD = $(XINE_LIB) $(ALSA_LIBS) $(PTHREAD_LIBS) $(LTLI xineplug_ao_out_alsa_la_CFLAGS = $(VISIBILITY_FLAG) $(ALSA_CFLAGS) xineplug_ao_out_alsa_la_LDFLAGS = -avoid-version -module -xineplug_ao_out_esd_la_SOURCES = audio_esd_out.c +xineplug_ao_out_esd_la_SOURCES = audio_esd_out.c xineplug_ao_out_esd_la_LIBADD = $(XINE_LIB) $(ESD_LIBS) $(LTLIBINTL) xineplug_ao_out_esd_la_CFLAGS = $(VISIBILITY_FLAG) $(ESD_CFLAGS) xineplug_ao_out_esd_la_LDFLAGS = -avoid-version -module @@ -104,7 +104,7 @@ xineplug_ao_out_sun_la_LIBADD = $(XINE_LIB) xineplug_ao_out_sun_la_CFLAGS = $(VISIBILITY_FLAG) xineplug_ao_out_sun_la_LDFLAGS = -avoid-version -module -#xineplug_ao_out_irixal_la_SOURCES = audio_irixal_out.c +#xineplug_ao_out_irixal_la_SOURCES = audio_irixal_out.c #xineplug_ao_out_irixal_la_LIBADD = $(IRIXAL_LIBS) #xineplug_ao_out_irixal_la_CFLAGS = $(VISIBILITY_FLAG) $(IRIXAL_CFLAGS) #xineplug_ao_out_irixal_la_LDFLAGS = -avoid-version -module diff --git a/src/audio_out/audio_alsa_out.c b/src/audio_out/audio_alsa_out.c index 470cd953a..b18637a7b 100644 --- a/src/audio_out/audio_alsa_out.c +++ b/src/audio_out/audio_alsa_out.c @@ -1,23 +1,23 @@ -/* +/* * Copyright (C) 2000-2006 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * - * Credits go + * Credits go * - for the SPDIF A/52 sync part * - frame size calculation added (16-08-2001) * (c) 2001 Andy Lo A Foe @@ -99,7 +99,7 @@ typedef struct alsa_driver_s { uint32_t bytes_per_frame; uint32_t bytes_in_buffer; /* number of bytes writen to audio hardware */ snd_pcm_uframes_t buffer_size; - int32_t mmap; + int32_t mmap; struct { pthread_t thread; @@ -136,10 +136,10 @@ static int my_snd_mixer_wait(snd_mixer_t *mixer, int timeout) { if (count < 0) return count; - + if ((unsigned int) count > sizeof(spfds) / sizeof(spfds[0])) { pfds = malloc(count * sizeof(*pfds)); - + if (!pfds) return -ENOMEM; @@ -169,44 +169,44 @@ static void *ao_alsa_handle_event_thread(void *data) { int old_mute; pthread_mutex_lock(&this->mixer.mutex); - + old_mute = (this->mixer.mute & MIXER_MASK_MUTE) ? 1 : 0; if((err = snd_mixer_handle_events(this->mixer.handle)) < 0) { - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: snd_mixer_handle_events(): %s\n", snd_strerror(err)); pthread_mutex_unlock(&this->mixer.mutex); continue; } - + if((err = snd_mixer_selem_get_playback_volume(this->mixer.elem, SND_MIXER_SCHN_FRONT_LEFT, &left_vol)) < 0) { - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err)); pthread_mutex_unlock(&this->mixer.mutex); continue; } - + if((err = snd_mixer_selem_get_playback_volume(this->mixer.elem, SND_MIXER_SCHN_FRONT_RIGHT, &right_vol)) < 0) { - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err)); pthread_mutex_unlock(&this->mixer.mutex); continue; } - + if(this->mixer.mute & MIXER_HAS_MUTE_SWITCH) { - + if(this->mixer.mute & MIXER_MASK_STEREO) { snd_mixer_selem_get_playback_switch(this->mixer.elem, SND_MIXER_SCHN_FRONT_LEFT, &swl); mute = (swl) ? 0 : 1; } else { - + if (this->mixer.mute & MIXER_MASK_LEFT) snd_mixer_selem_get_playback_switch(this->mixer.elem, SND_MIXER_SCHN_FRONT_LEFT, &swl); - + if ((SND_MIXER_SCHN_FRONT_RIGHT != SND_MIXER_SCHN_UNKNOWN) && (this->mixer.mute & MIXER_MASK_RIGHT)) snd_mixer_selem_get_playback_switch(this->mixer.elem, SND_MIXER_SCHN_FRONT_RIGHT, &swr); - + mute = (swl || swr) ? 0 : 1; } } @@ -216,26 +216,26 @@ static void *ao_alsa_handle_event_thread(void *data) { xine_audio_level_data_t data; xine_stream_t *stream; xine_list_iterator_t ite; - + this->mixer.right_vol = right_vol; this->mixer.left_vol = left_vol; if(mute) this->mixer.mute |= MIXER_MASK_MUTE; else this->mixer.mute &= ~MIXER_MASK_MUTE; - - data.right = ao_alsa_get_percent_from_volume(this->mixer.right_vol, + + data.right = ao_alsa_get_percent_from_volume(this->mixer.right_vol, this->mixer.min, this->mixer.max); - data.left = ao_alsa_get_percent_from_volume(this->mixer.left_vol, + data.left = ao_alsa_get_percent_from_volume(this->mixer.left_vol, this->mixer.min, this->mixer.max); data.mute = (this->mixer.mute & MIXER_MASK_MUTE) ? 1 : 0; - + event.type = XINE_EVENT_AUDIO_LEVEL; event.data = &data; event.data_length = sizeof(data); - + pthread_mutex_lock(&this->class->xine->streams_lock); - for(ite = xine_list_front(this->class->xine->streams); + for(ite = xine_list_front(this->class->xine->streams); ite; ite = xine_list_next(this->class->xine->streams, ite)) { stream = xine_list_get_value(this->class->xine->streams, ite); event.stream = stream; @@ -243,12 +243,12 @@ static void *ao_alsa_handle_event_thread(void *data) { } pthread_mutex_unlock(&this->class->xine->streams_lock); } - + pthread_mutex_unlock(&this->mixer.mutex); } } while(this->mixer.running); - + pthread_exit(NULL); } @@ -261,11 +261,11 @@ static long ao_alsa_get_volume_from_percent(int val, long min, long max) { } /* - * Error callback, we need to control this, + * Error callback, we need to control this, * error message should be printed only in DEBUG mode. */ static void XINE_FORMAT_PRINTF(5, 6) - error_callback(const char *file, int line, + error_callback(const char *file, int line, const char *function, int err, const char *fmt, ...) { #ifdef DEBUG va_list args; @@ -286,13 +286,13 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int alsa_driver_t *this = (alsa_driver_t *) this_gen; config_values_t *config = this->class->xine->config; char *pcm_device; - snd_pcm_stream_t direction = SND_PCM_STREAM_PLAYBACK; + snd_pcm_stream_t direction = SND_PCM_STREAM_PLAYBACK; snd_pcm_hw_params_t *params; snd_pcm_sw_params_t *swparams; snd_pcm_access_mask_t *mask; snd_pcm_uframes_t period_size; - snd_pcm_uframes_t period_size_min; - snd_pcm_uframes_t period_size_max; + snd_pcm_uframes_t period_size_min; + snd_pcm_uframes_t period_size_max; snd_pcm_uframes_t buffer_size_min; snd_pcm_uframes_t buffer_size_max; snd_pcm_format_t format; @@ -310,7 +310,7 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int snd_pcm_hw_params_alloca(¶ms); snd_pcm_sw_params_alloca(&swparams); err = snd_output_stdio_attach(&jcd_out, stdout, 0); - + switch (mode) { case AO_CAP_MODE_MONO: this->num_channels = 1; @@ -336,10 +336,10 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int pcm_device = config->lookup_entry(config, "audio.device.alsa_passthrough_device")->str_value; break; default: - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: ALSA Driver does not support the requested mode: 0x%X\n",mode); return 0; - } + } #ifdef ALSA_LOG printf("audio_alsa_out: Audio Device name = %s\n",pcm_device); @@ -362,25 +362,25 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int */ gettimeofday(&start_time, NULL); do { - err = snd_pcm_open(&this->audio_fd, pcm_device, direction, open_mode); + err = snd_pcm_open(&this->audio_fd, pcm_device, direction, open_mode); gettimeofday(&end_time, NULL); if( err == -EBUSY ) { - if( (double)end_time.tv_sec + 1E-6*end_time.tv_usec + if( (double)end_time.tv_sec + 1E-6*end_time.tv_usec - (double)start_time.tv_sec - 1E-6*start_time.tv_usec > 0.8) break; else usleep(10000); } } while( err == -EBUSY ); - - if(err <0 ) { - xprintf (this->class->xine, XINE_VERBOSITY_LOG, - _("audio_alsa_out: snd_pcm_open() of %s failed: %s\n"), pcm_device, snd_strerror(err)); - xprintf (this->class->xine, XINE_VERBOSITY_LOG, + + if(err <0 ) { + xprintf (this->class->xine, XINE_VERBOSITY_LOG, + _("audio_alsa_out: snd_pcm_open() of %s failed: %s\n"), pcm_device, snd_strerror(err)); + xprintf (this->class->xine, XINE_VERBOSITY_LOG, _("audio_alsa_out: >>> check if another program already uses PCM <<<\n")); return 0; } - /* printf ("audio_alsa_out: snd_pcm_open() opened %s\n", pcm_device); */ + /* printf ("audio_alsa_out: snd_pcm_open() opened %s\n", pcm_device); */ /* We wanted non blocking open but now put it back to normal */ //snd_pcm_nonblock(this->audio_fd, 0); snd_pcm_nonblock(this->audio_fd, 1); @@ -389,7 +389,7 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int */ err = snd_pcm_hw_params_any(this->audio_fd, params); if (err < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_LOG, + xprintf (this->class->xine, XINE_VERBOSITY_LOG, _("audio_alsa_out: broken configuration for this PCM: no configurations available: %s\n"), snd_strerror(err)); goto close; @@ -403,7 +403,7 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int snd_pcm_access_mask_set(mask, SND_PCM_ACCESS_MMAP_COMPLEX); err = snd_pcm_hw_params_set_access_mask(this->audio_fd, params, mask); if (err < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: mmap not availiable, falling back to compatiblity mode\n"); this->mmap=0; err = snd_pcm_hw_params_set_access(this->audio_fd, params, @@ -413,9 +413,9 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int err = snd_pcm_hw_params_set_access(this->audio_fd, params, SND_PCM_ACCESS_RW_INTERLEAVED); } - + if (err < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: access type not available: %s\n", snd_strerror(err)); goto close; } @@ -438,23 +438,23 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int case 4: format = SND_PCM_FORMAT_FLOAT; break; - default: + default: format = SND_PCM_FORMAT_S16; - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: pcm format bits=%d unknown. failed: %s\n", bits, snd_strerror(err)); break; } err = snd_pcm_hw_params_set_format(this->audio_fd, params, format ); if (err < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: sample format non available: %s\n", snd_strerror(err)); goto close; } /* set the number of channels */ err = snd_pcm_hw_params_set_channels(this->audio_fd, params, this->num_channels); if (err < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, - "audio_alsa_out: Cannot set number of channels to %d (err=%d:%s)\n", + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out: Cannot set number of channels to %d (err=%d:%s)\n", this->num_channels, err, snd_strerror(err)); goto close; } @@ -466,13 +466,13 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int dir=0; err = snd_pcm_hw_params_set_rate_near(this->audio_fd, params, &rate, &dir); if (err < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: rate not available: %s\n", snd_strerror(err)); goto close; } this->output_sample_rate = (uint32_t)rate; if (this->input_sample_rate != this->output_sample_rate) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: audio rate : %d requested, %d provided by device/sec\n", this->input_sample_rate, this->output_sample_rate); } @@ -504,7 +504,7 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int periods=8; err = snd_pcm_hw_params_set_periods_near(this->audio_fd, params, &periods ,&dir); if (err < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: unable to set any periods: %s\n", snd_strerror(err)); goto close; } @@ -512,7 +512,7 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int dir=0; err = snd_pcm_hw_params_set_buffer_time_near(this->audio_fd, params, &buffer_time, &dir); if (err < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: buffer time not available: %s\n", snd_strerror(err)); goto close; } @@ -522,7 +522,7 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int dir=0; err = snd_pcm_hw_params_set_period_size_near(this->audio_fd, params, &period_size, &dir); if (err < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: period time not available: %s\n", snd_strerror(err)); goto close; } @@ -533,7 +533,7 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int dir=0; err = snd_pcm_hw_params_set_buffer_size_near(this->audio_fd, params, &this->buffer_size); if (err < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: buffer time not available: %s\n", snd_strerror(err)); goto close; } @@ -543,22 +543,22 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int printf("was set buffer_size = %ld\n",this->buffer_size); #endif if (2*period_size > this->buffer_size) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: buffer to small, could not use\n"); goto close; } - + /* write the parameters to device */ err = snd_pcm_hw_params(this->audio_fd, params); if (err < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: pcm hw_params failed: %s\n", snd_strerror(err)); goto close; } /* Check for pause/resume support */ this->has_pause_resume = ( snd_pcm_hw_params_can_pause (params) && snd_pcm_hw_params_can_resume (params) ); - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out:open pause_resume=%d\n", this->has_pause_resume); this->sample_rate_factor = (double) this->output_sample_rate / (double) this->input_sample_rate; this->bytes_per_frame = snd_pcm_frames_to_bytes (this->audio_fd, 1); @@ -568,28 +568,28 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int /* Copy current parameters into swparams */ err = snd_pcm_sw_params_current(this->audio_fd, swparams); if (err < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: Unable to determine current swparams: %s\n", snd_strerror(err)); goto close; } /* align all transfers to 1 sample */ err = snd_pcm_sw_params_set_xfer_align(this->audio_fd, swparams, 1); if (err < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: Unable to set transfer alignment: %s\n", snd_strerror(err)); goto close; } /* allow the transfer when at least period_size samples can be processed */ err = snd_pcm_sw_params_set_avail_min(this->audio_fd, swparams, period_size); if (err < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: Unable to set available min: %s\n", snd_strerror(err)); goto close; } /* start the transfer when the buffer contains at least period_size samples */ err = snd_pcm_sw_params_set_start_threshold(this->audio_fd, swparams, period_size); if (err < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: Unable to set start threshold: %s\n", snd_strerror(err)); goto close; } @@ -597,7 +597,7 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int /* never stop the transfer, even on xruns */ err = snd_pcm_sw_params_set_stop_threshold(this->audio_fd, swparams, this->buffer_size); if (err < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: Unable to set stop threshold: %s\n", snd_strerror(err)); goto close; } @@ -605,15 +605,15 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int /* Install swparams into current parameters */ err = snd_pcm_sw_params(this->audio_fd, swparams); if (err < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: Unable to set swparams: %s\n", snd_strerror(err)); goto close; } #ifdef ALSA_LOG - snd_pcm_dump_setup(this->audio_fd, jcd_out); + snd_pcm_dump_setup(this->audio_fd, jcd_out); snd_pcm_sw_params_dump(swparams, jcd_out); #endif - + return this->output_sample_rate; close: @@ -648,7 +648,7 @@ static int ao_alsa_get_gap_tolerance (ao_driver_t *this_gen) { /* * Return the delay. is frames measured by looking at pending samples */ -/* FIXME: delay returns invalid data if status is not RUNNING. +/* FIXME: delay returns invalid data if status is not RUNNING. * e.g When there is an XRUN or we are in PREPARED mode. */ static int ao_alsa_delay (ao_driver_t *this_gen) { @@ -678,12 +678,12 @@ static int ao_alsa_delay (ao_driver_t *this_gen) { /* * Handle over/under-run */ -static void xrun(alsa_driver_t *this) +static void xrun(alsa_driver_t *this) { /* snd_pcm_status_t *status; */ int res; - /* + /* snd_pcm_status_alloca(&status); if ((res = snd_pcm_status(this->audio_fd, status))<0) { printf ("audio_alsa_out: status error: %s\n", snd_strerror(res)); @@ -759,7 +759,7 @@ static int ao_alsa_write(ao_driver_t *this_gen, int16_t *data, uint32_t count) { #ifdef LOG_DEBUG printf("audio_alsa_out:write:XRUN before\n"); snd_pcm_status(this->audio_fd, pcm_stat); - snd_pcm_status_dump(pcm_stat, jcd_out); + snd_pcm_status_dump(pcm_stat, jcd_out); #endif if ((res = snd_pcm_prepare(this->audio_fd))<0) { return 0; @@ -771,14 +771,14 @@ static int ao_alsa_write(ao_driver_t *this_gen, int16_t *data, uint32_t count) { #ifdef LOG_DEBUG printf("audio_alsa_out:write:XRUN after\n"); #endif - } + } if ( (state != SND_PCM_STATE_PREPARED) && (state != SND_PCM_STATE_RUNNING) && (state != SND_PCM_STATE_DRAINING) ) { - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out:write:BAD STATE, state = %d\n",state); } - + while( number_of_frames > 0) { if ( (state == SND_PCM_STATE_RUNNING) ) { #ifdef LOG_DEBUG @@ -816,7 +816,7 @@ static int ao_alsa_write(ao_driver_t *this_gen, int16_t *data, uint32_t count) { } else if ( (state != SND_PCM_STATE_PREPARED) && (state != SND_PCM_STATE_RUNNING) && (state != SND_PCM_STATE_DRAINING) ) { - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out:write:BAD STATE2, state = %d, going to try XRUN\n",state); if ((res = snd_pcm_prepare(this->audio_fd))<0) { xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, @@ -895,7 +895,7 @@ static void ao_alsa_exit(ao_driver_t *this_gen) { this->mixer.handle=0; } pthread_mutex_destroy(&this->mixer.mutex); - + if (this->audio_fd) snd_pcm_close(this->audio_fd); this->audio_fd=NULL; free (this); @@ -913,45 +913,45 @@ static int ao_alsa_get_property (ao_driver_t *this_gen, int property) { case AO_PROP_PCM_VOL: if(this->mixer.elem) { int vol; - + pthread_mutex_lock(&this->mixer.mutex); if((err = snd_mixer_selem_get_playback_volume(this->mixer.elem, SND_MIXER_SCHN_FRONT_LEFT, &this->mixer.left_vol)) < 0) { - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err)); goto done; } - + if((err = snd_mixer_selem_get_playback_volume(this->mixer.elem, SND_MIXER_SCHN_FRONT_RIGHT, &this->mixer.right_vol)) < 0) { - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err)); goto done; } - + done: vol = (((ao_alsa_get_percent_from_volume(this->mixer.left_vol, this->mixer.min, this->mixer.max)) + (ao_alsa_get_percent_from_volume(this->mixer.right_vol, this->mixer.min, this->mixer.max))) /2); pthread_mutex_unlock(&this->mixer.mutex); - + return vol; } break; - + case AO_PROP_MUTE_VOL: { int mute; - + pthread_mutex_lock(&this->mixer.mutex); mute = ((this->mixer.mute & MIXER_HAS_MUTE_SWITCH) && (this->mixer.mute & MIXER_MASK_MUTE)) ? 1 : 0; pthread_mutex_unlock(&this->mixer.mutex); - + return mute; } break; } - + return 0; } @@ -970,18 +970,18 @@ static int ao_alsa_set_property (ao_driver_t *this_gen, int property, int value) pthread_mutex_lock(&this->mixer.mutex); this->mixer.left_vol = this->mixer.right_vol = ao_alsa_get_volume_from_percent(value, this->mixer.min, this->mixer.max); - + if((err = snd_mixer_selem_set_playback_volume(this->mixer.elem, SND_MIXER_SCHN_FRONT_LEFT, this->mixer.left_vol)) < 0) { - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err)); pthread_mutex_unlock(&this->mixer.mutex); return ~value; } - + if((err = snd_mixer_selem_set_playback_volume(this->mixer.elem, SND_MIXER_SCHN_FRONT_RIGHT, this->mixer.right_vol)) < 0) { - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err)); pthread_mutex_unlock(&this->mixer.mutex); return ~value; @@ -997,20 +997,20 @@ static int ao_alsa_set_property (ao_driver_t *this_gen, int property, int value) if(this->mixer.mute & MIXER_HAS_MUTE_SWITCH) { int swl = 0, swr = 0; int old_mute; - + pthread_mutex_lock(&this->mixer.mutex); - + old_mute = this->mixer.mute; if(value) this->mixer.mute |= MIXER_MASK_MUTE; else this->mixer.mute &= ~MIXER_MASK_MUTE; - + if ((this->mixer.mute & MIXER_MASK_MUTE) != (old_mute & MIXER_MASK_MUTE)) { if(this->mixer.mute & MIXER_MASK_STEREO) { snd_mixer_selem_get_playback_switch(this->mixer.elem, SND_MIXER_SCHN_FRONT_LEFT, &swl); snd_mixer_selem_set_playback_switch_all(this->mixer.elem, !swl); - } + } else { if (this->mixer.mute & MIXER_MASK_LEFT) { snd_mixer_selem_get_playback_switch(this->mixer.elem, SND_MIXER_SCHN_FRONT_LEFT, &swl); @@ -1050,7 +1050,7 @@ static int ao_alsa_ctrl(ao_driver_t *this_gen, int cmd, ...) { if (this->audio_fd) { if (this->has_pause_resume) { if ((err=snd_pcm_pause(this->audio_fd, 1)) < 0) { - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: Pause call failed. (err=%d:%s)\n",err, snd_strerror(err)); this->has_pause_resume = 0; ao_alsa_ctrl(this_gen, AO_CTRL_PLAY_PAUSE, NULL); @@ -1059,15 +1059,15 @@ static int ao_alsa_ctrl(ao_driver_t *this_gen, int cmd, ...) { } } else { if ((err=snd_pcm_reset(this->audio_fd)) < 0) { - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: Reset call failed. (err=%d:%s)\n",err, snd_strerror(err)); } if ((err=snd_pcm_drain(this->audio_fd)) < 0) { - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: Drain call failed. (err=%d:%s)\n",err, snd_strerror(err)); } if ((err=snd_pcm_prepare(this->audio_fd)) < 0) { - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: Prepare call failed. (err=%d:%s)\n",err, snd_strerror(err)); } } @@ -1079,12 +1079,12 @@ static int ao_alsa_ctrl(ao_driver_t *this_gen, int cmd, ...) { if (this->has_pause_resume && this->is_paused) { if ((err=snd_pcm_pause(this->audio_fd, 0)) < 0) { if (err == -77) { - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: Warning: How am I supposed to RESUME, if I am not PAUSED. " "audio_out.c, please don't call me!\n"); break; } - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: Resume call failed. (err=%d:%s)\n",err, snd_strerror(err)); this->has_pause_resume = 0; } else { @@ -1097,11 +1097,11 @@ static int ao_alsa_ctrl(ao_driver_t *this_gen, int cmd, ...) { case AO_CTRL_FLUSH_BUFFERS: if (this->audio_fd) { if ((err=snd_pcm_drop(this->audio_fd)) < 0) { - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: Drop call failed. (err=%d:%s)\n",err, snd_strerror(err)); } if ((err=snd_pcm_prepare(this->audio_fd)) < 0) { - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: Prepare call failed. (err=%d:%s)\n",err, snd_strerror(err)); } } @@ -1129,43 +1129,43 @@ static void ao_alsa_mixer_init(ao_driver_t *this_gen) { int found; int swl = 0, swr = 0, send_events; - this->mixer.elem = 0; + this->mixer.elem = 0; snd_ctl_card_info_alloca(&hw_info); pcm_device = config->lookup_entry(config, "audio.device.alsa_default_device")->str_value; if ((err = snd_ctl_open (&ctl_handle, pcm_device, 0)) < 0) { xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: snd_ctl_open(): %s\n", snd_strerror(err)); return; } - + if ((err = snd_ctl_card_info (ctl_handle, hw_info)) < 0) { xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: snd_ctl_card_info(): %s\n", snd_strerror(err)); snd_ctl_close(ctl_handle); return; } - + snd_ctl_close (ctl_handle); - /* + /* * Open mixer device */ if ((err = snd_mixer_open (&this->mixer.handle, 0)) < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: snd_mixer_open(): %s\n", snd_strerror(err)); this->mixer.handle=0; return; } - + if ((err = snd_mixer_attach (this->mixer.handle, pcm_device)) < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: snd_mixer_attach(): %s\n", snd_strerror(err)); snd_mixer_close(this->mixer.handle); this->mixer.handle=0; return; } - + if ((err = snd_mixer_selem_register (this->mixer.handle, NULL, NULL)) < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: snd_mixer_selem_register(): %s\n", snd_strerror(err)); snd_mixer_close(this->mixer.handle); this->mixer.handle=0; @@ -1173,77 +1173,77 @@ static void ao_alsa_mixer_init(ao_driver_t *this_gen) { } if ((err = snd_mixer_load (this->mixer.handle)) < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: snd_mixer_load(): %s\n", snd_strerror(err)); snd_mixer_close(this->mixer.handle); this->mixer.handle=0; return; } - + mixer_sid = alloca(snd_mixer_selem_id_sizeof() * snd_mixer_get_count(this->mixer.handle)); if (mixer_sid == NULL) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: alloca() failed: %s\n", strerror(errno)); snd_mixer_close(this->mixer.handle); this->mixer.handle=0; return; } - + again: found = 0; mixer_n_selems = 0; for (elem = snd_mixer_first_elem(this->mixer.handle); elem; elem = snd_mixer_elem_next(elem)) { sid = (snd_mixer_selem_id_t *)(((char *)mixer_sid) + snd_mixer_selem_id_sizeof() * mixer_n_selems); - + if ((snd_mixer_elem_get_type(elem) != SND_MIXER_ELEM_SIMPLE) || !snd_mixer_selem_is_active(elem)) continue; - + snd_mixer_selem_get_id(elem, sid); mixer_n_selems++; if(!strcmp((snd_mixer_selem_get_name(elem)), this->mixer.name)) { /* printf("found %s\n", snd_mixer_selem_get_name(elem)); */ - + this->mixer.elem = elem; - - snd_mixer_selem_get_playback_volume_range(this->mixer.elem, + + snd_mixer_selem_get_playback_volume_range(this->mixer.elem, &this->mixer.min, &this->mixer.max); if((err = snd_mixer_selem_get_playback_volume(this->mixer.elem, SND_MIXER_SCHN_FRONT_LEFT, &this->mixer.left_vol)) < 0) { - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err)); this->mixer.elem = NULL; continue; } - + if((err = snd_mixer_selem_get_playback_volume(this->mixer.elem, SND_MIXER_SCHN_FRONT_RIGHT, &this->mixer.right_vol)) < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err)); this->mixer.elem = NULL; continue; } - + /* Channels mute */ this->mixer.mute = 0; if(snd_mixer_selem_has_playback_switch(this->mixer.elem)) { this->mixer.mute |= MIXER_HAS_MUTE_SWITCH; - + if (snd_mixer_selem_has_playback_switch_joined(this->mixer.elem)) { this->mixer.mute |= MIXER_MASK_STEREO; snd_mixer_selem_get_playback_switch(this->mixer.elem, SND_MIXER_SCHN_FRONT_LEFT, &swl); - } + } else { this->mixer.mute |= MIXER_MASK_LEFT; snd_mixer_selem_get_playback_switch(this->mixer.elem, SND_MIXER_SCHN_FRONT_LEFT, &swl); - + if (SND_MIXER_SCHN_FRONT_RIGHT != SND_MIXER_SCHN_UNKNOWN) { this->mixer.mute |= MIXER_MASK_RIGHT; snd_mixer_selem_get_playback_switch(this->mixer.elem, SND_MIXER_SCHN_FRONT_RIGHT, &swr); } - + if(!swl || !swr) this->mixer.mute |= MIXER_MASK_MUTE; } @@ -1256,10 +1256,10 @@ static void ao_alsa_mixer_init(ao_driver_t *this_gen) { goto mixer_found; } } - + if(loop) goto mixer_found; /* Yes, untrue but... ;-) */ - + if(!strcmp(this->mixer.name, "PCM")) { config->update_string(config, "audio.device.alsa_mixer_name", "Master"); loop++; @@ -1267,14 +1267,14 @@ static void ao_alsa_mixer_init(ao_driver_t *this_gen) { else { config->update_string(config, "audio.device.alsa_mixer_name", "PCM"); } - + this->mixer.name = config->lookup_entry(config, "audio.device.alsa_mixer_name")->str_value; - + goto again; mixer_found: - - /* + + /* * Ugly: yes[*] no[ ] */ if(found) { @@ -1301,11 +1301,11 @@ static void ao_alsa_mixer_init(ao_driver_t *this_gen) { if (send_events && found) { pthread_attr_t pth_attrs; struct sched_param pth_params; - + this->mixer.running = 1; pthread_attr_init(&pth_attrs); - + pthread_attr_getschedparam(&pth_attrs, &pth_params); pth_params.sched_priority = sched_get_priority_min(SCHED_OTHER); pthread_attr_setschedparam(&pth_attrs, &pth_params); @@ -1317,7 +1317,7 @@ static void ao_alsa_mixer_init(ao_driver_t *this_gen) { } static void alsa_speaker_arrangement_cb (void *user_data, - xine_cfg_entry_t *entry); + xine_cfg_entry_t *entry); /* * Initialize plugin @@ -1358,8 +1358,8 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da err = snd_lib_error_set_handler(error_callback); if(err < 0) - xine_log(this->class->xine, XINE_LOG_MSG, _("snd_lib_error_set_handler() failed: %d"), err); - + xine_log(this->class->xine, XINE_LOG_MSG, _("snd_lib_error_set_handler() failed: %d"), err); + snd_pcm_hw_params_alloca(¶ms); this->mmap = config->register_bool (config, @@ -1424,7 +1424,7 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da /* Use the default device to open first */ pcm_device = config->lookup_entry(config, "audio.device.alsa_default_device")->str_value; - + /* * find best device driver/channel */ @@ -1434,11 +1434,11 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da err=snd_pcm_open(&this->audio_fd, pcm_device, SND_PCM_STREAM_PLAYBACK, 1); /* NON-BLOCK mode */ if(err <0 ) { xine_log (this->class->xine, XINE_LOG_MSG, - _("snd_pcm_open() failed:%d:%s\n"), err, snd_strerror(err)); + _("snd_pcm_open() failed:%d:%s\n"), err, snd_strerror(err)); xine_log (this->class->xine, XINE_LOG_MSG, - _(">>> Check if another program already uses PCM <<<\n")); + _(">>> Check if another program already uses PCM <<<\n")); free(this); - return NULL; + return NULL; } /* @@ -1446,7 +1446,7 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da */ err = snd_pcm_hw_params_any(this->audio_fd, params); if (err < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: broken configuration for this PCM: no configurations available\n"); snd_pcm_close(this->audio_fd); free(this); @@ -1455,7 +1455,7 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da err = snd_pcm_hw_params_set_access(this->audio_fd, params, SND_PCM_ACCESS_RW_INTERLEAVED); if (err < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: access type not available"); snd_pcm_close(this->audio_fd); free(this); @@ -1537,31 +1537,31 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da ( speakers == SURROUND4 )) { this->capabilities |= AO_CAP_MODE_4CHANNEL; xine_strcat_realloc (&logmsg, _(" 4-channel")); - } + } else xine_strcat_realloc (&logmsg, _(" (4-channel not enabled in xine config)")); - - if (!(snd_pcm_hw_params_test_channels(this->audio_fd, params, 6)) && + + if (!(snd_pcm_hw_params_test_channels(this->audio_fd, params, 6)) && ( speakers == SURROUND41 )) { this->capabilities |= AO_CAP_MODE_4_1CHANNEL; xine_strcat_realloc (&logmsg, _(" 4.1-channel")); - } + } else xine_strcat_realloc (&logmsg, _(" (4.1-channel not enabled in xine config)")); - if (!(snd_pcm_hw_params_test_channels(this->audio_fd, params, 6)) && + if (!(snd_pcm_hw_params_test_channels(this->audio_fd, params, 6)) && ( speakers == SURROUND5 )) { this->capabilities |= AO_CAP_MODE_5CHANNEL; xine_strcat_realloc (&logmsg, _(" 5-channel")); - } + } else xine_strcat_realloc (&logmsg, _(" (5-channel not enabled in xine config)")); - if (!(snd_pcm_hw_params_test_channels(this->audio_fd, params, 6)) && + if (!(snd_pcm_hw_params_test_channels(this->audio_fd, params, 6)) && ( speakers >= SURROUND51 )) { this->capabilities |= AO_CAP_MODE_5_1CHANNEL; xine_strcat_realloc (&logmsg, _(" 5.1-channel")); - } + } else xine_strcat_realloc (&logmsg, _(" (5.1-channel not enabled in xine config)")); @@ -1587,7 +1587,7 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da this->capabilities |= AO_CAP_MODE_A52; this->capabilities |= AO_CAP_MODE_AC5; xine_strcat_realloc (&logmsg, _(" a/52 and DTS pass-through")); - } + } else xine_strcat_realloc (&logmsg, _(" (a/52 and DTS pass-through not enabled in xine config)")); @@ -1622,7 +1622,7 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da this->ao_driver.num_channels = ao_alsa_num_channels; this->ao_driver.bytes_per_frame = ao_alsa_bytes_per_frame; this->ao_driver.delay = ao_alsa_delay; - this->ao_driver.write = ao_alsa_write; + this->ao_driver.write = ao_alsa_write; this->ao_driver.close = ao_alsa_close; this->ao_driver.exit = ao_alsa_exit; this->ao_driver.get_gap_tolerance = ao_alsa_get_gap_tolerance; @@ -1711,7 +1711,7 @@ static ao_info_t ao_info_alsa = { */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_AUDIO_OUT, AO_OUT_ALSA_IFACE_VERSION, "alsa", XINE_VERSION_CODE, &ao_info_alsa, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/audio_out/audio_arts_out.c b/src/audio_out/audio_arts_out.c index 14bf5c965..7f796f2b3 100644 --- a/src/audio_out/audio_arts_out.c +++ b/src/audio_out/audio_arts_out.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -42,7 +42,7 @@ #define AUDIO_NUM_FRAGMENTS 15 #define AUDIO_FRAGMENT_SIZE 8192 -#define GAP_TOLERANCE AO_MAX_GAP +#define GAP_TOLERANCE AO_MAX_GAP typedef struct arts_driver_s { @@ -84,7 +84,7 @@ typedef struct { static void ao_arts_volume(void *buffer, int length, int volume) { int v; short *data = (short *)buffer; - + while (length--) { v=(int) ((*(data) * volume) / 100); *(data)=(v>32767) ? 32767 : ((v<-32768) ? -32768 : v); @@ -118,7 +118,7 @@ static int ao_arts_open(ao_driver_t *this_gen, sleep(2); /* arts might segfault if we are still playing */ arts_close_stream(this->audio_stream); } - + this->mode = mode; this->sample_rate = rate; this->bits_per_sample = bits; @@ -139,7 +139,7 @@ static int ao_arts_open(ao_driver_t *this_gen, this->audio_stream=arts_play_stream(this->sample_rate, bits, this->num_channels, "xine"); this->latency = arts_stream_get (this->audio_stream, ARTS_P_TOTAL_LATENCY); - + /* try to keep latency low, if we don't do this we might end with very high latencies for low quality sound and audio_out will try to fill gaps every time...(values in ms) */ @@ -181,7 +181,7 @@ static int ao_arts_write(ao_driver_t *this_gen, int16_t *data, arts_driver_t *this = (arts_driver_t *) this_gen; int size = num_frames * this->bytes_per_frame; - ao_arts_volume(data, num_frames * this->num_channels, this->mixer.vol_scale ); + ao_arts_volume(data, num_frames * this->num_channels, this->mixer.vol_scale ); arts_write(this->audio_stream, data, size ); return 1; @@ -220,7 +220,7 @@ static uint32_t ao_arts_get_capabilities (ao_driver_t *this_gen) { static void ao_arts_exit(ao_driver_t *this_gen) { arts_driver_t *this = (arts_driver_t *) this_gen; - + ao_arts_close(this_gen); /* FIXME: arts_free() freezes on BSD, so don't use it there */ #if !defined(__OpenBSD__) && !defined (__FreeBSD__) && !defined(__NetBSD__) @@ -233,7 +233,7 @@ static void ao_arts_exit(ao_driver_t *this_gen) static int ao_arts_get_property (ao_driver_t *this_gen, int property) { arts_driver_t *this = (arts_driver_t *) this_gen; - + switch(property) { case AO_PROP_PCM_VOL: case AO_PROP_MIXER_VOL: @@ -269,7 +269,7 @@ static int ao_arts_set_property (ao_driver_t *this_gen, int property, int value) } else { this->mixer.volume = this->mixer.v_mixer; this->mixer.vol_scale = this->mixer.volume; - } + } this->mixer.mute = mute; return value; break; @@ -323,7 +323,7 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da free(this); return NULL; } - + /* * set volume control */ @@ -409,7 +409,7 @@ static ao_info_t ao_info_arts = { */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_AUDIO_OUT, AO_OUT_ARTS_IFACE_VERSION, "arts", XINE_VERSION_CODE, &ao_info_arts, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/audio_out/audio_coreaudio_out.c b/src/audio_out/audio_coreaudio_out.c index 642f920c7..5e31a15e5 100644 --- a/src/audio_out/audio_coreaudio_out.c +++ b/src/audio_out/audio_coreaudio_out.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -54,7 +54,7 @@ #define AO_OUT_COREAUDIO_IFACE_VERSION 8 -#define GAP_TOLERANCE AO_MAX_GAP +#define GAP_TOLERANCE AO_MAX_GAP #define BUFSIZE 30720 /* Number of seconds to wait for buffered data to arrive/be used * before giving up. */ @@ -75,7 +75,7 @@ typedef struct coreaudio_driver_s { Component au_component; Component converter_component; - + AudioUnit au_unit; AudioUnit converter_unit; @@ -86,7 +86,7 @@ typedef struct coreaudio_driver_s { int mute; Float32 pre_mute_volume; - + pthread_mutex_t mutex; pthread_cond_t buffer_ready_for_reading; pthread_cond_t buffer_ready_for_writing; @@ -131,7 +131,7 @@ static OSStatus ao_coreaudio_render_proc (coreaudio_driver_t *this, pthread_mutex_lock (&this->mutex); if(this->buf_head < ((BUFSIZE) >> 2)) { set_to_future(&future); - if(pthread_cond_timedwait + if(pthread_cond_timedwait (&this->buffer_ready_for_reading, &this->mutex, &future) == ETIMEDOUT) { /* Timed out, give up and fill remainder with silence. */ @@ -143,13 +143,13 @@ static OSStatus ao_coreaudio_render_proc (coreaudio_driver_t *this, return noErr; } } - + if(this->buf_head < buffer_size - buffer_progress) { chunk_size = this->buf_head; } else { chunk_size = buffer_size - buffer_progress; } - + xine_fast_memcpy (ioData->mBuffers[i].mData, this->buf, chunk_size); if(chunk_size < this->buf_head) { memmove(this->buf, &(this->buf[chunk_size]), this->buf_head - chunk_size); @@ -188,7 +188,7 @@ static int ao_coreaudio_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate AudioStreamBasicDescription format; AudioUnitConnection connection; ComponentDescription desc; - + switch (mode) { case AO_CAP_MODE_MONO: this->num_channels = 1; @@ -209,7 +209,7 @@ static int ao_coreaudio_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate pthread_cond_init (&this->buffer_ready_for_reading, NULL); pthread_cond_init (&this->buffer_ready_for_writing, NULL); - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_coreaudio_out: ao_open bits=%d rate=%d, mode=%d\n", bits, rate, mode); /* find an audio output unit */ @@ -218,17 +218,17 @@ static int ao_coreaudio_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate desc.componentManufacturer = kAudioUnitManufacturer_Apple; desc.componentFlags = 0; desc.componentFlagsMask = 0; - + this->au_component = FindNextComponent (NULL, &desc); if (this->au_component == NULL) { - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_coreaudio_out: Unable to find a usable audio output unit component\n"); return 0; } - + OpenAComponent (this->au_component, &this->au_unit); - + /* find a converter unit */ desc.componentType = kAudioUnitType_FormatConverter; desc.componentSubType = kAudioUnitSubType_AUConverter; @@ -236,11 +236,11 @@ static int ao_coreaudio_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate this->converter_component = FindNextComponent (NULL, &desc); if (this->converter_component == NULL) { - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_coreaudio_out: Unable to find a usable audio converter unit component\n"); return 0; } - + OpenAComponent (this->converter_component, &this->converter_unit); /* set up the render procedure */ @@ -258,7 +258,7 @@ static int ao_coreaudio_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate connection.destInputNumber = 0; AudioUnitSetProperty (this->au_unit, kAudioUnitProperty_MakeConnection, - kAudioUnitScope_Input, 0, + kAudioUnitScope_Input, 0, &connection, sizeof(connection)); /* set up the audio format we want to use */ @@ -274,7 +274,7 @@ static int ao_coreaudio_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate format.mBytesPerFrame = this->bytes_per_frame; format.mFramesPerPacket = 1; format.mBytesPerPacket = format.mBytesPerFrame; - + AudioUnitSetProperty (this->converter_unit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, @@ -339,7 +339,7 @@ static int ao_coreaudio_write(ao_driver_t *this_gen, int16_t *data, pthread_mutex_lock (&this->mutex); if(this->buf_head > ((3 * BUFSIZE)>>2)) { set_to_future(&future); - if(pthread_cond_timedwait + if(pthread_cond_timedwait (&this->buffer_ready_for_writing, &this->mutex, &future) == ETIMEDOUT) { /* Timed out, give up. */ @@ -354,10 +354,10 @@ static int ao_coreaudio_write(ao_driver_t *this_gen, int16_t *data, } else { chunk_size = remaining_bytes; } - + xine_fast_memcpy(&(this->buf[this->buf_head]), data, chunk_size); this->buf_head += chunk_size; - remaining_bytes -= chunk_size; + remaining_bytes -= chunk_size; if(this->buf_head > 0) { pthread_cond_broadcast (&this->buffer_ready_for_reading); @@ -389,13 +389,13 @@ static void ao_coreaudio_close(ao_driver_t *this_gen) CloseComponent (this->au_unit); this->au_unit = 0; } - + if (this->converter_unit) { AudioUnitUninitialize (this->converter_unit); CloseComponent (this->converter_unit); this->converter_unit = 0; } - + if (this->au_component) { this->au_component = NULL; } @@ -417,7 +417,7 @@ static uint32_t ao_coreaudio_get_capabilities (ao_driver_t *this_gen) { static void ao_coreaudio_exit(ao_driver_t *this_gen) { coreaudio_driver_t *this = (coreaudio_driver_t *) this_gen; - + ao_coreaudio_close(this_gen); free (this); @@ -436,7 +436,7 @@ static int ao_coreaudio_get_property (ao_driver_t *this_gen, int property) { kAudioUnitScope_Output, 0, &val); } else { - val = this->pre_mute_volume; + val = this->pre_mute_volume; } return (int) (val * 12); break; @@ -472,12 +472,12 @@ static int ao_coreaudio_set_property (ao_driver_t *this_gen, int property, int v kHALOutputParam_Volume, kAudioUnitScope_Output, 0, &(this->pre_mute_volume)); - + AudioUnitSetParameter (this->au_unit, kHALOutputParam_Volume, kAudioUnitScope_Output, 0, 0, 0); - + this->mute = 1; } } else { @@ -487,14 +487,14 @@ static int ao_coreaudio_set_property (ao_driver_t *this_gen, int property, int v kHALOutputParam_Volume, kAudioUnitScope_Output, 0, this->pre_mute_volume, 0); - + this->mute = 0; } } return value; break; } - + return ~value; } @@ -521,7 +521,7 @@ static int ao_coreaudio_ctrl(ao_driver_t *this_gen, int cmd, ...) { return 0; } -static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, +static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *data) { coreaudio_class_t *class = (coreaudio_class_t *) class_gen; @@ -606,7 +606,7 @@ static const ao_info_t ao_info_coreaudio = { */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_AUDIO_OUT, AO_OUT_COREAUDIO_IFACE_VERSION, "coreaudio", XINE_VERSION_CODE, &ao_info_coreaudio, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/audio_out/audio_directx2_out.c b/src/audio_out/audio_directx2_out.c index 6bee2066c..4d7fe4e65 100644 --- a/src/audio_out/audio_directx2_out.c +++ b/src/audio_out/audio_directx2_out.c @@ -70,14 +70,14 @@ /* * If GAP_TOLERANCE is lower than AO_MAX_GAP, xine will - * try to smooth playback without skipping frames or + * try to smooth playback without skipping frames or * inserting silence. */ #define GAP_TOLERANCE (AO_MAX_GAP/3) -/* - * buffer size in miliseconds - * (one second takes 11-192 KB) +/* + * buffer size in miliseconds + * (one second takes 11-192 KB) */ #define BUFFER_MS 1000 @@ -86,7 +86,7 @@ */ #define BUFFER_MIN_MS 200 -/* +/* * base power factor for volume remapping */ #define FACTOR 60.0 @@ -117,8 +117,8 @@ typedef struct { LPDIRECTSOUNDBUFFER dsbuffer; /* DirectSound buffer */ size_t buffer_size; /* size of the buffer */ - size_t write_pos; /* positition in ring buffer for writing*/ - + size_t write_pos; /* positition in ring buffer for writing*/ + int status; /* current status of the driver */ int paused; /* paused mode */ int finished; /* driver finished */ @@ -356,7 +356,7 @@ static int audio_flush(dx2_driver_t *this) { } -/* +/* * set the volume * * DirecSound can only lower the volume by software way. @@ -403,7 +403,7 @@ static int audio_fill(dx2_driver_t *this, char *data, size_t size) { // this->read_size += size; this->write_pos = (this->write_pos + size ) % this->buffer_size; - lprintf("size %u, write_pos %u\n", size, this->write_pos); + lprintf("size %u, write_pos %u\n", size, this->write_pos); if ((err = IDirectSoundBuffer_Unlock(this->dsbuffer, ptr1, size1, ptr2, size2)) != DS_OK) { audio_error(this, err, _("Couldn't unlock direct sound buffer")); @@ -467,8 +467,8 @@ static int test_capability(LPDIRECTSOUNDBUFFER buffer, uint32_t bits, uint32_t r } -/* - * test capabilities of driver before opening +/* + * test capabilities of driver before opening * * Passed only 8 bit and 16 bit with mono or stereo. */ @@ -517,7 +517,7 @@ static int test_capabilities(dx2_driver_t *this) { /* size of free space in the ring buffer */ static size_t buffer_free_size(dx2_driver_t *this) { - + int ret; size_t play_pos; size_t free_space; @@ -526,10 +526,10 @@ static size_t buffer_free_size(dx2_driver_t *this) { ret = audio_tell(this, &play_pos); if (!ret) return 0; - + // calc free space (-1) free_space = (this->buffer_size + play_pos - this->write_pos - 1) % this->buffer_size; - + return free_space; } @@ -543,10 +543,10 @@ static size_t buffer_occupied_size(dx2_driver_t *this) { // get current play pos ret = audio_tell(this, &play_pos); if (!ret) return 0; - + // calc used space used_space = (this->buffer_size + this->write_pos - play_pos) % this->buffer_size; - + return used_space; } @@ -759,7 +759,7 @@ static int ao_dx2_delay(ao_driver_t *this_gen) { if (ret){ frames = buffer_occupied_size(this) / this->frame_size; } - } + } pthread_mutex_unlock(&this->data_mutex); diff --git a/src/audio_out/audio_directx_out.c b/src/audio_out/audio_directx_out.c index 21ba23d91..893a11976 100644 --- a/src/audio_out/audio_directx_out.c +++ b/src/audio_out/audio_directx_out.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2001-2003 the xine project - * + * * This file is part of xine, a unix video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -81,14 +81,14 @@ typedef struct { int capabilities; xine_t *xine; - + /* directx objects */ LPDIRECTSOUND dsobj; LPDIRECTSOUNDBUFFER dsbuffer; DSBCAPS dsbcaps; LPDIRECTSOUNDNOTIFY notify; DSBPOSITIONNOTIFY notify_events[ 2 ]; - + /* buffer vars */ long buffer_size; int write_status; @@ -96,13 +96,13 @@ typedef struct { uint8_t prebuff[ SOUND_BUFFER_MAX ]; uint32_t prebuff_size; - + /* current buffer properties */ int bits; int rate; int chnn; int frsz; - + /* current mixer settings */ int mute; int volume; @@ -118,7 +118,7 @@ typedef struct { * * BEGIN : Direct Sound and win32 handlers * for xine audio output plugins. - * + * * ------------------------------------------- */ void Error( HWND hwnd, LPSTR szfmt, ... ); @@ -128,7 +128,7 @@ boolean CreateSoundBuffer( ao_directx_t * ao_directx ); void DestroySoundBuffer( ao_directx_t * ao_directx ); uint32_t FillSoundBuffer( ao_directx_t * ao_directx, int code, unsigned char * samples ); -/* Display formatted error message in +/* Display formatted error message in * popup message box. */ void Error( HWND hwnd, LPSTR szfmt, ... ) @@ -229,25 +229,25 @@ boolean CreateSoundBuffer( ao_directx_t * ao_directx ) * related resources */ DestroySoundBuffer( ao_directx ); - + /* create a secondary sound buffer */ - - memset( &pcmwf, 0, sizeof( PCMWAVEFORMAT ) ); + + memset( &pcmwf, 0, sizeof( PCMWAVEFORMAT ) ); pcmwf.wBitsPerSample = ( unsigned short ) ao_directx->bits; - pcmwf.wf.wFormatTag = WAVE_FORMAT_PCM; + pcmwf.wf.wFormatTag = WAVE_FORMAT_PCM; pcmwf.wf.nChannels = ao_directx->chnn; - pcmwf.wf.nSamplesPerSec = ao_directx->rate; + pcmwf.wf.nSamplesPerSec = ao_directx->rate; pcmwf.wf.nBlockAlign = ao_directx->frsz; - pcmwf.wf.nAvgBytesPerSec = ao_directx->rate * ao_directx->frsz; + pcmwf.wf.nAvgBytesPerSec = ao_directx->rate * ao_directx->frsz; - memset( &dsbdesc, 0, sizeof( DSBUFFERDESC ) ); - dsbdesc.dwSize = sizeof( DSBUFFERDESC ); - dsbdesc.dwFlags = (DSBCAPS_CTRLVOLUME | DSBCAPS_GLOBALFOCUS | + memset( &dsbdesc, 0, sizeof( DSBUFFERDESC ) ); + dsbdesc.dwSize = sizeof( DSBUFFERDESC ); + dsbdesc.dwFlags = (DSBCAPS_CTRLVOLUME | DSBCAPS_GLOBALFOCUS | DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_CTRLPOSITIONNOTIFY); dsbdesc.dwBufferBytes = ao_directx->buffer_size; dsbdesc.lpwfxFormat = ( LPWAVEFORMATEX ) &pcmwf; - if( IDirectSound_CreateSoundBuffer( ao_directx->dsobj, &dsbdesc, + if( IDirectSound_CreateSoundBuffer( ao_directx->dsobj, &dsbdesc, &ao_directx->dsbuffer, 0 ) != DS_OK ) { Error( 0, "IDirectSound_CreateSoundBuffer : Unable to create secondary sound buffer" ); @@ -282,7 +282,7 @@ boolean CreateSoundBuffer( ao_directx_t * ao_directx ) /* get the direct sound notification interface */ if( IDirectSoundBuffer_QueryInterface( ao_directx->dsbuffer, - &IID_IDirectSoundNotify, + &IID_IDirectSoundNotify, (LPVOID *)&ao_directx->notify ) != DS_OK ) { Error( 0, "IDirectSoundBuffer_QueryInterface : Unable to get notification interface" ); @@ -380,9 +380,9 @@ uint32_t FillSoundBuffer( ao_directx_t * ao_directx, int code, unsigned char * s #ifdef LOG if ((void*)samples != (void*)0) - printf("audio_directx_out: FillSoundBuffer(%08x, %d, Null) Enter\n", (unsigned long)ao_directx, code); + printf("audio_directx_out: FillSoundBuffer(%08x, %d, Null) Enter\n", (unsigned long)ao_directx, code); else - printf("audio_directx_out: FillSoundBuffer(%08x, %d, Null) Enter\n", (unsigned long)ao_directx, code); + printf("audio_directx_out: FillSoundBuffer(%08x, %d, Null) Enter\n", (unsigned long)ao_directx, code); #endif half_size = ao_directx->buffer_size / 2; @@ -485,7 +485,7 @@ uint32_t FillSoundBuffer( ao_directx_t * ao_directx, int code, unsigned char * s } /* write data to our sound buffer */ - + memcpy( buff_pointer, samples, buff_length ); /* unlock our sound buffer */ @@ -512,7 +512,7 @@ uint32_t FillSoundBuffer( ao_directx_t * ao_directx, int code, unsigned char * s * ----------------------------------------- */ static int ao_directx_control(ao_driver_t *this_gen, int cmd, ...) { - switch (cmd) + switch (cmd) { case AO_CTRL_PLAY_PAUSE: @@ -539,7 +539,7 @@ static int ao_directx_open( ao_driver_t * ao_driver, uint32_t bits, uint32_t rat ao_directx->bits = bits; ao_directx->rate = rate; - + /* store channel count */ switch( mode ) @@ -628,7 +628,7 @@ static int ao_directx_write( ao_driver_t * ao_driver, int16_t * frame_buffer, ui uint32_t wrote; /* number of bytes written */ uint32_t half_size; /* half our sound buffer size */ - lprintf("ao_directx_write(%08x, %08x, %d) Enter\n", + lprintf("ao_directx_write(%08x, %08x, %d) Enter\n", (unsigned long)ao_directx, (unsigned long)frame_buffer, num_frames); /* zero write counter */ @@ -745,7 +745,7 @@ static int ao_directx_set_property( ao_driver_t * ao_driver, int property, int v { ao_directx_t *ao_directx = ( ao_directx_t * ) ao_driver; - lprintf("ao_directx_set_property(%08x, %d, %d) Enter\n", + lprintf("ao_directx_set_property(%08x, %d, %d) Enter\n", (unsigned long)ao_directx, property, value); switch( property ) @@ -759,7 +759,7 @@ static int ao_directx_set_property( ao_driver_t * ao_driver, int property, int v if( !ao_directx->mute && ao_directx->dsbuffer ) IDirectSoundBuffer_SetVolume( ao_directx->dsbuffer, ao_directx->volume ); - xprintf(ao_directx->xine, XINE_VERBOSITY_DEBUG, + xprintf(ao_directx->xine, XINE_VERBOSITY_DEBUG, "ao_directx : volume set to %d - directX volume = %d\n", value, ao_directx->volume); return value; @@ -793,11 +793,11 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da { audiox_class_t *class = (audiox_class_t *) class_gen; ao_directx_t *ao_directx; - + ao_directx = calloc(1, sizeof(ao_directx_t)); if (!ao_directx) return NULL; - + lprintf("open_plugin(%08x, %08x) Enter\n", (unsigned long)class_gen, (unsigned long)data); lprintf("open_plugin: ao_directx=%08x\n", (unsigned long)ao_directx); @@ -848,7 +848,7 @@ static void *init_class (xine_t *xine, void *data) { audiox = calloc(1, sizeof (audiox_class_t)); if (!audiox) return NULL; - + audiox->driver_class.open_plugin = open_plugin; audiox->driver_class.get_identifier = get_identifier; audiox->driver_class.get_description = get_description; @@ -858,7 +858,7 @@ static void *init_class (xine_t *xine, void *data) { audiox->config = xine->config; lprintf("init_class() Exit! Returning audiox=%08x\n", audiox); - + return audiox; } @@ -870,7 +870,7 @@ static const ao_info_t ao_info_directx = { * exported plugin catalog entry */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_AUDIO_OUT, AO_DIRECTX_IFACE_VERSION, "directx", XINE_VERSION_CODE, &ao_info_directx, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/audio_out/audio_esd_out.c b/src/audio_out/audio_esd_out.c index 63c54b546..ae7576259 100644 --- a/src/audio_out/audio_esd_out.c +++ b/src/audio_out/audio_esd_out.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -77,7 +77,7 @@ typedef struct esd_driver_s { /* * Temporary sample buffer used to reblock the sample output stream * to writes using buffer sizes of n*ESD_BUF_SIZE bytes. - * + * * The reblocking avoids a bug with esd 0.2.18 servers and reduces * cpu load with newer versions of the esd server. * @@ -99,7 +99,7 @@ typedef struct { /* - * connect to esd + * connect to esd */ static int ao_esd_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int mode) @@ -107,7 +107,7 @@ static int ao_esd_open(ao_driver_t *this_gen, esd_driver_t *this = (esd_driver_t *) this_gen; esd_format_t format; - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_esd_out: ao_open bits=%d rate=%d, mode=%d\n", bits, rate, mode); if ( (mode & this->capabilities) == 0 ) { @@ -117,12 +117,12 @@ static int ao_esd_open(ao_driver_t *this_gen, if (this->audio_fd>=0) { - if ( (mode == this->mode) && (rate == this->input_sample_rate) ) + if ( (mode == this->mode) && (rate == this->input_sample_rate) ) return this->output_sample_rate; esd_close (this->audio_fd); } - + this->mode = mode; this->input_sample_rate = rate; this->output_sample_rate = rate; @@ -170,7 +170,7 @@ static int ao_esd_open(ao_driver_t *this_gen, return this->output_sample_rate; } -static int ao_esd_num_channels(ao_driver_t *this_gen) +static int ao_esd_num_channels(ao_driver_t *this_gen) { esd_driver_t *this = (esd_driver_t *) this_gen; return this->num_channels; @@ -200,14 +200,14 @@ static int ao_esd_delay(ao_driver_t *this_gen) frames += (tv.tv_sec - this->start_time.tv_sec) * this->output_sample_rate; - frames -= this->latency; + frames -= this->latency; if (frames < 0) frames = 0; - + /* calc delay */ - + bytes_left = this->bytes_in_buffer - frames * this->bytes_per_frame; - + if (bytes_left<=0) /* buffer ran dry */ bytes_left = 0; return bytes_left / this->bytes_per_frame; @@ -230,18 +230,18 @@ static int ao_esd_write(ao_driver_t *this_gen, /* check if simulated buffer ran dry */ gettimeofday(&tv, NULL); - + frames = (tv.tv_usec - this->start_time.tv_usec) * this->output_sample_k_rate / 1000; frames += (tv.tv_sec - this->start_time.tv_sec) * this->output_sample_rate; - - frames -= this->latency; + + frames -= this->latency; if (frames < 0) frames = 0; /* calc delay */ - + simulated_bytes_in_buffer = frames * this->bytes_per_frame; if (this->bytes_in_buffer < simulated_bytes_in_buffer) @@ -296,7 +296,7 @@ static int ao_esd_write(ao_driver_t *this_gen, if (nwritten != num_bytes) { if (nwritten < 0) xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio_esd_out: writev failed: %s\n", strerror(errno)); - else + else xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio_esd_out: warning, incomplete write: %d\n", nwritten); } if (nwritten > 0) @@ -337,7 +337,7 @@ static int ao_esd_get_gap_tolerance (ao_driver_t *this_gen) { static void ao_esd_exit(ao_driver_t *this_gen) { esd_driver_t *this = (esd_driver_t *) this_gen; - + if (this->audio_fd != -1) esd_close(this->audio_fd); @@ -351,19 +351,19 @@ static int ao_esd_get_property (ao_driver_t *this_gen, int property) { int mixer_fd; esd_player_info_t *esd_pi; esd_info_t *esd_i; - + switch(property) { case AO_PROP_MIXER_VOL: - + if((mixer_fd = esd_open_sound(NULL)) >= 0) { if((esd_i = esd_get_all_info(mixer_fd)) != NULL) { for(esd_pi = esd_i->player_list; esd_pi != NULL; esd_pi = esd_pi->next) { if(!strcmp(this->pname, esd_pi->name)) { this->mixer.source_id = esd_pi->source_id; - + if(!this->mixer.mute) - this->mixer.volume = (((esd_pi->left_vol_scale * 100) / 256) + + this->mixer.volume = (((esd_pi->left_vol_scale * 100) / 256) + ((esd_pi->right_vol_scale * 100) / 256)) >> 1; } @@ -372,7 +372,7 @@ static int ao_esd_get_property (ao_driver_t *this_gen, int property) { } esd_close(mixer_fd); } - + return this->mixer.volume; break; @@ -390,39 +390,39 @@ static int ao_esd_set_property (ao_driver_t *this_gen, int property, int value) switch(property) { case AO_PROP_MIXER_VOL: - + if(!this->mixer.mute) { - + /* need this to get source_id */ (void) ao_esd_get_property(&this->ao_driver, AO_PROP_MIXER_VOL); if((mixer_fd = esd_open_sound(NULL)) >= 0) { int v = (value * 256) / 100; - + esd_set_stream_pan(mixer_fd, this->mixer.source_id, v, v); - + if(!this->mixer.mute) this->mixer.volume = value; - + esd_close(mixer_fd); } } else this->mixer.volume = value; - + return this->mixer.volume; break; - + case AO_PROP_MUTE_VOL: { int mute = (value) ? 1 : 0; - + /* need this to get source_id */ (void) ao_esd_get_property(&this->ao_driver, AO_PROP_MIXER_VOL); - + if(mute) { if((mixer_fd = esd_open_sound(NULL)) >= 0) { int v = 0; - + esd_set_stream_pan(mixer_fd, this->mixer.source_id, v, v); esd_close(mixer_fd); } @@ -430,14 +430,14 @@ static int ao_esd_set_property (ao_driver_t *this_gen, int property, int value) else { if((mixer_fd = esd_open_sound(NULL)) >= 0) { int v = (this->mixer.volume * 256) / 100; - + esd_set_stream_pan(mixer_fd, this->mixer.source_id, v, v); esd_close(mixer_fd); } } - + this->mixer.mute = mute; - + return value; } break; @@ -465,7 +465,7 @@ static int ao_esd_ctrl(ao_driver_t *this_gen, int cmd, ...) { return 0; } -static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, +static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *data) { esd_class_t *class = (esd_class_t *) class_gen; @@ -491,7 +491,7 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, sigemptyset(&vo_mask); sigaddset(&vo_mask, SIGALRM); - if (sigprocmask(SIG_UNBLOCK, &vo_mask, &vo_mask_orig)) + if (sigprocmask(SIG_UNBLOCK, &vo_mask, &vo_mask_orig)) xprintf(class->xine, XINE_VERBOSITY_DEBUG, "audio_esd_out: cannot unblock SIGALRM: %s\n", strerror(errno)); xprintf(class->xine, XINE_VERBOSITY_LOG, _("audio_esd_out: connecting to esd server...\n")); @@ -511,7 +511,7 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, return NULL; } - + esd_svinfo = esd_get_server_info(audio_fd); if (esd_svinfo) { server_sample_rate = esd_svinfo->rate; @@ -606,7 +606,7 @@ static const ao_info_t ao_info_esd = { */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_AUDIO_OUT, AO_OUT_ESD_IFACE_VERSION, "esd", XINE_VERSION_CODE, &ao_info_esd, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/audio_out/audio_file_out.c b/src/audio_out/audio_file_out.c index 699a5cf54..7b7bfe950 100644 --- a/src/audio_out/audio_file_out.c +++ b/src/audio_out/audio_file_out.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -46,7 +46,7 @@ struct wavhdr { unsigned char bRiffMagic[4]; // 'RIFF' uint32_t wRiffLength ; // length of file minus the 8 byte riff header unsigned char bWaveMagic[8]; // 'WAVEfmt ' - uint32_t wFmtSize; // length of format chunk minus 8 byte header + uint32_t wFmtSize; // length of format chunk minus 8 byte header uint16_t wFormatTag; // identifies PCM, ULAW etc uint16_t wChannels; uint32_t dwSamplesPerSecond; // samples per second per channel @@ -93,7 +93,7 @@ static int ao_file_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int file_driver_t *this = (file_driver_t *) this_gen; struct wavhdr w; - xprintf (this->xine, XINE_VERBOSITY_LOG, + xprintf (this->xine, XINE_VERBOSITY_LOG, "audio_file_out: ao_open bits=%d rate=%d, mode=%d\n", bits, rate, mode); this->mode = mode; @@ -314,7 +314,7 @@ static int ao_file_ctrl(ao_driver_t *this_gen, int cmd, ...) { return 0; } -static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, +static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *data) { file_class_t *class = (file_class_t *) class_gen; @@ -399,7 +399,7 @@ static const ao_info_t ao_info_file = { */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_AUDIO_OUT, AO_OUT_FILE_IFACE_VERSION, "file", XINE_VERSION_CODE, &ao_info_file, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/audio_out/audio_fusionsound_out.c b/src/audio_out/audio_fusionsound_out.c index 6c3a0ae33..873ab32e9 100644 --- a/src/audio_out/audio_fusionsound_out.c +++ b/src/audio_out/audio_fusionsound_out.c @@ -1,13 +1,13 @@ /* * Copyright (C) 2000-2006 the xine project and Claudio Ciccani - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 @@ -69,10 +69,10 @@ typedef struct fusionsound_driver_s { float vol; int vol_mute; - + float amp; int amp_mute; - + int paused; } fusionsound_driver_t; @@ -90,12 +90,12 @@ static int ao_fusionsound_open(ao_driver_t *ao_driver, DFBResult ret; lprintf ("ao_open( bits=%d, rate=%d, mode=%d )\n", bits, rate, mode); - - dsc.flags = FSSDF_BUFFERSIZE | FSBDF_CHANNELS | + + dsc.flags = FSSDF_BUFFERSIZE | FSBDF_CHANNELS | FSSDF_SAMPLEFORMAT | FSSDF_SAMPLERATE; switch (mode) { - case AO_CAP_MODE_MONO: + case AO_CAP_MODE_MONO: dsc.channels = 1; break; case AO_CAP_MODE_STEREO: @@ -140,13 +140,13 @@ static int ao_fusionsound_open(ao_driver_t *ao_driver, this->playback->Release (this->playback); this->playback = NULL; } - + if (this->stream) { this->stream->Release (this->stream); this->stream = NULL; } - - ret = this->sound->CreateStream (this->sound, &dsc, &this->stream); + + ret = this->sound->CreateStream (this->sound, &dsc, &this->stream); if (ret != DFB_OK) { xprintf (this->xine, XINE_VERBOSITY_LOG, "audio_fusionsound_out: IFusionSound::CreateStream() failed [%s]\n", @@ -160,10 +160,10 @@ static int ao_fusionsound_open(ao_driver_t *ao_driver, this->channels = dsc.channels; this->rate = dsc.samplerate; this->bytes_per_frame = this->channels * FS_BYTES_PER_SAMPLE(this->format); - + ret = this->stream->GetPlayback (this->stream, &this->playback); if (ret == DFB_OK) { - this->playback->SetVolume (this->playback, + this->playback->SetVolume (this->playback, (this->vol_mute ? 0 : this->vol) * (this->amp_mute ? 0 : this->amp)); if (this->paused) @@ -182,22 +182,22 @@ static int ao_fusionsound_open(ao_driver_t *ao_driver, static int ao_fusionsound_num_channels(ao_driver_t *ao_driver) { fusionsound_driver_t *this = (fusionsound_driver_t *) ao_driver; - + return this->channels; } static int ao_fusionsound_bytes_per_frame(ao_driver_t *ao_driver) { fusionsound_driver_t *this = (fusionsound_driver_t *) ao_driver; - + return this->bytes_per_frame; } static int ao_fusionsound_delay(ao_driver_t *ao_driver) { fusionsound_driver_t *this = (fusionsound_driver_t *) ao_driver; int delay = 0; - + this->stream->GetPresentationDelay (this->stream, &delay); - + return (delay * this->rate / 1000); } @@ -209,7 +209,7 @@ static int ao_fusionsound_write(ao_driver_t *ao_driver, int16_t *data, uint32_t num_frames) { fusionsound_driver_t *this = (fusionsound_driver_t *) ao_driver; DFBResult ret; - + if (this->paused) { xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_fusionsound_out: " @@ -226,7 +226,7 @@ static int ao_fusionsound_write(ao_driver_t *ao_driver, FusionSoundErrorString (ret)); return 0; } - + return num_frames; } @@ -264,13 +264,13 @@ static void ao_fusionsound_exit(ao_driver_t *ao_driver) { if (this->playback) this->playback->Release (this->playback); - + if (this->stream) this->stream->Release (this->stream); if (this->sound) this->sound->Release (this->sound); - + free (this); } @@ -287,17 +287,17 @@ static int ao_fusionsound_get_property(ao_driver_t *ao_driver, int property) { xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_fusionsound_out: volume mute is %d\n", this->vol_mute); return this->vol_mute; - + case AO_PROP_AMP: xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_fusionsound_out: amplifier is %.2f\n", this->amp); return (int) (this->amp * 100.0); - + case AO_PROP_AMP_MUTE: xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_fusionsound_out: amplifier mute is %d\n", this->amp_mute); return this->amp_mute; - + default: break; } @@ -305,10 +305,10 @@ static int ao_fusionsound_get_property(ao_driver_t *ao_driver, int property) { return 0; } -static int ao_fusionsound_set_property(ao_driver_t *ao_driver, +static int ao_fusionsound_set_property(ao_driver_t *ao_driver, int property, int value ) { fusionsound_driver_t *this = (fusionsound_driver_t *) ao_driver; - + if (!this->playback) return 0; @@ -318,11 +318,11 @@ static int ao_fusionsound_set_property(ao_driver_t *ao_driver, xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_fusionsound_out: volume set to %.2f\n", this->vol); break; - + case AO_PROP_MUTE_VOL: this->vol_mute = value ? 1 : 0; xprintf (this->xine, XINE_VERBOSITY_DEBUG, - "audio_fusionsound_out: volume mute set to %d\n", + "audio_fusionsound_out: volume mute set to %d\n", this->vol_mute); break; @@ -331,20 +331,20 @@ static int ao_fusionsound_set_property(ao_driver_t *ao_driver, xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_fusionsound_out: amplifier set to %.2f\n", this->amp); break; - + case AO_PROP_AMP_MUTE: this->amp_mute = value ? 1 : 0; xprintf (this->xine, XINE_VERBOSITY_DEBUG, - "audio_fusionsound_out: amplifier mute set to %d\n", + "audio_fusionsound_out: amplifier mute set to %d\n", this->amp_mute); break; default: return 0; } - + if (this->playback) { - this->playback->SetVolume (this->playback, + this->playback->SetVolume (this->playback, (this->vol_mute ? 0 : this->vol) * (this->amp_mute ? 0 : this->amp)); } @@ -362,10 +362,10 @@ static int ao_fusionsound_control(ao_driver_t *ao_driver, int cmd, ...) { this->playback->Stop (this->playback); this->paused = 1; return 1; - + case AO_CTRL_PLAY_RESUME: lprintf ("Resume()\n"); - if (this->playback) + if (this->playback) this->playback->Continue (this->playback); this->paused = 0; return 1; @@ -384,7 +384,7 @@ static int ao_fusionsound_control(ao_driver_t *ao_driver, int cmd, ...) { } -static ao_driver_t* open_plugin(audio_driver_class_t *ao_class, +static ao_driver_t* open_plugin(audio_driver_class_t *ao_class, const void *data ) { fusionsound_class_t *class = (fusionsound_class_t *) ao_class; fusionsound_driver_t *this; @@ -424,7 +424,7 @@ static ao_driver_t* open_plugin(audio_driver_class_t *ao_class, this->ao_driver.exit = ao_fusionsound_exit; this->ao_driver.get_gap_tolerance = ao_fusionsound_get_gap_tolerance; this->ao_driver.control = ao_fusionsound_control; - + this->vol = this->amp = 1.0; return &this->ao_driver; @@ -449,7 +449,7 @@ static void dispose_class(audio_driver_class_t *ao_class) { static void* init_class(xine_t *xine, void *data) { fusionsound_class_t *class; const char *error; - + /* check FusionSound version */ error = FusionSoundCheckVersion( FUSIONSOUND_MAJOR_VERSION, FUSIONSOUND_MINOR_VERSION, @@ -485,7 +485,7 @@ static const ao_info_t ao_info_fusionsound = { */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_AUDIO_OUT, AO_OUT_FS_IFACE_VERSION, "FusionSound", XINE_VERSION_CODE, &ao_info_fusionsound, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } diff --git a/src/audio_out/audio_irixal_out.c b/src/audio_out/audio_irixal_out.c index 1654cc1a7..336996a99 100644 --- a/src/audio_out/audio_irixal_out.c +++ b/src/audio_out/audio_irixal_out.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -113,7 +113,7 @@ static int ao_irixal_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, i default: xlerror ("irixal Driver does not support the requested mode: 0x%x",mode); return 0; - } + } if (! (config = alNewConfig ())) { @@ -126,7 +126,7 @@ static int ao_irixal_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, i alFreeConfig (config); return 0; } - + switch (bits) { case 8: if ( (alSetWidth (config, AL_SAMPLE_8)) == -1) @@ -211,7 +211,7 @@ static int ao_irixal_get_gap_tolerance (ao_driver_t *this_gen) return this->gap_tolerance; } -static int ao_irixal_delay (ao_driver_t *this_gen) +static int ao_irixal_delay (ao_driver_t *this_gen) { irixal_driver_t *this = (irixal_driver_t *) this_gen; stamp_t stamp, time; @@ -230,7 +230,7 @@ static int ao_irixal_write(ao_driver_t *this_gen,int16_t *data, uint32_t num_fra { irixal_driver_t *this = (irixal_driver_t *) this_gen; stamp_t stamp; - + /* Grmbf. IRIX audio does not tell us, wenn we run dry. * We have to detect this ourself. */ /* get absolute number of samples played so far @@ -249,7 +249,7 @@ static int ao_irixal_write(ao_driver_t *this_gen,int16_t *data, uint32_t num_fra * alGetFillable() would tell us, whether space was available */ alWriteFrames (this->port, data, num_frames); this->frames_in_buffer += num_frames; - + return num_frames; } @@ -376,9 +376,9 @@ static void *init_audio_out_plugin (config_values_t *config) } } } - + printf (" capabilities 0x%X\n",this->capabilities); - + /* TODO: anything can change during runtime... move check to the right location */ this->gap_tolerance = config->register_range (config, "audio.device.irixal_gap_tolerance", DEFAULT_GAP_TOLERANCE, 0, 90000, @@ -396,7 +396,7 @@ static void *init_audio_out_plugin (config_values_t *config) this->ao_driver.num_channels = ao_irixal_num_channels; this->ao_driver.bytes_per_frame = ao_irixal_bytes_per_frame; this->ao_driver.delay = ao_irixal_delay; - this->ao_driver.write = ao_irixal_write; + this->ao_driver.write = ao_irixal_write; this->ao_driver.close = ao_irixal_close; this->ao_driver.exit = ao_irixal_exit; this->ao_driver.get_gap_tolerance = ao_irixal_get_gap_tolerance; @@ -421,7 +421,7 @@ ao_info_t *get_audio_out_plugin_info() */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_AUDIO_OUT, AO_OUT_IRIXAL_IFACE_VERSION, "irixal", XINE_VERSION_CODE, &ao_info_irixal, init_audio_out_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/audio_out/audio_jack_out.c b/src/audio_out/audio_jack_out.c index 6394fd3e3..a343310f0 100644 --- a/src/audio_out/audio_jack_out.c +++ b/src/audio_out/audio_jack_out.c @@ -89,7 +89,7 @@ typedef struct /** * \brief get the number of free bytes in the buffer * \return number of free bytes in buffer - * + * * may only be called by Xine's thread * return value may change between immediately following two calls, * and the real number of free bytes might be larger! diff --git a/src/audio_out/audio_none_out.c b/src/audio_out/audio_none_out.c index 9ba9a00ca..c3d351035 100644 --- a/src/audio_out/audio_none_out.c +++ b/src/audio_out/audio_none_out.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -40,7 +40,7 @@ #define AUDIO_NUM_FRAGMENTS 15 #define AUDIO_FRAGMENT_SIZE 8192 -#define GAP_TOLERANCE AO_MAX_GAP +#define GAP_TOLERANCE AO_MAX_GAP typedef struct none_driver_s { @@ -74,7 +74,7 @@ static int ao_none_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int { none_driver_t *this = (none_driver_t *) this_gen; - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_none_out: ao_open bits=%d rate=%d, mode=%d\n", bits, rate, mode); this->mode = mode; @@ -115,13 +115,13 @@ static int ao_none_write(ao_driver_t *this_gen, int16_t *data, uint32_t num_frames) { none_driver_t *this = (none_driver_t *) this_gen; - + /* take some time to pretend we are doing something. * avoids burning cpu. */ if( (1000 * num_frames / this->sample_rate) > 10 ) xine_usec_sleep ((1000 * num_frames / this->sample_rate)*1000/2); - + return 1; } @@ -143,7 +143,7 @@ static uint32_t ao_none_get_capabilities (ao_driver_t *this_gen) { static void ao_none_exit(ao_driver_t *this_gen) { none_driver_t *this = (none_driver_t *) this_gen; - + ao_none_close(this_gen); free (this); @@ -177,7 +177,7 @@ static int ao_none_ctrl(ao_driver_t *this_gen, int cmd, ...) { return 0; } -static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, +static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *data) { none_class_t *class = (none_class_t *) class_gen; @@ -260,7 +260,7 @@ static const ao_info_t ao_info_none = { */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_AUDIO_OUT, AO_OUT_NONE_IFACE_VERSION, "none", XINE_VERSION_CODE, &ao_info_none, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/audio_out/audio_oss_out.c b/src/audio_out/audio_oss_out.c index ba1044ed4..bd16a6dd3 100644 --- a/src/audio_out/audio_oss_out.c +++ b/src/audio_out/audio_oss_out.c @@ -1,25 +1,25 @@ -/* +/* * Copyright (C) 2000-2008 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * 20-8-2001 First implementation of Audio sync and Audio driver separation. * Copyright (C) 2001 James Courtier-Dutton James@superbug.demon.co.uk - * + * * General Programming Guidelines: - * New concept of an "audio_frame". * An audio_frame consists of all the samples required to fill every audio channel @@ -90,7 +90,7 @@ #endif #ifndef AFMT_AC3 -# define AFMT_AC3 0x00000400 +# define AFMT_AC3 0x00000400 #endif #define AO_OUT_OSS_IFACE_VERSION 8 @@ -127,7 +127,7 @@ typedef struct oss_driver_s { uint32_t bytes_per_frame; uint32_t bytes_in_buffer; /* number of bytes writen to audio hardware */ uint32_t last_getoptr; - + int audio_started; int sync_method; int latency; @@ -178,7 +178,7 @@ static int ao_oss_open(ao_driver_t *this_gen, close (this->audio_fd); } - + this->mode = mode; this->input_sample_rate = rate; this->bits_per_sample = bits; @@ -192,11 +192,11 @@ static int ao_oss_open(ao_driver_t *this_gen, this->audio_fd=open(this->audio_dev,O_WRONLY|O_NONBLOCK); if (this->audio_fd < 0) { - xprintf(this->xine, XINE_VERBOSITY_LOG, + xprintf(this->xine, XINE_VERBOSITY_LOG, _("audio_oss_out: Opening audio device %s: %s\n"), this->audio_dev, strerror(errno)); return 0; } - + /* We wanted non blocking open but now put it back to normal */ fcntl(this->audio_fd, F_SETFL, fcntl(this->audio_fd, F_GETFL)&~O_NONBLOCK); @@ -213,8 +213,8 @@ static int ao_oss_open(ao_driver_t *this_gen, tmp = this->input_sample_rate; if (ioctl(this->audio_fd,SNDCTL_DSP_SPEED, &tmp) == -1) { - - xprintf(this->xine, XINE_VERBOSITY_LOG, + + xprintf(this->xine, XINE_VERBOSITY_LOG, _("audio_oss_out: warning: sampling rate %d Hz not supported, trying 44100 Hz\n"), this->input_sample_rate); @@ -272,7 +272,7 @@ static int ao_oss_open(ao_driver_t *this_gen, xprintf(this->xine, XINE_VERBOSITY_LOG, "audio_oss_out: %d channels output\n", this->num_channels); this->bytes_per_frame=(this->bits_per_sample*this->num_channels)/8; - + /* * set format */ @@ -303,7 +303,7 @@ static int ao_oss_open(ao_driver_t *this_gen, else xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio_oss_out: The AFMT_S16_NE ioctl failed.\n"); return 0; - } + } } break; case AO_CAP_MODE_A52: @@ -317,7 +317,7 @@ static int ao_oss_open(ao_driver_t *this_gen, ioctl(this->audio_fd, SNDCTL_DSP_CHANNELS, &tmp); tmp = AFMT_AC3; if (ioctl(this->audio_fd, SNDCTL_DSP_SETFMT, &tmp) < 0 || tmp != AFMT_AC3) { - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio_oss_out: AC3 SNDCTL_DSP_SETFMT failed. %d. Using alternative.\n",tmp); tmp = AFMT_S16_LE; ioctl(this->audio_fd, SNDCTL_DSP_SETFMT, &tmp); @@ -344,7 +344,7 @@ static int ao_oss_open(ao_driver_t *this_gen, printf ("audio_oss_out: audio buffer fragment info : %x\n",tmp); - ioctl(this->audio_fd,SNDCTL_DSP_SETFRAGMENT,&tmp); + ioctl(this->audio_fd,SNDCTL_DSP_SETFRAGMENT,&tmp); */ return this->output_sample_rate; @@ -395,9 +395,9 @@ static int ao_oss_delay(ao_driver_t *this_gen) { * this->output_sample_k_rate / 1000; frames += (tv.tv_sec - this->start_time.tv_sec) * this->output_sample_rate; - + frames -= this->latency * this->output_sample_k_rate; - + /* calc delay */ bytes_left = this->bytes_in_buffer - frames * this->bytes_per_frame; @@ -421,15 +421,15 @@ static int ao_oss_delay(ao_driver_t *this_gen) { if (ioctl (this->audio_fd, SNDCTL_DSP_GETOPTR, &info)) { perror ("audio_oss_out: SNDCTL_DSP_GETOPTR failed:"); } - + lprintf ("%d bytes output\n", info.bytes); if (this->bytes_in_buffer < info.bytes) { this->bytes_in_buffer -= this->last_getoptr; /* GETOPTR wrapped */ - } - + } + bytes_left = this->bytes_in_buffer - info.bytes; /* calc delay */ - + if (bytes_left<=0) { /* buffer ran dry */ bytes_left = 0; this->bytes_in_buffer = info.bytes; @@ -476,7 +476,7 @@ static int ao_oss_write(ao_driver_t *this_gen, this->bytes_in_buffer += num_frames * this->bytes_per_frame; - n = write(this->audio_fd, frame_buffer, num_frames * this->bytes_per_frame); + n = write(this->audio_fd, frame_buffer, num_frames * this->bytes_per_frame); lprintf ("ao_oss_write done\n"); @@ -520,20 +520,20 @@ static int ao_oss_get_property (ao_driver_t *this_gen, int property) { case AO_PROP_PCM_VOL: case AO_PROP_MIXER_VOL: if(!this->mixer.mute) { - + if(this->mixer.fd != -1) { IOCTL_REQUEST_TYPE cmd = 0; int v; - + ioctl(this->mixer.fd, SOUND_MIXER_READ_DEVMASK, &audio_devs); - + if(audio_devs & SOUND_MASK_PCM) cmd = SOUND_MIXER_READ_PCM; else if(audio_devs & SOUND_MASK_VOLUME) cmd = SOUND_MIXER_READ_VOLUME; else return -1; - + ioctl(this->mixer.fd, cmd, &v); this->mixer.volume = (((v & 0xFF00) >> 8) + (v & 0x00FF)) / 2; } else @@ -559,20 +559,20 @@ static int ao_oss_set_property (ao_driver_t *this_gen, int property, int value) case AO_PROP_PCM_VOL: case AO_PROP_MIXER_VOL: if(!this->mixer.mute) { - + if(this->mixer.fd != -1) { IOCTL_REQUEST_TYPE cmd = 0; int v; - + ioctl(this->mixer.fd, SOUND_MIXER_READ_DEVMASK, &audio_devs); - + if(audio_devs & SOUND_MASK_PCM) cmd = SOUND_MIXER_WRITE_PCM; else if(audio_devs & SOUND_MASK_VOLUME) cmd = SOUND_MIXER_WRITE_VOLUME; else return -1; - + v = (value << 8) | value; ioctl(this->mixer.fd, cmd, &v); this->mixer.volume = value; @@ -588,26 +588,26 @@ static int ao_oss_set_property (ao_driver_t *this_gen, int property, int value) this->mixer.mute = (value) ? 1 : 0; if(this->mixer.mute) { - + if(this->mixer.fd != -1) { IOCTL_REQUEST_TYPE cmd = 0; int v = 0; - + ioctl(this->mixer.fd, SOUND_MIXER_READ_DEVMASK, &audio_devs); - + if(audio_devs & SOUND_MASK_PCM) cmd = SOUND_MIXER_WRITE_PCM; else if(audio_devs & SOUND_MASK_VOLUME) cmd = SOUND_MIXER_WRITE_VOLUME; else return -1; - + ioctl(this->mixer.fd, cmd, &v); } else return -1; } else (void) ao_oss_set_property(&this->ao_driver, this->mixer.prop, this->mixer.volume); - + return value; break; } @@ -625,7 +625,7 @@ static int ao_oss_ctrl(ao_driver_t *this_gen, int cmd, ...) { if (this->sync_method != OSS_SYNC_SOFTSYNC) ioctl(this->audio_fd, SNDCTL_DSP_RESET, NULL); - + /* close/reopen if RESET causes problems */ if (this->sync_method == OSS_SYNC_GETOPTR) { ao_oss_close(this_gen); @@ -641,7 +641,7 @@ static int ao_oss_ctrl(ao_driver_t *this_gen, int cmd, ...) { lprintf ("AO_CTRL_FLUSH_BUFFERS\n"); if (this->sync_method != OSS_SYNC_SOFTSYNC) ioctl(this->audio_fd, SNDCTL_DSP_RESET, NULL); - + if (this->sync_method == OSS_SYNC_GETOPTR) { ao_oss_close(this_gen); ao_oss_open(this_gen, this->bits_per_sample, this->input_sample_rate, this->mode); @@ -687,14 +687,14 @@ static int probe_audio_devices(oss_driver_t *this) { strcpy(this->audio_dev, devname); /* Better, keep this one */ best_rate = rate; } - + close (audio_fd); } } } return best_rate; /* Will be zero if we did not find one */ -} - +} + static void oss_speaker_arrangement_cb (void *user_data, xine_cfg_entry_t *entry); @@ -728,7 +728,7 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da #define A52_PASSTHRU 12 int speakers; - + this = calloc(1, sizeof (oss_driver_t)); if (!this) return NULL; @@ -762,7 +762,7 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da xprintf(class->xine, XINE_VERBOSITY_LOG, _("audio_oss_out: audio.device.oss_device_name = auto, probing devs\n")); if ( ! probe_audio_devices(this)) { /* Returns zero on fail */ - xprintf(class->xine, XINE_VERBOSITY_LOG, + xprintf(class->xine, XINE_VERBOSITY_LOG, _("audio_oss_out: Auto probe for audio device failed\n")); free (this); return NULL; @@ -784,18 +784,18 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da audio_fd = open(this->audio_dev, O_WRONLY|O_NONBLOCK); if (audio_fd < 0) { - xprintf(class->xine, XINE_VERBOSITY_LOG, + xprintf(class->xine, XINE_VERBOSITY_LOG, _("audio_oss_out: opening audio device %s failed:\n%s\n"), this->audio_dev, strerror(errno)); free (this); return NULL; - } + } /* * set up driver to reasonable values for capabilities tests */ - arg = AFMT_S16_NE; + arg = AFMT_S16_NE; status = ioctl(audio_fd, SNDCTL_DSP_SETFMT, &arg); arg = 44100; status = ioctl(audio_fd, SNDCTL_DSP_SPEED, &arg); @@ -805,7 +805,7 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da */ this->sync_method = config->register_enum (config, "audio.oss_sync_method", OSS_SYNC_AUTO_DETECT, - sync_methods, + sync_methods, _("a/v sync method to use by OSS"), _("xine can use different methods to keep audio and video " "synchronized. Which setting works best depends on the " @@ -862,9 +862,9 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da "audio_oss_out: ...will use system real-time clock for soft-sync instead\n" "audio_oss_out: ...there may be audio/video synchronization issues\n")); xine_monotonic_clock(&this->start_time, NULL); - + this->latency = config->register_range (config, "audio.oss_latency", 0, - -3000, 3000, + -3000, 3000, _("OSS audio output latency (adjust a/v sync)"), _("If you experience audio being not in sync " "with the video, you can enter a fixed offset " @@ -873,20 +873,20 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da "of a second."), 20, NULL, NULL); } - + if (this->sync_method == OSS_SYNC_PROBEBUFFER) { char *buf; int c; this->buffer_size = 0; - + if( (buf=calloc(1, 1024)) != NULL ) { do { c = write(audio_fd,buf,1024); if( c != -1 ) this->buffer_size += c; } while( c == 1024 ); - + free(buf); } close(audio_fd); @@ -896,7 +896,7 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da audio_fd=open(this->audio_dev, O_WRONLY|O_NONBLOCK); - if(audio_fd < 0) + if(audio_fd < 0) { xprintf(class->xine, XINE_VERBOSITY_LOG, _("audio_oss_out: opening audio device %s failed:\n%s\n"), this->audio_dev, strerror(errno)); @@ -907,11 +907,11 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da } this->capabilities = 0; - + arg = AFMT_U8; if( ioctl(audio_fd, SNDCTL_DSP_SETFMT, &arg) != -1 && arg == AFMT_U8) this->capabilities |= AO_CAP_8BITS; - + /* switch back to 16bits, because some soundcards otherwise do not report all their capabilities */ arg = AFMT_S16_NE; if (ioctl(audio_fd, SNDCTL_DSP_SETFMT, &arg) == -1 || arg != AFMT_S16_NE) { @@ -956,30 +956,30 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da char *logmsg = strdup (_("audio_oss_out: supported modes are")); - num_channels = 1; - status = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &num_channels); + num_channels = 1; + status = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &num_channels); if ( (status != -1) && (num_channels==1) ) { this->capabilities |= AO_CAP_MODE_MONO; xine_strcat_realloc (&logmsg, _(" mono")); } - num_channels = 2; - status = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &num_channels); + num_channels = 2; + status = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &num_channels); if ( (status != -1) && (num_channels==2) ) { this->capabilities |= AO_CAP_MODE_STEREO; xine_strcat_realloc (&logmsg, _(" stereo")); } - num_channels = 4; - status = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &num_channels); + num_channels = 4; + status = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &num_channels); if ( (status != -1) && (num_channels==4) ) { if ( speakers == SURROUND4 ) { this->capabilities |= AO_CAP_MODE_4CHANNEL; xine_strcat_realloc (&logmsg, _(" 4-channel")); - } + } else xine_strcat_realloc (&logmsg, _(" (4-channel not enabled in xine config)")); } - num_channels = 5; - status = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &num_channels); + num_channels = 5; + status = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &num_channels); if ( (status != -1) && (num_channels==5) ) { if ( speakers == SURROUND5 ) { this->capabilities |= AO_CAP_MODE_5CHANNEL; @@ -988,13 +988,13 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da else xine_strcat_realloc (&logmsg, _(" (5-channel not enabled in xine config)")); } - num_channels = 6; - status = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &num_channels); + num_channels = 6; + status = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &num_channels); if ( (status != -1) && (num_channels==6) ) { if ( speakers == SURROUND51 ) { this->capabilities |= AO_CAP_MODE_5_1CHANNEL; xine_strcat_realloc (&logmsg, _(" 5.1-channel")); - } + } else xine_strcat_realloc (&logmsg, _(" (5.1-channel not enabled in xine config)")); } @@ -1007,13 +1007,13 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da this->capabilities |= AO_CAP_MODE_A52; this->capabilities |= AO_CAP_MODE_AC5; xine_strcat_realloc (&logmsg, _(" a/52 pass-through")); - } - else + } + else xine_strcat_realloc (&logmsg, _(" (a/52 pass-through not enabled in xine config)")); xprintf(class->xine, XINE_VERBOSITY_DEBUG, "%s\n", logmsg); free (logmsg); - + /* * mixer initialisation. */ @@ -1022,7 +1022,7 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da int mixer_num; int audio_devs; char *parse; - + mixer_num = config->register_num(config, "audio.device.oss_mixer_number", -1, _("OSS audio mixer number, -1 for none"), _("The full mixer device name is created by taking the " @@ -1033,7 +1033,7 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da "The range of this value is -1 or 0-15. This setting is " "ignored, when the OSS audio device name is set to \"auto\"."), 10, NULL, NULL); - + /* get the mixer device name from the audio device name by replacing "dsp" with "mixer" */ strcpy(mixer_name, this->audio_dev); if ((parse = strstr(mixer_name, "dsp"))) { @@ -1050,13 +1050,13 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da } else { _x_abort(); } - + this->mixer.fd = open(this->mixer.name, O_RDONLY); if(this->mixer.fd != -1) { ioctl(this->mixer.fd, SOUND_MIXER_READ_DEVMASK, &audio_devs); - + if(audio_devs & SOUND_MASK_PCM) { this->capabilities |= AO_CAP_PCM_VOL; this->mixer.prop = AO_PROP_PCM_VOL; @@ -1065,9 +1065,9 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da this->capabilities |= AO_CAP_MIXER_VOL; this->mixer.prop = AO_PROP_MIXER_VOL; } - + /* - * This is obsolete in Linux kernel OSS + * This is obsolete in Linux kernel OSS * implementation, so this will certainly doesn't work. * So we just simulate the mute stuff */ @@ -1076,11 +1076,11 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da this->capabilities |= AO_CAP_MUTE_VOL; */ this->capabilities |= AO_CAP_MUTE_VOL; - - } else + + } else xprintf (class->xine, XINE_VERBOSITY_LOG, _("audio_oss_out: open() mixer %s failed: %s\n"), this->mixer.name, strerror(errno)); - + this->mixer.mute = 0; this->mixer.volume = ao_oss_get_property (&this->ao_driver, this->mixer.prop); @@ -1190,7 +1190,7 @@ static const ao_info_t ao_info_oss = { */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_AUDIO_OUT, AO_OUT_OSS_IFACE_VERSION, "oss", XINE_VERSION_CODE, &ao_info_oss, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/audio_out/audio_sun_out.c b/src/audio_out/audio_sun_out.c index 048db6b86..2a154c09d 100644 --- a/src/audio_out/audio_sun_out.c +++ b/src/audio_out/audio_sun_out.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2001-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -159,7 +159,7 @@ static int realtime_samplecounter_available(xine_t *xine, char *dev) silence = calloc(1, len); if (silence == NULL) goto error; - + if ((fd = open(dev, O_WRONLY|O_NONBLOCK)) < 0) goto error; @@ -176,7 +176,7 @@ static int realtime_samplecounter_available(xine_t *xine, char *dev) xprintf(xine, XINE_VERBOSITY_DEBUG, "rtsc: SETINFO failed\n"); goto error; } - + if (write(fd, silence, len) != len) { xprintf(xine, XINE_VERBOSITY_DEBUG, "rtsc: write failed\n"); goto error; @@ -195,7 +195,7 @@ static int realtime_samplecounter_available(xine_t *xine, char *dev) delay.tv_sec = 0; delay.tv_nsec = 10000000; nanosleep(&delay, NULL); - + gettimeofday(&end, NULL); usec_delay = (end.tv_sec - start.tv_sec) * 1000000 + end.tv_usec - start.tv_usec; @@ -230,7 +230,7 @@ static int realtime_samplecounter_available(xine_t *xine, char *dev) * sample counter increment from the soundcard driver of less than * 2000 samples, we assume that the driver provides a useable realtime * sample counter in the AUDIO_INFO play.samples field. Timing based - * on sample counts should be much more accurate than counting whole + * on sample counts should be much more accurate than counting whole * 16kbyte chunks. */ if (min_increment < 2000) @@ -238,10 +238,10 @@ static int realtime_samplecounter_available(xine_t *xine, char *dev) /* printf("audio_sun_out: minimum sample counter increment per 10msec interval: %d\n" - "\t%susing sample counter based timing code\n", + "\t%susing sample counter based timing code\n", min_increment, rtsc_ok == RTSC_ENABLED ? "" : "not "); */ - + error: if (silence != NULL) free(silence); @@ -263,7 +263,7 @@ error: } -/* +/* * match the requested sample rate |sample_rate| against the * sample rates supported by the audio device |dev|. Return * a supported sample rate, it that sample rate is close to @@ -294,7 +294,7 @@ find_close_samplerate_match(int dev, int sample_rate) if (sr->flags & MIXER_SR_LIMITS) { /* - * HW can playback any rate between + * HW can playback any rate between * sr->samp_rates[0] .. sr->samp_rates[1] */ free(sr); @@ -340,7 +340,7 @@ find_close_samplerate_match(int dev, int sample_rate) for (i = 0; audiocs_rates[i]; i++) { err = abs(audiocs_rates[i] - sample_rate); if (err == 0) { - /* + /* * exact supported sample rate match, no need to * retry something elise */ @@ -385,7 +385,7 @@ find_highest_samplerate(int dev) if (sr->flags & MIXER_SR_LIMITS) { /* - * HW can playback any rate between + * HW can playback any rate between * sr->samp_rates[0] .. sr->samp_rates[1] */ max_rate = sr->samp_rates[1]; @@ -412,7 +412,7 @@ find_highest_samplerate(int dev) * Implicit assumptions about audio format (bits/rate/mode): * * bits == 16: We always get 16-bit samples in native endian format, - * using signed linear encoding + * using signed linear encoding * * bits == 8: 8-bit samples use unsigned linear encoding, * other 8-bit formats (uLaw, aLaw, etc) are currently not supported @@ -440,7 +440,7 @@ static int ao_sun_open(ao_driver_t *this_gen, close (this->audio_fd); } - + this->mode = mode; this->input_sample_rate = rate; #ifdef __svr4__ @@ -453,11 +453,11 @@ static int ao_sun_open(ao_driver_t *this_gen, this->audio_fd = open(this->audio_dev, O_WRONLY|O_NONBLOCK); if(this->audio_fd < 0) { - xprintf(this->xine, XINE_VERBOSITY_LOG, + xprintf(this->xine, XINE_VERBOSITY_LOG, _("audio_sun_out: opening audio device %s failed: %s\n"), this->audio_dev, strerror(errno)); return 0; } - + /* We wanted non blocking open but now put it back to normal */ fcntl(this->audio_fd, F_SETFL, fcntl(this->audio_fd, F_GETFL) & ~O_NONBLOCK); @@ -485,7 +485,7 @@ static int ao_sun_open(ao_driver_t *this_gen, if (pass & 1) { /* - * on some sun audio drivers, 8-bit unsigned LINEAR8 encoding is + * on some sun audio drivers, 8-bit unsigned LINEAR8 encoding is * not supported, but 8-bit signed encoding is. * * Try S8, and if it works, use our own U8->S8 conversion before @@ -511,7 +511,7 @@ static int ao_sun_open(ao_driver_t *this_gen, */ if (!(info.play.sample_rate = find_close_samplerate_match(this->audio_fd, - this->input_sample_rate))) + this->input_sample_rate))) continue; } @@ -567,7 +567,7 @@ static int ao_sun_open(ao_driver_t *this_gen, return this->output_sample_rate; } -static int ao_sun_num_channels(ao_driver_t *this_gen) +static int ao_sun_num_channels(ao_driver_t *this_gen) { sun_driver_t *this = (sun_driver_t *) this_gen; return this->num_channels; @@ -589,7 +589,7 @@ static int ao_sun_delay(ao_driver_t *this_gen) (this->frames_in_buffer == 0 || info.play.samples > 0)) { if (info.play.samples < this->last_samplecnt) { - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio_sun_out: broken sound driver, sample counter runs backwards, cur %u < prev %u\n", info.play.samples, this->last_samplecnt); } @@ -728,7 +728,7 @@ static int ao_sun_write(ao_driver_t *this_gen, int num_written; if (this->convert_u8_s8) { - /* + /* * Audio hardware does not support 8-bit unsigned format, * only 8-bit signed. Convert to 8-bit unsigned before sending * the data to the audio device. @@ -736,7 +736,7 @@ static int ao_sun_write(ao_driver_t *this_gen, uint8_t *p = (void *)frame_buffer; int i; - for (i = num_frames * this->bytes_per_frame; --i >= 0; p++) + for (i = num_frames * this->bytes_per_frame; --i >= 0; p++) *p ^= 0x80; } num_written = sun_audio_write(this, frame_buffer, num_frames * this->bytes_per_frame); @@ -747,7 +747,7 @@ static int ao_sun_write(ao_driver_t *this_gen, this->frames_in_buffer += num_written / this->bytes_per_frame; #endif - /* + /* * Avoid storing too much data in the sound driver's buffers. * * When we find more than 3 seconds of buffered audio data in the @@ -783,7 +783,7 @@ static uint32_t ao_sun_get_capabilities (ao_driver_t *this_gen) { static void ao_sun_exit(ao_driver_t *this_gen) { sun_driver_t *this = (sun_driver_t *) this_gen; - + if (this->audio_fd >= 0) close(this->audio_fd); @@ -869,7 +869,7 @@ static int ao_sun_ctrl(ao_driver_t *this_gen, int cmd, ...) { /* flush buffered STEAMS data first */ ioctl(this->audio_fd, I_FLUSH, FLUSHW); - /* + /* * the flush above discarded an unknown amount of data from the * audio device. To get the "*_delay" computation in sync again, * reset the audio device's sample counter to 0, after waiting @@ -944,7 +944,7 @@ static ao_driver_t *ao_sun_open_plugin (audio_driver_class_t *class_gen, const v this->audio_fd = open(this->audio_dev = devname, O_WRONLY|O_NONBLOCK); - if(this->audio_fd < 0) + if(this->audio_fd < 0) { xprintf(this->xine, XINE_VERBOSITY_LOG, _("audio_sun_out: opening audio device %s failed: %s\n"), devname, strerror(errno)); @@ -962,7 +962,7 @@ static ao_driver_t *ao_sun_open_plugin (audio_driver_class_t *class_gen, const v info.play.precision = AUDIO_PRECISION_16; info.play.sample_rate = 44100; status = ioctl(this->audio_fd, AUDIO_SETINFO, &info); - + if (status < 0) { xprintf(this->xine, XINE_VERBOSITY_LOG, _("audio_sun_out: audio ioctl on device %s failed: %s\n"), devname, strerror(errno)); @@ -976,7 +976,7 @@ static ao_driver_t *ao_sun_open_plugin (audio_driver_class_t *class_gen, const v */ this->capabilities = AO_CAP_MODE_MONO | AO_CAP_MODE_STEREO | AO_CAP_8BITS - | AO_CAP_16BITS | AO_CAP_PCM_VOL; + | AO_CAP_16BITS | AO_CAP_PCM_VOL; #ifdef __svr4__ this->capabilities |= AO_CAP_MUTE_VOL; #endif @@ -1056,7 +1056,7 @@ static const ao_info_t ao_info_sun = { */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_AUDIO_OUT, AO_SUN_IFACE_VERSION, "sun", XINE_VERSION_CODE, &ao_info_sun, ao_sun_init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/combined/combined_wavpack.c b/src/combined/combined_wavpack.c index 98bbe5b57..5e4f47342 100644 --- a/src/combined/combined_wavpack.c +++ b/src/combined/combined_wavpack.c @@ -27,7 +27,7 @@ static const demuxer_info_t demux_info_wv = { 0 /* priority */ }; -static uint32_t audio_types[] = { +static uint32_t audio_types[] = { BUF_AUDIO_WAVPACK, 0 }; diff --git a/src/combined/decoder_flac.c b/src/combined/decoder_flac.c index e5884006a..e9a7fbb25 100644 --- a/src/combined/decoder_flac.c +++ b/src/combined/decoder_flac.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -82,8 +82,8 @@ typedef struct flac_decoder_s { * FLAC callback functions */ -static FLAC__StreamDecoderReadStatus -flac_read_callback (const FLAC__StreamDecoder *decoder, +static FLAC__StreamDecoderReadStatus +flac_read_callback (const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data) @@ -131,36 +131,36 @@ flac_write_callback (const FLAC__StreamDecoder *decoder, lprintf("flac_write_callback\n"); while( samples_left ) { - + audio_buffer = this->stream->audio_out->get_buffer(this->stream->audio_out); if( audio_buffer->mem_size < samples_left * frame->header.channels * bytes_per_sample ) buf_samples = audio_buffer->mem_size / (frame->header.channels * bytes_per_sample); else buf_samples = samples_left; - - + + if( frame->header.bits_per_sample == 8 ) { data8 = (int8_t *)audio_buffer->mem; - + for( j=0; j < buf_samples; j++ ) for( i=0; i < frame->header.channels; i++ ) *data8++ = buffer[i][j]; - + } else { - + data16 = (int16_t *)audio_buffer->mem; - + for( j=0; j < buf_samples; j++ ) for( i=0; i < frame->header.channels; i++ ) *data16++ = buffer[i][j]; - } + } audio_buffer->num_frames = buf_samples; audio_buffer->vpts = this->pts; this->pts = 0; this->stream->audio_out->put_buffer (this->stream->audio_out, audio_buffer, this->stream); - + samples_left -= buf_samples; } return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; @@ -173,9 +173,9 @@ flac_metadata_callback (const FLAC__StreamDecoder *decoder, void *client_data) { /* flac_decoder_t *this = (flac_decoder_t *)client_data; */ - + lprintf("Metadata callback called!\n"); - + #ifdef LOG if (metadata->type == FLAC__METADATA_TYPE_STREAMINFO) { printf("libflac: min_blocksize = %d\n", metadata->data.stream_info.min_blocksize); @@ -209,7 +209,7 @@ flac_error_callback (const FLAC__StreamDecoder *decoder, else printf("libflac: unknown error.\n"); #endif - + return; } @@ -218,34 +218,34 @@ flac_error_callback (const FLAC__StreamDecoder *decoder, * FLAC plugin decoder */ -static void +static void flac_reset (audio_decoder_t *this_gen) { flac_decoder_t *this = (flac_decoder_t *) this_gen; this->buf_pos = 0; - - if( FLAC__stream_decoder_get_state(this->flac_decoder) != - FLAC__STREAM_DECODER_SEARCH_FOR_METADATA ) + + if( FLAC__stream_decoder_get_state(this->flac_decoder) != + FLAC__STREAM_DECODER_SEARCH_FOR_METADATA ) FLAC__stream_decoder_flush (this->flac_decoder); } -static void -flac_discontinuity (audio_decoder_t *this_gen) +static void +flac_discontinuity (audio_decoder_t *this_gen) { flac_decoder_t *this = (flac_decoder_t *) this_gen; this->pts = 0; - + lprintf("Discontinuity!\n"); } -static void +static void flac_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { flac_decoder_t *this = (flac_decoder_t *) this_gen; int ret = 1; - + /* We are getting the stream header, open up the audio * device, and collect information about the stream */ @@ -288,15 +288,15 @@ flac_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) xine_fast_memcpy (&this->buf[this->buf_pos], buf->content, buf->size); this->buf_pos += buf->size; - + if (buf->pts) this->pts = buf->pts; /* We have enough to decode a frame */ while( ret && this->buf_pos > this->min_size ) { - + FLAC__StreamDecoderState state = FLAC__stream_decoder_get_state(this->flac_decoder); - + if( state == FLAC__STREAM_DECODER_SEARCH_FOR_METADATA ) { lprintf("process_until_end_of_metadata\n"); ret = FLAC__stream_decoder_process_until_end_of_metadata (this->flac_decoder); @@ -312,24 +312,24 @@ flac_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) } } else return; - + } static void flac_dispose (audio_decoder_t *this_gen) { - flac_decoder_t *this = (flac_decoder_t *) this_gen; + flac_decoder_t *this = (flac_decoder_t *) this_gen; FLAC__stream_decoder_finish (this->flac_decoder); FLAC__stream_decoder_delete (this->flac_decoder); - if (this->output_open) + if (this->output_open) this->stream->audio_out->close (this->stream->audio_out, this->stream); if (this->buf) free(this->buf); - + free (this_gen); } @@ -408,7 +408,7 @@ static void dispose_class (audio_decoder_class_t *this) { static void * init_plugin (xine_t *xine, void *data) { flac_class_t *this; - + this = calloc(1, sizeof (flac_class_t)); this->decoder_class.open_plugin = open_plugin; @@ -420,7 +420,7 @@ init_plugin (xine_t *xine, void *data) { return this; } -static uint32_t audio_types[] = { +static uint32_t audio_types[] = { BUF_AUDIO_FLAC, 0 }; @@ -430,7 +430,7 @@ static const decoder_info_t dec_info_audio = { }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_DEMUX, 26, "flac", XINE_VERSION_CODE, NULL, demux_flac_init_class }, { PLUGIN_AUDIO_DECODER, 15, "flacdec", XINE_VERSION_CODE, &dec_info_audio, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } diff --git a/src/combined/decoder_wavpack.c b/src/combined/decoder_wavpack.c index 36bf0deab..7b00ec8f3 100644 --- a/src/combined/decoder_wavpack.c +++ b/src/combined/decoder_wavpack.c @@ -138,7 +138,7 @@ static void wavpack_reset (audio_decoder_t *const this_gen) this->buf_pos = 0; } -static void wavpack_discontinuity (audio_decoder_t *const this_gen) +static void wavpack_discontinuity (audio_decoder_t *const this_gen) { /* wavpack_decoder_t *this = (wavpack_decoder_t *) this_gen; */ @@ -148,7 +148,7 @@ static void wavpack_discontinuity (audio_decoder_t *const this_gen) static void wavpack_decode_data (audio_decoder_t *const this_gen, buf_element_t *const buf) { wavpack_decoder_t *const this = (wavpack_decoder_t *) this_gen; - + /* We are getting the stream header, open up the audio * device, and collect information about the stream */ @@ -192,7 +192,7 @@ static void wavpack_decode_data (audio_decoder_t *const this_gen, buf_element_t xine_fast_memcpy (&this->buf[this->buf_pos], buf->content, buf->size); this->buf_pos += buf->size; - + if ( buf->decoder_flags & BUF_FLAG_FRAME_END ) { static WavpackStreamReader wavpack_buffer_reader = { .read_bytes = xine_buffer_read_bytes, @@ -214,7 +214,7 @@ static void wavpack_decode_data (audio_decoder_t *const this_gen, buf_element_t this->buf_pos = 0; if ( le2me_32(header->samples_count) == 0 ) return; - + ctx = WavpackOpenFileInputEx(&wavpack_buffer_reader, this, NULL, error, OPEN_STREAMING, 0); if ( ! ctx ) { lprintf("unable to open the stream: %s\n", error); @@ -248,14 +248,14 @@ static void wavpack_decode_data (audio_decoder_t *const this_gen, buf_element_t } lprintf("Decoded %d samples\n", buf_samples); - + samples_left -= decoded_count; audio_buffer->num_frames = decoded_count; audio_buffer->vpts = 0; /* TODO: Fix the pts calculation */ // audio_buffer->vpts = (buf->pts * (samples_total-samples_left)) / samples_total; lprintf("Audio buffer with pts %"PRId64"\n", audio_buffer->vpts); - + switch(this->bits_per_sample) { case 8: { int8_t *data8 = (int8_t*)audio_buffer->mem; @@ -280,13 +280,13 @@ static void wavpack_decode_data (audio_decoder_t *const this_gen, buf_element_t } static void wavpack_dispose (audio_decoder_t *this_gen) { - wavpack_decoder_t *this = (wavpack_decoder_t *) this_gen; + wavpack_decoder_t *this = (wavpack_decoder_t *) this_gen; if (this->output_open) this->stream->audio_out->close (this->stream->audio_out, this->stream); free(this->buf); - + free (this_gen); } @@ -323,7 +323,7 @@ static void dispose_class (audio_decoder_class_t *this) { void *decoder_wavpack_init_plugin (xine_t *xine, void *data) { wavpack_class_t *this; - + this = calloc(1, sizeof (wavpack_class_t)); this->decoder_class.open_plugin = open_plugin; diff --git a/src/combined/demux_flac.c b/src/combined/demux_flac.c index fc638fe35..9c5f7de32 100644 --- a/src/combined/demux_flac.c +++ b/src/combined/demux_flac.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2006 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -66,7 +66,7 @@ typedef struct demux_flac_s { demux_plugin_t demux_plugin; xine_stream_t *stream; - + fifo_buffer_t *audio_fifo; fifo_buffer_t *video_fifo; @@ -112,15 +112,15 @@ flac_read_callback (const FLAC__SeekableStreamDecoder *decoder, void *client_data) { demux_flac_t *this = (demux_flac_t *)client_data; - input_plugin_t *input = this->input; + input_plugin_t *input = this->input; off_t offset = *bytes; lprintf("flac_read_callback\n"); - + /* This should only be called when flac is reading the metadata * of the flac stream. */ - + offset = input->read (input, buffer, offset); lprintf("Read %lld / %u bytes into buffer\n", offset, *bytes); @@ -130,7 +130,7 @@ flac_read_callback (const FLAC__SeekableStreamDecoder *decoder, { *bytes = offset; lprintf("Marking EOF\n"); - + this->status = DEMUX_FINISHED; #ifdef LEGACY_FLAC return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_ERROR; @@ -142,7 +142,7 @@ flac_read_callback (const FLAC__SeekableStreamDecoder *decoder, { *bytes = offset; lprintf("Read was perfect\n"); - + #ifdef LEGACY_FLAC return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_OK; #else @@ -233,7 +233,7 @@ flac_length_callback (const FLAC__SeekableStreamDecoder *decoder, #endif } -static FLAC__bool +static FLAC__bool flac_eof_callback (const FLAC__SeekableStreamDecoder *decoder, void *client_data) { @@ -255,28 +255,28 @@ flac_eof_callback (const FLAC__SeekableStreamDecoder *decoder, } } -static FLAC__StreamDecoderWriteStatus -flac_write_callback (const FLAC__SeekableStreamDecoder *decoder, +static FLAC__StreamDecoderWriteStatus +flac_write_callback (const FLAC__SeekableStreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], - void *client_data) + void *client_data) { /* This should never be called, all we use flac for in this demuxer * is seeking. We do the decoding in the decoder */ - + lprintf("Error: Write callback was called!\n"); return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; } -static void -flac_metadata_callback (const FLAC__SeekableStreamDecoder *decoder, - const FLAC__StreamMetadata *metadata, +static void +flac_metadata_callback (const FLAC__SeekableStreamDecoder *decoder, + const FLAC__StreamMetadata *metadata, void *client_data) { demux_flac_t *this = (demux_flac_t *)client_data; - + lprintf("IN: Metadata callback\n"); /* This should be called when we first look at a flac stream, @@ -295,8 +295,8 @@ flac_metadata_callback (const FLAC__SeekableStreamDecoder *decoder, return; } -static void -flac_error_callback (const FLAC__SeekableStreamDecoder *decoder, +static void +flac_error_callback (const FLAC__SeekableStreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) { @@ -308,24 +308,24 @@ flac_error_callback (const FLAC__SeekableStreamDecoder *decoder, xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_flac: flac_error_callback\n"); if (status == FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC) - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_flac: Decoder lost synchronization.\n"); else if (status == FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER) xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_flac: Decoder encounted a corrupted frame header.\n"); else if (status == FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH) - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_flac: Frame's data did not match the CRC in the footer.\n"); else xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_flac: unknown error.\n"); - + this->status = DEMUX_FINISHED; - + return; } /* FLAC Demuxer plugin */ -static int +static int demux_flac_send_chunk (demux_plugin_t *this_gen) { demux_flac_t *this = (demux_flac_t *) this_gen; buf_element_t *buf = NULL; @@ -335,7 +335,7 @@ demux_flac_send_chunk (demux_plugin_t *this_gen) { remaining_sample_bytes = 2048; - current_file_pos = this->input->get_current_pos (this->input) + current_file_pos = this->input->get_current_pos (this->input) - this->data_start; if( (this->data_size - this->data_start) > 0 ) file_size = (this->data_size - this->data_start); @@ -400,7 +400,7 @@ demux_flac_send_chunk (demux_plugin_t *this_gen) { return this->status; } -static void +static void demux_flac_send_headers (demux_plugin_t *this_gen) { demux_flac_t *this = (demux_flac_t *) this_gen; @@ -434,7 +434,7 @@ demux_flac_send_headers (demux_plugin_t *this_gen) { } } -static void +static void demux_flac_dispose (demux_plugin_t *this_gen) { demux_flac_t *this = (demux_flac_t *) this_gen; @@ -451,7 +451,7 @@ demux_flac_dispose (demux_plugin_t *this_gen) { return; } -static int +static int demux_flac_get_status (demux_plugin_t *this_gen) { demux_flac_t *this = (demux_flac_t *) this_gen; @@ -461,7 +461,7 @@ demux_flac_get_status (demux_plugin_t *this_gen) { } -static int +static int demux_flac_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time, int playing) { demux_flac_t *this = (demux_flac_t *) this_gen; @@ -479,15 +479,15 @@ demux_flac_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time, int } start_pos = (uint64_t)(distance * (this->data_size - this->data_start)); } - + if (start_pos || !start_time) { - + start_pos += this->data_start; this->input->seek (this->input, start_pos, SEEK_SET); lprintf ("Seek to position: %lld\n", start_pos); - + } else { - + double distance = (double)start_time; uint64_t target_sample; FLAC__bool s = false; @@ -518,9 +518,9 @@ demux_flac_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time, int return this->status; } -static int +static int demux_flac_get_stream_length (demux_plugin_t *this_gen) { - demux_flac_t *this = (demux_flac_t *) this_gen; + demux_flac_t *this = (demux_flac_t *) this_gen; lprintf("demux_flac_get_stream_length\n"); @@ -530,14 +530,14 @@ demux_flac_get_stream_length (demux_plugin_t *this_gen) { return 0; } -static uint32_t +static uint32_t demux_flac_get_capabilities (demux_plugin_t *this_gen) { lprintf("demux_flac_get_capabilities\n"); return DEMUX_CAP_NOCAP; } -static int +static int demux_flac_get_optional_data (demux_plugin_t *this_gen, void *data, int dtype) { lprintf("demux_flac_get_optional_data\n"); @@ -545,8 +545,8 @@ demux_flac_get_optional_data (demux_plugin_t *this_gen, void *data, int dtype) { } static demux_plugin_t * -open_plugin (demux_class_t *class_gen, - xine_stream_t *stream, +open_plugin (demux_class_t *class_gen, + xine_stream_t *stream, input_plugin_t *input) { demux_flac_t *this; @@ -558,22 +558,22 @@ open_plugin (demux_class_t *class_gen, uint8_t buf[MAX_PREVIEW_SIZE]; int len; - /* + /* * try to get a preview of the data */ len = input->get_optional_data (input, buf, INPUT_OPTIONAL_DATA_PREVIEW); if (len == INPUT_OPTIONAL_UNSUPPORTED) { - + if (input->get_capabilities (input) & INPUT_CAP_SEEKABLE) { - + input->seek (input, 0, SEEK_SET); if ( (len=input->read (input, buf, 1024)) <= 0) return NULL; input->seek (input, 0, SEEK_SET); - + } else return NULL; - } + } /* FIXME: Skip id3v2 tag */ /* Look for fLaC tag at the beginning of file */ @@ -584,9 +584,9 @@ open_plugin (demux_class_t *class_gen, break; case METHOD_BY_EXTENSION: { const char *ending, *mrl; - + mrl = input->get_mrl (input); - + ending = strrchr (mrl, '.'); if (!ending || (strlen (ending) < 5)) @@ -622,7 +622,7 @@ open_plugin (demux_class_t *class_gen, this->demux_plugin.demux_class = class_gen; this->seek_flag = 0; - + /* Get a new FLAC decoder and hook up callbacks */ #ifdef LEGACY_FLAC @@ -719,7 +719,7 @@ static const char * get_description (demux_class_t *this_gen) { return "FLAC demux plugin"; } - + static const char * get_identifier (demux_class_t *this_gen) { return "FLAC"; @@ -736,7 +736,7 @@ get_mimetypes (demux_class_t *this_gen) { "audio/flac: flac: FLAC Audio;"; } -static void +static void class_dispose (demux_class_t *this_gen) { demux_flac_class_t *this = (demux_flac_class_t *) this_gen; @@ -749,7 +749,7 @@ void * demux_flac_init_class (xine_t *xine, void *data) { demux_flac_class_t *this; - + lprintf("demux_flac_init_class\n"); this = calloc(1, sizeof (demux_flac_class_t)); diff --git a/src/combined/demux_flac.h b/src/combined/demux_flac.h index a48c73260..d9e09e34a 100644 --- a/src/combined/demux_flac.h +++ b/src/combined/demux_flac.h @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA diff --git a/src/combined/demux_wavpack.c b/src/combined/demux_wavpack.c index 2c3e6ce55..94a23acdc 100644 --- a/src/combined/demux_wavpack.c +++ b/src/combined/demux_wavpack.c @@ -39,7 +39,7 @@ typedef struct { demux_plugin_t demux_plugin; - + xine_stream_t *stream; fifo_buffer_t *audio_fifo; input_plugin_t *input; @@ -188,7 +188,7 @@ static int demux_wv_send_chunk(demux_plugin_t *const this_gen) { this->status = DEMUX_FINISHED; return this->status; } - + lprintf("current sample: %u\n", this->current_sample); do { @@ -229,7 +229,7 @@ static int demux_wv_send_chunk(demux_plugin_t *const this_gen) { input_time_guess *= buf->extra_info->input_normpos; input_time_guess /= 65535; buf->extra_info->input_time = input_time_guess; - + if ( ! header_sent ) offset = sizeof(wvheader_t); @@ -247,7 +247,7 @@ static int demux_wv_send_chunk(demux_plugin_t *const this_gen) { if ( bytes_to_read <= 0 && (le2me_32(header.flags) & FINAL_BLOCK) == FINAL_BLOCK) buf->decoder_flags |= BUF_FLAG_FRAME_END; - + this->audio_fifo->put(this->audio_fifo, buf); } } while ( (le2me_32(header.flags) & FINAL_BLOCK) != FINAL_BLOCK ); @@ -271,7 +271,7 @@ static void demux_wv_send_headers(demux_plugin_t *const this_gen) { /* Send header to decoder */ if (this->audio_fifo) { buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); - + buf->type = BUF_AUDIO_WAVPACK; buf->decoder_flags = BUF_FLAG_HEADER|BUF_FLAG_STDHEADER|BUF_FLAG_FRAME_END; buf->decoder_info[0] = this->input->get_length(this->input); @@ -362,12 +362,12 @@ static demux_plugin_t *open_plugin (demux_class_t *const class_gen, case METHOD_BY_CONTENT: case METHOD_EXPLICIT: - + if (!open_wv_file(this)) { free (this); return NULL; } - + break; default: diff --git a/src/combined/ffmpeg/ff_audio_decoder.c b/src/combined/ffmpeg/ff_audio_decoder.c index 24c193b44..bd3ada69d 100644 --- a/src/combined/ffmpeg/ff_audio_decoder.c +++ b/src/combined/ffmpeg/ff_audio_decoder.c @@ -1,25 +1,25 @@ /* * Copyright (C) 2001-2008 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * xine audio decoder plugin using ffmpeg */ - + #ifdef HAVE_CONFIG_H #include "config.h" #include "../../libffmpeg/ffmpeg_config.h" @@ -66,7 +66,7 @@ typedef struct ff_audio_decoder_s { AVCodecContext *context; AVCodec *codec; - + char *decode_buffer; int decoder_ok; @@ -79,7 +79,7 @@ typedef struct ff_audio_decoder_s { if (size > this->bufsize) { this->bufsize = size + size / 2; xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - _("ffmpeg_audio_dec: increasing buffer to %d to avoid overflow.\n"), + _("ffmpeg_audio_dec: increasing buffer to %d to avoid overflow.\n"), this->bufsize); this->buf = realloc( this->buf, this->bufsize ); } @@ -102,15 +102,15 @@ static void ff_audio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) ff_audio_ensure_buffer_size(this, this->size + buf->size); memcpy(this->buf + this->size, buf->content, buf->size); this->size += buf->size; - + if (buf->decoder_flags & BUF_FLAG_FRAME_END) { size_t i; unsigned int codec_type; xine_waveformatex *audio_header; - + codec_type = buf->type & 0xFFFF0000; this->codec = NULL; - + for(i = 0; i < sizeof(ff_audio_lookup)/sizeof(ff_codec_t); i++) if(ff_audio_lookup[i].type == codec_type) { pthread_mutex_lock (&ffmpeg_lock); @@ -120,57 +120,57 @@ static void ff_audio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) ff_audio_lookup[i].name); break; } - + if (!this->codec) { - xprintf (this->stream->xine, XINE_VERBOSITY_LOG, + xprintf (this->stream->xine, XINE_VERBOSITY_LOG, _("ffmpeg_audio_dec: couldn't find ffmpeg decoder for buf type 0x%X\n"), codec_type); _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_HANDLED, 0); return; } - + this->context = avcodec_alloc_context(); - + if(buf->decoder_flags & BUF_FLAG_STDHEADER) { this->audio_sample_rate = buf->decoder_info[1]; this->audio_channels = buf->decoder_info[3]; - + if(this->size) { audio_header = (xine_waveformatex *)this->buf; - + this->context->block_align = audio_header->nBlockAlign; this->context->bit_rate = audio_header->nAvgBytesPerSec * 8; - + if(audio_header->cbSize > 0) { this->context->extradata = malloc(audio_header->cbSize); this->context->extradata_size = audio_header->cbSize; - memcpy( this->context->extradata, + memcpy( this->context->extradata, (uint8_t *)audio_header + sizeof(xine_waveformatex), - audio_header->cbSize ); + audio_header->cbSize ); } } } else { short *ptr; - + switch(codec_type) { case BUF_AUDIO_14_4: this->audio_sample_rate = 8000; this->audio_channels = 1; - + this->context->block_align = 240; break; case BUF_AUDIO_28_8: this->audio_sample_rate = _X_BE_16(&this->buf[0x30]); this->audio_channels = this->buf[0x37]; /* this->audio_bits = buf->content[0x35] */ - + this->context->block_align = _X_BE_32(&this->buf[0x18]); this->context->extradata_size = 5*sizeof(short); this->context->extradata = malloc(this->context->extradata_size); - + ptr = (short *) this->context->extradata; - + ptr[0] = _X_BE_16(&this->buf[0x2C]); /* subpacket size */ ptr[1] = _X_BE_16(&this->buf[0x28]); /* subpacket height */ ptr[2] = _X_BE_16(&this->buf[0x16]); /* subpacket flavour */ @@ -227,23 +227,23 @@ static void ff_audio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) break; } } - - /* Current ffmpeg audio decoders always use 16 bits/sample + + /* Current ffmpeg audio decoders always use 16 bits/sample * buf->decoder_info[2] can't be used as it doesn't refer to the output * bits/sample for some codecs (e.g. MS ADPCM) */ - this->audio_bits = 16; - + this->audio_bits = 16; + this->context->bits_per_sample = this->audio_bits; this->context->sample_rate = this->audio_sample_rate; this->context->channels = this->audio_channels; this->context->codec_id = this->codec->id; this->context->codec_type = this->codec->type; this->context->codec_tag = _x_stream_info_get(this->stream, XINE_STREAM_INFO_AUDIO_FOURCC); - + this->size = 0; - + this->decode_buffer = calloc(1, AVCODEC_MAX_AUDIO_FRAME_SIZE); - + return; } } else if ((buf->decoder_flags & BUF_FLAG_SPECIAL) && @@ -268,12 +268,12 @@ static void ff_audio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) pthread_mutex_lock (&ffmpeg_lock); if (avcodec_open (this->context, this->codec) < 0) { pthread_mutex_unlock (&ffmpeg_lock); - xprintf (this->stream->xine, XINE_VERBOSITY_LOG, + xprintf (this->stream->xine, XINE_VERBOSITY_LOG, _("ffmpeg_audio_dec: couldn't open decoder\n")); _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_HANDLED, 0); return; } - pthread_mutex_unlock (&ffmpeg_lock); + pthread_mutex_unlock (&ffmpeg_lock); this->decoder_ok = 1; } @@ -311,14 +311,14 @@ static void ff_audio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) offset = 0; while (this->size>0) { decode_buffer_size = AVCODEC_MAX_AUDIO_FRAME_SIZE; - bytes_consumed = avcodec_decode_audio2 (this->context, + bytes_consumed = avcodec_decode_audio2 (this->context, (int16_t *)this->decode_buffer, - &decode_buffer_size, + &decode_buffer_size, &this->buf[offset], this->size); if (bytes_consumed<0) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "ffmpeg_audio_dec: error decompressing audio frame\n"); this->size=0; return; @@ -338,10 +338,10 @@ static void ff_audio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) return; } - audio_buffer = + audio_buffer = this->stream->audio_out->get_buffer (this->stream->audio_out); if (audio_buffer->mem_size == 0) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "ffmpeg_audio_dec: Help! Allocated audio buffer with nothing in it!\n"); return; } @@ -377,7 +377,7 @@ static void ff_audio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) static void ff_audio_reset (audio_decoder_t *this_gen) { ff_audio_decoder_t *this = (ff_audio_decoder_t *) this_gen; - + this->size = 0; /* try to reset the wma decoder */ @@ -396,7 +396,7 @@ static void ff_audio_discontinuity (audio_decoder_t *this_gen) { static void ff_audio_dispose (audio_decoder_t *this_gen) { ff_audio_decoder_t *this = (ff_audio_decoder_t *) this_gen; - + if( this->context && this->decoder_ok ) { pthread_mutex_lock (&ffmpeg_lock); avcodec_close (this->context); @@ -437,7 +437,7 @@ static audio_decoder_t *ff_audio_open_plugin (audio_decoder_class_t *class_gen, this->size = 0; this->bufsize = 0; this->decoder_ok = 0; - + ff_audio_ensure_buffer_size(this, AUDIOBUFSIZE); return &this->audio_decoder; diff --git a/src/combined/ffmpeg/ff_dvaudio_decoder.c b/src/combined/ffmpeg/ff_dvaudio_decoder.c index 6a102f627..4d78162df 100644 --- a/src/combined/ffmpeg/ff_dvaudio_decoder.c +++ b/src/combined/ffmpeg/ff_dvaudio_decoder.c @@ -1,25 +1,25 @@ /* * Copyright (C) 2005 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * dv audio decoder based on patch by Dan Dennedy */ - + #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -246,29 +246,29 @@ static void dvaudio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) int out; audio_buffer_t *audio_buffer; int bytes_to_send; - + if (buf->decoder_flags & BUF_FLAG_PREVIEW) return; - + if (buf->decoder_flags & BUF_FLAG_STDHEADER) { this->buf = calloc(1, AUDIOBUFSIZE); this->bufsize = AUDIOBUFSIZE; this->size = 0; this->decode_buffer = calloc(1, MAXFRAMESIZE); - + this->audio_sample_rate = buf->decoder_info[1]; this->audio_bits = buf->decoder_info[2]; this->audio_channels = buf->decoder_info[3]; - + _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, "DV Audio"); - + this->decoder_ok = 1; - + return; } - + if (this->decoder_ok && !(buf->decoder_flags & (BUF_FLAG_HEADER|BUF_FLAG_SPECIAL))) { - + if (!this->output_open) { this->output_open = (this->stream->audio_out->open) (this->stream->audio_out, this->stream, this->audio_bits, this->audio_sample_rate, @@ -278,11 +278,11 @@ static void dvaudio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) /* if the audio still isn't open, bail */ if (!this->output_open) return; - + if( this->size + buf->size > this->bufsize ) { this->bufsize = this->size + 2 * buf->size; xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - _("dvaudio: increasing buffer to %d to avoid overflow.\n"), + _("dvaudio: increasing buffer to %d to avoid overflow.\n"), this->bufsize); this->buf = realloc( this->buf, this->bufsize ); } @@ -300,14 +300,14 @@ static void dvaudio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) bytes_consumed = dv_frame_profile(&this->buf[offset])->frame_size; else bytes_consumed = decode_buffer_size; - + /* dispatch the decoded audio */ out = 0; while (out < decode_buffer_size) { - audio_buffer = + audio_buffer = this->stream->audio_out->get_buffer (this->stream->audio_out); if (audio_buffer->mem_size == 0) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "dvaudio: Help! Allocated audio buffer with nothing in it!\n"); return; } @@ -343,7 +343,7 @@ static void dvaudio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) static void dvaudio_reset (audio_decoder_t *this_gen) { dvaudio_decoder_t *this = (dvaudio_decoder_t *) this_gen; - + this->size = 0; } @@ -353,7 +353,7 @@ static void dvaudio_discontinuity (audio_decoder_t *this_gen) { static void dvaudio_dispose (audio_decoder_t *this_gen) { dvaudio_decoder_t *this = (dvaudio_decoder_t *) this_gen; - + if (this->output_open) this->stream->audio_out->close (this->stream->audio_out, this->stream); this->output_open = 0; @@ -381,7 +381,7 @@ static audio_decoder_t *dvaudio_open_plugin (audio_decoder_class_t *class_gen, x this->buf = NULL; this->size = 0; this->decoder_ok = 0; - + return &this->audio_decoder; } @@ -411,7 +411,7 @@ static void *init_dvaudio_plugin (xine_t *xine, void *data) { return this; } -static uint32_t supported_audio_types[] = { +static uint32_t supported_audio_types[] = { BUF_AUDIO_DV, 0 }; @@ -420,13 +420,13 @@ static const decoder_info_t dec_info_dvaudio = { supported_audio_types, /* supported types */ 5 /* priority */ }; - + /* * exported plugin catalog entry */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_AUDIO_DECODER, 15, "dvaudio", XINE_VERSION_CODE, &dec_info_dvaudio, init_dvaudio_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/combined/ffmpeg/ff_mpeg_parser.c b/src/combined/ffmpeg/ff_mpeg_parser.c index 3c2c2cf48..54f7d6c94 100644 --- a/src/combined/ffmpeg/ff_mpeg_parser.c +++ b/src/combined/ffmpeg/ff_mpeg_parser.c @@ -57,7 +57,7 @@ void mpeg_parser_init (mpeg_parser_t *parser) void mpeg_parser_dispose (mpeg_parser_t *parser) { if ( parser == NULL ) return; - + free(parser->chunk_buffer); } @@ -124,7 +124,7 @@ static int parse_chunk (mpeg_parser_t *parser, int code, uint8_t *buffer, int le { int is_frame_done; int next_code = parser->code; - + /* wait for sequence_header_code */ if (parser->is_sequence_needed) { if (code != 0xb3) { @@ -133,7 +133,7 @@ static int parse_chunk (mpeg_parser_t *parser, int code, uint8_t *buffer, int le return 0; } } - + is_frame_done = parser->in_slice && ((!next_code) || (next_code == 0xb7)); if (is_frame_done) @@ -141,7 +141,7 @@ static int parse_chunk (mpeg_parser_t *parser, int code, uint8_t *buffer, int le switch (code) { case 0x00: /* picture_start_code */ - + parse_header_picture (parser, buffer); parser->in_slice = 1; @@ -150,11 +150,11 @@ static int parse_chunk (mpeg_parser_t *parser, int code, uint8_t *buffer, int le case B_TYPE: lprintf ("B-Frame\n"); break; - + case P_TYPE: lprintf ("P-Frame\n"); break; - + case I_TYPE: lprintf ("I-Frame\n"); break; @@ -169,11 +169,11 @@ static int parse_chunk (mpeg_parser_t *parser, int code, uint8_t *buffer, int le { int value; uint16_t width, height; - + if (parser->is_sequence_needed) { parser->is_sequence_needed = 0; } - + if ((buffer[6] & 0x20) != 0x20) { lprintf("Invalid sequence: missing marker_bit\n"); parser->has_sequence = 0; @@ -185,7 +185,7 @@ static int parse_chunk (mpeg_parser_t *parser, int code, uint8_t *buffer, int le buffer[2]; width = ((value >> 12) + 15) & ~15; height = ((value & 0xfff) + 15) & ~15; - + if ((width > 1920) || (height > 1152)) { lprintf("Invalid sequence: width=%d, height=%d\n", width, height); parser->has_sequence = 0; @@ -196,7 +196,7 @@ static int parse_chunk (mpeg_parser_t *parser, int code, uint8_t *buffer, int le parser->height = height; parser->rate_code = buffer[3] & 15; parser->aspect_ratio_info = buffer[3] >> 4; - + if (parser->rate_code < (sizeof(frame_rate_tab)/sizeof(*frame_rate_tab))) { parser->frame_duration = 90000; parser->frame_duration *= frame_rate_tab[parser->rate_code][1]; @@ -211,7 +211,7 @@ static int parse_chunk (mpeg_parser_t *parser, int code, uint8_t *buffer, int le parser->is_mpeg1 = 1; } break; - + case 0xb5: /* extension_start_code */ switch (buffer[0] & 0xf0) { case 0x10: /* sequence extension */ @@ -282,7 +282,7 @@ uint8_t *mpeg_parser_decode_data (mpeg_parser_t *parser, ret = 0; *flush = 0; - + while (current != end) { if (parser->chunk_ptr == parser->chunk_buffer) { /* write the beginning of the chunk */ @@ -294,9 +294,9 @@ uint8_t *mpeg_parser_decode_data (mpeg_parser_t *parser, parser->chunk_start = parser->chunk_ptr; parser->has_sequence = 0; } - + code = parser->code; - + current = copy_chunk (parser, current, end); if (current == NULL) return NULL; @@ -309,10 +309,10 @@ uint8_t *mpeg_parser_decode_data (mpeg_parser_t *parser, } parser->buffer_size = parser->chunk_ptr - parser->chunk_buffer - 4; parser->chunk_ptr = parser->chunk_buffer; - + if (parser->code == 0xb7) /* sequence end, maybe a still menu */ *flush = 1; - + return current; } } diff --git a/src/combined/ffmpeg/ff_mpeg_parser.h b/src/combined/ffmpeg/ff_mpeg_parser.h index ea43a6ce4..5797933df 100644 --- a/src/combined/ffmpeg/ff_mpeg_parser.h +++ b/src/combined/ffmpeg/ff_mpeg_parser.h @@ -49,7 +49,7 @@ typedef struct mpeg_parser_s { uint8_t in_slice:1; uint8_t rate_code:4; - + int aspect_ratio_info; /* public properties */ diff --git a/src/combined/ffmpeg/ff_video_decoder.c b/src/combined/ffmpeg/ff_video_decoder.c index 98caac269..093ca4776 100644 --- a/src/combined/ffmpeg/ff_video_decoder.c +++ b/src/combined/ffmpeg/ff_video_decoder.c @@ -1,25 +1,25 @@ /* * Copyright (C) 2001-2008 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * xine video decoder plugin using ffmpeg */ - + #ifdef HAVE_CONFIG_H #include "config.h" #include "../../libffmpeg/ffmpeg_config.h" @@ -73,7 +73,7 @@ typedef struct ff_video_class_s { int thread_count; int8_t skip_loop_filter_enum; int8_t choose_speed_over_accuracy; - + xine_t *xine; } ff_video_class_t; @@ -107,13 +107,13 @@ struct ff_video_decoder_s { int bufsize; int size; int skipframes; - + int slice_offset_size; AVFrame *av_frame; AVCodecContext *context; AVCodec *codec; - + int pp_quality; int pp_flags; pp_context_t *pp_context; @@ -126,7 +126,7 @@ struct ff_video_decoder_s { int aspect_ratio_prio; int frame_flags; int crop_right, crop_bottom; - + int output_format; xine_list_t *dr1_frames; @@ -154,7 +154,7 @@ static int get_buffer(AVCodecContext *context, AVFrame *av_frame){ vo_frame_t *img; int width = context->width; int height = context->height; - + if (!this->bih.biWidth || !this->bih.biHeight) { this->bih.biWidth = width; this->bih.biHeight = height; @@ -166,12 +166,12 @@ static int get_buffer(AVCodecContext *context, AVFrame *av_frame){ set_stream_info(this); } } - + avcodec_align_dimensions(context, &width, &height); if( this->context->pix_fmt != PIX_FMT_YUV420P && this->context->pix_fmt != PIX_FMT_YUVJ420P ) { if (!this->is_direct_rendering_disabled) { - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("ffmpeg_video_dec: unsupported frame format, DR1 disabled.\n")); this->is_direct_rendering_disabled = 1; } @@ -182,14 +182,14 @@ static int get_buffer(AVCodecContext *context, AVFrame *av_frame){ av_frame->data[2]= NULL; return avcodec_default_get_buffer(context, av_frame); } - + if((width != this->bih.biWidth) || (height != this->bih.biHeight)) { if(this->stream->video_out->get_capabilities(this->stream->video_out) & VO_CAP_CROP) { this->crop_right = width - this->bih.biWidth; this->crop_bottom = height - this->bih.biHeight; } else { if (!this->is_direct_rendering_disabled) { - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("ffmpeg_video_dec: unsupported frame dimensions, DR1 disabled.\n")); this->is_direct_rendering_disabled = 1; } @@ -204,7 +204,7 @@ static int get_buffer(AVCodecContext *context, AVFrame *av_frame){ img = this->stream->video_out->get_frame (this->stream->video_out, width, height, - this->aspect_ratio, + this->aspect_ratio, this->output_format, VO_BOTH_FIELDS|this->frame_flags); @@ -246,7 +246,7 @@ static void release_buffer(struct AVCodecContext *context, AVFrame *av_frame){ } xine_list_iterator_t it; - + it = xine_list_find(this->dr1_frames, av_frame); assert(it); if( it != NULL ) @@ -300,7 +300,7 @@ static void init_video_codec (ff_video_decoder_t *this, unsigned int codec_type) } if (!this->codec) { - xprintf (this->stream->xine, XINE_VERBOSITY_LOG, + xprintf (this->stream->xine, XINE_VERBOSITY_LOG, _("ffmpeg_video_dec: couldn't find ffmpeg decoder for buf type 0x%X\n"), codec_type); _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_HANDLED, 0); @@ -309,14 +309,14 @@ static void init_video_codec (ff_video_decoder_t *this, unsigned int codec_type) lprintf("lavc decoder found\n"); - /* force (width % 8 == 0), otherwise there will be - * display problems with Xv. - */ + /* force (width % 8 == 0), otherwise there will be + * display problems with Xv. + */ this->bih.biWidth = (this->bih.biWidth + 1) & (~1); this->context->width = this->bih.biWidth; this->context->height = this->bih.biHeight; - this->context->stream_codec_tag = this->context->codec_tag = + this->context->stream_codec_tag = this->context->codec_tag = _x_stream_info_get(this->stream, XINE_STREAM_INFO_VIDEO_FOURCC); @@ -325,14 +325,14 @@ static void init_video_codec (ff_video_decoder_t *this, unsigned int codec_type) if(this->codec->capabilities & CODEC_CAP_DR1 && this->codec->id != CODEC_ID_H264) { this->context->flags |= CODEC_FLAG_EMU_EDGE; } - + if (this->class->choose_speed_over_accuracy) this->context->flags2 |= CODEC_FLAG2_FAST; pthread_mutex_lock(&ffmpeg_lock); if (avcodec_open (this->context, this->codec) < 0) { pthread_mutex_unlock(&ffmpeg_lock); - xprintf (this->stream->xine, XINE_VERBOSITY_LOG, + xprintf (this->stream->xine, XINE_VERBOSITY_LOG, _("ffmpeg_video_dec: couldn't open decoder\n")); free(this->context); this->context = NULL; @@ -340,14 +340,14 @@ static void init_video_codec (ff_video_decoder_t *this, unsigned int codec_type) return; } - if (this->codec->id == CODEC_ID_VC1 && + if (this->codec->id == CODEC_ID_VC1 && (!this->bih.biWidth || !this->bih.biHeight)) { /* VC1 codec must be re-opened with correct width and height. */ avcodec_close(this->context); if (avcodec_open (this->context, this->codec) < 0) { pthread_mutex_unlock(&ffmpeg_lock); - xprintf (this->stream->xine, XINE_VERBOSITY_LOG, + xprintf (this->stream->xine, XINE_VERBOSITY_LOG, _("ffmpeg_video_dec: couldn't open decoder (pass 2)\n")); free(this->context); this->context = NULL; @@ -384,14 +384,14 @@ static void init_video_codec (ff_video_decoder_t *this, unsigned int codec_type) (this->stream->video_out->open) (this->stream->video_out, this->stream); this->skipframes = 0; - + /* enable direct rendering by default */ this->output_format = XINE_IMGFMT_YV12; #ifdef ENABLE_DIRECT_RENDERING if( this->codec->capabilities & CODEC_CAP_DR1 && this->codec->id != CODEC_ID_H264 ) { this->context->get_buffer = get_buffer; this->context->release_buffer = release_buffer; - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("ffmpeg_video_dec: direct rendering enabled\n")); } #endif @@ -422,25 +422,25 @@ static void init_video_codec (ff_video_decoder_t *this, unsigned int codec_type) static void choose_speed_over_accuracy_cb(void *user_data, xine_cfg_entry_t *entry) { ff_video_class_t *class = (ff_video_class_t *) user_data; - + class->choose_speed_over_accuracy = entry->num_value; } static void skip_loop_filter_enum_cb(void *user_data, xine_cfg_entry_t *entry) { ff_video_class_t *class = (ff_video_class_t *) user_data; - + class->skip_loop_filter_enum = entry->num_value; } static void thread_count_cb(void *user_data, xine_cfg_entry_t *entry) { ff_video_class_t *class = (ff_video_class_t *) user_data; - + class->thread_count = entry->num_value; } static void pp_quality_cb(void *user_data, xine_cfg_entry_t *entry) { ff_video_class_t *class = (ff_video_class_t *) user_data; - + class->pp_quality = entry->num_value; } @@ -453,15 +453,15 @@ static void pp_change_quality (ff_video_decoder_t *this) { this->pp_flags); if(this->pp_mode) pp_free_mode(this->pp_mode); - - this->pp_mode = pp_get_mode_by_name_and_quality("hb:a,vb:a,dr:a", + + this->pp_mode = pp_get_mode_by_name_and_quality("hb:a,vb:a,dr:a", this->pp_quality); } else { if(this->pp_mode) { pp_free_mode(this->pp_mode); this->pp_mode = NULL; } - + if(this->pp_context) { pp_free_context(this->pp_context); this->pp_context = NULL; @@ -486,22 +486,22 @@ static void init_postprocess (ff_video_decoder_t *this) { this->pp_available = 0; break; } - + /* Detect what cpu accel we have */ cpu_caps = xine_mm_accel(); this->pp_flags = PP_FORMAT_420; - + if(cpu_caps & MM_ACCEL_X86_MMX) this->pp_flags |= PP_CPU_CAPS_MMX; - + if(cpu_caps & MM_ACCEL_X86_MMXEXT) this->pp_flags |= PP_CPU_CAPS_MMX2; - - if(cpu_caps & MM_ACCEL_X86_3DNOW) + + if(cpu_caps & MM_ACCEL_X86_3DNOW) this->pp_flags |= PP_CPU_CAPS_3DNOW; - + /* Set level */ - pp_change_quality(this); + pp_change_quality(this); } static int ff_handle_mpeg_sequence(ff_video_decoder_t *this, mpeg_parser_t *parser) { @@ -510,13 +510,13 @@ static int ff_handle_mpeg_sequence(ff_video_decoder_t *this, mpeg_parser_t *pars * init codec */ if (this->decoder_init_mode) { - _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, + _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, "mpeg-1 (ffmpeg)"); init_video_codec (this, BUF_VIDEO_MPEG); this->decoder_init_mode = 0; } - + /* frame format change */ if ((parser->width != this->bih.biWidth) || (parser->height != this->bih.biHeight) || @@ -542,7 +542,7 @@ static int ff_handle_mpeg_sequence(ff_video_decoder_t *this, mpeg_parser_t *pars xine_event_send(this->stream, &event); } this->video_step = this->mpeg_parser->frame_duration; - + return 1; } @@ -611,7 +611,7 @@ static void ff_convert_frame(ff_video_decoder_t *this, vo_frame_t *img) { this->bih.biHeight); } else if (this->context->pix_fmt == PIX_FMT_RGB32) { - + int x, plane_ptr = 0; uint32_t *argb_pixels; uint32_t argb; @@ -620,7 +620,7 @@ static void ff_convert_frame(ff_video_decoder_t *this, vo_frame_t *img) { argb_pixels = (uint32_t *)sy; for(x = 0; x < img->width; x++) { uint8_t r, g, b; - + /* this is endian-safe as the ARGB pixels are stored in * machine order */ argb = *argb_pixels++; @@ -635,9 +635,9 @@ static void ff_convert_frame(ff_video_decoder_t *this, vo_frame_t *img) { } sy += this->av_frame->linesize[0]; } - + yuv444_to_yuy2(&this->yuv, img->base[0], img->pitches[0]); - + } else if (this->context->pix_fmt == PIX_FMT_RGB565) { int x, plane_ptr = 0; @@ -648,7 +648,7 @@ static void ff_convert_frame(ff_video_decoder_t *this, vo_frame_t *img) { src = sy; for(x = 0; x < img->width; x++) { uint8_t r, g, b; - + /* a 16-bit RGB565 pixel is supposed to be stored in native-endian * byte order; the following should be endian-safe */ pixel16 = *((uint16_t *)src); @@ -664,20 +664,20 @@ static void ff_convert_frame(ff_video_decoder_t *this, vo_frame_t *img) { } sy += this->av_frame->linesize[0]; } - + yuv444_to_yuy2(&this->yuv, img->base[0], img->pitches[0]); - + } else if (this->context->pix_fmt == PIX_FMT_RGB555) { - + int x, plane_ptr = 0; uint8_t *src; uint16_t pixel16; - + for(y = 0; y < this->bih.biHeight; y++) { src = sy; for(x = 0; x < img->width; x++) { uint8_t r, g, b; - + /* a 16-bit RGB555 pixel is supposed to be stored in native-endian * byte order; the following should be endian-safe */ pixel16 = *((uint16_t *)src); @@ -693,9 +693,9 @@ static void ff_convert_frame(ff_video_decoder_t *this, vo_frame_t *img) { } sy += this->av_frame->linesize[0]; } - + yuv444_to_yuy2(&this->yuv, img->base[0], img->pitches[0]); - + } else if (this->context->pix_fmt == PIX_FMT_BGR24) { int x, plane_ptr = 0; @@ -705,7 +705,7 @@ static void ff_convert_frame(ff_video_decoder_t *this, vo_frame_t *img) { src = sy; for(x = 0; x < img->width; x++) { uint8_t r, g, b; - + b = *src++; g = *src++; r = *src++; @@ -717,9 +717,9 @@ static void ff_convert_frame(ff_video_decoder_t *this, vo_frame_t *img) { } sy += this->av_frame->linesize[0]; } - + yuv444_to_yuy2(&this->yuv, img->base[0], img->pitches[0]); - + } else if (this->context->pix_fmt == PIX_FMT_RGB24) { int x, plane_ptr = 0; @@ -729,7 +729,7 @@ static void ff_convert_frame(ff_video_decoder_t *this, vo_frame_t *img) { src = sy; for(x = 0; x < img->width; x++) { uint8_t r, g, b; - + r = *src++; g = *src++; b = *src++; @@ -741,11 +741,11 @@ static void ff_convert_frame(ff_video_decoder_t *this, vo_frame_t *img) { } sy += this->av_frame->linesize[0]; } - + yuv444_to_yuy2(&this->yuv, img->base[0], img->pitches[0]); - + } else if (this->context->pix_fmt == PIX_FMT_PAL8) { - + int x, plane_ptr = 0; uint8_t *src; uint8_t pixel; @@ -780,34 +780,34 @@ static void ff_convert_frame(ff_video_decoder_t *this, vo_frame_t *img) { } sy += this->av_frame->linesize[0]; } - + yuv444_to_yuy2(&this->yuv, img->base[0], img->pitches[0]); - + } else { - + for (y = 0; y < this->bih.biHeight; y++) { xine_fast_memcpy (dy, sy, img->width); - + dy += img->pitches[0]; - + sy += this->av_frame->linesize[0]; } for (y = 0; y < this->bih.biHeight / 2; y++) { - + if (this->context->pix_fmt != PIX_FMT_YUV444P) { - + xine_fast_memcpy (du, su, img->width/2); xine_fast_memcpy (dv, sv, img->width/2); - + } else { - + int x; uint8_t *src; uint8_t *dst; - + /* subsample */ - + src = su; dst = du; for (x=0; x<(img->width/2); x++) { *dst = *src; @@ -822,7 +822,7 @@ static void ff_convert_frame(ff_video_decoder_t *this, vo_frame_t *img) { } } - + du += img->pitches[1]; dv += img->pitches[2]; @@ -840,8 +840,8 @@ static void ff_convert_frame(ff_video_decoder_t *this, vo_frame_t *img) { static void ff_check_bufsize (ff_video_decoder_t *this, int size) { if (size > this->bufsize) { this->bufsize = size + size / 2; - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - _("ffmpeg_video_dec: increasing buffer to %d to avoid overflow.\n"), + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("ffmpeg_video_dec: increasing buffer to %d to avoid overflow.\n"), this->bufsize); this->buf = realloc(this->buf, this->bufsize + FF_INPUT_BUFFER_PADDING_SIZE ); } @@ -887,28 +887,28 @@ static void ff_handle_header_buffer (ff_video_decoder_t *this, buf_element_t *bu if (buf->decoder_flags & BUF_FLAG_STDHEADER) { lprintf("standard header\n"); - + /* init package containing bih */ memcpy ( &this->bih, this->buf, sizeof(xine_bmiheader) ); if (this->bih.biSize > sizeof(xine_bmiheader)) { this->context->extradata_size = this->bih.biSize - sizeof(xine_bmiheader); - this->context->extradata = malloc(this->context->extradata_size + + this->context->extradata = malloc(this->context->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); memcpy(this->context->extradata, this->buf + sizeof(xine_bmiheader), this->context->extradata_size); } - + this->context->bits_per_sample = this->bih.biBitCount; - + } else { - + switch (codec_type) { case BUF_VIDEO_RV10: case BUF_VIDEO_RV20: this->bih.biWidth = _X_BE_16(&this->buf[12]); this->bih.biHeight = _X_BE_16(&this->buf[14]); - + this->context->sub_id = _X_BE_32(&this->buf[30]); this->context->slice_offset = calloc(SLICE_OFFSET_SIZE, sizeof(int)); @@ -950,7 +950,7 @@ static void ff_handle_header_buffer (ff_video_decoder_t *this, buf_element_t *bu } static void ff_handle_special_buffer (ff_video_decoder_t *this, buf_element_t *buf) { - /* take care of all the various types of special buffers + /* take care of all the various types of special buffers * note that order is important here */ lprintf("special buffer\n"); @@ -959,34 +959,34 @@ static void ff_handle_special_buffer (ff_video_decoder_t *this, buf_element_t *b lprintf("BUF_SPECIAL_STSD_ATOM\n"); this->context->extradata_size = buf->decoder_info[2]; - this->context->extradata = malloc(buf->decoder_info[2] + + this->context->extradata = malloc(buf->decoder_info[2] + FF_INPUT_BUFFER_PADDING_SIZE); memcpy(this->context->extradata, buf->decoder_info_ptr[2], buf->decoder_info[2]); } else if (buf->decoder_info[1] == BUF_SPECIAL_DECODER_CONFIG && !this->context->extradata_size) { - + lprintf("BUF_SPECIAL_DECODER_CONFIG\n"); this->context->extradata_size = buf->decoder_info[2]; this->context->extradata = malloc(buf->decoder_info[2] + FF_INPUT_BUFFER_PADDING_SIZE); memcpy(this->context->extradata, buf->decoder_info_ptr[2], buf->decoder_info[2]); - + } else if (buf->decoder_info[1] == BUF_SPECIAL_PALETTE) { unsigned int i; palette_entry_t *demuxer_palette; AVPaletteControl *decoder_palette; - + lprintf("BUF_SPECIAL_PALETTE\n"); this->context->palctrl = &this->palette_control; decoder_palette = (AVPaletteControl *)this->context->palctrl; demuxer_palette = (palette_entry_t *)buf->decoder_info_ptr[2]; for (i = 0; i < buf->decoder_info[2]; i++) { - decoder_palette->palette[i] = + decoder_palette->palette[i] = (demuxer_palette[i].r << 16) | (demuxer_palette[i].g << 8) | (demuxer_palette[i].b << 0); @@ -995,20 +995,20 @@ static void ff_handle_special_buffer (ff_video_decoder_t *this, buf_element_t *b } else if (buf->decoder_info[1] == BUF_SPECIAL_RV_CHUNK_TABLE) { int i; - + lprintf("BUF_SPECIAL_RV_CHUNK_TABLE\n"); this->context->slice_count = buf->decoder_info[2]+1; lprintf("slice_count=%d\n", this->context->slice_count); - + if(this->context->slice_count > this->slice_offset_size) { this->context->slice_offset = realloc(this->context->slice_offset, sizeof(int)*this->context->slice_count); this->slice_offset_size = this->context->slice_count; } - + for(i = 0; i < this->context->slice_count; i++) { - this->context->slice_offset[i] = + this->context->slice_offset[i] = ((uint32_t *) buf->decoder_info_ptr[2])[(2*i)+1]; lprintf("slice_offset[%d]=%d\n", i, this->context->slice_offset[i]); } @@ -1051,7 +1051,7 @@ static void ff_handle_mpeg12_buffer (ff_video_decoder_t *this, buf_element_t *bu if (!this->decoder_ok) return; - + if (flush) { lprintf("flush lavc buffers\n"); /* hack: ffmpeg outputs the last frame if size=0 */ @@ -1069,11 +1069,11 @@ static void ff_handle_mpeg12_buffer (ff_video_decoder_t *this, buf_element_t *bu len, got_picture); len = current - buf->content - offset; lprintf("avcodec_decode_video: consumed_size=%d\n", len); - + flush = next_flush; if ((len < 0) || (len > buf->size)) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "ffmpeg_video_dec: error decompressing frame\n"); size = 0; /* draw a bad frame and exit */ } else { @@ -1088,7 +1088,7 @@ static void ff_handle_mpeg12_buffer (ff_video_decoder_t *this, buf_element_t *bu img = this->stream->video_out->get_frame (this->stream->video_out, this->bih.biWidth, this->bih.biHeight, - this->aspect_ratio, + this->aspect_ratio, this->output_format, VO_BOTH_FIELDS|this->frame_flags); free_img = 1; @@ -1108,7 +1108,7 @@ static void ff_handle_mpeg12_buffer (ff_video_decoder_t *this, buf_element_t *bu img->crop_right = this->crop_right; img->crop_bottom = this->crop_bottom; - + this->skipframes = img->draw(img, this->stream); if(free_img) @@ -1121,7 +1121,7 @@ static void ff_handle_mpeg12_buffer (ff_video_decoder_t *this, buf_element_t *bu img = this->stream->video_out->get_frame (this->stream->video_out, this->bih.biWidth, this->bih.biHeight, - this->aspect_ratio, + this->aspect_ratio, this->output_format, VO_BOTH_FIELDS|this->frame_flags); img->pts = 0; @@ -1265,7 +1265,7 @@ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) { /* data accumulation */ if (buf->size > 0) { if ((this->size == 0) && - ((buf->size + FF_INPUT_BUFFER_PADDING_SIZE) < buf->max_size) && + ((buf->size + FF_INPUT_BUFFER_PADDING_SIZE) < buf->max_size) && (buf->decoder_flags & BUF_FLAG_FRAME_END)) { /* buf contains a complete frame */ /* no memcpy needed */ @@ -1278,7 +1278,7 @@ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) { chunk_buf = this->buf; /* ff_check_bufsize might realloc this->buf */ xine_fast_memcpy (&this->buf[this->size], buf->content, buf->size); - + this->size += buf->size; lprintf("accumulate data into this->buf\n"); } @@ -1301,7 +1301,7 @@ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) { memset(&chunk_buf[this->size], 0, FF_INPUT_BUFFER_PADDING_SIZE); while (this->size > 0) { - + /* DV frames can be completely skipped */ if( codec_type == BUF_VIDEO_DV && this->skipframes ) { this->size = 0; @@ -1322,7 +1322,7 @@ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) { lprintf("consumed size: %d, got_picture: %d\n", len, got_picture); if ((len <= 0) || (len > this->size)) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "ffmpeg_video_dec: error decompressing frame\n"); this->size = 0; @@ -1366,7 +1366,7 @@ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) { this->bih.biHeight = this->context->height; } - this->aspect_ratio = av_q2d(this->context->sample_aspect_ratio) * + this->aspect_ratio = av_q2d(this->context->sample_aspect_ratio) * (double)this->bih.biWidth / (double)this->bih.biHeight; this->aspect_ratio_prio = 2; lprintf("ffmpeg aspect ratio: %f\n", this->aspect_ratio); @@ -1405,7 +1405,7 @@ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) { img = this->stream->video_out->get_frame (this->stream->video_out, (this->bih.biWidth + 15) & ~15, (this->bih.biHeight + 15) & ~15, - this->aspect_ratio, + this->aspect_ratio, this->output_format, VO_BOTH_FIELDS|this->frame_flags); free_img = 1; @@ -1426,17 +1426,17 @@ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) { img = this->stream->video_out->get_frame (this->stream->video_out, (img->width + 15) & ~15, (img->height + 15) & ~15, - this->aspect_ratio, + this->aspect_ratio, this->output_format, VO_BOTH_FIELDS|this->frame_flags); free_img = 1; } - pp_postprocess(this->av_frame->data, this->av_frame->linesize, - img->base, img->pitches, + pp_postprocess(this->av_frame->data, this->av_frame->linesize, + img->base, img->pitches, img->width, img->height, this->av_frame->qscale_table, this->av_frame->qstride, - this->pp_mode, this->pp_context, + this->pp_mode, this->pp_context, this->av_frame->pict_type); } else if (!this->av_frame->opaque) { @@ -1476,7 +1476,7 @@ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) { img->top_field_first = this->av_frame->top_field_first; this->skipframes = img->draw(img, this->stream); - + if(free_img) img->free(img); } @@ -1490,7 +1490,7 @@ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) { img = this->stream->video_out->get_frame (this->stream->video_out, (this->bih.biWidth <= 0) ? 16 : ((this->bih.biWidth + 15) & ~15), (this->bih.biHeight <= 0) ? 16 : ((this->bih.biHeight + 15) & ~15), - this->aspect_ratio, + this->aspect_ratio, this->output_format, VO_BOTH_FIELDS|this->frame_flags); /* set PTS to allow early syncing */ @@ -1520,7 +1520,7 @@ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) { static void ff_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { ff_video_decoder_t *this = (ff_video_decoder_t *) this_gen; - lprintf ("processing packet type = %08x, len = %d, decoder_flags=%08x\n", + lprintf ("processing packet type = %08x, len = %d, decoder_flags=%08x\n", buf->type, buf->size, buf->decoder_flags); if (buf->decoder_flags & BUF_FLAG_FRAMERATE) { @@ -1529,7 +1529,7 @@ static void ff_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { } if (buf->decoder_flags & BUF_FLAG_PREVIEW) { - + ff_handle_preview_buffer(this, buf); } else { @@ -1537,7 +1537,7 @@ static void ff_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { if (buf->decoder_flags & BUF_FLAG_SPECIAL) { ff_handle_special_buffer(this, buf); - + } if (buf->decoder_flags & BUF_FLAG_HEADER) { @@ -1551,7 +1551,7 @@ static void ff_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { lprintf("aspect ratio: %f\n", this->aspect_ratio); set_stream_info(this); } - } + } } else { @@ -1582,7 +1582,7 @@ static void ff_reset (video_decoder_t *this_gen) { if(this->context && this->decoder_ok) avcodec_flush_buffers(this->context); - + if (this->is_mpeg12) mpeg_parser_reset(this->mpeg_parser); @@ -1596,14 +1596,14 @@ static void ff_reset (video_decoder_t *this_gen) { static void ff_discontinuity (video_decoder_t *this_gen) { ff_video_decoder_t *this = (ff_video_decoder_t *) this_gen; - + lprintf ("ff_discontinuity\n"); this->pts = 0; #ifdef AVCODEC_HAS_REORDERED_OPAQUE /* * there is currently no way to reset all the pts which are stored in the decoder. - * therefore, we add a unique tag (generated from pts_tag_counter) to pts (see + * therefore, we add a unique tag (generated from pts_tag_counter) to pts (see * ff_tag_pts()) and wait for it to appear on returned frames. * until then, any retrieved pts value will be reset to 0 (see ff_untag_pts()). * when we see the tag returned, pts_tag will be reset to 0. from now on, any @@ -1640,15 +1640,15 @@ static void ff_dispose (video_decoder_t *this_gen) { ff_video_decoder_t *this = (ff_video_decoder_t *) this_gen; lprintf ("ff_dispose\n"); - + if (this->decoder_ok) { xine_list_iterator_t it; AVFrame *av_frame; - + pthread_mutex_lock(&ffmpeg_lock); avcodec_close (this->context); pthread_mutex_unlock(&ffmpeg_lock); - + /* frame garbage collector here - workaround for buggy ffmpeg codecs that * don't release their DR1 frames */ while( (it = xine_list_front(this->dr1_frames)) != NULL ) @@ -1656,7 +1656,7 @@ static void ff_dispose (video_decoder_t *this_gen) { av_frame = (AVFrame *)xine_list_get_value(this->dr1_frames, it); release_buffer(this->context, av_frame); } - + this->stream->video_out->close(this->stream->video_out, this->stream); this->decoder_ok = 0; } @@ -1669,27 +1669,27 @@ static void ff_dispose (video_decoder_t *this_gen) { if(this->yuv_init) free_yuv_planes(&this->yuv); - + if( this->context ) av_free( this->context ); if( this->av_frame ) av_free( this->av_frame ); - + if (this->buf) free(this->buf); this->buf = NULL; - + if(this->pp_context) pp_free_context(this->pp_context); - + if(this->pp_mode) pp_free_mode(this->pp_mode); mpeg_parser_dispose(this->mpeg_parser); - + xine_list_delete(this->dr1_frames); - + free (this_gen); } @@ -1715,7 +1715,7 @@ static video_decoder_t *ff_video_open_plugin (video_decoder_class_t *class_gen, this->context = avcodec_alloc_context(); this->context->opaque = this; this->context->palctrl = NULL; - + this->decoder_ok = 0; this->decoder_init_mode = 1; this->buf = calloc(1, VIDEOBUFSIZE + FF_INPUT_BUFFER_PADDING_SIZE); @@ -1727,9 +1727,9 @@ static video_decoder_t *ff_video_open_plugin (video_decoder_class_t *class_gen, this->pp_quality = 0; this->pp_context = NULL; this->pp_mode = NULL; - + this->mpeg_parser = NULL; - + this->dr1_frames = xine_list_new(); #ifdef LOG @@ -1755,7 +1755,7 @@ void *init_video_plugin (xine_t *xine, void *data) { ff_video_class_t *this; config_values_t *config; - + this = calloc(1, sizeof (ff_video_class_t)); this->decoder_class.open_plugin = ff_video_open_plugin; @@ -1765,12 +1765,12 @@ void *init_video_plugin (xine_t *xine, void *data) { this->xine = xine; pthread_once( &once_control, init_once_routine ); - + /* Configuration for post processing quality - default to mid (3) for the * moment */ config = xine->config; - - this->pp_quality = xine->config->register_range(config, "video.processing.ffmpeg_pp_quality", 3, + + this->pp_quality = xine->config->register_range(config, "video.processing.ffmpeg_pp_quality", 3, 0, PP_QUALITY_MAX, _("MPEG-4 postprocessing quality"), _("You can adjust the amount of post processing applied to MPEG-4 video.\n" @@ -1779,8 +1779,8 @@ void *init_video_plugin (xine_t *xine, void *data) { "too heavy post processing can actually make the image worse by blurring it " "too much."), 10, pp_quality_cb, this); - - this->thread_count = xine->config->register_num(config, "video.processing.ffmpeg_thread_count", 1, + + this->thread_count = xine->config->register_num(config, "video.processing.ffmpeg_thread_count", 1, _("FFmpeg video decoding thread count"), _("You can adjust the number of video decoding threads which FFmpeg may use.\n" "Higher values should speed up decoding but it depends on the codec used " @@ -1789,7 +1789,7 @@ void *init_video_plugin (xine_t *xine, void *data) { "A change of this setting will take effect with playing the next stream."), 10, thread_count_cb, this); - this->skip_loop_filter_enum = xine->config->register_enum(config, "video.processing.ffmpeg_skip_loop_filter", 0, + this->skip_loop_filter_enum = xine->config->register_enum(config, "video.processing.ffmpeg_skip_loop_filter", 0, (char **)skip_loop_filter_enum_names, _("Skip loop filter"), _("You can control for which frames the loop filter shall be skipped after " @@ -1800,7 +1800,7 @@ void *init_video_plugin (xine_t *xine, void *data) { "A change of this setting will take effect with playing the next stream."), 10, skip_loop_filter_enum_cb, this); - this->choose_speed_over_accuracy = xine->config->register_bool(config, "video.processing.ffmpeg_choose_speed_over_accuracy", 0, + this->choose_speed_over_accuracy = xine->config->register_bool(config, "video.processing.ffmpeg_choose_speed_over_accuracy", 0, _("Choose speed over specification compliance"), _("You may want to allow speed cheats which violate codec specification.\n" "Cheating may speed up decoding but can also lead to decoding artefacts.\n" @@ -1810,14 +1810,14 @@ void *init_video_plugin (xine_t *xine, void *data) { return this; } -static uint32_t wmv8_video_types[] = { +static uint32_t wmv8_video_types[] = { BUF_VIDEO_WMV8, - 0 + 0 }; -static uint32_t wmv9_video_types[] = { +static uint32_t wmv9_video_types[] = { BUF_VIDEO_WMV9, - 0 + 0 }; decoder_info_t dec_info_ffmpeg_video = { diff --git a/src/combined/ffmpeg/ffmpeg_decoder.c b/src/combined/ffmpeg/ffmpeg_decoder.c index 776e07df9..6d0bfa432 100644 --- a/src/combined/ffmpeg/ffmpeg_decoder.c +++ b/src/combined/ffmpeg/ffmpeg_decoder.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2001-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -317,7 +317,7 @@ void init_once_routine(void) { */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_VIDEO_DECODER | PLUGIN_MUST_PRELOAD, 18, "ffmpegvideo", XINE_VERSION_CODE, &dec_info_ffmpeg_video, init_video_plugin }, { PLUGIN_VIDEO_DECODER, 18, "ffmpeg-wmv8", XINE_VERSION_CODE, &dec_info_ffmpeg_wmv8, init_video_plugin }, { PLUGIN_VIDEO_DECODER, 18, "ffmpeg-wmv9", XINE_VERSION_CODE, &dec_info_ffmpeg_wmv9, init_video_plugin }, diff --git a/src/combined/ffmpeg/ffmpeg_decoder.h b/src/combined/ffmpeg/ffmpeg_decoder.h index 0f4ff1f1e..0aeb71271 100644 --- a/src/combined/ffmpeg/ffmpeg_decoder.h +++ b/src/combined/ffmpeg/ffmpeg_decoder.h @@ -1,23 +1,23 @@ /* * Copyright (C) 2001-2005 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA */ - + #ifndef HAVE_XINE_DECODER_H #define HAVE_XINE_DECODER_H diff --git a/src/combined/ffmpeg/ffmpeg_encoder.c b/src/combined/ffmpeg/ffmpeg_encoder.c index 84243a56f..d41023675 100644 --- a/src/combined/ffmpeg/ffmpeg_encoder.c +++ b/src/combined/ffmpeg/ffmpeg_encoder.c @@ -1,23 +1,23 @@ -/* +/* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a unix video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA */ - + /* mpeg encoders for the dxr3 video out plugin. */ #ifdef HAVE_CONFIG_H @@ -46,7 +46,7 @@ # include "../../libffmpeg/libavcodec/avcodec.h" #endif -/* buffer size for encoded mpeg1 stream; will hold one intra frame +/* buffer size for encoded mpeg1 stream; will hold one intra frame * at 640x480 typical sizes are <50 kB. 512 kB should be plenty */ #define DEFAULT_BUFFER_SIZE 512*1024 @@ -76,7 +76,7 @@ int dxr3_encoder_init(dxr3_driver_t *drv) lavc_data_t* this; avcodec_init(); - avcodec_register_all(); + avcodec_register_all(); lprintf("lavc init , version %x\n", avcodec_version()); this = calloc(1, sizeof(lavc_data_t)); if (!this) return 0; @@ -87,7 +87,7 @@ int dxr3_encoder_init(dxr3_driver_t *drv) this->encoder_data.on_display_frame = lavc_on_display_frame; this->encoder_data.on_unneeded = lavc_on_unneeded; this->context = 0; - + drv->enc = &this->encoder_data; return 1; } @@ -100,7 +100,7 @@ static int lavc_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame) lavc_data_t *this = (lavc_data_t *)drv->enc; AVCodec *codec; unsigned char use_quantizer; - + if (this->context) { avcodec_close(this->context); free(this->context); @@ -108,27 +108,27 @@ static int lavc_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame) this->context = NULL; this->picture = NULL; } - + /* if YUY2 and dimensions changed, we need to re-allocate the * internal YV12 buffer */ if (frame->vo_frame.format == XINE_IMGFMT_YUY2) { int image_size = frame->vo_frame.pitches[0] * frame->oheight; - this->out[0] = xine_xmalloc_aligned(16, image_size * 3/2, + this->out[0] = xine_xmalloc_aligned(16, image_size * 3/2, (void *)&this->buf); - this->out[1] = this->out[0] + image_size; - this->out[2] = this->out[1] + image_size/4; + this->out[1] = this->out[0] + image_size; + this->out[2] = this->out[1] + image_size/4; /* fill with black (yuv 16,128,128) */ memset(this->out[0], 16, image_size); memset(this->out[1], 128, image_size/4); memset(this->out[2], 128, image_size/4); - lprintf("Using YUY2->YV12 conversion\n"); + lprintf("Using YUY2->YV12 conversion\n"); } - + /* resolution must be a multiple of two */ if ((frame->vo_frame.pitches[0] % 2 != 0) || (frame->oheight % 2 != 0)) { - xprintf(drv->class->xine, XINE_VERBOSITY_LOG, + xprintf(drv->class->xine, XINE_VERBOSITY_LOG, "dxr3_mpeg_encoder: lavc only handles video dimensions which are multiples of 2\n"); return 0; } @@ -150,7 +150,7 @@ static int lavc_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame) xprintf(drv->class->xine, XINE_VERBOSITY_LOG, "dxr3_mpeg_encoder: Couldn't start the ffmpeg library\n"); return 0; - } + } this->picture = avcodec_alloc_frame(); if (!this->picture) { xprintf(drv->class->xine, XINE_VERBOSITY_LOG, @@ -160,7 +160,7 @@ static int lavc_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame) /* mpeg1 encoder only support YUV420P */ this->context->pix_fmt = PIX_FMT_YUVJ420P; - + /* put sample parameters */ this->context->bit_rate = drv->class->xine->config->register_range(drv->class->xine->config, "dxr3.encoding.lavc_bitrate", 10000, 1000, 20000, @@ -169,7 +169,7 @@ static int lavc_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame) "Higher values will increase quality and CPU usage.\n" "This setting is only considered, when constant quality mode is disabled."), 10, NULL, NULL); this->context->bit_rate *= 1000; /* config in kbit/s, libavcodec wants bit/s */ - + use_quantizer = drv->class->xine->config->register_bool(drv->class->xine->config, "dxr3.encoding.lavc_quantizer", 1, _("constant quality mode"), @@ -177,18 +177,18 @@ static int lavc_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame) "compressing the images based on their complexity. When disabled, libavcodec " "will use constant bitrate mode."), 10, NULL, NULL); - if (use_quantizer) { + if (use_quantizer) { this->context->qmin = drv->class->xine->config->register_range(drv->class->xine->config, "dxr3.encoding.lavc_qmin", 1, 1, 10, _("minimum compression"), _("The minimum compression to apply to an image in constant quality mode."), 10, NULL, NULL); - + this->context->qmax = drv->class->xine->config->register_range(drv->class->xine->config, "dxr3.encoding.lavc_qmax", 2, 1, 20, _("maximum quantizer"), _("The maximum compression to apply to an image in constant quality mode."), - 10, NULL, NULL); + 10, NULL, NULL); } lprintf("lavc -> bitrate %d \n", this->context->bit_rate); @@ -198,7 +198,7 @@ static int lavc_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame) this->context->gop_size = 0; /*intra frames only */ this->context->me_method = ME_ZERO; /*motion estimation type*/ - + this->context->time_base.den = 90000; if (frame->vo_frame.duration > 90000 / 24) this->context->time_base.num = 90000 / 24; @@ -209,14 +209,14 @@ static int lavc_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame) /* ffmpeg can complain about illegal framerates, but since this seems no * problem for the DXR3, we just tell ffmpeg to be more lax with */ this->context->strict_std_compliance = -1; - + /* open avcodec */ if (avcodec_open(this->context, codec) < 0) { xprintf(drv->class->xine, XINE_VERBOSITY_LOG, "dxr3_mpeg_encoder: could not open codec\n"); return 0; } lprintf("dxr3_mpeg_encoder: lavc MPEG1 codec opened.\n"); - + if (!this->ffmpeg_buffer) this->ffmpeg_buffer = (unsigned char *)malloc(DEFAULT_BUFFER_SIZE); /* why allocate more than needed ?! */ if (!this->ffmpeg_buffer) { @@ -233,7 +233,7 @@ static int lavc_on_display_frame(dxr3_driver_t *drv, dxr3_frame_t *frame) int size; lavc_data_t* this = (lavc_data_t *)drv->enc; ssize_t written; - + if (frame->vo_frame.bad_frame) return 1; /* ignore old frames */ if ((frame->vo_frame.pitches[0] != this->context->width) || (frame->oheight != this->context->height)) { @@ -286,7 +286,7 @@ static int lavc_prepare_frame(lavc_data_t *this, dxr3_driver_t *drv, dxr3_frame_ { int i, j, w2; uint8_t *yuy2; - + if (frame->vo_frame.bad_frame) return 1; if (frame->vo_frame.format == XINE_IMGFMT_YUY2) { @@ -322,7 +322,7 @@ static int lavc_prepare_frame(lavc_data_t *this, dxr3_driver_t *drv, dxr3_frame_ this->picture->data[1] = this->out[1]; this->picture->data[2] = this->out[2]; } - else { /* YV12 **/ + else { /* YV12 **/ this->picture->data[0] = frame->real_base[0]; this->picture->data[1] = frame->real_base[1]; this->picture->data[2] = frame->real_base[2]; diff --git a/src/demuxers/Makefile.am b/src/demuxers/Makefile.am index 4c2aac019..bcf812e03 100644 --- a/src/demuxers/Makefile.am +++ b/src/demuxers/Makefile.am @@ -9,7 +9,7 @@ ogg_module = xineplug_dmx_ogg.la endif if BUILD_ASF -asf_module = xineplug_dmx_asf.la +asf_module = xineplug_dmx_asf.la endif if BUILD_NOSEFART @@ -49,7 +49,7 @@ xineplug_LTLIBRARIES = $(ogg_module) $(asf_module) $(mng_module) $(image_module) xineplug_dmx_nsv.la \ xineplug_dmx_matroska.la \ xineplug_dmx_iff.la \ - xineplug_dmx_flv.la + xineplug_dmx_flv.la xineplug_dmx_ogg_la_SOURCES = demux_ogg.c xineplug_dmx_ogg_la_LIBADD = $(XINE_LIB) $(VORBIS_LIBS) $(SPEEX_LIBS) $(THEORA_LIBS) $(OGG_LIBS) $(LTLIBINTL) diff --git a/src/demuxers/demux.h b/src/demuxers/demux.h index 81907cfcf..a824730ea 100644 --- a/src/demuxers/demux.h +++ b/src/demuxers/demux.h @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -63,7 +63,7 @@ struct demux_class_s { */ const char* (*get_identifier) (demux_class_t *this); - + /* * return MIME types supported for this plugin */ @@ -73,7 +73,7 @@ struct demux_class_s { /* * return ' ' seperated list of file extensions this * demuxer is likely to handle - * (will be used to filter media files in + * (will be used to filter media files in * file selection dialogs) */ @@ -100,7 +100,7 @@ struct demux_plugin_s { void (*send_headers) (demux_plugin_t *this); /* - * ask demux to seek + * ask demux to seek * * for seekable streams, a start position can be specified * @@ -118,11 +118,11 @@ struct demux_plugin_s { * starting the demuxer) */ - int (*seek) (demux_plugin_t *this, + int (*seek) (demux_plugin_t *this, off_t start_pos, int start_time, int playing ); /* - * send a chunk of data down to decoder fifos + * send a chunk of data down to decoder fifos * * the meaning of "chunk" is specific to every demux, usually * it involves parsing one unit of data from stream. @@ -132,15 +132,15 @@ struct demux_plugin_s { */ int (*send_chunk) (demux_plugin_t *this); - + /* - * free resources + * free resources */ void (*dispose) (demux_plugin_t *this) ; /* - * returns DEMUX_OK or DEMUX_FINISHED + * returns DEMUX_OK or DEMUX_FINISHED */ int (*get_status) (demux_plugin_t *this) ; @@ -157,12 +157,12 @@ struct demux_plugin_s { */ uint32_t (*get_capabilities) (demux_plugin_t *this); - + /* * request optional data from input plugin. */ int (*get_optional_data) (demux_plugin_t *this, void *data, int data_type); - + /* * "backwards" link to plugin class */ @@ -181,8 +181,8 @@ struct demux_plugin_s { /* * DEMUX_CAP_AUDIOLANG: * DEMUX_CAP_SPULANG: - * demux plugin knows something about audio/spu languages, - * e.g. knows that audio stream #0 is english, + * demux plugin knows something about audio/spu languages, + * e.g. knows that audio stream #0 is english, * audio stream #1 is german, ... Same bits as INPUT * capabilities . */ diff --git a/src/demuxers/demux_4xm.c b/src/demuxers/demux_4xm.c index 397a271b8..a58cf0f22 100644 --- a/src/demuxers/demux_4xm.c +++ b/src/demuxers/demux_4xm.c @@ -256,7 +256,7 @@ static int demux_fourxm_send_chunk(demux_plugin_t *this_gen) { buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); buf->type = BUF_VIDEO_4XM; if( this->filesize ) - buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * + buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * 65535 / this->filesize ); buf->extra_info->input_time = this->video_pts / 90; buf->pts = this->video_pts; @@ -271,7 +271,7 @@ static int demux_fourxm_send_chunk(demux_plugin_t *this_gen) { buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); buf->type = BUF_VIDEO_4XM; if( this->filesize ) - buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * + buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * 65535 / this->filesize ); buf->extra_info->input_time = this->video_pts / 90; buf->pts = this->video_pts; @@ -320,7 +320,7 @@ static int demux_fourxm_send_chunk(demux_plugin_t *this_gen) { buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); buf->type = this->tracks[current_track].audio_type; if( this->filesize ) - buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * + buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * 65535 / this->filesize ); /* let the engine sort it out */ buf->extra_info->input_time = 0; @@ -354,7 +354,7 @@ static int demux_fourxm_send_chunk(demux_plugin_t *this_gen) { break; default: - lprintf("bad chunk: %c%c%c%c (%02X%02X%02X%02X)\n", + lprintf("bad chunk: %c%c%c%c (%02X%02X%02X%02X)\n", header[0], header[1], header[2], header[3], header[0], header[1], header[2], header[3]); this->status = DEMUX_FINISHED; diff --git a/src/demuxers/demux_aac.c b/src/demuxers/demux_aac.c index 68a684ffa..6615f4f61 100644 --- a/src/demuxers/demux_aac.c +++ b/src/demuxers/demux_aac.c @@ -108,7 +108,7 @@ static int open_aac_file(demux_aac_t *this) { if ( this->input->read(this->input, peak, MAX_PREVIEW_SIZE) != MAX_PREVIEW_SIZE ) return 0; this->input->seek(this->input, 0, SEEK_SET); - } else if (_x_demux_read_header(this->input, peak, MAX_PREVIEW_SIZE) != + } else if (_x_demux_read_header(this->input, peak, MAX_PREVIEW_SIZE) != MAX_PREVIEW_SIZE) return 0; @@ -177,7 +177,7 @@ static int demux_aac_send_chunk(demux_plugin_t *this_gen) { buf->free_buffer(buf); this->status = DEMUX_FINISHED; return this->status; - } else + } else buf->size = bytes_read; /* each buffer stands on its own */ diff --git a/src/demuxers/demux_ac3.c b/src/demuxers/demux_ac3.c index 711bb0b45..f13144254 100644 --- a/src/demuxers/demux_ac3.c +++ b/src/demuxers/demux_ac3.c @@ -307,7 +307,7 @@ static int demux_ac3_send_chunk (demux_plugin_t *this_gen) { } } else { buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); - buf->size = this->input->read(this->input, buf->content, + buf->size = this->input->read(this->input, buf->content, this->frame_size); } @@ -319,7 +319,7 @@ static int demux_ac3_send_chunk (demux_plugin_t *this_gen) { buf->type = this->buf_type; if( this->input->get_length (this->input) ) - buf->extra_info->input_normpos = (int)( (double) current_stream_pos * + buf->extra_info->input_normpos = (int)( (double) current_stream_pos * 65535 / this->input->get_length (this->input) ); buf->extra_info->input_time = audio_pts / 90; buf->pts = audio_pts; diff --git a/src/demuxers/demux_aiff.c b/src/demuxers/demux_aiff.c index 273992f64..ee45963a5 100644 --- a/src/demuxers/demux_aiff.c +++ b/src/demuxers/demux_aiff.c @@ -139,7 +139,7 @@ static int open_aiff_file(demux_aiff_t *this) { } chunk_type = _X_BE_32(&preamble[0]); chunk_size = _X_BE_32(&preamble[4]); - + if (chunk_type == COMM_TAG) { unsigned char buffer[100]; @@ -174,7 +174,7 @@ static int open_aiff_file(demux_aiff_t *this) { (this->audio_bits / 8); this->running_time = (this->audio_frames / this->audio_sample_rate) * 1000; - /* we should send only complete frames to decoder, as it + /* we should send only complete frames to decoder, as it * doesn't handle underconsumption yet */ this->audio_block_align = PCM_BLOCK_ALIGN - PCM_BLOCK_ALIGN % (this->audio_bits / 8 * this->audio_channels); @@ -210,7 +210,7 @@ static int demux_aiff_send_chunk (demux_plugin_t *this_gen) { /* just load data chunks from wherever the stream happens to be * pointing; issue a DEMUX_FINISHED status if EOF is reached */ remaining_sample_bytes = this->audio_block_align; - current_file_pos = + current_file_pos = this->input->get_current_pos(this->input) - this->data_start; current_pts = current_file_pos; @@ -258,7 +258,7 @@ static int demux_aiff_send_chunk (demux_plugin_t *this_gen) { this->audio_fifo->put (this->audio_fifo, buf); } - + return this->status; } diff --git a/src/demuxers/demux_asf.c b/src/demuxers/demux_asf.c index 6c9ea631c..e2da05c75 100644 --- a/src/demuxers/demux_asf.c +++ b/src/demuxers/demux_asf.c @@ -88,13 +88,13 @@ typedef struct { int skip; int resync; int first_seq; - + int payload_size; /* palette handling */ int palette_count; palette_entry_t palette[256]; - + } asf_demux_stream_t; typedef struct demux_asf_s { @@ -109,13 +109,13 @@ typedef struct demux_asf_s { int64_t keyframe_ts; int keyframe_found; - + int seqno; uint32_t packet_size; uint8_t packet_len_flags; uint32_t data_size; uint64_t packet_count; - + asf_demux_stream_t streams[MAX_NUM_STREAMS]; int video_stream; int audio_stream; @@ -145,7 +145,7 @@ typedef struct demux_asf_s { int reorder_b; int buf_flag_seek; - + /* first packet position */ int64_t first_packet_pos; @@ -267,7 +267,7 @@ static int get_guid (demux_asf_t *this) { for(i = 0; i < 8; i++) { g.Data4[i] = get_byte(this); } - + return get_guid_id(this, &g); } @@ -306,7 +306,7 @@ static void asf_send_audio_header (demux_asf_t *this, int stream) { this->status = DEMUX_FINISHED; return; } - + memcpy (buf->content, wavex, asf_stream->private_data_length); _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_FOURCC, wavex->wFormatTag); @@ -347,10 +347,10 @@ static void asf_send_video_header (demux_asf_t *this, int stream) { this->status = DEMUX_FINISHED; return; } - + buf->decoder_flags = BUF_FLAG_HEADER|BUF_FLAG_STDHEADER|BUF_FLAG_FRAMERATE| BUF_FLAG_FRAME_END; - + buf->decoder_info[0] = 0; if (this->asf_header->aspect_ratios[stream].x && this->asf_header->aspect_ratios[stream].y) @@ -369,7 +369,7 @@ static void asf_send_video_header (demux_asf_t *this, int stream) { /* send off the palette, if there is one */ if (demux_stream->palette_count) { - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "demux_asf: stream %d, palette : %d entries\n", stream, demux_stream->palette_count); buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); buf->decoder_flags = BUF_FLAG_SPECIAL|BUF_FLAG_HEADER; @@ -390,7 +390,7 @@ static int asf_read_header (demux_asf_t *this) { asf_header_len = get_le64(this); if (asf_header_len > 4 * 1024 * 1024) { - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_asf: asf_read_header: overly-large header? (%"PRIu64" bytes)\n", asf_header_len); return 0; @@ -425,13 +425,13 @@ static int asf_read_header (demux_asf_t *this) { this->packet_size = this->asf_header->file->packet_size; this->packet_count = this->asf_header->file->data_packet_count; - + /* compute stream duration */ - this->length = (this->asf_header->file->send_duration - + this->length = (this->asf_header->file->send_duration - this->asf_header->file->preroll) / 10000; if (this->length < 0) this->length = 0; - + /* compute average byterate (needed for seeking) */ if (this->asf_header->file->max_bitrate) this->rate = this->asf_header->file->max_bitrate >> 3; @@ -473,14 +473,14 @@ static int asf_read_header (demux_asf_t *this) { this->reorder_w = (asf_stream->error_correction_data[2]<<8)|asf_stream->error_correction_data[1]; this->reorder_b = (asf_stream->error_correction_data[4]<<8)|asf_stream->error_correction_data[3]; this->reorder_w /= this->reorder_b; - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_asf: audio conceal interleave detected (%d x %d x %d)\n", this->reorder_w, this->reorder_h, this->reorder_b ); } else { this->reorder_b = this->reorder_h = this->reorder_w = 1; } - - + + demux_stream->buf_type = _x_formattag_to_buf_audio ( ((xine_waveformatex *)asf_stream->private_data)->wFormatTag ); if ( !demux_stream->buf_type ) { @@ -489,9 +489,9 @@ static int asf_read_header (demux_asf_t *this) { ((xine_waveformatex *)asf_stream->private_data)->wFormatTag); demux_stream->buf_type = BUF_AUDIO_UNKNOWN; } - + _x_meta_info_set(this->stream, XINE_META_INFO_AUDIOCODEC, _x_buf_audio_name(demux_stream->buf_type)); - + this->streams[i].fifo = this->audio_fifo; this->streams[i].frag_offset = 0; this->streams[i].seq = 0; @@ -501,12 +501,12 @@ static int asf_read_header (demux_asf_t *this) { this->streams[i].defrag = 1; } else this->streams[i].defrag = 0; - + lprintf ("found an audio stream id=%d \n", asf_stream->stream_number); break; - + case GUID_ASF_VIDEO_MEDIA: - { + { /* video private data * 11 bytes : header * 40 bytes : bmiheader @@ -515,38 +515,38 @@ static int asf_read_header (demux_asf_t *this) { uint32_t width, height; uint16_t bmiheader_size; xine_bmiheader *bmiheader; - + width = _X_LE_32(asf_stream->private_data); height = _X_LE_32(asf_stream->private_data + 4); /* there is one unknown byte between height and the bmiheader size */ bmiheader_size = _X_LE_16(asf_stream->private_data + 9); - + /* FIXME: bmiheader_size must be >= sizeof(xine_bmiheader) */ - + bmiheader = (xine_bmiheader *) (asf_stream->private_data + 11); _x_bmiheader_le2me(bmiheader); - + /* FIXME: check if (bmi_header_size == bmiheader->biSize) ? */ demux_stream->buf_type = _x_fourcc_to_buf_video(bmiheader->biCompression); if( !demux_stream->buf_type ) { xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_asf: unknown video format %.4s\n", (char*)&(bmiheader->biCompression)); - + demux_stream->buf_type = BUF_VIDEO_UNKNOWN; } - + _x_meta_info_set(this->stream, XINE_META_INFO_VIDEOCODEC, _x_buf_video_name(demux_stream->buf_type)); _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_WIDTH, width); _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_HEIGHT, height); - + this->streams[i].fifo = this->video_fifo; this->streams[i].frag_offset = 0; this->streams[i].defrag = 0; - + /* load the palette, if there is one */ demux_stream->palette_count = bmiheader->biClrUsed; - + lprintf ("palette_count: %d\n", demux_stream->palette_count); if (demux_stream->palette_count > 256) { lprintf ("number of colours exceeded 256 (%d)", demux_stream->palette_count); @@ -555,10 +555,10 @@ static int asf_read_header (demux_asf_t *this) { if ((asf_stream->private_data_length - sizeof(xine_bmiheader) - 11) >= (demux_stream->palette_count * 4)) { int j; uint8_t *palette; - + /* according to msdn the palette is located here : */ palette = (uint8_t *)bmiheader + bmiheader->biSize; - + /* load the palette */ for (j = 0; j < demux_stream->palette_count; j++) { demux_stream->palette[j].b = *(palette + j * 4 + 0); @@ -567,7 +567,7 @@ static int asf_read_header (demux_asf_t *this) { } } else { int j; - + /* generate a greyscale palette */ demux_stream->palette_count = 256; for (j = 0; j < demux_stream->palette_count; j++) { @@ -576,7 +576,7 @@ static int asf_read_header (demux_asf_t *this) { demux_stream->palette[j].b = j; } } - + lprintf ("found a video stream id=%d, buf_type=%08x \n", this->asf_header->streams[i]->stream_number, this->streams[i].buf_type); } @@ -746,7 +746,7 @@ static void asf_send_buffer_nodefrag (demux_asf_t *this, asf_demux_stream_t *str lprintf ("data: %d %d %d %d\n", buf->content[0], buf->content[1], buf->content[2], buf->content[3]); if( this->input->get_length (this->input) ) - buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * + buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * 65535 / this->input->get_length (this->input) ); buf->extra_info->input_time = timestamp; @@ -832,46 +832,46 @@ static void asf_send_buffer_defrag (demux_asf_t *this, asf_demux_stream_t *strea if (package_done) { int bufsize; uint8_t *p; - + lprintf("packet done: offset=%d, payload=%d\n", stream->frag_offset, stream->payload_size); if (stream->fifo == this->audio_fifo && this->reorder_h > 1 && this->reorder_w > 1 ) { asf_reorder(this,stream->buffer,stream->frag_offset); } - + p = stream->buffer; while( stream->frag_offset ) { if ( stream->frag_offset < stream->fifo->buffer_pool_buf_size ) bufsize = stream->frag_offset; else bufsize = stream->fifo->buffer_pool_buf_size; - + buf = stream->fifo->buffer_pool_alloc (stream->fifo); xine_fast_memcpy (buf->content, p, bufsize); - + if( this->input->get_length (this->input) ) - buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * + buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * 65535 / this->input->get_length (this->input) ); buf->extra_info->input_time = stream->timestamp; - + /* send the same pts for the entire frame */ buf->pts = stream->timestamp * 90; - + buf->type = stream->buf_type; buf->size = bufsize; - + lprintf ("buffer type %08x %8d bytes, %8lld pts\n", buf->type, buf->size, buf->pts); - + stream->frag_offset -= bufsize; p+=bufsize; - + if ((buf->type & BUF_MAJOR_MASK) == BUF_VIDEO_BASE) check_newpts (this, buf->pts, PTS_VIDEO, !stream->frag_offset); else check_newpts (this, buf->pts, PTS_AUDIO, !stream->frag_offset); - + /* test if whole packet read */ if ( !stream->frag_offset ) buf->decoder_flags |= BUF_FLAG_FRAME_END; @@ -888,9 +888,9 @@ static int asf_parse_packet_align(demux_asf_t *this) { uint32_t mod; uint64_t packet_num; - + current_pos = this->input->get_current_pos (this->input); - + /* seek to the beginning of the next packet */ mod = (current_pos - this->first_packet_pos) % this->packet_size; this->packet_size_left = mod ? this->packet_size - mod : 0; @@ -904,7 +904,7 @@ static int asf_parse_packet_align(demux_asf_t *this) { } } this->packet_size_left = 0; - + /* check packet_count */ packet_num = (packet_pos - this->first_packet_pos) / this->packet_size; lprintf("packet_num=%"PRId64", packet_count=%"PRId64"\n", packet_num, this->packet_count); @@ -925,7 +925,7 @@ static int asf_parse_packet_align(demux_asf_t *this) { } } } - + return 0; } @@ -951,7 +951,7 @@ static int asf_parse_packet_ecd(demux_asf_t *this, uint32_t *p_hdr_size) { ecd_opaque = (ecd_flags >> 4) & 0x1; ecd_len_type = (ecd_flags >> 5) & 0x3; ecd_present = (ecd_flags >> 7) & 0x1; - + /* skip ecd */ if (ecd_present && !ecd_opaque && !ecd_len_type) { int read_size; @@ -965,7 +965,7 @@ static int asf_parse_packet_ecd(demux_asf_t *this, uint32_t *p_hdr_size) { } else { GUID *guid = (GUID *)buf; - + /* check if it's a new stream */ buf[0] = ecd_flags; if (this->input->read (this->input, buf + 1, 15) != 15) { @@ -982,7 +982,7 @@ static int asf_parse_packet_ecd(demux_asf_t *this, uint32_t *p_hdr_size) { if (demux_asf_send_headers_common(this)) return 1; } else { - + /* skip invalid packet */ xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_asf: skip invalid packet: %2X\n", ecd_flags); this->input->seek (this->input, this->packet_size - *p_hdr_size, SEEK_CUR); @@ -991,7 +991,7 @@ static int asf_parse_packet_ecd(demux_asf_t *this, uint32_t *p_hdr_size) { } } } while (invalid_packet); - + return 0; } @@ -1060,7 +1060,7 @@ static int asf_parse_packet_payload_header(demux_asf_t *this, uint32_t p_hdr_siz xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_asf: invalid padsize: %d\n", this->packet_padsize); return 1; } - + /* Multiple frames */ if (this->packet_len_flags & 0x01) { this->frame_flag = get_byte(this); p_hdr_size += 1; @@ -1097,7 +1097,7 @@ static int asf_parse_packet_payload_common(demux_asf_t *this, *stream = NULL; lprintf ("got raw_id=%d, stream_id=%d\n", raw_id, stream_id); - + for (i = 0; i < this->asf_header->stream_count; i++) { lprintf ("stream_number = %d\n", this->asf_header->streams[i]->stream_number); if ((this->asf_header->streams[i]->stream_number == stream_id) && @@ -1107,7 +1107,7 @@ static int asf_parse_packet_payload_common(demux_asf_t *this, break; } } - + switch ((this->packet_prop_flags >> 4) & 3){ case 1: seq = get_byte(this); s_hdr_size += 1; @@ -1264,10 +1264,10 @@ static int asf_parse_packet_compressed_payload(demux_asf_t *this, stream->resync = 0; stream->skip = 0; } - + if (!stream->skip) { lprintf ("sending buffer of type %08x\n", stream->buf_type); - + if (stream->defrag) asf_send_buffer_defrag (this, stream, 0, *timestamp, object_length); else @@ -1439,15 +1439,15 @@ static int demux_asf_parse_http_references( demux_asf_t *this) { if (!end) goto failure; *end = '\0'; } - + /* replace http by mmsh */ if (!strncmp(href, "http", 4)) { memcpy(href, "mmsh", 4); } - + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_asf: http ref: %s\n", href); _x_demux_send_mrl_reference (this->stream, 0, href, NULL, 0, 0); - + if (free_href) free(href); } @@ -1631,13 +1631,13 @@ static int demux_asf_parse_asx_references( demux_asf_t *this) { else if (!strcasecmp (asx_ref->name, "STARTTIME")) { - if (start_time == (uint32_t)-1) + if (start_time == (uint32_t)-1) start_time = asx_get_time_value (asx_ref); } else if (!strcasecmp (asx_ref->name, "DURATION")) { - if (duration == (uint32_t)-1) + if (duration == (uint32_t)-1) duration = asx_get_time_value (asx_ref); } @@ -1690,7 +1690,7 @@ static int demux_asf_send_chunk (demux_plugin_t *this_gen) { uint32_t rlen = 0; uint8_t raw_id = 0; int64_t ts = 0; - + switch (this->mode) { case ASF_MODE_ASX_REF: return demux_asf_parse_asx_references(this); @@ -1707,9 +1707,9 @@ static int demux_asf_send_chunk (demux_plugin_t *this_gen) { return this->status; default: - { + { int header_size = 0; - + if (asf_parse_packet_align(this)) { xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_asf: asf_parse_packet_align failed\n"); this->status = DEMUX_FINISHED; @@ -1725,7 +1725,7 @@ static int demux_asf_send_chunk (demux_plugin_t *this_gen) { this->status = DEMUX_FINISHED; return this->status; } - + for (this->frame = 0; this->frame < (this->nb_frames & 0x3f); this->frame++) { raw_id = get_byte(this); this->packet_size_left -= 1; @@ -1750,7 +1750,7 @@ static void demux_asf_dispose (demux_plugin_t *this_gen) { if (this->asf_header) { int i; - + for (i=0; iasf_header->stream_count; i++) { asf_demux_stream_t *asf_stream; @@ -1763,7 +1763,7 @@ static void demux_asf_dispose (demux_plugin_t *this_gen) { asf_header_delete (this->asf_header); } - + free (this); } @@ -1823,11 +1823,11 @@ static int demux_asf_seek (demux_plugin_t *this_gen, start_pos, start_time); this->status = DEMUX_OK; - + if (this->mode != ASF_MODE_NORMAL) { return this->status; } - + /* * seek to start position */ @@ -1841,7 +1841,7 @@ static int demux_asf_seek (demux_plugin_t *this_gen, this->last_pts[PTS_AUDIO] = 0; this->keyframe_ts = 0; this->keyframe_found = 0; - + /* engine sync stuff */ this->send_newpts = 1; this->buf_flag_seek = 1; @@ -1849,11 +1849,11 @@ static int demux_asf_seek (demux_plugin_t *this_gen, if (this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) { _x_demux_flush_engine(this->stream); - + start_time /= 1000; start_pos = (off_t) ( (double) start_pos / 65535 * this->input->get_length (this->input) ); - + if ( (!start_pos) && (start_time)) start_pos = start_time * this->rate; @@ -1914,7 +1914,7 @@ static int demux_asf_seek (demux_plugin_t *this_gen, this->status = DEMUX_FINISHED; return this->status; } - + for (this->frame = 0; this->frame < (this->nb_frames & 0x3f); this->frame++) { raw_id = get_byte(this); this->packet_size_left -= 1; @@ -1923,7 +1923,7 @@ static int demux_asf_seek (demux_plugin_t *this_gen, stream_id = raw_id & 0x7f; if (asf_parse_packet_payload_common(this, raw_id, &stream, &frag_offset, &rlen)) break; - + if (rlen == 1) { if (asf_parse_packet_compressed_payload(this, stream, raw_id, frag_offset, &ts)) break; @@ -1931,7 +1931,7 @@ static int demux_asf_seek (demux_plugin_t *this_gen, if (asf_parse_packet_payload(this, stream, raw_id, frag_offset, rlen, &ts)) break; } - + if (state == 0) { if (this->keyframe_found) { if (this->audio_stream == -1) { @@ -1981,12 +1981,12 @@ static int demux_asf_seek (demux_plugin_t *this_gen, this->streams[this->audio_stream].resync = 1; this->streams[this->audio_stream].skip = 1; } - } else if (!playing && this->input->seek_time != NULL) { + } else if (!playing && this->input->seek_time != NULL) { if (start_pos && !start_time) start_time = this->length * start_pos / 65535; - + this->input->seek_time (this->input, start_time, SEEK_SET); - + this->keyframe_ts = 0; this->keyframe_found = 0; /* means next keyframe */ if (this->video_stream >= 0) { @@ -2011,7 +2011,7 @@ static int demux_asf_seek (demux_plugin_t *this_gen, } } return this->status; - + error: this->status = DEMUX_FINISHED; return this->status; @@ -2140,7 +2140,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, this->demux_plugin.demux_class = class_gen; this->status = DEMUX_FINISHED; - + return &this->demux_plugin; } @@ -2201,7 +2201,7 @@ static void *init_class (xine_t *xine, void *data) { static const demuxer_info_t demux_info_asf = { 10 /* priority */ }; - + const plugin_info_t xine_plugin_info[] EXPORTED = { /* type, API, "name", version, special_info, init_function */ { PLUGIN_DEMUX, 26, "asf", XINE_VERSION_CODE, &demux_info_asf, init_class }, diff --git a/src/demuxers/demux_aud.c b/src/demuxers/demux_aud.c index 7730de1fa..caaa4e91a 100644 --- a/src/demuxers/demux_aud.c +++ b/src/demuxers/demux_aud.c @@ -105,7 +105,7 @@ remove this case for the time being since this audio type is not supported anyway. if (header[11] == 1) this->audio_type = BUF_AUDIO_WESTWOOD; - else + else #endif if (header[11] == 99) this->audio_type = BUF_AUDIO_VQA_IMA; diff --git a/src/demuxers/demux_avi.c b/src/demuxers/demux_avi.c index 0ab3448bb..100828bd2 100644 --- a/src/demuxers/demux_avi.c +++ b/src/demuxers/demux_avi.c @@ -7,12 +7,12 @@ * 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -134,7 +134,7 @@ typedef struct _avistdindex_chunk { uint32_t dwReserved3; /* must be 0 */ avistdindex_entry *aIndex; } avistdindex_chunk; - + /* Base Index Form 'indx' */ typedef struct _avisuperindex_chunk { @@ -150,7 +150,7 @@ typedef struct _avisuperindex_chunk { avisuperindex_entry *aIndex; /* where are the ix## chunks */ avistdindex_chunk **stdindex; /* the ix## chunks itself (array) */ } avisuperindex_chunk; - + /* These next three are the video and audio structures that can grow * during the playback of a streaming file. */ @@ -473,7 +473,7 @@ static int start_pos_stopper(demux_avi_t *this, void *data) { maxframe--; } return -1; -} +} /* Use this one to ensure that a video frame with the given timestamp * is in the index. */ @@ -600,11 +600,11 @@ static int idx_grow(demux_avi_t *this, int (*stopper)(demux_avi_t *, void *), } } else { int i; - + /* Audio chunk */ for(i = 0; i < this->avi->n_audio; ++i) { avi_audio_t *audio = this->avi->audio[i]; - + if ((data[0] == audio->audio_tag[0]) && (data[1] == audio->audio_tag[1])) { off_t pos = chunk_pos + AVI_HEADER_SIZE; @@ -617,7 +617,7 @@ static int idx_grow(demux_avi_t *this, int (*stopper)(demux_avi_t *, void *), } else { audio->block_no += 1; } - + if (audio_index_append(this->avi, i, pos, chunk_len, audio->audio_tot, audio->block_no) == -1) { /* As above. */ @@ -711,10 +711,10 @@ do { \ static void reset_idx(demux_avi_t *this, avi_t *AVI) { int n; - + this->idx_grow.nexttagoffset = AVI->movi_start; this->has_index = 0; - + AVI->video_idx.video_frames = 0; for(n = 0; n < AVI->n_audio; n++) { AVI->audio[n]->audio_idx.audio_chunks = 0; @@ -778,14 +778,14 @@ static avi_t *XINE_MALLOC AVI_init(demux_avi_t *this) { n = _X_LE_32(data + 4); n = PAD_EVEN(n); next_chunk = this->idx_grow.nexttagoffset + 8 + n; - + lprintf("chunk: %c%c%c%c, size: %" PRId64 "\n", data[0], data[1], data[2], data[3], (int64_t)n); - + if (n >= 4 && strncasecmp(data,"LIST",4) == 0) { if( this->input->read(this->input, data,4) != 4 ) ERR_EXIT(AVI_ERR_READ); n -= 4; - + lprintf(" chunk: %c%c%c%c\n", data[0], data[1], data[2], data[3]); @@ -799,7 +799,7 @@ static avi_t *XINE_MALLOC AVI_init(demux_avi_t *this) { ERR_EXIT(AVI_ERR_READ); } else if(strncasecmp(data,"movi",4) == 0) { - + AVI->movi_start = this->input->get_current_pos(this->input); AVI->movi_end = AVI->movi_start + n - 1; @@ -877,7 +877,7 @@ static avi_t *XINE_MALLOC AVI_init(demux_avi_t *this) { lasttag = 1; /* vids */ lprintf("dwScale=%d, dwRate=%d, dwInitialFrames=%d, dwStart=%d, num_stream=%d\n", AVI->dwScale, AVI->dwRate, AVI->dwInitialFrames, AVI->dwStart, num_stream); - + } else if (strncasecmp (hdrl_data+i,"auds",4) ==0 /* && ! auds_strh_seen*/) { if(AVI->n_audio < MAX_AUDIO_STREAMS) { avi_audio_t *a = (avi_audio_t *) calloc(1, sizeof(avi_audio_t)); @@ -892,10 +892,10 @@ static avi_t *XINE_MALLOC AVI_init(demux_avi_t *this) { a->dwScale = _X_LE_32(hdrl_data + i + 20); a->dwRate = _X_LE_32(hdrl_data + i + 24); a->dwStart = _X_LE_32(hdrl_data + i + 28); - + lprintf("dwScale=%d, dwRate=%d, dwInitialFrames=%d, dwStart=%d, num_stream=%d\n", a->dwScale, a->dwRate, a->dwInitialFrames, a->dwStart, num_stream); - + a->dwSampleSize = _X_LE_32(hdrl_data + i + 44); a->audio_tot = 0; auds_strh_seen = 1; @@ -909,14 +909,14 @@ static avi_t *XINE_MALLOC AVI_init(demux_avi_t *this) { lasttag = 0; } num_stream++; - + } else if(strncasecmp(hdrl_data+i,"dmlh",4) == 0) { AVI->total_frames = _X_LE_32(hdrl_data+i+8); #ifdef DEBUG_ODML lprintf( "AVI: real number of frames %d\n", AVI->total_frames); #endif i += 8; - + } else if(strncasecmp(hdrl_data + i, "strf", 4) == 0) { i += 4; strf_size = _X_LE_32(hdrl_data + i); @@ -973,7 +973,7 @@ static avi_t *XINE_MALLOC AVI_init(demux_avi_t *this) { } else if(lasttag == 2) { xine_waveformatex *wavex; - + wavex = (xine_waveformatex *)malloc(n); if (!wavex) { this->AVI_errno = AVI_ERR_NO_MEM; @@ -1175,7 +1175,7 @@ static avi_t *XINE_MALLOC AVI_init(demux_avi_t *this) { } lprintf("idx_type=%d, AVI->n_idx=%d\n", idx_type, AVI->n_idx); - + if (idx_type != 0 && !AVI->is_opendml) { /* Now generate the video index and audio index arrays from the * idx1 record. */ @@ -1232,7 +1232,7 @@ static avi_t *XINE_MALLOC AVI_init(demux_avi_t *this) { xprintf (this->stream->xine, XINE_VERBOSITY_LOG, "demux_avi: This is an OpenDML stream\n"); nvi = 0; - for(audtr=0; audtrn_audio; ++audtr) nai[audtr] = 0; + for(audtr=0; audtrn_audio; ++audtr) nai[audtr] = 0; /* ************************ */ /* VIDEO */ @@ -1300,7 +1300,7 @@ static avi_t *XINE_MALLOC AVI_init(demux_avi_t *this) { "demux_avi: Warning: the video super index is NULL\n"); } - + /* ************************ */ /* AUDIO */ /* ************************ */ @@ -1344,7 +1344,7 @@ static avi_t *XINE_MALLOC AVI_init(demux_avi_t *this) { /* skip header */ en += hdrl_len; nai[audtr] += nrEntries; - + while (k < nai[audtr]) { off_t pos; @@ -1352,7 +1352,7 @@ static avi_t *XINE_MALLOC AVI_init(demux_avi_t *this) { pos = offset + _X_LE_32(en); en += 4; len = odml_len(en); en += 4; - + /* VBR streams (hack from mplayer) */ if (audio->wavex && audio->wavex->nBlockAlign) { audio->block_no += (len + audio->wavex->nBlockAlign - 1) / @@ -1394,7 +1394,7 @@ static avi_t *XINE_MALLOC AVI_init(demux_avi_t *this) { this->idx_grow.nexttagoffset = AVI->movi_start; this->has_index = 0; } - + /* Reposition the file */ if (!this->streaming) this->input->seek(this->input, AVI->movi_start, SEEK_SET); @@ -1480,7 +1480,7 @@ static int AVI_read_video(demux_avi_t *this, avi_t *AVI, char *vidbuf, nr = 0; /* total number of bytes read */ left = vie->len - AVI->video_posb; - + while ((bytes > 0) && (left > 0)) { if (bytes < left) todo = bytes; @@ -1522,7 +1522,7 @@ static int demux_avi_next (demux_avi_t *this, int decoder_flags) { int audio_sent = 0; lprintf("begin\n"); - + /* Try to grow the index, in case more of the avi file has shown up * since we last checked. If it's still too small, well then we're at * the end of the stream. */ @@ -1531,7 +1531,7 @@ static int demux_avi_next (demux_avi_t *this, int decoder_flags) { lprintf("end of stream\n"); } } - + for (i = 0; i < this->avi->n_audio; i++) { avi_audio_t *audio = this->avi->audio[i]; @@ -1542,7 +1542,7 @@ static int demux_avi_next (demux_avi_t *this, int decoder_flags) { } } } - + video_pts = get_video_pts (this, this->avi->video_posf); for (i=0; i < this->avi->n_audio; i++) { @@ -1568,7 +1568,7 @@ static int demux_avi_next (demux_avi_t *this, int decoder_flags) { /* read audio */ buf->pts = audio_pts; - + buf->size = AVI_read_audio (this, audio, buf->mem, buf->max_size, &buf->decoder_flags); buf->decoder_flags |= decoder_flags; @@ -1580,12 +1580,12 @@ static int demux_avi_next (demux_avi_t *this, int decoder_flags) { buf->type = audio->audio_type | i; buf->extra_info->input_time = audio_pts / 90; if( this->input->get_length (this->input) ) - buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * + buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * 65535 / this->input->get_length (this->input) ); - + check_newpts (this, buf->pts, PTS_AUDIO); this->audio_fifo->put (this->audio_fifo, buf); - + audio_sent++; } } else @@ -1595,7 +1595,7 @@ static int demux_avi_next (demux_avi_t *this, int decoder_flags) { if (audio_sent == 0) { do_read_video = 1; } - + if (do_read_video) { buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); @@ -1611,12 +1611,12 @@ static int demux_avi_next (demux_avi_t *this, int decoder_flags) { if (this->has_index && this->avi->video_idx.video_frames > 2) { /* use video_frames-2 instead of video_frames-1 to fix problems with weird non-interleaved streams */ - buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * + buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * 65535 / this->avi->video_idx.vindex[this->avi->video_idx.video_frames - 2].pos); } else { if( this->input->get_length (this->input) ) - buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * + buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * 65535 / this->input->get_length (this->input) ); } buf->extra_info->frame_number = this->avi->video_posf; @@ -1631,7 +1631,7 @@ static int demux_avi_next (demux_avi_t *this, int decoder_flags) { lprintf ("adding buf %d to video fifo, decoder_info[0]: %d\n", buf, buf->decoder_info[0]); */ - + check_newpts (this, buf->pts, PTS_VIDEO); this->video_fifo->put (this->video_fifo, buf); video_sent++; @@ -1752,7 +1752,7 @@ static int demux_avi_next_streaming (demux_avi_t *this, int decoder_flags) { } buf->extra_info->input_time = audio_pts / 90; if( this->input->get_length (this->input) ) - buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * + buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * 65535 / this->input->get_length (this->input) ); buf->type = audio->audio_type | audio_stream; @@ -1783,7 +1783,7 @@ static int demux_avi_next_streaming (demux_avi_t *this, int decoder_flags) { /* read video */ buf->pts = video_pts; lprintf("video pts: %" PRId64 "\n", video_pts); - + if (left > this->video_fifo->buffer_pool_buf_size) { buf->size = this->video_fifo->buffer_pool_buf_size; buf->decoder_flags = 0; @@ -1838,7 +1838,7 @@ static int demux_avi_send_chunk (demux_plugin_t *this_gen) { this->seek_request = 0; demux_avi_seek_internal(this); } - + if (!demux_avi_next (this, 0)) { this->status = DEMUX_FINISHED; } @@ -1918,7 +1918,7 @@ static void demux_avi_send_headers (demux_plugin_t *this_gen) { this->avi->bih->biCompression = this->avi->compressor; this->avi->video_type = BUF_VIDEO_XVID; } - + _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_VIDEO, 1); _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_AUDIO, !this->no_audio); _x_meta_info_set(this->stream, XINE_META_INFO_VIDEOCODEC, _x_buf_video_name(this->avi->video_type)); @@ -1936,7 +1936,7 @@ static void demux_avi_send_headers (demux_plugin_t *this_gen) { _x_demux_control_start (this->stream); buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); - + if (this->avi->bih->biSize > buf->max_size) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "demux_avi: private video decoder data length (%d) is greater than fifo buffer length (%d)\n", @@ -1945,9 +1945,9 @@ static void demux_avi_send_headers (demux_plugin_t *this_gen) { this->status = DEMUX_FINISHED; return; } - + /* wait, before sending out the video header, one more special case hack: - * if the video type is RGB, indicate that it is upside down with a + * if the video type is RGB, indicate that it is upside down with a * negative height */ if (this->avi->video_type == BUF_VIDEO_RGB) { this->avi->bih->biHeight = -this->avi->bih->biHeight; @@ -1958,7 +1958,7 @@ static void demux_avi_send_headers (demux_plugin_t *this_gen) { buf->decoder_info[0] = this->video_step; memcpy (buf->content, this->avi->bih, this->avi->bih->biSize); buf->size = this->avi->bih->biSize; - + if (this->avi->video_type) { this->avi->compressor = this->avi->bih->biCompression; } else { @@ -2006,7 +2006,7 @@ static void demux_avi_send_headers (demux_plugin_t *this_gen) { buf->size = todo; } todo -= buf->size; - + buf->decoder_flags = BUF_FLAG_HEADER|BUF_FLAG_STDHEADER; if (todo == 0) buf->decoder_flags |= BUF_FLAG_FRAME_END; @@ -2023,7 +2023,7 @@ static void demux_avi_send_headers (demux_plugin_t *this_gen) { } if(this->avi->n_audio == 1) - _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_FOURCC, + _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_FOURCC, this->avi->audio[0]->wavex->wFormatTag); } @@ -2073,7 +2073,7 @@ static int demux_avi_seek_internal (demux_avi_t *this) { int64_t audio_pts; off_t start_pos = this->seek_start_pos; int start_time = this->seek_start_time; - + start_pos = (off_t) ( (double) start_pos / 65535 * this->input->get_length (this->input) ); @@ -2108,12 +2108,12 @@ static int demux_avi_seek_internal (demux_avi_t *this) { video_pts = start_time * 90; idx_grow(this, start_time_stopper, &video_pts); } - + if (start_pos || start_time) max_pos = this->avi->video_idx.video_frames - 1; else max_pos=0; - + cur_pos = this->avi->video_posf; if (max_pos < 0) { this->status = DEMUX_FINISHED; @@ -2141,7 +2141,7 @@ static int demux_avi_seek_internal (demux_avi_t *this) { } } } - + while (vie && !(vie->flags & AVIIF_KEYFRAME) && cur_pos) { this->avi->video_posf = --cur_pos; vie = video_cur_index_entry(this); @@ -2164,7 +2164,7 @@ static int demux_avi_seek_internal (demux_avi_t *this) { if (!this->no_audio && this->status == DEMUX_OK) { audio_index_entry_t *aie; int i; - + for(i = 0; i < this->avi->n_audio; i++) { max_pos = this->avi->audio[i]->audio_idx.audio_chunks - 1; min_pos = 0; diff --git a/src/demuxers/demux_cdda.c b/src/demuxers/demux_cdda.c index d48bb2a51..6aee5042e 100644 --- a/src/demuxers/demux_cdda.c +++ b/src/demuxers/demux_cdda.c @@ -84,7 +84,7 @@ static int demux_cdda_send_chunk (demux_plugin_t *this_gen) { buf->type = BUF_AUDIO_LPCM_LE; if( this->input->get_length (this->input) ) - buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * + buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * 65535 / this->input->get_length (this->input) ); buf->pts = this->input->get_current_pos(this->input); buf->pts *= 90000; diff --git a/src/demuxers/demux_dts.c b/src/demuxers/demux_dts.c index ed1f16d33..0c73877e9 100644 --- a/src/demuxers/demux_dts.c +++ b/src/demuxers/demux_dts.c @@ -160,7 +160,7 @@ static int open_dts_file(demux_dts_t *this) { break; } /* 14 bits and little endian bitstream */ - else if ((syncword == 0xff1f00e8) && + else if ((syncword == 0xff1f00e8) && ((peak[i] & 0xf0) == 0xf0) && (peak[i+1] == 0x07)) { dts_version = 3; break; @@ -218,8 +218,8 @@ static int open_dts_file(demux_dts_t *this) { { case 0: /* BE16 */ case 1: /* LE16 */ - this->frame_size = fsize * 8 / 16 * 2; - break; + this->frame_size = fsize * 8 / 16 * 2; + break; case 2: /* BE14 */ case 3: /* LE14 */ this->frame_size = fsize * 8 / 14 * 2; @@ -250,7 +250,7 @@ static int demux_dts_send_chunk (demux_plugin_t *this_gen) { int frame_number; uint32_t blocksize; - current_stream_pos = this->input->get_current_pos(this->input) - + current_stream_pos = this->input->get_current_pos(this->input) - this->data_start; frame_number = current_stream_pos / this->frame_size; @@ -274,7 +274,7 @@ static int demux_dts_send_chunk (demux_plugin_t *this_gen) { } } else { buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); - buf->size = this->input->read(this->input, buf->content, + buf->size = this->input->read(this->input, buf->content, this->frame_size); } @@ -286,7 +286,7 @@ static int demux_dts_send_chunk (demux_plugin_t *this_gen) { buf->type = BUF_AUDIO_DTS; if( this->input->get_length (this->input) ) - buf->extra_info->input_normpos = (int)( (double) current_stream_pos * + buf->extra_info->input_normpos = (int)( (double) current_stream_pos * 65535 / (this->input->get_length(this->input) - this->data_start) ); buf->extra_info->input_time = audio_pts / 90; buf->pts = audio_pts; @@ -360,7 +360,7 @@ static int demux_dts_seek (demux_plugin_t *this_gen, if (start_time) { int length = demux_dts_get_stream_length (this_gen); if (length != 0) { - start_pos = start_time * + start_pos = start_time * (this->input->get_length(this->input) - this->data_start) / length; } } diff --git a/src/demuxers/demux_eawve.c b/src/demuxers/demux_eawve.c index 7a21635cb..2e393847c 100644 --- a/src/demuxers/demux_eawve.c +++ b/src/demuxers/demux_eawve.c @@ -213,7 +213,7 @@ static int demux_eawve_send_chunk(demux_eawve_t *this){ buf = this->audio_fifo->buffer_pool_alloc(this->audio_fifo); buf->type = BUF_AUDIO_EA_ADPCM; if( this->input->get_length (this->input) ) - buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * + buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * 65535 / this->input->get_length (this->input) ); buf->extra_info->input_time = (int)((int64_t)this->sample_counter * 1000 / 22050); buf->pts = this->sample_counter; diff --git a/src/demuxers/demux_elem.c b/src/demuxers/demux_elem.c index a66befe01..d38fe3c62 100644 --- a/src/demuxers/demux_elem.c +++ b/src/demuxers/demux_elem.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -46,7 +46,7 @@ #define NUM_PREVIEW_BUFFERS 50 #define SCRATCH_SIZE 256 -typedef struct { +typedef struct { demux_plugin_t demux_plugin; xine_stream_t *stream; @@ -83,7 +83,7 @@ static int demux_mpeg_elem_next (demux_mpeg_elem_t *this, int preview_mode) { buf->content = buf->mem; buf->pts = 0; if( this->input->get_length (this->input) ) - buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * + buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * 65535 / this->input->get_length (this->input) ); buf->type = BUF_VIDEO_MPEG; @@ -91,7 +91,7 @@ static int demux_mpeg_elem_next (demux_mpeg_elem_t *this, int preview_mode) { buf->decoder_flags = BUF_FLAG_PREVIEW; this->video_fifo->put(this->video_fifo, buf); - + return 1; } @@ -304,7 +304,7 @@ static const demuxer_info_t demux_info_elem = { }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_DEMUX, 26, "elem", XINE_VERSION_CODE, &demux_info_elem, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/demuxers/demux_film.c b/src/demuxers/demux_film.c index dcd57f76c..a8bd0b288 100644 --- a/src/demuxers/demux_film.c +++ b/src/demuxers/demux_film.c @@ -163,7 +163,7 @@ static int open_film_file(demux_film_t *film) { film->version[3]); /* load the rest of the FILM header */ - if (film->input->read(film->input, film_header, film_header_size) != + if (film->input->read(film->input, film_header, film_header_size) != film_header_size) { free (film->interleave_buffer); free (film->sample_table); @@ -202,7 +202,7 @@ static int open_film_file(demux_film_t *film) { if( !film->video_type ) film->video_type = BUF_VIDEO_UNKNOWN; - + /* fetch the audio information if the chunk size checks out */ if (chunk_size == 32) { film->audio_channels = film_header[21]; @@ -388,7 +388,7 @@ static int demux_film_send_chunk(demux_plugin_t *this_gen) { } /* check if we're only sending audio samples until the next keyframe */ - if ((this->waiting_for_keyframe) && + if ((this->waiting_for_keyframe) && (!this->sample_table[i].audio)) { if (this->sample_table[i].keyframe) { this->waiting_for_keyframe = 0; @@ -428,7 +428,7 @@ static int demux_film_send_chunk(demux_plugin_t *this_gen) { /* set the frame duration */ buf->decoder_flags |= BUF_FLAG_FRAMERATE; buf->decoder_info[0] = this->sample_table[i].duration; - + if (remaining_sample_bytes > buf->max_size) buf->size = buf->max_size; else @@ -443,11 +443,11 @@ static int demux_film_send_chunk(demux_plugin_t *this_gen) { } /* skip over the extra non-spec CVID bytes */ - this->input->seek(this->input, + this->input->seek(this->input, this->sample_table[i].sample_size - cvid_chunk_size, SEEK_CUR); /* load the rest of the chunk */ - if (this->input->read(this->input, buf->content + 10, + if (this->input->read(this->input, buf->content + 10, buf->size - 10) != buf->size - 10) { buf->free_buffer(buf); this->status = DEMUX_FINISHED; @@ -499,7 +499,7 @@ static int demux_film_send_chunk(demux_plugin_t *this_gen) { /* set the frame duration */ buf->decoder_flags |= BUF_FLAG_FRAMERATE; buf->decoder_info[0] = this->sample_table[i].duration; - + if (remaining_sample_bytes > buf->max_size) buf->size = buf->max_size; else @@ -627,8 +627,8 @@ static int demux_film_send_chunk(demux_plugin_t *this_gen) { buf->content[j] = this->interleave_buffer[k]; buf->content[j + 1] = this->interleave_buffer[k + 1]; } - for (j = 2, - k = interleave_index + this->sample_table[i].sample_size / 2; + for (j = 2, + k = interleave_index + this->sample_table[i].sample_size / 2; j < buf->size; j += 4, k += 2) { buf->content[j] = this->interleave_buffer[k]; buf->content[j + 1] = this->interleave_buffer[k + 1]; @@ -638,8 +638,8 @@ static int demux_film_send_chunk(demux_plugin_t *this_gen) { for (j = 0, k = interleave_index; j < buf->size; j += 2, k += 1) { buf->content[j] = this->interleave_buffer[k] += 0x80; } - for (j = 1, - k = interleave_index + this->sample_table[i].sample_size / 2; + for (j = 1, + k = interleave_index + this->sample_table[i].sample_size / 2; j < buf->size; j += 2, k += 1) { buf->content[j] = this->interleave_buffer[k] += 0x80; } @@ -654,7 +654,7 @@ static int demux_film_send_chunk(demux_plugin_t *this_gen) { this->audio_fifo->put(this->audio_fifo, buf); } } - + return this->status; } @@ -737,13 +737,13 @@ static int demux_film_seek (demux_plugin_t *this_gen, off_t start_pos, int start this->waiting_for_keyframe = 0; this->last_sample = 0; } - + /* if input is non-seekable, do not proceed with the rest of this * seek function */ if (!INPUT_IS_SEEKABLE(this->input)) return this->status; - /* perform a binary search on the sample table, testing the offset + /* perform a binary search on the sample table, testing the offset * boundaries first */ if (start_pos) { if (start_pos <= 0) @@ -760,7 +760,7 @@ static int demux_film_seek (demux_plugin_t *this_gen, off_t start_pos, int start while (!found) { middle = (left + right) / 2; if ((start_pos >= this->sample_table[middle].sample_offset) && - (start_pos <= this->sample_table[middle].sample_offset + + (start_pos <= this->sample_table[middle].sample_offset + this->sample_table[middle].sample_size)) { found = 1; } else if (start_pos < this->sample_table[middle].sample_offset) { @@ -817,7 +817,7 @@ static int demux_film_seek (demux_plugin_t *this_gen, off_t start_pos, int start } this->current_sample = best_index; - + return this->status; } diff --git a/src/demuxers/demux_flac.c b/src/demuxers/demux_flac.c index c4132b767..885e440a1 100644 --- a/src/demuxers/demux_flac.c +++ b/src/demuxers/demux_flac.c @@ -119,7 +119,7 @@ static int open_flac_file(demux_flac_t *flac) { * will always be 1 metadata block */ do { - if (flac->input->read(flac->input, preamble, FLAC_SIGNATURE_SIZE) != + if (flac->input->read(flac->input, preamble, FLAC_SIGNATURE_SIZE) != FLAC_SIGNATURE_SIZE) return 0; @@ -133,11 +133,11 @@ static int open_flac_file(demux_flac_t *flac) { case 0: lprintf ("STREAMINFO metadata\n"); if (block_length != FLAC_STREAMINFO_SIZE) { - lprintf ("expected STREAMINFO chunk of %d bytes\n", + lprintf ("expected STREAMINFO chunk of %d bytes\n", FLAC_STREAMINFO_SIZE); return 0; } - if (flac->input->read(flac->input, + if (flac->input->read(flac->input, flac->streaminfo + sizeof(xine_waveformatex), FLAC_STREAMINFO_SIZE) != FLAC_STREAMINFO_SIZE) return 0; @@ -146,8 +146,8 @@ static int open_flac_file(demux_flac_t *flac) { flac->bits_per_sample = ((flac->sample_rate >> 4) & 0x1F) + 1; flac->sample_rate >>= 12; flac->total_samples = _X_BE_64(&streaminfo[10]) & UINT64_C(0x0FFFFFFFFF); /* 36 bits */ - lprintf ("%d Hz, %d bits, %d channels, %"PRId64" total samples\n", - flac->sample_rate, flac->bits_per_sample, + lprintf ("%d Hz, %d bits, %d channels, %"PRId64" total samples\n", + flac->sample_rate, flac->bits_per_sample, flac->channels, flac->total_samples); break; @@ -178,7 +178,7 @@ static int open_flac_file(demux_flac_t *flac) { lprintf (" %d: sample %"PRId64", ", i, flac->seekpoints[i].sample_number); flac->seekpoints[i].offset = _X_BE_64(&buffer[8]); flac->seekpoints[i].size = _X_BE_16(&buffer[16]); - lprintf ("@ 0x%"PRIX64", size = %d bytes, ", + lprintf ("@ 0x%"PRIX64", size = %d bytes, ", flac->seekpoints[i].offset, flac->seekpoints[i].size); flac->seekpoints[i].pts = flac->seekpoints[i].sample_number; flac->seekpoints[i].pts *= 90000; @@ -187,7 +187,7 @@ static int open_flac_file(demux_flac_t *flac) { } break; - /* VORBIS_COMMENT + /* VORBIS_COMMENT * * For a description of the format please have a look at * http://www.xiph.org/vorbis/doc/v-comment.html */ @@ -229,7 +229,7 @@ static int open_flac_file(demux_flac_t *flac) { lprintf ("comment[%02d] = %s\n", cn, comment); - if ((strncasecmp ("TITLE=", comment, 6) == 0) + if ((strncasecmp ("TITLE=", comment, 6) == 0) && (length - 6 > 0)) { _x_meta_info_set_utf8 (flac->stream, XINE_META_INFO_TITLE, comment + 6); } else if ((strncasecmp ("ARTIST=", comment, 7) == 0) @@ -397,7 +397,7 @@ static int demux_flac_seek (demux_plugin_t *this_gen, int seekpoint_index = 0; int64_t start_pts; unsigned char buf[4]; - + start_pos = (off_t) ( (double) start_pos / 65535 * this->data_size ); @@ -458,9 +458,9 @@ static int demux_flac_seek (demux_plugin_t *this_gen, } _x_demux_flush_engine(this->stream); - this->input->seek(this->input, this->seekpoints[seekpoint_index].offset, + this->input->seek(this->input, this->seekpoints[seekpoint_index].offset, SEEK_SET); - _x_demux_control_newpts(this->stream, + _x_demux_control_newpts(this->stream, this->seekpoints[seekpoint_index].pts, BUF_FLAG_SEEK); } diff --git a/src/demuxers/demux_fli.c b/src/demuxers/demux_fli.c index 12ae81609..7735671b9 100644 --- a/src/demuxers/demux_fli.c +++ b/src/demuxers/demux_fli.c @@ -112,7 +112,7 @@ static int open_fli_file(demux_fli_t *this) { this->speed = _X_LE_32(&this->fli_header[16]); if (this->magic_number == FLI_FILE_MAGIC_1) { - /* + /* * in this case, the speed (n) is number of 1/70s ticks between frames: * * xine pts n * frame # @@ -123,7 +123,7 @@ static int open_fli_file(demux_fli_t *this) { */ this->frame_pts_inc = this->speed * 1285.7; } else if (this->magic_number == FLI_FILE_MAGIC_2) { - /* + /* * in this case, the speed (n) is number of milliseconds between frames: * * xine pts n * frame # diff --git a/src/demuxers/demux_flv.c b/src/demuxers/demux_flv.c index d3da20136..813f33086 100644 --- a/src/demuxers/demux_flv.c +++ b/src/demuxers/demux_flv.c @@ -20,7 +20,7 @@ /* * Flash Video (.flv) File Demuxer - * by Mike Melanson (melanson@pcisys.net) and + * by Mike Melanson (melanson@pcisys.net) and * Claudio Ciccani (klan@users.sf.net) * * For more information on the FLV file format, visit: @@ -67,28 +67,28 @@ typedef struct { unsigned char flags; off_t start; /* in bytes */ off_t size; /* in bytes */ - + unsigned char got_video_header; unsigned char got_audio_header; - + unsigned int length; /* in ms */ int width; int height; int duration; int videocodec; - + int samplerate; int samplesize; int stereo; int audiocodec; - + off_t filesize; - + flv_index_entry_t *index; unsigned int num_indices; - + unsigned int cur_pts; - + int64_t last_pts[2]; int send_newpts; int buf_flag_seek; @@ -178,7 +178,7 @@ static int open_flv_file(demux_flv_t *this) { if ((buffer[0] != 'F') || (buffer[1] != 'L') || (buffer[2] != 'V')) return 0; - + if (buffer[3] != 0x01) { xprintf(this->xine, XINE_VERBOSITY_LOG, _("unsupported FLV version (%d).\n"), buffer[3]); @@ -194,10 +194,10 @@ static int open_flv_file(demux_flv_t *this) { this->start = _X_BE_32(&buffer[5]); this->size = this->input->get_length(this->input); - + this->input->seek(this->input, this->start, SEEK_SET); - - lprintf(" qualified FLV file, repositioned @ offset 0x%" PRIxMAX "\n", + + lprintf(" qualified FLV file, repositioned @ offset 0x%" PRIxMAX "\n", (intmax_t)this->start); return 1; @@ -209,19 +209,19 @@ static int open_flv_file(demux_flv_t *this) { _tmp.d;\ })\ -static int parse_flv_var(demux_flv_t *this, +static int parse_flv_var(demux_flv_t *this, unsigned char *buf, int size, char *key, int keylen) { unsigned char *tmp = buf; unsigned char *end = buf + size; char *str; unsigned char type; unsigned int len, num; - + if (size < 1) return 0; - + type = *tmp++; - + switch (type) { case FLV_DATA_TYPE_NUMBER: lprintf(" got number (%f)\n", BE_F64(tmp)); @@ -366,7 +366,7 @@ static int parse_flv_var(demux_flv_t *this, lprintf(" got type %d\n", type); break; } - + return (tmp - buf); } @@ -375,7 +375,7 @@ static void parse_flv_script(demux_flv_t *this, int size) { unsigned char *tmp = buf; unsigned char *end = buf + size; int len; - + if (!buf || this->input->read(this->input, buf, size ) != size) { this->status = DEMUX_FINISHED; free(buf); @@ -388,7 +388,7 @@ static void parse_flv_script(demux_flv_t *this, int size) { break; tmp += len; } - + free(buf); } @@ -401,7 +401,7 @@ static int read_flv_packet(demux_flv_t *this, int preview) { unsigned int buf_type = 0; unsigned int buf_flags = 0; unsigned int pts; - + while (1) { lprintf (" reading FLV tag...\n"); this->input->seek(this->input, 4, SEEK_CUR); @@ -413,7 +413,7 @@ static int read_flv_packet(demux_flv_t *this, int preview) { tag_type = buffer[0]; remaining_bytes = _X_BE_24(&buffer[1]); pts = _X_BE_24(&buffer[4]) | (buffer[7] << 24); - + lprintf(" tag_type = 0x%02X, 0x%X bytes, pts %u\n", tag_type, remaining_bytes, pts/90); @@ -422,10 +422,10 @@ static int read_flv_packet(demux_flv_t *this, int preview) { lprintf(" got audio tag..\n"); if (this->input->read(this->input, buffer, 1) != 1) { this->status = DEMUX_FINISHED; - return this->status; + return this->status; } remaining_bytes--; - + this->audiocodec = buffer[0] >> 4; /* override */ switch (this->audiocodec) { case FLV_SOUND_FORMAT_PCM_BE: @@ -458,7 +458,7 @@ static int read_flv_packet(demux_flv_t *this, int preview) { buf_type = BUF_AUDIO_UNKNOWN; break; } - + fifo = this->audio_fifo; if (preview && !this->got_audio_header) { /* send init info to audio decoder */ @@ -474,7 +474,7 @@ static int read_flv_packet(demux_flv_t *this, int preview) { this->got_audio_header = 1; } break; - + case FLV_TAG_TYPE_VIDEO: lprintf(" got video tag..\n"); if (this->input->read(this->input, buffer, 1) != 1) { @@ -482,7 +482,7 @@ static int read_flv_packet(demux_flv_t *this, int preview) { return this->status; } remaining_bytes--; - + switch ((buffer[0] >> 4)) { case 0x01: buf_flags = BUF_FLAG_KEYFRAME; @@ -494,7 +494,7 @@ static int read_flv_packet(demux_flv_t *this, int preview) { default: break; } - + this->videocodec = buffer[0] & 0x0F; /* override */ switch (this->videocodec) { case FLV_VIDEO_FORMAT_FLV1: @@ -523,12 +523,12 @@ static int read_flv_packet(demux_flv_t *this, int preview) { buf_type = BUF_VIDEO_UNKNOWN; break; } - + fifo = this->video_fifo; if (preview && !this->got_video_header) { xine_bmiheader *bih; /* send init info to video decoder; send the bitmapinfo header to the decoder - * primarily as a formality since there is no real data inside */ + * primarily as a formality since there is no real data inside */ buf = fifo->buffer_pool_alloc(fifo); buf->decoder_flags = BUF_FLAG_HEADER | BUF_FLAG_STDHEADER | BUF_FLAG_FRAMERATE | BUF_FLAG_FRAME_END; @@ -566,7 +566,7 @@ static int read_flv_packet(demux_flv_t *this, int preview) { this->got_video_header = 1; } break; - + case FLV_TAG_TYPE_SCRIPT: lprintf(" got script tag...\n"); if (preview) { @@ -612,7 +612,7 @@ static int read_flv_packet(demux_flv_t *this, int preview) { this->got_audio_header = 1; lprintf(" got audio header from metadata...\n"); } - + if (!this->got_video_header && this->videocodec && this->videocodec != FLV_VIDEO_FORMAT_H264) { xine_bmiheader *bih; buf = this->video_fifo->buffer_pool_alloc(this->video_fifo); @@ -647,34 +647,34 @@ static int read_flv_packet(demux_flv_t *this, int preview) { this->got_video_header = 1; lprintf(" got video header from metadata...\n"); } - + return this->status; } /* no preview */ - this->input->seek(this->input, remaining_bytes, SEEK_CUR); + this->input->seek(this->input, remaining_bytes, SEEK_CUR); continue; - + default: lprintf(" skipping packet...\n"); this->input->seek(this->input, remaining_bytes, SEEK_CUR); continue; } - + while (remaining_bytes) { buf = fifo->buffer_pool_alloc(fifo); buf->type = buf_type; - + buf->extra_info->input_time = pts; if (this->input->get_length(this->input)) { - buf->extra_info->input_normpos = + buf->extra_info->input_normpos = (int)((double)this->input->get_current_pos(this->input) * 65535.0 / this->size); } - + if ((buf_type == BUF_VIDEO_H264 || buf_type == BUF_AUDIO_AAC) && buffer[0] == 0) { /* AVC/AAC sequence header */ buf->pts = 0; buf->size = 0; - + buf->decoder_flags = BUF_FLAG_SPECIAL | BUF_FLAG_HEADER; if (preview) buf->decoder_flags |= BUF_FLAG_PREVIEW; @@ -682,13 +682,13 @@ static int read_flv_packet(demux_flv_t *this, int preview) { buf->decoder_info[1] = BUF_SPECIAL_DECODER_CONFIG; buf->decoder_info[2] = MIN(remaining_bytes, buf->max_size); buf->decoder_info_ptr[2] = buf->mem; - + if (this->input->read(this->input, buf->mem, buf->decoder_info[2]) != buf->decoder_info[2]) { buf->free_buffer(buf); this->status = DEMUX_FINISHED; break; } - + if (remaining_bytes > buf->max_size) { xprintf(this->xine, XINE_VERBOSITY_LOG, _("sequence header too big (%u bytes)!\n"), remaining_bytes); @@ -722,11 +722,11 @@ static int read_flv_packet(demux_flv_t *this, int preview) { fifo->put(fifo, buf); } - + this->cur_pts = pts; break; } - + return this->status; } @@ -737,32 +737,32 @@ static void seek_flv_file(demux_flv_t *this, off_t seek_pos, int seek_pts) { int next_tag = 0; int do_rewind = (seek_pts < this->cur_pts); int i; - - lprintf(" seeking %s to %d...\n", + + lprintf(" seeking %s to %d...\n", do_rewind ? "backward" : "forward", seek_pts); - + if (seek_pos == 0 && seek_pts == 0) { this->input->seek(this->input, this->start, SEEK_SET); this->cur_pts = 0; return; } - + if (this->index) { if (do_rewind) { for (i = this->num_indices-1; i > 0; i--) { if (this->index[i-1].pts < seek_pts) break; } - } + } else { for (i = 0; i < (this->num_indices-1); i++) { if (this->index[i+1].pts > seek_pts) break; } } - + if (this->index[i].offset >= this->start+4) { - lprintf(" seeking to index entry %d (pts:%u, offset:%u).\n", + lprintf(" seeking to index entry %d (pts:%u, offset:%u).\n", i, this->index[i].pts, this->index[i].offset); this->input->seek(this->input, this->index[i].offset-4, SEEK_SET); @@ -771,16 +771,16 @@ static void seek_flv_file(demux_flv_t *this, off_t seek_pos, int seek_pts) { } else if (seek_pos && this->videocodec && abs(seek_pts-this->cur_pts) > 300000) { off_t pos, size; - + pos = this->input->get_current_pos(this->input); size = this->filesize ? : this->input->get_length(this->input); this->input->seek(this->input, (uint64_t)size * seek_pos / 65535, SEEK_SET); lprintf(" resyncing...\n"); - + /* resync */ for (i = 0; i < 200000; i++) { uint8_t buf[4]; - + if (this->input->read(this->input, buf, 1) < 1) { this->status = DEMUX_FINISHED; return; @@ -801,30 +801,30 @@ static void seek_flv_file(demux_flv_t *this, off_t seek_pos, int seek_pts) { this->input->seek(this->input, -11, SEEK_CUR); } } - + lprintf(" ...resync failed!\n"); this->input->seek(this->input, pos, SEEK_SET); - } - else if (seek_pts) { + } + else if (seek_pts) { while (do_rewind ? (seek_pts < this->cur_pts) : (seek_pts > this->cur_pts)) { unsigned char tag_type; int data_size; int ptag_size; - + if (next_tag) this->input->seek(this->input, next_tag, SEEK_CUR); - + len = this->input->read(this->input, buffer, 16); if (len != 16) { len = (len < 0) ? 0 : len; break; } - + ptag_size = _X_BE_32(&buffer[0]); tag_type = buffer[4]; data_size = _X_BE_24(&buffer[5]); pts = _X_BE_24(&buffer[8]) | (buffer[11] << 24); - + if (do_rewind) { if (!ptag_size) break; /* beginning of movie */ @@ -833,7 +833,7 @@ static void seek_flv_file(demux_flv_t *this, off_t seek_pos, int seek_pts) { else { next_tag = data_size - 1; } - + if (this->flags & FLV_FLAG_HAS_VIDEO) { /* sync to video key frame */ if (tag_type != FLV_TAG_TYPE_VIDEO || (buffer[15] >> 4) != 0x01) @@ -842,10 +842,10 @@ static void seek_flv_file(demux_flv_t *this, off_t seek_pos, int seek_pts) { } this->cur_pts = pts; } - + /* seek back to the beginning of the tag */ this->input->seek(this->input, -len, SEEK_CUR); - + lprintf( " seeked to %d.\n", pts); } } @@ -853,7 +853,7 @@ static void seek_flv_file(demux_flv_t *this, off_t seek_pos, int seek_pts) { static int demux_flv_send_chunk(demux_plugin_t *this_gen) { demux_flv_t *this = (demux_flv_t *) this_gen; - + return read_flv_packet(this, 0); } @@ -865,11 +865,11 @@ static void demux_flv_send_headers(demux_plugin_t *this_gen) { this->audio_fifo = this->stream->audio_fifo; this->status = DEMUX_OK; - + this->buf_flag_seek = 1; /* load stream information */ - _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_VIDEO, + _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_VIDEO, (this->flags & FLV_FLAG_HAS_VIDEO) ? 1 : 0); _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_AUDIO, (this->flags & FLV_FLAG_HAS_AUDIO) ? 1 : 0); @@ -898,7 +898,7 @@ static int demux_flv_seek (demux_plugin_t *this_gen, if (INPUT_IS_SEEKABLE(this->input)) { if (start_pos && !start_time) { - if (this->length) + if (this->length) start_time = (int64_t) this->length * start_pos / 65535; else if (this->index) start_time = this->index[(int)(start_pos * (this->num_indices-1) / 65535)].pts; @@ -906,13 +906,13 @@ static int demux_flv_seek (demux_plugin_t *this_gen, if (!this->length || start_time < this->length) { seek_flv_file(this, start_pos, start_time); - + if (playing) { this->buf_flag_seek = 1; _x_demux_flush_engine(this->stream); } } - } + } return this->status; } diff --git a/src/demuxers/demux_idcin.c b/src/demuxers/demux_idcin.c index d44f03ab3..46d4c284b 100644 --- a/src/demuxers/demux_idcin.c +++ b/src/demuxers/demux_idcin.c @@ -328,7 +328,7 @@ static int open_idcin_file(demux_idcin_t *this) { this->input->seek(this->input, IDCIN_HEADER_SIZE, SEEK_SET); /* read the Huffman table */ - if (this->input->read(this->input, huffman_table, HUFFMAN_TABLE_SIZE) != + if (this->input->read(this->input, huffman_table, HUFFMAN_TABLE_SIZE) != HUFFMAN_TABLE_SIZE) return 0; @@ -347,7 +347,7 @@ static int open_idcin_file(demux_idcin_t *this) { _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_BITS, this->wave.wBitsPerSample); - this->filesize = this->input->get_length(this->input) - + this->filesize = this->input->get_length(this->input) - IDCIN_HEADER_SIZE - HUFFMAN_TABLE_SIZE; return 1; @@ -433,7 +433,7 @@ static int demux_idcin_seek (demux_plugin_t *this_gen, off_t start_pos, int star this->status = DEMUX_OK; /* reposition stream past the Huffman tables */ - this->input->seek(this->input, IDCIN_HEADER_SIZE + HUFFMAN_TABLE_SIZE, + this->input->seek(this->input, IDCIN_HEADER_SIZE + HUFFMAN_TABLE_SIZE, SEEK_SET); this->pts_counter = 0; diff --git a/src/demuxers/demux_image.c b/src/demuxers/demux_image.c index feaf3ceaa..08136edba 100644 --- a/src/demuxers/demux_image.c +++ b/src/demuxers/demux_image.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2003-2005 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -82,7 +82,7 @@ static int demux_image_next (demux_plugin_t *this_gen, int preview) { } else { this->status = DEMUX_OK; } - + if (preview) buf->decoder_flags = BUF_FLAG_PREVIEW; @@ -211,7 +211,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, this->demux_plugin.get_capabilities = demux_image_get_capabilities; this->demux_plugin.get_optional_data = demux_image_get_optional_data; this->demux_plugin.demux_class = class_gen; - + this->status = DEMUX_FINISHED; this->buf_type = buf_type; @@ -226,7 +226,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, static const char *get_description (demux_class_t *this_gen) { return "image demux plugin"; } - + static const char *get_identifier (demux_class_t *this_gen) { return "imagedmx"; } diff --git a/src/demuxers/demux_ipmovie.c b/src/demuxers/demux_ipmovie.c index 4ef877988..5b4e12ef8 100644 --- a/src/demuxers/demux_ipmovie.c +++ b/src/demuxers/demux_ipmovie.c @@ -183,7 +183,7 @@ static int process_ipmovie_chunk(demux_ipmovie_t *this) { while ((chunk_size > 0) && (chunk_type != CHUNK_BAD)) { /* read the next chunk, wherever the file happens to be pointing */ - if (this->input->read(this->input, opcode_preamble, + if (this->input->read(this->input, opcode_preamble, OPCODE_PREAMBLE_SIZE) != OPCODE_PREAMBLE_SIZE) { chunk_type = CHUNK_BAD; break; @@ -221,7 +221,7 @@ static int process_ipmovie_chunk(demux_ipmovie_t *this) { chunk_type = CHUNK_BAD; break; } - if (this->input->read(this->input, scratch, opcode_size) != + if (this->input->read(this->input, scratch, opcode_size) != opcode_size) { chunk_type = CHUNK_BAD; break; @@ -239,7 +239,7 @@ static int process_ipmovie_chunk(demux_ipmovie_t *this) { chunk_type = CHUNK_BAD; break; } - if (this->input->read(this->input, scratch, opcode_size) != + if (this->input->read(this->input, scratch, opcode_size) != opcode_size) { chunk_type = CHUNK_BAD; break; @@ -275,7 +275,7 @@ static int process_ipmovie_chunk(demux_ipmovie_t *this) { chunk_type = CHUNK_BAD; break; } - if (this->input->read(this->input, scratch, opcode_size) != + if (this->input->read(this->input, scratch, opcode_size) != opcode_size) { chunk_type = CHUNK_BAD; break; @@ -336,23 +336,23 @@ static int process_ipmovie_chunk(demux_ipmovie_t *this) { buf->extra_info->input_normpos = (int)( (double) current_file_pos * 65535 / this->data_size); buf->extra_info->input_time = audio_pts / 90; buf->pts = audio_pts; - + if (opcode_size > buf->max_size) buf->size = buf->max_size; else buf->size = opcode_size; opcode_size -= buf->size; - + if (this->input->read(this->input, buf->content, buf->size) != buf->size) { buf->free_buffer(buf); chunk_type = CHUNK_BAD; break; } - + if (!opcode_size) buf->decoder_flags |= BUF_FLAG_FRAME_END; - + this->audio_fifo->put (this->audio_fifo, buf); } }else{ @@ -377,7 +377,7 @@ static int process_ipmovie_chunk(demux_ipmovie_t *this) { case OPCODE_SET_PALETTE: lprintf("set palette\n"); - /* check for the logical maximum palette size + /* check for the logical maximum palette size * (3 * 256 + 4 bytes) */ if (opcode_size > 0x304) { lprintf("set_palette opcode too large\n"); diff --git a/src/demuxers/demux_matroska-chapters.c b/src/demuxers/demux_matroska-chapters.c index aad8fe46d..4bfafe0da 100644 --- a/src/demuxers/demux_matroska-chapters.c +++ b/src/demuxers/demux_matroska-chapters.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2009 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA diff --git a/src/demuxers/demux_matroska.c b/src/demuxers/demux_matroska.c index 9d224c62c..94f47db44 100644 --- a/src/demuxers/demux_matroska.c +++ b/src/demuxers/demux_matroska.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2008 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -59,7 +59,7 @@ static void check_newpts (demux_matroska_t *this, int64_t pts, if ((track->track_type == MATROSKA_TRACK_VIDEO) || (track->track_type == MATROSKA_TRACK_AUDIO)) { - + diff = pts - track->last_pts; if (pts && (this->send_newpts || (track->last_pts && abs(diff)>WRAP_THRESHOLD)) ) { @@ -410,9 +410,9 @@ static int parse_content_encodings (demux_matroska_t *this, matroska_track_t *tr static void init_codec_video(demux_matroska_t *this, matroska_track_t *track) { buf_element_t *buf; - + buf = track->fifo->buffer_pool_alloc (track->fifo); - + if (track->codec_private_len > buf->max_size) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "demux_matroska: private decoder data length (%d) is greater than fifo buffer length (%" PRId32 ")\n", @@ -429,20 +429,20 @@ static void init_codec_video(demux_matroska_t *this, matroska_track_t *track) { xine_fast_memcpy (buf->content, track->codec_private, buf->size); else buf->content = NULL; - + if(track->default_duration) { buf->decoder_flags |= BUF_FLAG_FRAMERATE; - buf->decoder_info[0] = (int64_t)track->default_duration * + buf->decoder_info[0] = (int64_t)track->default_duration * (int64_t)90 / (int64_t)1000000; } - - if(track->video_track && track->video_track->display_width && + + if(track->video_track && track->video_track->display_width && track->video_track->display_height) { buf->decoder_flags |= BUF_FLAG_ASPECT; buf->decoder_info[1] = track->video_track->display_width; buf->decoder_info[2] = track->video_track->display_height; } - + track->fifo->put (track->fifo, buf); } @@ -460,7 +460,7 @@ static void init_codec_audio(demux_matroska_t *this, matroska_track_t *track) { return; } buf->size = track->codec_private_len; - + /* default param */ buf->decoder_info[0] = 0; buf->decoder_info[1] = 44100; @@ -492,9 +492,9 @@ static void init_codec_audio(demux_matroska_t *this, matroska_track_t *track) { static void init_codec_real(demux_matroska_t *this, matroska_track_t * track) { buf_element_t *buf; - + buf = track->fifo->buffer_pool_alloc (track->fifo); - + if (track->codec_private_len > buf->max_size) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "demux_matroska: private decoder data length (%d) is greater than fifo buffer length (%" PRId32 ")\n", @@ -502,30 +502,30 @@ static void init_codec_real(demux_matroska_t *this, matroska_track_t * track) { buf->free_buffer(buf); return; } - + buf->size = track->codec_private_len; buf->decoder_flags = BUF_FLAG_HEADER | BUF_FLAG_FRAME_END; buf->type = track->buf_type; buf->pts = 0; - + if (buf->size) xine_fast_memcpy (buf->content, track->codec_private, buf->size); else buf->content = NULL; - + if(track->default_duration) { buf->decoder_flags |= BUF_FLAG_FRAMERATE; - buf->decoder_info[0] = (int64_t)track->default_duration * + buf->decoder_info[0] = (int64_t)track->default_duration * (int64_t)90 / (int64_t)1000000; } - - if(track->video_track && track->video_track->display_width && + + if(track->video_track && track->video_track->display_width && track->video_track->display_height) { buf->decoder_flags |= BUF_FLAG_ASPECT; buf->decoder_info[1] = track->video_track->display_width; buf->decoder_info[2] = track->video_track->display_height; } - + track->fifo->put (track->fifo, buf); } @@ -551,7 +551,7 @@ static void init_codec_xiph(demux_matroska_t *this, matroska_track_t *track) { data = track->codec_private + 3; for (i = 0; i < 3; i++) { buf = track->fifo->buffer_pool_alloc (track->fifo); - + if (frame[i] > buf->max_size) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "demux_matroska: private decoder data length (%d) is greater than fifo buffer length (%" PRId32 ")\n", @@ -560,7 +560,7 @@ static void init_codec_xiph(demux_matroska_t *this, matroska_track_t *track) { return; } buf->size = frame[i]; - + buf->decoder_flags = BUF_FLAG_HEADER | BUF_FLAG_FRAME_START | BUF_FLAG_FRAME_END; buf->type = track->buf_type; buf->pts = 0; @@ -849,7 +849,7 @@ static void handle_realvideo (demux_plugin_t *this_gen, matroska_track_t *track, buf->decoder_info[1] = BUF_SPECIAL_RV_CHUNK_TABLE; buf->decoder_info[2] = chunks; buf->decoder_info_ptr[2] = buf->content; - + buf->size = 0; buf->type = track->buf_type; @@ -916,7 +916,7 @@ static void handle_sub_ssa (demux_plugin_t *this_gen, matroska_track_t *track, } } } - + last_char = *data; data++; data_len--; } @@ -927,11 +927,11 @@ static void handle_sub_ssa (demux_plugin_t *this_gen, matroska_track_t *track, buf->size = dest - (char *)buf->content; buf->extra_info->input_normpos = input_normpos; buf->extra_info->input_time = input_time; - + track->fifo->put(track->fifo, buf); } else { buf->free_buffer(buf); - } + } } static void handle_sub_utf8 (demux_plugin_t *this_gen, matroska_track_t *track, @@ -946,7 +946,7 @@ static void handle_sub_utf8 (demux_plugin_t *this_gen, matroska_track_t *track, buf = track->fifo->buffer_pool_alloc(track->fifo); buf->size = data_len + 9; /* 2 uint32_t + '\0' */ - + if (buf->max_size >= buf->size) { buf->decoder_flags = decoder_flags; @@ -955,7 +955,7 @@ static void handle_sub_utf8 (demux_plugin_t *this_gen, matroska_track_t *track, buf->decoder_info[1] = BUF_SPECIAL_CHARSET_ENCODING; buf->decoder_info_ptr[2] = "utf-8"; buf->decoder_info[2] = strlen(buf->decoder_info_ptr[2]); - + val = (uint32_t *)buf->content; *val++ = data_pts / 90; /* start time */ *val++ = (data_pts + data_duration) / 90; /* end time */ @@ -1020,7 +1020,7 @@ static void handle_vobsub (demux_plugin_t *this_gen, matroska_track_t *track, (int)track->track_num, result); free(dest); inflateEnd(&zstream); - + if (result == Z_DATA_ERROR && track->compress_algo == MATROSKA_COMPRESS_UNKNOWN) { track->compress_algo = MATROSKA_COMPRESS_NONE; data_len = old_data_len; @@ -1033,11 +1033,11 @@ static void handle_vobsub (demux_plugin_t *this_gen, matroska_track_t *track, zstream.avail_out += 4000; } while ((zstream.avail_out == 4000) && (zstream.avail_in != 0) && (result != Z_STREAM_END)); - + if (track->compress_algo != MATROSKA_COMPRESS_NONE) { data_len = zstream.total_out; inflateEnd(&zstream); - + data = dest; track->compress_algo = MATROSKA_COMPRESS_ZLIB; lprintf("VobSub: decompression for track %d from %d to %d\n", @@ -1098,7 +1098,7 @@ static int parse_track_entry(demux_matroska_t *this, matroska_track_t *track) { } break; - case MATROSKA_ID_TR_TYPE: + case MATROSKA_ID_TR_TYPE: { uint64_t num; lprintf("TrackType\n"); @@ -1200,7 +1200,7 @@ static int parse_track_entry(demux_matroska_t *this, matroska_track_t *track) { } break; - case MATROSKA_ID_TR_UID: + case MATROSKA_ID_TR_UID: { uint64_t val; @@ -1470,10 +1470,10 @@ static int parse_track_entry(demux_matroska_t *this, matroska_track_t *track) { static int parse_tracks(demux_matroska_t *this) { ebml_parser_t *ebml = this->ebml; int next_level = 2; - + while (next_level == 2) { ebml_elem_t elem; - + if (!ebml_read_elem_head(ebml, &elem)) return 0; @@ -1515,10 +1515,10 @@ static int parse_cue_trackposition(demux_matroska_t *this, int *track_num, int64_t *pos) { ebml_parser_t *ebml = this->ebml; int next_level = 4; - + while (next_level == 4) { ebml_elem_t elem; - + if (!ebml_read_elem_head(ebml, &elem)) return 0; @@ -1555,10 +1555,10 @@ static int parse_cue_point(demux_matroska_t *this) { int next_level = 3; int64_t timecode = -1, pos = -1; int track_num = -1; - + while (next_level == 3) { ebml_elem_t elem; - + if (!ebml_read_elem_head(ebml, &elem)) return 0; @@ -1623,10 +1623,10 @@ static int parse_cue_point(demux_matroska_t *this) { static int parse_cues(demux_matroska_t *this) { ebml_parser_t *ebml = this->ebml; int next_level = 2; - + while (next_level == 2) { ebml_elem_t elem; - + if (!ebml_read_elem_head(ebml, &elem)) return 0; @@ -1652,10 +1652,10 @@ static int parse_cues(demux_matroska_t *this) { static int parse_attachments(demux_matroska_t *this) { ebml_parser_t *ebml = this->ebml; int next_level = 2; - + while (next_level == 2) { ebml_elem_t elem; - + if (!ebml_read_elem_head(ebml, &elem)) return 0; @@ -1674,10 +1674,10 @@ static int parse_attachments(demux_matroska_t *this) { static int parse_tags(demux_matroska_t *this) { ebml_parser_t *ebml = this->ebml; int next_level = 2; - + while (next_level == 2) { ebml_elem_t elem; - + if (!ebml_read_elem_head(ebml, &elem)) return 0; @@ -1716,7 +1716,7 @@ static int parse_ebml_uint(demux_matroska_t *this, uint8_t *data, uint64_t *num) } if (size > 8) { off_t pos = this->input->get_current_pos(this->input); - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "demux_matroska: Invalid Track Number at position %" PRIdMAX "\n", (intmax_t)pos); return 0; @@ -1745,7 +1745,7 @@ static int parse_ebml_sint(demux_matroska_t *this, uint8_t *data, int64_t *num) *num = -1; else *num = unum - ((1 << ((7 * size) - 1)) - 1); - + return size; } @@ -1815,7 +1815,7 @@ static int parse_block (demux_matroska_t *this, size_t block_size, flags = *data; data += 1; - + lprintf("track_num: %" PRIu64 ", timecode_diff: %d, flags: 0x%x\n", track_num, timecode_diff, flags); gap = flags & 1; @@ -1922,7 +1922,7 @@ static int parse_block (demux_matroska_t *this, size_t block_size, int frame_size; lprintf("fixed size lacing\n"); - + frame_size = block_size_left / (lace_num + 1); for (i = 0; i < lace_num; i++) { frame[i] = frame_size; @@ -2024,10 +2024,10 @@ static int parse_simpleblock(demux_matroska_t *this, size_t block_len, uint64_t file_len = this->input->get_length(this->input); if( file_len ) normpos = (int) ( (double) block_pos * 65535 / file_len ); - + if (!read_block_data(this, block_len)) return 0; - + has_block = 1; /* we have the duration, we can parse the block now */ if (!parse_block(this, block_len, cluster_timecode, block_duration, @@ -2258,10 +2258,10 @@ static int parse_seek_entry(demux_matroska_t *this) { int has_position = 0; uint64_t id = 0; uint64_t pos; - + while (next_level == 3) { ebml_elem_t elem; - + if (!ebml_read_elem_head(ebml, &elem)) return 0; @@ -2285,26 +2285,26 @@ static int parse_seek_entry(demux_matroska_t *this) { } next_level = ebml_get_next_level(ebml, &elem); } - + /* do not parse clusters */ if (id == MATROSKA_ID_CLUSTER) { lprintf("skip cluster\n"); return 1; } - - /* parse the referenced element */ + + /* parse the referenced element */ if (has_id && has_position) { off_t current_pos, seek_pos; - + seek_pos = this->segment.start + pos; - + if ((seek_pos > 0) && (seek_pos < this->input->get_length(this->input))) { ebml_parser_t ebml_bak; /* backup current state */ current_pos = this->input->get_current_pos(this->input); memcpy(&ebml_bak, this->ebml, sizeof(ebml_parser_t)); /* FIXME */ - + /* seek and parse the top_level element */ this->ebml->level = 1; if (this->input->seek(this->input, seek_pos, SEEK_SET) < 0) { @@ -2343,7 +2343,7 @@ static int parse_seekhead(demux_matroska_t *this) { while (next_level == 2) { ebml_elem_t elem; - + if (!ebml_read_elem_head(ebml, &elem)) return 0; @@ -2381,18 +2381,18 @@ static int parse_top_level_head(demux_matroska_t *this, int *next_level) { int ret_value = 1; off_t current_pos; - + current_pos = this->input->get_current_pos(this->input); lprintf("current_pos: %" PRIdMAX "\n", (intmax_t)current_pos); - + if (!ebml_read_elem_head(ebml, &elem)) return 0; - + if (!find_top_level_entry(this, current_pos)) { if (!add_top_level_entry(this, current_pos)) return 0; - + switch (elem.id) { case MATROSKA_ID_SEEKHEAD: lprintf("SeekHead\n"); @@ -2459,7 +2459,7 @@ static int parse_top_level_head(demux_matroska_t *this, int *next_level) { if (!ebml_skip(ebml, &elem)) return 0; } - + if (next_level) *next_level = ebml_get_next_level(ebml, &elem); @@ -2546,12 +2546,12 @@ static int parse_segment(demux_matroska_t *this) { if (this->segment.id == MATROSKA_ID_SEGMENT) { int res; int next_level; - + lprintf("Segment detected\n"); if (!ebml_read_master (ebml, &this->segment)) return 0; - + res = 1; next_level = 1; /* stop the loop on the first cluster */ @@ -2603,14 +2603,14 @@ static void demux_matroska_send_headers (demux_plugin_t *this_gen) { _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_VIDEO, (this->num_video_tracks != 0)); _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_AUDIO, (this->num_audio_tracks != 0)); - + /* * send preview buffers */ /* enter in the segment */ ebml_read_master (this->ebml, &this->segment); - + /* seek back to the beginning of the segment */ next_level = 1; if (this->input->seek(this->input, this->segment.start, SEEK_SET) < 0) { @@ -2620,7 +2620,7 @@ static void demux_matroska_send_headers (demux_plugin_t *this_gen) { this->status = DEMUX_FINISHED; return; } - + this->preview_sent = 0; this->preview_mode = 1; @@ -2706,7 +2706,7 @@ static int demux_matroska_seek (demux_plugin_t *this_gen, matroska_index_t *index; matroska_track_t *track; int i, entry; - + start_pos = (off_t) ( (double) start_pos / 65535 * this->input->get_length (this->input) ); @@ -2762,10 +2762,10 @@ static int demux_matroska_seek (demux_plugin_t *this_gen, index->track_num, start_pos ? "pos" : "time", start_pos ? (intmax_t)start_pos : (intmax_t)start_time, index->track_num, index->timecode[entry], (intmax_t)index->pos[entry]); - + if (this->input->seek(this->input, index->pos[entry], SEEK_SET) < 0) this->status = DEMUX_FINISHED; - + /* we always seek to the ebml level 1 */ this->ebml->level = 1; @@ -2779,7 +2779,7 @@ static int demux_matroska_seek (demux_plugin_t *this_gen, static void demux_matroska_dispose (demux_plugin_t *this_gen) { - + demux_matroska_t *this = (demux_matroska_t *) this_gen; int i; @@ -2861,7 +2861,7 @@ static int demux_matroska_get_optional_data (demux_plugin_t *this_gen, if ((channel >= 0) && (channel < this->num_sub_tracks)) { for (track_num = 0; track_num < this->num_tracks; track_num++) { matroska_track_t *track = this->tracks[track_num]; - + if ((track->buf_type & 0xFF00001F) == (BUF_SPU_BASE + channel)) { if (track->language) { strncpy (str, track->language, XINE_LANG_MAX); @@ -2877,13 +2877,13 @@ static int demux_matroska_get_optional_data (demux_plugin_t *this_gen, } } return DEMUX_OPTIONAL_UNSUPPORTED; - + case DEMUX_OPTIONAL_DATA_AUDIOLANG: lprintf ("DEMUX_OPTIONAL_DATA_AUDIOLANG channel = %d\n",channel); if ((channel >= 0) && (channel < this->num_audio_tracks)) { for (track_num = 0; track_num < this->num_tracks; track_num++) { matroska_track_t *track = this->tracks[track_num]; - + if ((track->buf_type & 0xFF00001F) == (BUF_AUDIO_BASE + channel)) { if (track->language) { strncpy (str, track->language, XINE_LANG_MAX); diff --git a/src/demuxers/demux_matroska.h b/src/demuxers/demux_matroska.h index a62aba498..e1611f397 100644 --- a/src/demuxers/demux_matroska.h +++ b/src/demuxers/demux_matroska.h @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2008 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -55,7 +55,7 @@ typedef struct { off_t *pos; uint64_t *timecode; int num_entries; - + } matroska_index_t; typedef struct { @@ -110,10 +110,10 @@ typedef struct { matroska_track_t *audio_track; /* to remove */ matroska_track_t *sub_track; /* to remove */ uint64_t last_timecode; - + int send_newpts; int buf_flag_seek; - + /* seekhead parsing */ int top_level_list_size; int top_level_list_max_size; diff --git a/src/demuxers/demux_mng.c b/src/demuxers/demux_mng.c index d0d83ff80..2fccd0b9e 100644 --- a/src/demuxers/demux_mng.c +++ b/src/demuxers/demux_mng.c @@ -181,7 +181,7 @@ static int demux_mng_send_chunk(demux_mng_t *this){ buf->decoder_flags = BUF_FLAG_FRAMERATE; buf->decoder_info[0] = 90 * this->timer_count; if( this->input->get_length (this->input) ) - buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * + buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * 65535 / this->input->get_length (this->input) ); buf->extra_info->input_time = this->tick_count; buf->pts = 90 * this->tick_count; diff --git a/src/demuxers/demux_mod.c b/src/demuxers/demux_mod.c index de3e29ca8..0439be7ee 100644 --- a/src/demuxers/demux_mod.c +++ b/src/demuxers/demux_mod.c @@ -74,16 +74,16 @@ typedef struct { char *artist; char *copyright; size_t filesize; - + char *buffer; int64_t current_pts; - + ModPlug_Settings settings; ModPlugFile *mpfile; int mod_length; int seek_flag; /* this is set when a seek just occurred */ - + } demux_mod_t; typedef struct { @@ -131,7 +131,7 @@ static int probe_mod_file(demux_mod_t *this) { static int open_mod_file(demux_mod_t *this) { int total_read; off_t input_length; - + /* Get size and create buffer */ input_length = this->input->get_length(this->input); /* Avoid potential issues with signed variables and e.g. read() returning -1 */ @@ -139,7 +139,7 @@ static int open_mod_file(demux_mod_t *this) { xine_log(this->stream->xine, XINE_LOG_PLUGIN, "modplug - size overflow\n"); return 0; } - this->filesize = input_length; + this->filesize = input_length; this->buffer = (char *)malloc(this->filesize); if(!this->buffer) { xine_log(this->stream->xine, XINE_LOG_PLUGIN, "modplug - allocation failure\n"); @@ -148,23 +148,23 @@ static int open_mod_file(demux_mod_t *this) { /* Seek to beginning */ this->input->seek(this->input, 0, SEEK_SET); - + /* Read data */ total_read = this->input->read(this->input, this->buffer, this->filesize); - + if(total_read != this->filesize) { xine_log(this->stream->xine, XINE_LOG_PLUGIN, "modplug - filesize error\n"); free(this->buffer); return 0; } - + this->mpfile = ModPlug_Load(this->buffer, this->filesize); if (this->mpfile==NULL) { xine_log(this->stream->xine, XINE_LOG_PLUGIN, "modplug - load error\n"); free(this->buffer); return 0; } - + /* Set up modplug engine */ ModPlug_GetSettings(&this->settings); this->settings.mResamplingMode = MODPLUG_RESAMPLE_FIR; /* RESAMP */ @@ -172,15 +172,15 @@ static int open_mod_file(demux_mod_t *this) { this->settings.mBits = MOD_BITS; this->settings.mFrequency = MOD_SAMPLERATE; ModPlug_SetSettings(&this->settings); - + this->title = strdup(ModPlug_GetName(this->mpfile)); this->artist = strdup(""); this->copyright = strdup(""); - + this->mod_length = ModPlug_GetLength(this->mpfile); if (this->mod_length < 1) this->mod_length = 1; /* avoids -ve & div-by-0 */ - + return 1; } @@ -201,20 +201,20 @@ static int demux_mod_send_chunk(demux_plugin_t *this_gen) { buf->size = mlen; buf->pts = this->current_pts; buf->extra_info->input_time = buf->pts / 90; - + buf->extra_info->input_normpos = buf->extra_info->input_time * 65535 / this->mod_length; buf->decoder_flags = BUF_FLAG_FRAME_END; - + if (this->seek_flag) { _x_demux_control_newpts(this->stream, buf->pts, BUF_FLAG_SEEK); this->seek_flag = 0; } this->audio_fifo->put (this->audio_fifo, buf); - + this->current_pts += 90000 * mlen / OUT_BYTES_PER_SECOND; } - + return this->status; } @@ -260,9 +260,9 @@ static int demux_mod_seek (demux_plugin_t *this_gen, demux_mod_t *this = (demux_mod_t *) this_gen; int64_t seek_millis; - + if (start_pos) { - seek_millis = this->mod_length; + seek_millis = this->mod_length; seek_millis *= start_pos; seek_millis /= 65535; } else { @@ -272,14 +272,14 @@ static int demux_mod_seek (demux_plugin_t *this_gen, _x_demux_flush_engine(this->stream); ModPlug_Seek(this->mpfile, seek_millis); this->current_pts = seek_millis * 90; - + this->seek_flag = 1; return this->status; } static void demux_mod_dispose (demux_plugin_t *this_gen) { demux_mod_t *this = (demux_mod_t *) this_gen; - + ModPlug_Unload(this->mpfile); free(this->buffer); free(this->title); @@ -335,7 +335,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str this->status = DEMUX_FINISHED; xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "TEST mod decode\n"); - + switch (stream->content_detection_method) { case METHOD_EXPLICIT: diff --git a/src/demuxers/demux_mpc.c b/src/demuxers/demux_mpc.c index 220e1b8b6..04b25eeb5 100644 --- a/src/demuxers/demux_mpc.c +++ b/src/demuxers/demux_mpc.c @@ -24,7 +24,7 @@ * APE tag reading * Seeking?? */ - + #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -66,7 +66,7 @@ typedef struct { unsigned int frames; double samplerate; unsigned int length; - + unsigned int current_frame; unsigned int next_frame_bits; } demux_mpc_t; @@ -82,7 +82,7 @@ typedef struct { static int open_mpc_file(demux_mpc_t *this) { unsigned int first_frame_size; unsigned int id3v2_size = 0; - + /* Read the file header */ if (_x_demux_read_header(this->input, this->header, HEADER_SIZE) != HEADER_SIZE) return 0; @@ -91,39 +91,39 @@ static int open_mpc_file(demux_mpc_t *this) { if (INPUT_IS_SEEKABLE(this->input)) { /* Check for id3v2 tag */ if (id3v2_istag(this->header)) { - + lprintf("found id3v2 header\n"); - + /* Read tag size */ - + id3v2_size = _X_BE_32_synchsafe(&this->header[6]) + 10; - + /* Add footer size if one is present */ if (this->header[5] & 0x10) id3v2_size += 10; - + lprintf("id3v2 size: %u\n", id3v2_size); - + /* Seek past tag */ if (this->input->seek(this->input, id3v2_size, SEEK_SET) < 0) return 0; - + /* Read musepack header */ if (this->input->read(this->input, this->header, HEADER_SIZE) != HEADER_SIZE) return 0; } } - + /* Validate signature - We only support SV 7.x at the moment */ if ( memcmp(this->header, "MP+", 3) != 0 || ((this->header[3]&0x0f) != 0x07)) return 0; - + /* Get frame count */ this->current_frame = 0; this->frames = _X_LE_32(&this->header[4]); lprintf("number of frames: %u\n", this->frames); - + /* Get sample rate */ switch ((_X_LE_32(&this->header[8]) >> 16) & 0x3) { case 0: @@ -142,7 +142,7 @@ static int open_mpc_file(demux_mpc_t *this) { break; } lprintf("samplerate: %f kHz\n", this->samplerate); - + /* Calculate stream length */ this->length = (int) ((double) this->frames * 1152 / this->samplerate); lprintf("stream length: %d ms\n", this->length); @@ -151,14 +151,14 @@ static int open_mpc_file(demux_mpc_t *this) { first_frame_size = (_X_LE_32(&this->header[24]) >> 4) & 0xFFFFF; this->next_frame_bits = first_frame_size - 4; lprintf("first frame size: %u\n", first_frame_size); - + /* Move input to start of data (to nearest multiple of 4) */ this->input->seek(this->input, 28+id3v2_size, SEEK_SET); - + /* Set stream info */ _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_AUDIO, 1); _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_FOURCC, _X_ME_32(this->header)); - + return 1; } @@ -168,30 +168,30 @@ static int demux_mpc_send_chunk(demux_plugin_t *this_gen) { off_t bytes_read; buf_element_t *buf = NULL; - + /* Check if we've finished */ if (this->current_frame++ == this->frames) { lprintf("all frames read\n"); this->status = DEMUX_FINISHED; - return this->status; + return this->status; } lprintf("current frame: %u\n", this->current_frame); - - /* Get a buffer */ + + /* Get a buffer */ buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); buf->type = BUF_AUDIO_MPC; buf->pts = 0; buf->extra_info->total_time = this->length; - + /* Set normalised position */ - buf->extra_info->input_normpos = - (int) ((double) this->input->get_current_pos(this->input) * 65535 / + buf->extra_info->input_normpos = + (int) ((double) this->input->get_current_pos(this->input) * 65535 / this->input->get_length(this->input)); - + /* Set time based on there being 1152 audio frames per frame */ - buf->extra_info->input_time = + buf->extra_info->input_time = (int) ((double) this->current_frame * 1152 / this->samplerate); - + /* Calculate the number of bits that need to be read to finish reading * the current frame and read the size of the next frame. This number * has to be rounded up to the nearest 4 bytes on account of the @@ -204,35 +204,35 @@ static int demux_mpc_send_chunk(demux_plugin_t *this_gen) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("demux_mpc: frame too big for buffer")); this->status = DEMUX_FINISHED; - return this->status; + return this->status; } - + /* Read data */ bytes_read = this->input->read(this->input, buf->content, bytes_to_read); if(bytes_read <= 0) { buf->free_buffer(buf); this->status = DEMUX_FINISHED; return this->status; - } else + } else buf->size = bytes_read; - + /* Read the size of the next frame */ if (this->current_frame < this->frames) { - /* The number of bits of the next frame we've read */ + /* The number of bits of the next frame we've read */ extra_bits_read = bits_to_read - (this->next_frame_bits+20); - + if(extra_bits_read <= 12) next_frame_size = (_X_LE_32(&buf->content[bytes_to_read-4]) >> extra_bits_read) & 0xFFFFF; else next_frame_size = ((_X_LE_32(&buf->content[bytes_to_read-8]) << (32-extra_bits_read)) | (_X_LE_32(&buf->content[bytes_to_read-4]) >> extra_bits_read)) & 0xFFFFF; - + lprintf("next frame size: %u\n", next_frame_size); - + /* The number of bits of the next frame still to read */ - this->next_frame_bits = next_frame_size - extra_bits_read; + this->next_frame_bits = next_frame_size - extra_bits_read; } - + /* Each buffer contains at least one frame */ buf->decoder_flags |= BUF_FLAG_FRAME_END; @@ -255,14 +255,14 @@ static void demux_mpc_send_headers(demux_plugin_t *this_gen) { /* Send header to decoder */ if (this->audio_fifo) { buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); - + buf->type = BUF_AUDIO_MPC; buf->decoder_flags = BUF_FLAG_HEADER|BUF_FLAG_FRAME_END; buf->decoder_info[0] = this->input->get_length(this->input); buf->decoder_info[1] = 0; buf->decoder_info[2] = 0; buf->decoder_info[3] = 0; - + /* Copy the header */ buf->size = HEADER_SIZE; memcpy(buf->content, this->header, buf->size); @@ -351,12 +351,12 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str case METHOD_BY_CONTENT: case METHOD_EXPLICIT: - + if (!open_mpc_file(this)) { free (this); return NULL; } - + break; default: diff --git a/src/demuxers/demux_mpeg.c b/src/demuxers/demux_mpeg.c index 85b62f48e..dbaae108d 100644 --- a/src/demuxers/demux_mpeg.c +++ b/src/demuxers/demux_mpeg.c @@ -170,7 +170,7 @@ static void find_mdat_atom(input_plugin_t *input, off_t *mdat_offset, } else atom_size -= ATOM_PREAMBLE_SIZE; - + input->seek(input, atom_size, SEEK_CUR); } } @@ -310,13 +310,13 @@ static void parse_mpeg2_packet (demux_mpeg_t *this, int stream_id, int64_t scr) buf->type = BUF_SPU_SVCD + spu_id; buf->pts = pts; - /* There is a bug in WinSubMux doesn't redo PACK headers in + /* There is a bug in WinSubMux doesn't redo PACK headers in the private stream 1. This might cause the below to mess up. if( !preview_mode ) check_newpts( this, this->pts, PTS_VIDEO ); */ this->video_fifo->put (this->video_fifo, buf); - lprintf ("SPU SVCD PACK (pts: %"PRId64", spu id: %d) put on FIFO\n", + lprintf ("SPU SVCD PACK (pts: %"PRId64", spu id: %d) put on FIFO\n", buf->pts, spu_id); return; @@ -368,10 +368,10 @@ static void parse_mpeg2_packet (demux_mpeg_t *this, int stream_id, int64_t scr) buf->decoder_flags = BUF_FLAG_PREVIEW; if( this->input->get_length (this->input) ) - buf->extra_info->input_normpos = - (int)( ((int64_t)this->input->get_current_pos (this->input) * + buf->extra_info->input_normpos = + (int)( ((int64_t)this->input->get_current_pos (this->input) * 65535) / this->input->get_length (this->input) ); - + if (this->rate) buf->extra_info->input_time = (int)((int64_t)this->input->get_current_pos (this->input) * 1000 / (this->rate * 50)); @@ -405,8 +405,8 @@ static void parse_mpeg2_packet (demux_mpeg_t *this, int stream_id, int64_t scr) buf->decoder_flags |= BUF_FLAG_PREVIEW; if( this->input->get_length (this->input) ) - buf->extra_info->input_normpos = - (int)( ((int64_t)this->input->get_current_pos (this->input) * + buf->extra_info->input_normpos = + (int)( ((int64_t)this->input->get_current_pos (this->input) * 65535) / this->input->get_length (this->input) ); if (this->rate) buf->extra_info->input_time = (int)((int64_t)this->input->get_current_pos (this->input) @@ -449,7 +449,7 @@ static void parse_mpeg2_packet (demux_mpeg_t *this, int stream_id, int64_t scr) this->input->read (this->input, this->dummy_space, header_len); - for (i = len; i > 0; i -= (this->audio_fifo) + for (i = len; i > 0; i -= (this->audio_fifo) ? this->audio_fifo->buffer_pool_buf_size : this->video_fifo->buffer_pool_buf_size) { if(this->audio_fifo) { buf = this->input->read_block (this->input, this->audio_fifo, @@ -469,8 +469,8 @@ static void parse_mpeg2_packet (demux_mpeg_t *this, int stream_id, int64_t scr) buf->decoder_flags = BUF_FLAG_PREVIEW; if( this->input->get_length (this->input) ) - buf->extra_info->input_normpos = - (int)( ((int64_t)this->input->get_current_pos (this->input) * + buf->extra_info->input_normpos = + (int)( ((int64_t)this->input->get_current_pos (this->input) * 65535) / this->input->get_length (this->input) ); if (this->rate) buf->extra_info->input_time = (int)((int64_t)this->input->get_current_pos (this->input) @@ -505,18 +505,18 @@ static void parse_mpeg2_packet (demux_mpeg_t *this, int stream_id, int64_t scr) header_len -= 5 ; } - + if ((flags & 0x40) == 0x40) { - + w = read_bytes(this, 1); dts = (int64_t)(w & 0x0e) << 29 ; w = read_bytes(this, 2); dts |= (w & 0xFFFE) << 14; w = read_bytes(this, 2); dts |= (w & 0xFFFE) >> 1; - + header_len -= 5 ; - } + } /* read rest of header */ this->input->read (this->input, this->dummy_space, header_len); @@ -542,8 +542,8 @@ static void parse_mpeg2_packet (demux_mpeg_t *this, int stream_id, int64_t scr) buf->decoder_flags = BUF_FLAG_PREVIEW; if( this->input->get_length (this->input) ) - buf->extra_info->input_normpos = - (int)( ((int64_t)this->input->get_current_pos (this->input) * + buf->extra_info->input_normpos = + (int)( ((int64_t)this->input->get_current_pos (this->input) * 65535) / this->input->get_length (this->input) ); if (this->rate) buf->extra_info->input_time = (int)((int64_t)this->input->get_current_pos (this->input) @@ -554,7 +554,7 @@ static void parse_mpeg2_packet (demux_mpeg_t *this, int stream_id, int64_t scr) } else { - for (i = len; i > 0; i -= 10000) + for (i = len; i > 0; i -= 10000) this->input->read (this->input, this->dummy_space, (i > 10000) ? 10000 : i); } @@ -622,7 +622,7 @@ static void parse_mpeg1_packet (demux_mpeg_t *this, int stream_id, int64_t scr) pts |= (w & 0xFFFE) << 14; w = read_bytes(this, 2); len -= 2; - + pts |= (w & 0xFFFE) >> 1; w = read_bytes(this, 1); len -= 1; @@ -649,11 +649,11 @@ static void parse_mpeg1_packet (demux_mpeg_t *this, int stream_id, int64_t scr) lprintf("use scr\n"); pts = scr; } - + if ((stream_id & 0xe0) == 0xc0) { int track = stream_id & 0x1f; - for (i = len; i > 0; i -= (this->audio_fifo) + for (i = len; i > 0; i -= (this->audio_fifo) ? this->audio_fifo->buffer_pool_buf_size : this->video_fifo->buffer_pool_buf_size) { if(this->audio_fifo) { buf = this->input->read_block (this->input, this->audio_fifo, @@ -673,8 +673,8 @@ static void parse_mpeg1_packet (demux_mpeg_t *this, int stream_id, int64_t scr) buf->decoder_flags = BUF_FLAG_PREVIEW; if( this->input->get_length (this->input) ) - buf->extra_info->input_normpos = - (int)( ((int64_t)this->input->get_current_pos (this->input) * + buf->extra_info->input_normpos = + (int)( ((int64_t)this->input->get_current_pos (this->input) * 65535) / this->input->get_length (this->input) ); if (this->rate) buf->extra_info->input_time = (int)((int64_t)this->input->get_current_pos (this->input) @@ -708,8 +708,8 @@ static void parse_mpeg1_packet (demux_mpeg_t *this, int stream_id, int64_t scr) buf->decoder_flags = BUF_FLAG_PREVIEW; if( this->input->get_length (this->input) ) - buf->extra_info->input_normpos = - (int)( ((int64_t)this->input->get_current_pos (this->input) * + buf->extra_info->input_normpos = + (int)( ((int64_t)this->input->get_current_pos (this->input) * 65535) / this->input->get_length (this->input) ); if (this->rate) buf->extra_info->input_time = (int)((int64_t)this->input->get_current_pos (this->input) @@ -720,12 +720,12 @@ static void parse_mpeg1_packet (demux_mpeg_t *this, int stream_id, int64_t scr) } else if (stream_id == 0xbd) { - for (i = len; i > 0; i -= 10000) + for (i = len; i > 0; i -= 10000) this->input->read (this->input, this->dummy_space, (i > 10000) ? 10000 : i); } else { - for (i = len; i > 0; i -= 10000) + for (i = len; i > 0; i -= 10000) this->input->read (this->input, this->dummy_space, (i > 10000) ? 10000 : i); } } @@ -978,40 +978,40 @@ static void demux_mpeg_send_headers (demux_plugin_t *this_gen) { demux_mpeg_t *this = (demux_mpeg_t *) this_gen; uint32_t w; int num_buffers = NUM_PREVIEW_BUFFERS; - + this->video_fifo = this->stream->video_fifo; this->audio_fifo = this->stream->audio_fifo; this->rate = 0; /* fixme */ this->last_pts[0] = 0; this->last_pts[1] = 0; - + _x_demux_control_start(this->stream); /* * send preview buffers for stream/meta_info */ - + _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_VIDEO, 1); _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_AUDIO, 1); this->preview_mode = 1; - + this->input->seek (this->input, 4, SEEK_SET); - + this->status = DEMUX_OK ; - + do { w = parse_pack_preview (this, &num_buffers); - + if (w != 0x000001ba) demux_mpeg_resync (this, w); - + num_buffers --; - + } while ( (this->status == DEMUX_OK) && (num_buffers > 0)); - + this->status = DEMUX_OK ; _x_stream_info_set(this->stream, XINE_STREAM_INFO_BITRATE, this->rate * 50 * 8); @@ -1155,7 +1155,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str /* go through the same MPEG detection song and dance */ if (input->read(input, buf, 4) == 4) { - if (!buf[0] && !buf[1] && (buf[2] == 0x01) + if (!buf[0] && !buf[1] && (buf[2] == 0x01) && (buf[3] == 0xba)) /* if so, take it */ break; } @@ -1163,7 +1163,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str free (this); return NULL; } - + /* reset position for next check */ if (input->seek(input, 0, SEEK_SET) != 0) { free (this); @@ -1174,7 +1174,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str fourcc_tag = _X_BE_32(&buf[0]); if (fourcc_tag == RIFF_TAG) { uint8_t large_buf[1024]; - + if (input->read(input, large_buf, 12) != 12) { free(this); return NULL; @@ -1193,7 +1193,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str * MPEG video marker. No, it's not a very efficient approach, but * if execution has reached this special case, this is currently * the best chance for detecting the file automatically. Also, - * be extra lazy and do not bother skipping over the data + * be extra lazy and do not bother skipping over the data * header. */ for (i = 0; i < RIFF_CHECK_KILOBYTES && !ok; i++) { if (input->read(input, large_buf, 1024) != 1024) @@ -1282,7 +1282,7 @@ static const demuxer_info_t demux_info_mpeg = { }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_DEMUX, 26, "mpeg", XINE_VERSION_CODE, &demux_info_mpeg, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/demuxers/demux_mpeg_block.c b/src/demuxers/demux_mpeg_block.c index 55eb0ce81..aa5294e8b 100644 --- a/src/demuxers/demux_mpeg_block.c +++ b/src/demuxers/demux_mpeg_block.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2006 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -20,7 +20,7 @@ * demultiplexer for mpeg 1/2 program streams * used with fixed blocksize devices (like dvd/vcd) */ - + #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -44,7 +44,7 @@ #define NUM_PREVIEW_BUFFERS 250 #define DISC_TRESHOLD 90000 -#define WRAP_THRESHOLD 120000 +#define WRAP_THRESHOLD 120000 #define PTS_AUDIO 0 #define PTS_VIDEO 1 @@ -56,14 +56,14 @@ typedef struct demux_mpeg_block_s { demux_plugin_t demux_plugin; - xine_stream_t *stream; + xine_stream_t *stream; fifo_buffer_t *audio_fifo; fifo_buffer_t *video_fifo; input_plugin_t *input; int status; - + int blocksize; int rate; @@ -123,30 +123,30 @@ static int32_t parse_program_stream_pack_header(demux_mpeg_block_t *this, uint8_ /* OK, i think demux_mpeg_block discontinuity handling demands some explanation: - + - The preferred discontinuity handling/detection for DVD is based on NAV packets information. Most of the time it will provide us very accurate and reliable information. - + - Has been shown that sometimes a DVD discontinuity may happen before a new NAV packet arrives (seeking?). To avoid sending wrong PTS to decoders we _used_ to check for SCR discontinuities. Unfortunately some VCDs have very broken SCR values causing false triggering. - + - To fix the above problem (also note that VCDs don't have NAV packets) we fallback to the same PTS-based wrap detection as used in demux_mpeg. The only trick is to not send discontinuity information if NAV packets have already done the job. - + [Miguel 02-05-2002] */ static void check_newpts( demux_mpeg_block_t *this, int64_t pts, int video ) { int64_t diff; - + diff = pts - this->last_pts[video]; - + if( pts && (this->send_newpts || (this->last_pts[video] && abs(diff)>WRAP_THRESHOLD) ) ) { /* check if pts is outside nav pts range. any stream without nav must enter here. */ @@ -164,10 +164,10 @@ static void check_newpts( demux_mpeg_block_t *this, int64_t pts, int video ) } else { lprintf("no wrap detected\n" ); } - + this->last_pts[1-video] = 0; } - + if( pts ) this->last_pts[video] = pts; } @@ -220,9 +220,9 @@ static void demux_mpeg_block_parse_pack (demux_mpeg_block_t *this, int preview_m buf->decoder_flags = BUF_FLAG_PREVIEW; else buf->decoder_flags = 0; - + if( this->input->get_length (this->input) ) - buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * + buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * 65535 / this->input->get_length (this->input) ); while(p < (buf->content + this->blocksize)) { @@ -435,7 +435,7 @@ static int32_t parse_program_stream_pack_header(demux_mpeg_block_t *this, uint8_ return 12; } else { /* mpeg2 */ - + int num_stuffing_bytes; /* system_clock_reference */ @@ -499,7 +499,7 @@ static int32_t parse_private_stream_2(demux_mpeg_block_t *this, uint8_t *p, buf_ * the NAV packet for a much more accurate timing */ if (buf->extra_info->input_time) { int64_t cell_time, frames; - + cell_time = (p[7+0x18] >> 4 ) * 10 * 60 * 60 * 1000; cell_time += (p[7+0x18] & 0x0f) * 60 * 60 * 1000; cell_time += (p[7+0x19] >> 4 ) * 10 * 60 * 1000; @@ -508,7 +508,7 @@ static int32_t parse_private_stream_2(demux_mpeg_block_t *this, uint8_t *p, buf_ cell_time += (p[7+0x1a] & 0x0f) * 1000; frames = ((p[7+0x1b] & 0x30) >> 4) * 10; frames += ((p[7+0x1b] & 0x0f) ) ; - + if (p[7+0x1b] & 0x80) cell_time += (frames * 1000)/25; else @@ -518,7 +518,7 @@ static int32_t parse_private_stream_2(demux_mpeg_block_t *this, uint8_t *p, buf_ this->last_cell_pos = this->input->get_current_pos (this->input); this->last_begin_time = buf->extra_info->input_time; } - + lprintf ("NAV packet, start pts = %"PRId64", end_pts = %"PRId64"\n", start_pts, end_pts); @@ -569,14 +569,14 @@ static int32_t parse_pes_for_pts(demux_mpeg_block_t *this, uint8_t *p, buf_eleme } if (this->rate && !buf->extra_info->input_time) - buf->extra_info->input_time = (int)((int64_t)this->input->get_current_pos (this->input) + buf->extra_info->input_time = (int)((int64_t)this->input->get_current_pos (this->input) * 1000 / (this->rate * 50)); if (this->mpeg1) { header_len = 6; p += 6; /* packet_len -= 6; */ while ((p[0] & 0x80) == 0x80) { - p++; + p++; header_len++; this->packet_len--; /* printf ("stuffing\n");*/ @@ -589,9 +589,9 @@ static int32_t parse_pes_for_pts(demux_mpeg_block_t *this, uint8_t *p, buf_eleme this->packet_len -= 2; } - this->pts = 0; + this->pts = 0; this->dts = 0; - + if ((p[0] & 0xf0) == 0x20) { this->pts = (int64_t)(p[ 0] & 0x0E) << 29 ; this->pts |= p[ 1] << 22 ; @@ -608,19 +608,19 @@ static int32_t parse_pes_for_pts(demux_mpeg_block_t *this, uint8_t *p, buf_eleme this->pts |= (p[ 2] & 0xFE) << 14 ; this->pts |= p[ 3] << 7 ; this->pts |= (p[ 4] & 0xFE) >> 1 ; - + this->dts = (int64_t)(p[ 5] & 0x0E) << 29 ; this->dts |= p[ 6] << 22 ; this->dts |= (p[ 7] & 0xFE) << 14 ; this->dts |= p[ 8] << 7 ; this->dts |= (p[ 9] & 0xFE) >> 1 ; - + p += 10; header_len += 10; this->packet_len -= 10; return header_len; } else { - p++; + p++; header_len++; this->packet_len--; return header_len; @@ -664,13 +664,13 @@ static int32_t parse_pes_for_pts(demux_mpeg_block_t *this, uint8_t *p, buf_eleme this->pts = 0; if (p[7] & 0x40) { /* dts avail */ - + this->dts = (int64_t)(p[14] & 0x0E) << 29 ; this->dts |= p[15] << 22 ; this->dts |= (p[16] & 0xFE) << 14 ; this->dts |= p[17] << 7 ; this->dts |= (p[18] & 0xFE) >> 1 ; - + } else this->dts = 0; @@ -699,16 +699,16 @@ static int32_t parse_private_stream_1(demux_mpeg_block_t *this, uint8_t *p, buf_ buf->content = p+1; buf->size = this->packet_len-1; - + buf->type = BUF_SPU_DVD + spu_id; buf->decoder_flags |= BUF_FLAG_SPECIAL; buf->decoder_info[1] = BUF_SPECIAL_SPU_DVD_SUBTYPE; buf->decoder_info[2] = SPU_DVD_SUBTYPE_PACKAGE; buf->pts = this->pts; - - this->video_fifo->put (this->video_fifo, buf); + + this->video_fifo->put (this->video_fifo, buf); lprintf ("SPU PACK put on fifo\n"); - + return -1; } @@ -724,9 +724,9 @@ static int32_t parse_private_stream_1(demux_mpeg_block_t *this, uint8_t *p, buf_ if( !preview_mode ) check_newpts( this, this->pts, PTS_VIDEO ); */ - this->video_fifo->put (this->video_fifo, buf); + this->video_fifo->put (this->video_fifo, buf); lprintf ("SPU SVCD PACK (%"PRId64", %d) put on fifo\n", this->pts, spu_id); - + return -1; } @@ -741,29 +741,29 @@ static int32_t parse_private_stream_1(demux_mpeg_block_t *this, uint8_t *p, buf_ /* this is probably wrong: if( !preview_mode ) check_newpts( this, this->pts, PTS_VIDEO ); - */ - this->video_fifo->put (this->video_fifo, buf); + */ + this->video_fifo->put (this->video_fifo, buf); lprintf ("SPU CVD PACK (%"PRId64", %d) put on fifo\n", this->pts, spu_id); - + return -1; } if ((p[0]&0xF0) == 0x80) { - + track = p[0] & 0x0F; /* hack : ac3 track */ - /* Number of frame headers + /* Number of frame headers * * Describes the number of a52 frame headers that start in this pack (One pack per DVD sector). * * Likely values: 1 or 2. */ buf->decoder_info[1] = p[1]; - /* First access unit pointer. + /* First access unit pointer. * * Describes the byte offset within this pack to the beginning of the first A52 frame header. * The PTS from this pack applies to the beginning of the first A52 frame that starts in this pack. - * Any bytes before this offset should be considered to belong to the previous A52 frame. + * Any bytes before this offset should be considered to belong to the previous A52 frame. * and therefore be tagged with a PTS value derived from the previous pack. * * Likely values: Anything from 1 to the size of an A52 frame. @@ -864,7 +864,7 @@ static int32_t parse_private_stream_1(demux_mpeg_block_t *this, uint8_t *p, buf_ buf->free_buffer(buf); return -1; } - + } else if ((p[0]&0xf0) == 0xa0) { int pcm_offset; @@ -911,7 +911,7 @@ static int32_t parse_private_stream_1(demux_mpeg_block_t *this, uint8_t *p, buf_ buf->decoder_flags |= BUF_FLAG_SPECIAL; buf->decoder_info[1] = BUF_SPECIAL_LPCM_CONFIG; buf->decoder_info[2] = p[5]; - + pcm_offset = 7; buf->content = p+pcm_offset; @@ -930,7 +930,7 @@ static int32_t parse_private_stream_1(demux_mpeg_block_t *this, uint8_t *p, buf_ buf->free_buffer(buf); return -1; } - + } /* Some new streams have been encountered. 1) DVD+RW disc recorded with a Philips DVD recorder: - new unknown sub-stream id of 0xff @@ -1003,10 +1003,10 @@ static int demux_mpeg_block_send_chunk (demux_plugin_t *this_gen) { } #ifdef ESTIMATE_RATE_FIXED -/*! - Estimate bitrate by looking inside the MPEG file for presentation - time stamps (PTS) and computing how far apart these are - in bytes and in time. +/*! + Estimate bitrate by looking inside the MPEG file for presentation + time stamps (PTS) and computing how far apart these are + in bytes and in time. On failure return 0. @@ -1037,23 +1037,23 @@ static int demux_mpeg_block_estimate_rate (demux_mpeg_block_t *this) { int rate=0; /* The return rate value */ int stream_id; - /* We can't estimate by sampling if we don't thave the ability to + /* We can't estimate by sampling if we don't thave the ability to randomly access the and more importantly reset after accessessing. */ if (!(this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE)) return 0; mpeg_length= this->input->get_length (this->input); - step = TRUNC((mpeg_length/MAX_SAMPLES), blocksize); + step = TRUNC((mpeg_length/MAX_SAMPLES), blocksize); if (step <= 0) step = blocksize; /* avoid endless loop for tiny files */ pos = step; /* At this point "pos", and "step" are a multiple of blocksize and they should continue to be so throughout. */ - + this->input->seek (this->input, pos, SEEK_SET); - while ( (buf = this->input->read_block (this->input, this->video_fifo, blocksize)) + while ( (buf = this->input->read_block (this->input, this->video_fifo, blocksize)) && count < MAX_SAMPLES && reads++ < MAX_READS ) { p = buf->content; /* len = this->mnBlocksize; */ @@ -1062,9 +1062,9 @@ static int demux_mpeg_block_estimate_rate (demux_mpeg_block_t *this) { is_mpeg1 = (p[4] & 0x40) == 0; - if (is_mpeg1) + if (is_mpeg1) p += 12; - else + else p += 14 + (p[0xD] & 0x07); } @@ -1081,7 +1081,7 @@ static int demux_mpeg_block_estimate_rate (demux_mpeg_block_t *this) { } stream_id = p[3]; - pts = 0; + pts = 0; if ((stream_id < 0xbc) || ((stream_id & 0xf0) != 0xe0)) { pos += (off_t) blocksize; @@ -1111,18 +1111,18 @@ static int demux_mpeg_block_estimate_rate (demux_mpeg_block_t *this) { pts |= (p[ 2] & 0xFE) << 14 ; pts |= p[ 3] << 7 ; pts |= (p[ 4] & 0xFE) >> 1 ; - } + } } } else { /* mpeg 2 */ - + if (p[7] & 0x80) { /* pts avail */ - + pts = (int64_t)(p[ 9] & 0x0E) << 29 ; pts |= p[10] << 22 ; pts |= (p[11] & 0xFE) << 14 ; pts |= p[12] << 7 ; pts |= (p[13] & 0xFE) >> 1 ; - + } else pts = 0; } @@ -1132,16 +1132,16 @@ static int demux_mpeg_block_estimate_rate (demux_mpeg_block_t *this) { if ( (pos>last_pos) && (pts>last_pts) ) { int cur_rate; - + cur_rate = ((pos - last_pos)*90000) / ((pts - last_pts) * 50); - + rate = (count * rate + cur_rate) / (count+1); count ++; - + /* - printf ("demux_mpeg_block: stream_id %02x, pos: %"PRId64", pts: %d, cur_rate = %d, overall rate : %d\n", - stream_id, pos, pts, cur_rate, rate); + printf ("demux_mpeg_block: stream_id %02x, pos: %"PRId64", pts: %d, cur_rate = %d, overall rate : %d\n", + stream_id, pos, pts, cur_rate, rate); */ } @@ -1165,14 +1165,14 @@ static int demux_mpeg_block_estimate_rate (demux_mpeg_block_t *this) { lprintf("est_rate=%d\n",rate); return rate; - + } #endif /*ESTIMATE_RATE_FIXED*/ static void demux_mpeg_block_dispose (demux_plugin_t *this_gen) { demux_mpeg_block_t *this = (demux_mpeg_block_t *) this_gen; - + free (this); } @@ -1182,7 +1182,7 @@ static int demux_mpeg_block_get_status (demux_plugin_t *this_gen) { return this->status; } -static int demux_mpeg_detect_blocksize(demux_mpeg_block_t *this, +static int demux_mpeg_detect_blocksize(demux_mpeg_block_t *this, input_plugin_t *input) { uint8_t scratch[4]; @@ -1196,10 +1196,10 @@ static int demux_mpeg_detect_blocksize(demux_mpeg_block_t *this, input->seek(input, 2324, SEEK_SET); if (input->read(input, scratch, 4) != 4) return 0; - if (scratch[0] || scratch[1] - || (scratch[2] != 0x01) || (scratch[3] != 0xba)) + if (scratch[0] || scratch[1] + || (scratch[2] != 0x01) || (scratch[3] != 0xba)) return 0; - + return 2324; } else return 2048; @@ -1219,34 +1219,34 @@ static void demux_mpeg_block_send_headers (demux_plugin_t *this_gen) { if (!this->blocksize) return; } - - /* + + /* * send start buffer */ - + _x_demux_control_start(this->stream); - + #ifdef USE_ILL_ADVISED_ESTIMATE_RATE_INITIALLY - if (!this->rate) + if (!this->rate) this->rate = demux_mpeg_block_estimate_rate (this); -#else +#else /* Set to Use rate given in by stream initially. */ - this->rate = 0; + this->rate = 0; #endif - + if((this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) != 0) { - + int num_buffers = NUM_PREVIEW_BUFFERS; - + this->input->seek (this->input, 0, SEEK_SET); - + this->status = DEMUX_OK ; while ( (num_buffers>0) && (this->status == DEMUX_OK) ) { - + demux_mpeg_block_parse_pack(this, 1); num_buffers --; } - } + } /* else FIXME: implement preview generation from PREVIEW data */ this->status = DEMUX_OK; @@ -1265,19 +1265,19 @@ static int demux_mpeg_block_seek (demux_plugin_t *this_gen, this->input->get_length (this->input) ); if((this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) != 0) { - + if (start_pos) { start_pos /= (off_t) this->blocksize; start_pos *= (off_t) this->blocksize; - + this->input->seek (this->input, start_pos, SEEK_SET); } else if (start_time) { - + if( this->input->seek_time ) { this->input->seek_time (this->input, start_time, SEEK_SET); } else { start_time /= 1000; - + if (this->last_cell_time) { start_pos = start_time - (this->last_cell_time + this->last_begin_time)/1000; start_pos *= this->rate; @@ -1290,20 +1290,20 @@ static int demux_mpeg_block_seek (demux_plugin_t *this_gen, } start_pos /= (off_t) this->blocksize; start_pos *= (off_t) this->blocksize; - + this->input->seek (this->input, start_pos, SEEK_SET); } } else this->input->seek (this->input, 0, SEEK_SET); } - + /* * now start demuxing */ this->last_cell_time = 0; this->send_newpts = 1; if( !playing ) { - + this->buf_flag_seek = 0; this->nav_last_end_pts = this->nav_last_start_pts = 0; this->status = DEMUX_OK ; @@ -1314,7 +1314,7 @@ static int demux_mpeg_block_seek (demux_plugin_t *this_gen, this->nav_last_end_pts = this->nav_last_start_pts = 0; _x_demux_flush_engine(this->stream); } - + return this->status; } @@ -1332,7 +1332,7 @@ static void demux_mpeg_block_accept_input (demux_mpeg_block_t *this, lprintf ("mrl %s is new\n", this->cur_mrl); - } + } else { lprintf ("mrl %s is known, bitrate: %d\n", this->cur_mrl, this->rate * 50 * 8); @@ -1346,7 +1346,7 @@ static int demux_mpeg_block_get_stream_length (demux_plugin_t *this_gen) { * find input plugin */ - if (this->rate) + if (this->rate) return (int)((int64_t) 1000 * this->input->get_length (this->input) / (this->rate * 50)); else @@ -1371,7 +1371,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str this = calloc(1, sizeof(demux_mpeg_block_t)); this->stream = stream; this->input = input; - + this->demux_plugin.send_headers = demux_mpeg_block_send_headers; this->demux_plugin.send_chunk = demux_mpeg_block_send_chunk; this->demux_plugin.seek = demux_mpeg_block_seek; @@ -1386,9 +1386,9 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str lprintf ("open_plugin:detection_method=%d\n", stream->content_detection_method); - + switch (stream->content_detection_method) { - + case METHOD_BY_CONTENT: { /* use demux_mpeg for non-block devices */ @@ -1551,7 +1551,7 @@ static const demuxer_info_t demux_info_mpeg_block = { }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_DEMUX, 26, "mpeg_block", XINE_VERSION_CODE, &demux_info_mpeg_block, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/demuxers/demux_mpeg_pes.c b/src/demuxers/demux_mpeg_pes.c index 9715e1254..0fe97fb93 100644 --- a/src/demuxers/demux_mpeg_pes.c +++ b/src/demuxers/demux_mpeg_pes.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2008 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -24,7 +24,7 @@ * (c) 2003 James Courtier-Dutton James@superbug.demon.co.uk * This code might also decode normal MPG files. */ - + #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -48,7 +48,7 @@ #define NUM_PREVIEW_BUFFERS 250 #define DISC_TRESHOLD 90000 -#define WRAP_THRESHOLD 270000 +#define WRAP_THRESHOLD 270000 #define PTS_AUDIO 0 #define PTS_VIDEO 1 @@ -60,14 +60,14 @@ typedef struct demux_mpeg_pes_s { demux_plugin_t demux_plugin; - xine_stream_t *stream; + xine_stream_t *stream; fifo_buffer_t *audio_fifo; fifo_buffer_t *video_fifo; input_plugin_t *input; int status; - + int rate; char cur_mrl[256]; @@ -91,7 +91,7 @@ typedef struct demux_mpeg_pes_s { uint8_t mpeg1:1; uint8_t wait_for_program_stream_pack_header:1; uint8_t mpeg12_h264_detected:2; - + int last_begin_time; int64_t last_cell_time; off_t last_cell_pos; @@ -202,7 +202,7 @@ static int detect_pts_discontinuity( demux_mpeg_pes_t *this, int64_t pts, int vi /* no discontinuity detected */ return 0; } - + static void check_newpts( demux_mpeg_pes_t *this, int64_t pts, int video ) { if( pts && (this->send_newpts || detect_pts_discontinuity(this, pts, video) ) ) { @@ -226,7 +226,7 @@ static void check_newpts( demux_mpeg_pes_t *this, int64_t pts, int video ) /* clear pts on the other track to avoid detecting the same discontinuity again */ this->last_pts[1-video] = 0; } - + if( pts ) this->last_pts[video] = pts; } @@ -258,7 +258,7 @@ static void demux_mpeg_pes_parse_pack (demux_mpeg_pes_t *this, int preview_mode) int32_t result; off_t i; uint8_t buf6[ 6 ]; - + this->scr = 0; this->preview_mode = preview_mode; @@ -280,9 +280,9 @@ static void demux_mpeg_pes_parse_pack (demux_mpeg_pes_t *this, int preview_mode) return; } } - + /* FIXME: buf must be allocated from somewhere before calling here. */ - + /* these streams should be allocated on the audio_fifo, if available. */ if ((0xC0 <= p[ 3 ] && p[ 3 ] <= 0xDF) /* audio_stream */ || 0xBD == p[ 3 ]) /* private_sream_1 */ @@ -301,19 +301,19 @@ static void demux_mpeg_pes_parse_pack (demux_mpeg_pes_t *this, int preview_mode) return; } } - + p = buf->mem; /* copy local buffer to fifo element. */ memcpy(p, buf6, sizeof(buf6)); - + if (preview_mode) buf->decoder_flags = BUF_FLAG_PREVIEW; else buf->decoder_flags = 0; - + if( this->input->get_length (this->input) ) - buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * + buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * 65535 / this->input->get_length (this->input) ); this->stream_id = p[3]; @@ -412,7 +412,7 @@ static void demux_mpeg_pes_parse_pack (demux_mpeg_pes_t *this, int preview_mode) xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("xine-lib:demux_mpeg_pes: Unrecognised stream_id 0x%02x. " "Please report this to xine developers.\n"), this->stream_id); - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "xine-lib:demux_mpeg_pes: packet_len=%d\n", this->packet_len); buf->free_buffer (buf); return; @@ -435,11 +435,11 @@ static int32_t parse_padding_stream(demux_mpeg_pes_t *this, uint8_t *p, buf_elem { /* Handle Jumbo frames from VDR. */ int i; - + int size = buf->max_size; if ((todo - done) < size) size = todo - done; - + i = read_data(this, buf->mem, (off_t)size); if (i != size) break; @@ -456,98 +456,98 @@ static int32_t parse_padding_stream(demux_mpeg_pes_t *this, uint8_t *p, buf_elem static int32_t parse_program_stream_map(demux_mpeg_pes_t *this, uint8_t *p, buf_element_t *buf) { /* FIXME: Implement */ - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "xine-lib:demux_mpeg_pes: Unhandled stream_id 0x%02x.\n", this->stream_id); buf->free_buffer (buf); return -1; } static int32_t parse_ecm_stream(demux_mpeg_pes_t *this, uint8_t *p, buf_element_t *buf) { /* FIXME: Implement */ - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "xine-lib:demux_mpeg_pes: Unhandled stream_id 0x%02x\n", this->stream_id); buf->free_buffer (buf); return -1; } static int32_t parse_emm_stream(demux_mpeg_pes_t *this, uint8_t *p, buf_element_t *buf) { /* FIXME: Implement */ - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "xine-lib:demux_mpeg_pes: Unhandled stream_id 0x%02x\n", this->stream_id); buf->free_buffer (buf); return -1; } static int32_t parse_dsmcc_stream(demux_mpeg_pes_t *this, uint8_t *p, buf_element_t *buf) { /* FIXME: Implement */ - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "xine-lib:demux_mpeg_pes: Unhandled stream_id 0x%02x\n", this->stream_id); buf->free_buffer (buf); return -1; } static int32_t parse_iec_13522_stream(demux_mpeg_pes_t *this, uint8_t *p, buf_element_t *buf) { /* FIXME: Implement */ - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "xine-lib:demux_mpeg_pes: Unhandled stream_id 0x%02x\n", this->stream_id); buf->free_buffer (buf); return -1; } static int32_t parse_h222_typeA_stream(demux_mpeg_pes_t *this, uint8_t *p, buf_element_t *buf) { /* FIXME: Implement */ - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "xine-lib:demux_mpeg_pes: Unhandled stream_id 0x%02x\n", this->stream_id); buf->free_buffer (buf); return -1; } static int32_t parse_h222_typeB_stream(demux_mpeg_pes_t *this, uint8_t *p, buf_element_t *buf) { /* FIXME: Implement */ - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "xine-lib:demux_mpeg_pes: Unhandled stream_id 0x%02x\n", this->stream_id); buf->free_buffer (buf); return -1; } static int32_t parse_h222_typeC_stream(demux_mpeg_pes_t *this, uint8_t *p, buf_element_t *buf) { /* FIXME: Implement */ - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "xine-lib:demux_mpeg_pes: Unhandled stream_id 0x%02x\n", this->stream_id); buf->free_buffer (buf); return -1; } static int32_t parse_h222_typeD_stream(demux_mpeg_pes_t *this, uint8_t *p, buf_element_t *buf) { /* FIXME: Implement */ - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "xine-lib:demux_mpeg_pes: Unhandled stream_id 0x%02x\n", this->stream_id); buf->free_buffer (buf); return -1; } static int32_t parse_h222_typeE_stream(demux_mpeg_pes_t *this, uint8_t *p, buf_element_t *buf) { /* FIXME: Implement */ - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "xine-lib:demux_mpeg_pes: Unhandled stream_id 0x%02x\n", this->stream_id); buf->free_buffer (buf); return -1; } static int32_t parse_IEC14496_SL_packetized_stream(demux_mpeg_pes_t *this, uint8_t *p, buf_element_t *buf) { /* FIXME: Implement */ - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "xine-lib:demux_mpeg_pes: Unhandled stream_id 0x%02x\n", this->stream_id); buf->free_buffer (buf); return -1; } static int32_t parse_IEC14496_FlexMux_stream(demux_mpeg_pes_t *this, uint8_t *p, buf_element_t *buf) { /* FIXME: Implement */ - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "xine-lib:demux_mpeg_pes: Unhandled stream_id 0x%02x\n", this->stream_id); buf->free_buffer (buf); return -1; } static int32_t parse_program_stream_directory(demux_mpeg_pes_t *this, uint8_t *p, buf_element_t *buf) { /* FIXME: Implement */ - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "xine-lib:demux_mpeg_pes: Unhandled stream_id 0x%02x\n", this->stream_id); buf->free_buffer (buf); return -1; } static int32_t parse_ancillary_stream(demux_mpeg_pes_t *this, uint8_t *p, buf_element_t *buf) { /* FIXME: Implement */ - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "xine-lib:demux_mpeg_pes: Unhandled stream_id 0x%02x\n", this->stream_id); buf->free_buffer (buf); return -1; @@ -588,7 +588,7 @@ static int32_t parse_program_stream_pack_header(demux_mpeg_pes_t *this, uint8_t return 12; } else { /* mpeg2 */ - + int num_stuffing_bytes; /* system_clock_reference */ @@ -662,7 +662,7 @@ static int32_t parse_private_stream_2(demux_mpeg_pes_t *this, uint8_t *p, buf_el * the NAV packet for a much more accurate timing */ if (buf->extra_info->input_time) { int64_t cell_time, frames; - + cell_time = (p[7+0x18] >> 4 ) * 10 * 60 * 60 * 1000; cell_time += (p[7+0x18] & 0x0f) * 60 * 60 * 1000; cell_time += (p[7+0x19] >> 4 ) * 10 * 60 * 1000; @@ -671,7 +671,7 @@ static int32_t parse_private_stream_2(demux_mpeg_pes_t *this, uint8_t *p, buf_el cell_time += (p[7+0x1a] & 0x0f) * 1000; frames = ((p[7+0x1b] & 0x30) >> 4) * 10; frames += ((p[7+0x1b] & 0x0f) ) ; - + if (p[7+0x1b] & 0x80) cell_time += (frames * 1000)/25; else @@ -681,7 +681,7 @@ static int32_t parse_private_stream_2(demux_mpeg_pes_t *this, uint8_t *p, buf_el this->last_cell_pos = this->input->get_current_pos (this->input); this->last_begin_time = buf->extra_info->input_time; } - + lprintf ("NAV packet, start pts = %"PRId64", end_pts = %"PRId64"\n", start_pts, end_pts); @@ -731,7 +731,7 @@ static int32_t parse_pes_for_pts(demux_mpeg_pes_t *this, uint8_t *p, buf_element } if (this->rate && !buf->extra_info->input_time) - buf->extra_info->input_time = (int)((int64_t)this->input->get_current_pos (this->input) + buf->extra_info->input_time = (int)((int64_t)this->input->get_current_pos (this->input) * 1000 / (this->rate * 50)); /* FIXME: This was determined by comparing a single MPEG1 and a single MPEG2 stream */ @@ -746,7 +746,7 @@ static int32_t parse_pes_for_pts(demux_mpeg_pes_t *this, uint8_t *p, buf_element p += 6; /* packet_len -= 6; */ while ((p[0] & 0x80) == 0x80) { - p++; + p++; header_len++; this->packet_len--; /* printf ("stuffing\n");*/ @@ -759,9 +759,9 @@ static int32_t parse_pes_for_pts(demux_mpeg_pes_t *this, uint8_t *p, buf_element this->packet_len -= 2; } - this->pts = 0; + this->pts = 0; this->dts = 0; - + if ((p[0] & 0xf0) == 0x20) { this->pts = (int64_t) (p[ 0] & 0x0E) << 29 ; this->pts |= (int64_t) p[ 1] << 22 ; @@ -778,19 +778,19 @@ static int32_t parse_pes_for_pts(demux_mpeg_pes_t *this, uint8_t *p, buf_element this->pts |= (int64_t) (p[ 2] & 0xFE) << 14 ; this->pts |= (int64_t) p[ 3] << 7 ; this->pts |= (int64_t) (p[ 4] & 0xFE) >> 1 ; - + this->dts = (int64_t) (p[ 5] & 0x0E) << 29 ; this->dts |= (int64_t) p[ 6] << 22 ; this->dts |= (int64_t) (p[ 7] & 0xFE) << 14 ; this->dts |= (int64_t) p[ 8] << 7 ; this->dts |= (int64_t) (p[ 9] & 0xFE) >> 1 ; - + p += 10; header_len += 10; this->packet_len -= 10; return header_len; } else { - p++; + p++; header_len++; this->packet_len--; return header_len; @@ -834,13 +834,13 @@ static int32_t parse_pes_for_pts(demux_mpeg_pes_t *this, uint8_t *p, buf_element this->pts = 0; if (p[7] & 0x40) { /* dts avail */ - + this->dts = (int64_t) (p[14] & 0x0E) << 29 ; this->dts |= (int64_t) p[15] << 22 ; this->dts |= (int64_t) (p[16] & 0xFE) << 14 ; this->dts |= (int64_t) p[17] << 7 ; this->dts |= (int64_t) (p[18] & 0xFE) >> 1 ; - + } else this->dts = 0; @@ -869,16 +869,16 @@ static int32_t parse_private_stream_1(demux_mpeg_pes_t *this, uint8_t *p, buf_el buf->content = p+1; buf->size = this->packet_len-1; - + buf->type = BUF_SPU_DVD + spu_id; buf->decoder_flags |= BUF_FLAG_SPECIAL; buf->decoder_info[1] = BUF_SPECIAL_SPU_DVD_SUBTYPE; buf->decoder_info[2] = SPU_DVD_SUBTYPE_PACKAGE; buf->pts = this->pts; - - this->video_fifo->put (this->video_fifo, buf); + + this->video_fifo->put (this->video_fifo, buf); lprintf ("SPU PACK put on fifo\n"); - + return this->packet_len + result; } @@ -894,9 +894,9 @@ static int32_t parse_private_stream_1(demux_mpeg_pes_t *this, uint8_t *p, buf_el if( !preview_mode ) check_newpts( this, this->pts, PTS_VIDEO ); */ - this->video_fifo->put (this->video_fifo, buf); + this->video_fifo->put (this->video_fifo, buf); lprintf ("SPU SVCD PACK (%"PRId64", %d) put on fifo\n", this->pts, spu_id); - + return this->packet_len + result; } @@ -911,15 +911,15 @@ static int32_t parse_private_stream_1(demux_mpeg_pes_t *this, uint8_t *p, buf_el /* this is probably wrong: if( !preview_mode ) check_newpts( this, this->pts, PTS_VIDEO ); - */ - this->video_fifo->put (this->video_fifo, buf); + */ + this->video_fifo->put (this->video_fifo, buf); lprintf ("SPU CVD PACK (%"PRId64", %d) put on fifo\n", this->pts, spu_id); - + return this->packet_len + result; } if ((p[0]&0xF0) == 0x80) { - + track = p[0] & 0x0F; /* hack : ac3 track */ buf->decoder_info[1] = p[1]; /* Number of frame headers */ buf->decoder_info[2] = p[2] << 8 | p[3]; /* First access unit pointer */ @@ -943,7 +943,7 @@ static int32_t parse_private_stream_1(demux_mpeg_pes_t *this, uint8_t *p, buf_el buf->free_buffer(buf); } return this->packet_len + result; - + } else if ((p[0]&0xf0) == 0xa0) { int pcm_offset; @@ -983,7 +983,7 @@ static int32_t parse_private_stream_1(demux_mpeg_pes_t *this, uint8_t *p, buf_el switch ((p[5]>>6) & 3) { case 3: /* illegal, use 16-bits? */ default: - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "illegal lpcm sample format (%d), assume 16-bit samples\n", (p[5]>>6) & 3 ); case 0: bits_per_sample = 16; break; @@ -996,7 +996,7 @@ static int32_t parse_private_stream_1(demux_mpeg_pes_t *this, uint8_t *p, buf_el buf->decoder_flags |= BUF_FLAG_SPECIAL; buf->decoder_info[1] = BUF_SPECIAL_LPCM_CONFIG; buf->decoder_info[2] = p[5]; - + pcm_offset = 7; buf->content = p+pcm_offset; @@ -1020,7 +1020,7 @@ static int32_t parse_private_stream_1(demux_mpeg_pes_t *this, uint8_t *p, buf_el int size; /* - * A52/AC3 streams in some DVB-S recordings made with VDR. + * A52/AC3 streams in some DVB-S recordings made with VDR. * It is broadcast by a german tv-station called PRO7. * PRO7 uses dolby 5.1 (A52 5.1) in some of the movies they broadcast, * (and they would switch it to stereo-sound(A52 2.0) during commercials.) @@ -1073,18 +1073,18 @@ static int32_t parse_private_stream_1(demux_mpeg_pes_t *this, uint8_t *p, buf_el lprintf ("A52 PACK put on fifo\n"); } else { buf->free_buffer(buf); - } + } } return this->packet_len + result; } - + /* Some new streams have been encountered. 1) DVD+RW disc recorded with a Philips DVD recorder: - new unknown sub-stream id of 0xff */ - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("demux_mpeg_pes:Unrecognised private stream 1 0x%02x. Please report this to xine developers.\n"), p[0]); buf->free_buffer(buf); return this->packet_len + result; @@ -1166,7 +1166,7 @@ static int32_t parse_video_stream(demux_mpeg_pes_t *this, uint8_t *p, buf_elemen if (this->mpeg12_h264_detected > 2) { int nal_type_code = -1; if (payload_size >= 4 && p[2] == 0x01 && p[1] == 0x00 && p[0] == 0x00) - nal_type_code = p[3] & 0x1f; + nal_type_code = p[3] & 0x1f; if (nal_type_code == 9) { /* access unit delimiter */ buf_element_t *b = this->video_fifo->buffer_pool_alloc (this->video_fifo); b->content = b->mem; @@ -1275,10 +1275,10 @@ static int demux_mpeg_pes_send_chunk (demux_plugin_t *this_gen) { } #ifdef ESTIMATE_RATE_FIXED -/*! - Estimate bitrate by looking inside the MPEG file for presentation - time stamps (PTS) and computing how far apart these are - in bytes and in time. +/*! + Estimate bitrate by looking inside the MPEG file for presentation + time stamps (PTS) and computing how far apart these are + in bytes and in time. On failure return 0. @@ -1308,23 +1308,23 @@ static int demux_mpeg_pes_estimate_rate (demux_mpeg_pes_t *this) { int rate=0; /* The return rate value */ int stream_id; - /* We can't estimate by sampling if we don't thave the ability to + /* We can't estimate by sampling if we don't thave the ability to randomly access the and more importantly reset after accessessing. */ if (!(this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE)) return 0; mpeg_length= this->input->get_length (this->input); - step = TRUNC((mpeg_length/MAX_SAMPLES), 2048); + step = TRUNC((mpeg_length/MAX_SAMPLES), 2048); if (step <= 0) step = 2048; /* avoid endless loop for tiny files */ pos = step; /* At this point "pos", and "step" are a multiple of blocksize and they should continue to be so throughout. */ - + this->input->seek (this->input, pos, SEEK_SET); - while ( (buf = this->input->read_block (this->input, this->video_fifo, 2048)) + while ( (buf = this->input->read_block (this->input, this->video_fifo, 2048)) && count < MAX_SAMPLES && reads++ < MAX_READS ) { p = buf->content; /* len = this->mnBlocksize; */ @@ -1333,9 +1333,9 @@ static int demux_mpeg_pes_estimate_rate (demux_mpeg_pes_t *this) { is_mpeg1 = (p[4] & 0x40) == 0; - if (is_mpeg1) + if (is_mpeg1) p += 12; - else + else p += 14 + (p[0xD] & 0x07); } @@ -1345,14 +1345,14 @@ static int demux_mpeg_pes_estimate_rate (demux_mpeg_pes_t *this) { /* we should now have a PES packet here */ if (p[0] || p[1] || (p[2] != 1)) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_mpeg_pes: error %02x %02x %02x (should be 0x000001) \n", p[0], p[1], p[2]); buf->free_buffer (buf); return rate; } stream_id = p[3]; - pts = 0; + pts = 0; if ((stream_id < 0xbc) || ((stream_id & 0xf0) != 0xe0)) { pos += (off_t) 2048; @@ -1381,18 +1381,18 @@ static int demux_mpeg_pes_estimate_rate (demux_mpeg_pes_t *this) { pts |= (p[ 2] & 0xFE) << 14 ; pts |= p[ 3] << 7 ; pts |= (p[ 4] & 0xFE) >> 1 ; - } + } } } else { /* mpeg 2 */ - + if (p[7] & 0x80) { /* pts avail */ - + pts = (int64_t)(p[ 9] & 0x0E) << 29 ; pts |= p[10] << 22 ; pts |= (p[11] & 0xFE) << 14 ; pts |= p[12] << 7 ; pts |= (p[13] & 0xFE) >> 1 ; - + } else pts = 0; } @@ -1402,16 +1402,16 @@ static int demux_mpeg_pes_estimate_rate (demux_mpeg_pes_t *this) { if ( (pos>last_pos) && (pts>last_pts) ) { int cur_rate; - + cur_rate = ((pos - last_pos)*90000) / ((pts - last_pts) * 50); - + rate = (count * rate + cur_rate) / (count+1); count ++; - + /* - printf ("demux_mpeg_pes: stream_id %02x, pos: %"PRId64", pts: %d, cur_rate = %d, overall rate : %d\n", - stream_id, pos, pts, cur_rate, rate); + printf ("demux_mpeg_pes: stream_id %02x, pos: %"PRId64", pts: %d, cur_rate = %d, overall rate : %d\n", + stream_id, pos, pts, cur_rate, rate); */ } @@ -1431,14 +1431,14 @@ static int demux_mpeg_pes_estimate_rate (demux_mpeg_pes_t *this) { lprintf("est_rate=%d\n",rate); return rate; - + } #endif /*ESTIMATE_RATE_FIXED*/ static void demux_mpeg_pes_dispose (demux_plugin_t *this_gen) { demux_mpeg_pes_t *this = (demux_mpeg_pes_t *) this_gen; - + free (this->scratch_base); free (this); } @@ -1456,35 +1456,35 @@ static void demux_mpeg_pes_send_headers (demux_plugin_t *this_gen) { this->video_fifo = this->stream->video_fifo; this->audio_fifo = this->stream->audio_fifo; - /* + /* * send start buffer */ - + _x_demux_control_start(this->stream); - + #ifdef USE_ILL_ADVISED_ESTIMATE_RATE_INITIALLY - if (!this->rate) + if (!this->rate) this->rate = demux_mpeg_pes_estimate_rate (this); -#else +#else /* Set to Use rate given in by stream initially. */ - this->rate = 0; + this->rate = 0; #endif - + if((this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) != 0) { - + int num_buffers = NUM_PREVIEW_BUFFERS; - + this->input->seek (this->input, 0, SEEK_SET); - + this->status = DEMUX_OK ; while ( (num_buffers>0) && (this->status == DEMUX_OK) ) { - + demux_mpeg_pes_parse_pack(this, 1); num_buffers --; } - } + } else if((this->input->get_capabilities(this->input) & INPUT_CAP_PREVIEW) != 0) { - + this->preview_size = this->input->get_optional_data(this->input, &this->preview_data, INPUT_OPTIONAL_DATA_PREVIEW); this->preview_done = 0; @@ -1512,14 +1512,14 @@ static int demux_mpeg_pes_seek (demux_plugin_t *this_gen, this->input->get_length (this->input) ); if((this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) != 0) { - + if (start_pos) { start_pos /= (off_t) 2048; start_pos *= (off_t) 2048; - + this->input->seek (this->input, start_pos, SEEK_SET); } else if (start_time) { - + if (this->last_cell_time) { start_pos = start_time - (this->last_cell_time + this->last_begin_time)/1000; start_pos *= this->rate; @@ -1532,19 +1532,19 @@ static int demux_mpeg_pes_seek (demux_plugin_t *this_gen, } start_pos /= (off_t) 2048; start_pos *= (off_t) 2048; - + this->input->seek (this->input, start_pos, SEEK_SET); } else this->input->seek (this->input, 0, SEEK_SET); } - + /* * now start demuxing */ this->last_cell_time = 0; this->send_newpts = 1; if( !playing ) { - + this->buf_flag_seek = 0; this->nav_last_end_pts = this->nav_last_start_pts = 0; this->status = DEMUX_OK ; @@ -1557,7 +1557,7 @@ static int demux_mpeg_pes_seek (demux_plugin_t *this_gen, this->mpeg12_h264_detected = 0; _x_demux_flush_engine(this->stream); } - + return this->status; } @@ -1575,7 +1575,7 @@ static void demux_mpeg_pes_accept_input (demux_mpeg_pes_t *this, lprintf ("mrl %s is new\n", this->cur_mrl); - } + } else { lprintf ("mrl %s is known, bitrate: %d\n", this->cur_mrl, this->rate * 50 * 8); @@ -1589,7 +1589,7 @@ static int demux_mpeg_pes_get_stream_length (demux_plugin_t *this_gen) { * find input plugin */ - if (this->rate) + if (this->rate) return (int)((int64_t) 1000 * this->input->get_length (this->input) / (this->rate * 50)); else @@ -1614,7 +1614,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str this = calloc(1, sizeof(demux_mpeg_pes_t)); this->stream = stream; this->input = input; - + this->demux_plugin.send_headers = demux_mpeg_pes_send_headers; this->demux_plugin.send_chunk = demux_mpeg_pes_send_chunk; this->demux_plugin.seek = demux_mpeg_pes_seek; @@ -1637,9 +1637,9 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str lprintf ("open_plugin:detection_method=%d\n", stream->content_detection_method); - + switch (stream->content_detection_method) { - + case METHOD_BY_CONTENT: { /* use demux_mpeg_block for block devices */ @@ -1806,7 +1806,7 @@ static const demuxer_info_t demux_info_mpeg_pes = { }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_DEMUX, 26, "mpeg_pes", XINE_VERSION_CODE, &demux_info_mpeg_pes, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c index a87de5f97..6205f9a08 100644 --- a/src/demuxers/demux_mpgaudio.c +++ b/src/demuxers/demux_mpgaudio.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2007 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -98,7 +98,7 @@ typedef struct { uint32_t stream_size; uint8_t toc[XING_TOC_LENGTH]; uint32_t vbr_scale; - + /* Lame extension */ uint16_t start_delay; uint16_t end_delay; @@ -289,7 +289,7 @@ static int parse_frame_header(mpg_audio_frame_t *const frame, const uint8_t *con return 0; } #endif - + { const uint16_t samples = mp3_samples[frame->version_idx][frame->layer - 1]; frame->bitrate = mp3_bitrates[frame->version_idx][frame->layer - 1][frame_header.bitrate_idx] * 1000; @@ -339,21 +339,21 @@ static xing_header_t *XINE_MALLOC parse_xing_header(mpg_audio_frame_t *frame, else ptr += (9 + 4); } - + if (ptr >= (buf + bufsize - 4)) goto exit_error; lprintf("checking %08X\n", *ptr); - + if (_X_BE_32(ptr) == XING_TAG) { int has_frames_flag = 0; int has_bytes_flag = 0; - + xing = calloc(1, sizeof(xing_header_t)); if (!xing) goto exit_error; - + lprintf("found Xing header\n"); ptr += 4; - + if (ptr >= (buf + bufsize - 4)) goto exit_error; xing->flags = _X_BE_32(ptr); ptr += 4; @@ -369,7 +369,7 @@ static xing_header_t *XINE_MALLOC parse_xing_header(mpg_audio_frame_t *frame, lprintf("stream size: %d\n", xing->stream_size); has_bytes_flag = 1; } - + /* check if it's a useful Xing header */ if (!has_frames_flag || !has_bytes_flag) { lprintf("Stupid Xing tag, cannot do anything with it !\n"); @@ -427,7 +427,7 @@ static xing_header_t *XINE_MALLOC parse_xing_header(mpg_audio_frame_t *frame, lprintf("Xing header not found\n"); } return xing; - + exit_error: lprintf("Xing header parse error\n"); free(xing); @@ -450,13 +450,13 @@ static vbri_header_t *XINE_MALLOC parse_vbri_header(mpg_audio_frame_t *frame, return NULL; ptr += (32 + 4); - + if ((ptr + 4) >= (buf + bufsize)) return 0; lprintf("Checking %08X\n", *ptr); if (_X_BE_32(ptr) == VBRI_TAG) { lprintf("found Vbri header\n"); ptr += 4; - + if ((ptr + 22) >= (buf + bufsize)) return 0; vbri->version = _X_BE_16(ptr); ptr += 2; vbri->delai = _X_BE_16(ptr); ptr += 2; @@ -699,7 +699,7 @@ static int sniff_buffer_looks_like_mp3 (uint8_t *buf, int buflen, int *version, static int read_frame_header(demux_mpgaudio_t *this, uint8_t *header_buf, int bytes) { off_t len; int i; - + for (i = 0; i < (4 - bytes); i++) { header_buf[i] = header_buf[i + bytes]; } @@ -958,7 +958,7 @@ static void demux_mpgaudio_send_headers (demux_plugin_t *this_gen) { this->br = ((uint64_t)vbri->stream_size * 8 * 1000) / this->stream_length; } } - + /* Set to default if Vbr header is incomplete or not present */ if (!this->br) { /* assume CBR */ @@ -1152,7 +1152,7 @@ static uint32_t demux_mpgaudio_get_capabilities(demux_plugin_t *this_gen) { static int demux_mpgaudio_get_optional_data(demux_plugin_t *this_gen, void *data, int data_type) { return DEMUX_OPTIONAL_UNSUPPORTED; -} +} static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *stream, input_plugin_t *input) { @@ -1174,18 +1174,18 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str case METHOD_BY_EXTENSION: { const char *const mrl = input->get_mrl(input); const char *const extensions = class_gen->get_extensions (class_gen); - + lprintf ("stage by extension %s\n", mrl); - + if (!_x_demux_check_extension (mrl, extensions)) return NULL; - + } break; case METHOD_EXPLICIT: break; - + default: return NULL; } @@ -1229,7 +1229,7 @@ static const char *get_identifier (demux_class_t *this_gen) { static const char *get_extensions (demux_class_t *this_gen) { demux_mpgaudio_class_t *this = (demux_mpgaudio_class_t *) this_gen; - + if( _x_decoder_available(this->xine, BUF_AUDIO_MPEG) ) return "mp3 mp2 mpa mpega"; else @@ -1262,9 +1262,9 @@ static void class_dispose (demux_class_t *this_gen) { } void *demux_mpgaudio_init_class (xine_t *xine, void *data) { - + demux_mpgaudio_class_t *this; - + this = calloc(1, sizeof(demux_mpgaudio_class_t)); this->xine = xine; diff --git a/src/demuxers/demux_nsf.c b/src/demuxers/demux_nsf.c index 926ea97e1..40aeae9da 100644 --- a/src/demuxers/demux_nsf.c +++ b/src/demuxers/demux_nsf.c @@ -22,7 +22,7 @@ * NSF File "Demuxer" by Mike Melanson (melanson@pcisys.net) * This is really just a loader for NES Music File Format (extension NSF) * which loads an entire NSF file and passes it over to the NSF audio - * decoder. + * decoder. * * After the file is sent over, the demuxer controls the playback by * sending empty buffers with incrementing pts values. @@ -166,7 +166,7 @@ static int demux_nsf_send_chunk(demux_plugin_t *this_gen) { buf->decoder_info[1] = 0; buf->type = BUF_AUDIO_NSF; - if(this->total_songs) + if(this->total_songs) buf->extra_info->input_normpos = (this->current_song - 1) * 65535 / this->total_songs; buf->extra_info->input_time = this->current_pts / 90; buf->pts = this->current_pts; diff --git a/src/demuxers/demux_nsv.c b/src/demuxers/demux_nsv.c index 42d31ca14..8017d3d3f 100644 --- a/src/demuxers/demux_nsv.c +++ b/src/demuxers/demux_nsv.c @@ -106,17 +106,17 @@ static void nsv_parse_framerate(demux_nsv_t *this, uint8_t framerate) /* 29.97 fps */ this->frame_pts_inc = 3003; break; - + case 3: /* 23.976 fps */ this->frame_pts_inc = 3753; break; - + case 5: /* 14.98 fps */ this->frame_pts_inc = 6006; break; - + default: lprintf("unknown framerate: 0x%02X\n", this->fps); this->frame_pts_inc = 90000; @@ -124,7 +124,7 @@ static void nsv_parse_framerate(demux_nsv_t *this, uint8_t framerate) } } else this->frame_pts_inc = 90000 / this->fps; - + lprintf("frame_pts_inc=%d\n", this->frame_pts_inc); } @@ -138,7 +138,7 @@ static off_t nsv_read(demux_nsv_t *this, uint8_t *buffer, off_t len) { int ultravox_rest; int buffer_pos = 0; - + /* ultravox stuff */ while (len) { ultravox_rest = this->ultravox_size - this->ultravox_pos; @@ -194,7 +194,7 @@ static off_t nsv_seek(demux_nsv_t *this, off_t offset, int origin) { /* ultravox stuff */ if (origin == SEEK_CUR) { uint8_t buffer[1024]; - + while (offset) { if (offset > sizeof(buffer)) { if (nsv_read(this, buffer, sizeof(buffer)) != sizeof(buffer)) @@ -221,7 +221,7 @@ static int nsv_resync(demux_nsv_t *this) { for (i = 0; i < NSV_MAX_RESYNC; i++) { uint8_t byte; - + if (nsv_read(this, &byte, 1) != 1) return NSV_RESYNC_ERROR; @@ -267,11 +267,11 @@ static int open_nsv_file(demux_nsv_t *this) { while (!NSVs_found) { switch (nsv_resync(this)) { - + case NSV_RESYNC_NSVf: { uint32_t chunk_size; - + /* if there is a NSVs tag, load 24 more header bytes; load starting at * offset 4 in buffer to keep header data in line with document */ if (nsv_read(this, &preview[4], 24) != 24) @@ -280,41 +280,41 @@ static int open_nsv_file(demux_nsv_t *this) { lprintf("found NSVf chunk\n"); /* this->data_size = _X_LE_32(&preview[8]);*/ /*lprintf("data_size: %lld\n", this->data_size);*/ - + /* skip the rest of the data */ chunk_size = _X_LE_32(&preview[4]); nsv_seek(this, chunk_size - 28, SEEK_CUR); } break; - + case NSV_RESYNC_NSVs: - - /* fetch the remaining 15 header bytes of the first chunk to get the + + /* fetch the remaining 15 header bytes of the first chunk to get the * relevant information */ if (nsv_read(this, &preview[4], 15) != 15) return 0; - + this->video_fourcc = _X_ME_32(&preview[4]); if (_x_is_fourcc(&preview[4], "NONE")) this->video_type = 0; else this->video_type = _x_fourcc_to_buf_video(this->video_fourcc); - + this->audio_fourcc = _X_ME_32(&preview[8]); if (_x_is_fourcc(&preview[8], "NONE")) this->audio_type = 0; else this->audio_type = _x_formattag_to_buf_audio(this->audio_fourcc); - + this->bih.biSize = sizeof(this->bih); this->bih.biWidth = _X_LE_16(&preview[12]); this->bih.biHeight = _X_LE_16(&preview[14]); this->bih.biCompression = this->video_fourcc; this->video_pts = 0; - + /* may not be true, but set it for the time being */ this->frame_pts_inc = 3003; - + lprintf("video: %c%c%c%c, buffer type %08X, %dx%d\n", preview[4], preview[5], @@ -333,10 +333,10 @@ static int open_nsv_file(demux_nsv_t *this) { nsv_parse_framerate(this, preview[16]); NSVs_found = 1; break; - + case NSV_RESYNC_ERROR: return 0; - + } } @@ -458,27 +458,27 @@ static int demux_nsv_send_chunk(demux_plugin_t *this_gen) { current_file_pos = this->input->get_current_pos(this->input); lprintf("dispatching video & audio chunks...\n"); - + if (this->is_first_chunk) { chunk_type = NSV_RESYNC_BEEF; this->is_first_chunk = 0; } else { chunk_type = nsv_resync(this); } - + switch (chunk_type) { case NSV_RESYNC_NSVf: /* do nothing */ break; - + case NSV_RESYNC_NSVs: /* skip header */ if (nsv_read(this, buffer, 15) != 15) return 0; nsv_parse_framerate(this, buffer[12]); - + /* fall thru */ - + case NSV_RESYNC_BEEF: if (nsv_read(this, buffer, 5) != 5) { this->status = DEMUX_FINISHED; @@ -488,15 +488,15 @@ static int demux_nsv_send_chunk(demux_plugin_t *this_gen) { video_size >>= 4; video_size &= 0xFFFFF; audio_size = _X_LE_16(&buffer[3]); - + nsv_parse_payload(this, video_size, audio_size); break; - + case NSV_RESYNC_ERROR: this->status = DEMUX_FINISHED; break; } - + return this->status; } diff --git a/src/demuxers/demux_ogg.c b/src/demuxers/demux_ogg.c index e3a9b20c4..3fc5ec9e1 100644 --- a/src/demuxers/demux_ogg.c +++ b/src/demuxers/demux_ogg.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -329,7 +329,7 @@ static void send_ogg_packet (demux_ogg_t *this, buf->pts = pts; if( this->input->get_length (this->input) ) - buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * + buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * 65535 / this->input->get_length (this->input) ); buf->extra_info->input_time = buf->pts / 90 ; buf->type = this->si[stream_num]->buf_types; @@ -578,10 +578,10 @@ static void send_ogg_buf (demux_ogg_t *this, int normpos = 0; if( this->input->get_length (this->input) ) - normpos = (int)( (double) this->input->get_current_pos (this->input) * + normpos = (int)( (double) this->input->get_current_pos (this->input) * 65535 / this->input->get_length (this->input) ); - + hdrlen = (*op->packet & PACKET_LEN_BITS01) >> 6; hdrlen |= (*op->packet & PACKET_LEN_BITS2) << 1; @@ -686,7 +686,7 @@ static void send_ogg_buf (demux_ogg_t *this, check_newpts( this, pts, PTS_VIDEO, decoder_flags ); } else pts = 0; - + llprintf(DEBUG_VIDEO_PACKETS, "videostream %d op-gpos %" PRId64 " hdr-gpos %" PRId64 " pts %" PRId64 " \n", stream_num, @@ -1328,7 +1328,7 @@ static void decode_anxdata_header (demux_ogg_t *this, const int stream_num, ogg_ } else { this->si[stream_num]->buf_types = BUF_CONTROL_NOP; } - + } static void decode_cmml_header (demux_ogg_t *this, const int stream_num, ogg_packet *op) { @@ -1603,10 +1603,10 @@ static int demux_ogg_send_chunk (demux_plugin_t *this_gen) { if (ogg_page_eos(&this->og)) { int i; int finished_streams = 0; - + lprintf("end of stream, serialnumber %d\n", cur_serno); this->si[stream_num]->delivered_eos = 1; - + /* check if all logical streams are finished */ for (i = 0; i < this->num_streams; i++) { finished_streams += this->si[i]->delivered_eos; @@ -1628,12 +1628,12 @@ static int demux_ogg_send_chunk (demux_plugin_t *this_gen) { this->unhandled_video_streams = 0; this->num_spu_streams = 0; this->avg_bitrate = 1; - + /* try to read a chained stream */ this->send_newpts = 1; this->last_pts[0] = 0; this->last_pts[1] = 0; - + /* send control buffer to avoid buffer leak */ _x_demux_control_end(this->stream, 0); _x_demux_control_start(this->stream); @@ -1762,7 +1762,7 @@ static int demux_ogg_seek (demux_plugin_t *this_gen, hasn` changed its length, otherwise no seek to "new" data is possible*/ lprintf ("seek to time %d called\n",start_time); - lprintf ("current time is %d\n",current_time); + lprintf ("current time is %d\n",current_time); if (current_time > start_time) { /*seek between beginning and current_pos*/ @@ -1782,7 +1782,7 @@ static int demux_ogg_seek (demux_plugin_t *this_gen, } lprintf ("current_pos is %" PRId64 "\n",current_pos); - lprintf ("new_pos is %" PRId64 "\n",start_pos); + lprintf ("new_pos is %" PRId64 "\n",start_pos); } else { /*seek using avg_bitrate*/ @@ -1801,9 +1801,9 @@ static int demux_ogg_seek (demux_plugin_t *this_gen, ogg_stream_reset(&this->si[i]->oss); } - /*some strange streams have no syncpoint flag set at the beginning*/ - if (start_pos == 0) - this->keyframe_needed = 0; + /*some strange streams have no syncpoint flag set at the beginning*/ + if (start_pos == 0) + this->keyframe_needed = 0; lprintf ("seek to %" PRId64 " called\n",start_pos); @@ -1814,7 +1814,7 @@ static int demux_ogg_seek (demux_plugin_t *this_gen, /* fixme - this would be a nice position to do the following tasks 1. adjust an ogg videostream to a keyframe 2. compare the keyframe_pts with start_time. if the difference is to - high (e.g. larger than max keyframe_intervall, do a new seek or + high (e.g. larger than max keyframe_intervall, do a new seek or continue reading 3. adjust the audiostreams in such a way, that the difference is not to high. @@ -1822,12 +1822,12 @@ static int demux_ogg_seek (demux_plugin_t *this_gen, In short words, do all the cleanups necessary to continue playback without further actions */ - + this->send_newpts = 1; this->status = DEMUX_OK; - + if( !playing ) { - + this->buf_flag_seek = 0; } else { @@ -1844,13 +1844,13 @@ static int demux_ogg_seek (demux_plugin_t *this_gen, _x_demux_flush_engine(this->stream); } - + return this->status; } static int demux_ogg_get_stream_length (demux_plugin_t *this_gen) { - demux_ogg_t *this = (demux_ogg_t *) this_gen; + demux_ogg_t *this = (demux_ogg_t *) this_gen; if (this->time_length==-1){ if (this->avg_bitrate) { @@ -1865,7 +1865,7 @@ static int demux_ogg_get_stream_length (demux_plugin_t *this_gen) { } static uint32_t demux_ogg_get_capabilities(demux_plugin_t *this_gen) { - demux_ogg_t *this = (demux_ogg_t *) this_gen; + demux_ogg_t *this = (demux_ogg_t *) this_gen; int cap_chapter = 0; if (this->chapter_info) @@ -1895,8 +1895,8 @@ static int format_lang_string (demux_ogg_t * this, uint32_t buf_mask, uint32_t b static int demux_ogg_get_optional_data(demux_plugin_t *this_gen, void *data, int data_type) { - - demux_ogg_t *this = (demux_ogg_t *) this_gen; + + demux_ogg_t *this = (demux_ogg_t *) this_gen; char *str=(char *) data; int channel = *((int *)data); @@ -2021,7 +2021,7 @@ static int detect_anx_content (int detection_method, demux_class_t *class_gen, } static demux_plugin_t *anx_open_plugin (demux_class_t *class_gen, - xine_stream_t *stream, + xine_stream_t *stream, input_plugin_t *input) { demux_ogg_t *this; @@ -2050,13 +2050,13 @@ static demux_plugin_t *anx_open_plugin (demux_class_t *class_gen, this->demux_plugin.get_capabilities = demux_ogg_get_capabilities; this->demux_plugin.get_optional_data = demux_ogg_get_optional_data; this->demux_plugin.demux_class = class_gen; - + this->status = DEMUX_FINISHED; #ifdef HAVE_THEORA theora_info_init (&this->t_info); theora_comment_init (&this->t_comment); -#endif +#endif this->chapter_info = 0; this->title = 0; @@ -2066,7 +2066,7 @@ static demux_plugin_t *anx_open_plugin (demux_class_t *class_gen, } static demux_plugin_t *ogg_open_plugin (demux_class_t *class_gen, - xine_stream_t *stream, + xine_stream_t *stream, input_plugin_t *input) { demux_ogg_t *this; @@ -2091,13 +2091,13 @@ static demux_plugin_t *ogg_open_plugin (demux_class_t *class_gen, this->demux_plugin.get_capabilities = demux_ogg_get_capabilities; this->demux_plugin.get_optional_data = demux_ogg_get_optional_data; this->demux_plugin.demux_class = class_gen; - + this->status = DEMUX_FINISHED; #ifdef HAVE_THEORA theora_info_init (&this->t_info); theora_comment_init (&this->t_comment); -#endif +#endif this->chapter_info = 0; this->title = 0; @@ -2113,7 +2113,7 @@ static demux_plugin_t *ogg_open_plugin (demux_class_t *class_gen, static const char *anx_get_description (demux_class_t *this_gen) { return "Annodex demux plugin"; } - + static const char *anx_get_identifier (demux_class_t *this_gen) { return "Annodex"; } @@ -2159,7 +2159,7 @@ static void *anx_init_class (xine_t *xine, void *data) { static const char *ogg_get_description (demux_class_t *this_gen) { return "OGG demux plugin"; } - + static const char *ogg_get_identifier (demux_class_t *this_gen) { return "OGG"; } @@ -2213,7 +2213,7 @@ static const demuxer_info_t demux_info_ogg = { }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_DEMUX, 26, "ogg", XINE_VERSION_CODE, &demux_info_ogg, ogg_init_class }, { PLUGIN_DEMUX, 26, "anx", XINE_VERSION_CODE, &demux_info_anx, anx_init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } diff --git a/src/demuxers/demux_pva.c b/src/demuxers/demux_pva.c index ddd32b63c..e2b61dcf0 100644 --- a/src/demuxers/demux_pva.c +++ b/src/demuxers/demux_pva.c @@ -148,7 +148,7 @@ static int demux_pva_send_chunk(demux_plugin_t *this_gen) { current_file_pos = this->input->get_current_pos(this->input); if (preamble[2] == 1) { - + /* video */ /* load the pts if it is the first thing in the chunk */ @@ -253,7 +253,7 @@ static int demux_pva_send_chunk(demux_plugin_t *this_gen) { buf->pts = pts; if( this->data_size ) - buf->extra_info->input_normpos = (int) ((double) this->input->get_current_pos(this->input) * + buf->extra_info->input_normpos = (int) ((double) this->input->get_current_pos(this->input) * 65535 / this->data_size); this->audio_fifo->put (this->audio_fifo, buf); @@ -302,7 +302,7 @@ static void demux_pva_send_headers(demux_plugin_t *this_gen) { buf->pts = 0; if( this->data_size ) - buf->extra_info->input_normpos = (int) ((double) this->input->get_current_pos(this->input) * + buf->extra_info->input_normpos = (int) ((double) this->input->get_current_pos(this->input) * 65535 / this->data_size); buf->type = BUF_VIDEO_MPEG; @@ -329,7 +329,7 @@ static void demux_pva_send_headers(demux_plugin_t *this_gen) { buf->pts = 0; if( this->data_size ) - buf->extra_info->input_normpos = (int) ((double) this->input->get_current_pos(this->input) * + buf->extra_info->input_normpos = (int) ((double) this->input->get_current_pos(this->input) * 65535 / this->data_size); buf->type = BUF_AUDIO_MPEG; @@ -347,7 +347,7 @@ static int demux_pva_seek (demux_plugin_t *this_gen, unsigned char seek_buffer[SEEK_BUFFER_SIZE]; int found = 0; int i; - + start_pos = (off_t) ( (double) start_pos / 65535 * this->data_size ); diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c index 2039e54d3..8e00d73a4 100644 --- a/src/demuxers/demux_qt.c +++ b/src/demuxers/demux_qt.c @@ -262,10 +262,10 @@ typedef struct { /* flags that indicate how a trak is supposed to be used */ unsigned int flags; - + /* formattag-like field that specifies codec in mp4 files */ unsigned int object_type_id; - + /* decoder data pass information to the decoder */ void *decoder_config; int decoder_config_len; @@ -307,7 +307,7 @@ typedef struct { unsigned int modification_time; unsigned int timescale; /* base clock frequency is Hz */ unsigned int duration; - + int64_t moov_first_offset; int trak_count; @@ -381,7 +381,7 @@ typedef struct { * lazyqt special debugging functions **********************************************************************/ -/* define DEBUG_ATOM_LOAD as 1 to get a verbose parsing of the relevant +/* define DEBUG_ATOM_LOAD as 1 to get a verbose parsing of the relevant * atoms */ #define DEBUG_ATOM_LOAD 0 @@ -403,7 +403,7 @@ typedef struct { /* Define DEBUG_DUMP_MOOV as 1 to dump the raw moov atom to disk. This is * particularly useful in debugging a file with a compressed moov (cmov) - * atom. The atom will be dumped to the filename specified as + * atom. The atom will be dumped to the filename specified as * RAW_MOOV_FILENAME. */ #define DEBUG_DUMP_MOOV 0 #define RAW_MOOV_FILENAME "moovatom.raw" @@ -502,7 +502,7 @@ static void find_moov_atom(input_plugin_t *input, off_t *moov_offset, atom = _X_BE_32(&atom_preamble[4]); /* Special case alert: 'free' atoms sometimes masquerade as 'moov' - * atoms. If this is a free atom, check for 'cmov' or 'mvhd' immediately + * atoms. If this is a free atom, check for 'cmov' or 'mvhd' immediately * following. QT Player can handle it, so xine should too. */ if (atom == FREE_ATOM) { @@ -533,7 +533,7 @@ static void find_moov_atom(input_plugin_t *input, off_t *moov_offset, /* if this atom is not the moov atom, make sure that it is at least one * of the other top-level QT atom. - * However, allow a configurable amount ( currently 1 ) atom be a + * However, allow a configurable amount ( currently 1 ) atom be a * non known atom, in hopes a known atom will be found */ if ((atom != FREE_ATOM) && (atom != JUNK_ATOM) && @@ -712,7 +712,7 @@ static int is_qt_file(input_plugin_t *qt_file) { return 0; } else { /* check that the next atom in the chunk contains alphanumeric - * characters in the atom type field; if not, disqualify the file + * characters in the atom type field; if not, disqualify the file * as a QT file */ qt_file->seek(qt_file, moov_atom_offset + ATOM_PREAMBLE_SIZE, SEEK_SET); if (qt_file->read(qt_file, atom_preamble, ATOM_PREAMBLE_SIZE) != @@ -821,7 +821,7 @@ static void parse_mvhd_atom(qt_info *info, unsigned char *mvhd_atom) { static int mp4_read_descr_len(unsigned char *s, uint32_t *length) { uint8_t b; uint8_t numBytes = 0; - + *length = 0; do { @@ -900,14 +900,14 @@ static qt_error parse_trak_atom (qt_trak *trak, break; } } - + debug_atom_load(" qt: parsing %s trak atom\n", (trak->type == MEDIA_VIDEO) ? "video" : (trak->type == MEDIA_AUDIO) ? "audio" : "other"); /* search for the useful atoms */ for (i = ATOM_PREAMBLE_SIZE; i < trak_atom_size - 4; i++) { - current_atom_size = _X_BE_32(&trak_atom[i - 4]); + current_atom_size = _X_BE_32(&trak_atom[i - 4]); current_atom = _X_BE_32(&trak_atom[i]); if (current_atom == TKHD_ATOM) { @@ -947,7 +947,7 @@ static qt_error parse_trak_atom (qt_trak *trak, } else if (current_atom == MDHD_ATOM) { int version; debug_atom_load ("demux_qt: mdhd atom\n"); - + version = trak_atom[i+4]; if ( version > 1 ) continue; /* unsupported, undocumented */ @@ -975,7 +975,7 @@ static qt_error parse_trak_atom (qt_trak *trak, properties_offset = 0x0C; for (k = 0; k < trak->stsd_atoms_count; k++) { - current_stsd_atom_size = _X_BE_32(&trak_atom[atom_pos - 4]); + current_stsd_atom_size = _X_BE_32(&trak_atom[atom_pos - 4]); if (current_stsd_atom_size < 4) { last_error = QT_HEADER_TROUBLE; goto free_trak; @@ -988,7 +988,7 @@ static qt_error parse_trak_atom (qt_trak *trak, /* copy the properties atom */ trak->stsd_atoms[k].video.properties_atom_size = current_stsd_atom_size - 4; - trak->stsd_atoms[k].video.properties_atom = + trak->stsd_atoms[k].video.properties_atom = xine_xmalloc(trak->stsd_atoms[k].video.properties_atom_size); if (!trak->stsd_atoms[k].video.properties_atom) { last_error = QT_NO_MEMORY; @@ -1006,7 +1006,7 @@ static qt_error parse_trak_atom (qt_trak *trak, trak->stsd_atoms[k].video.palette_count = 0; /* fetch video parameters */ - if( _X_BE_16(&trak_atom[atom_pos + 0x1C]) && + if( _X_BE_16(&trak_atom[atom_pos + 0x1C]) && _X_BE_16(&trak_atom[atom_pos + 0x1E]) ) { trak->stsd_atoms[k].video.width = _X_BE_16(&trak_atom[atom_pos + 0x1C]); @@ -1034,9 +1034,9 @@ static qt_error parse_trak_atom (qt_trak *trak, /* compute the greyscale palette */ color_index = 255; - color_dec = 256 / + color_dec = 256 / (trak->stsd_atoms[k].video.palette_count - 1); - for (j = 0; + for (j = 0; j < trak->stsd_atoms[k].video.palette_count; j++) { @@ -1061,7 +1061,7 @@ static qt_error parse_trak_atom (qt_trak *trak, else color_table = qt_default_palette_256; - for (j = 0; + for (j = 0; j < trak->stsd_atoms[k].video.palette_count; j++) { @@ -1088,7 +1088,7 @@ static qt_error parse_trak_atom (qt_trak *trak, color_index = _X_BE_16(&trak_atom[atom_pos + 0x5A + j * 8]); if (color_count & 0x8000) color_index = j; - if (color_index < + if (color_index < trak->stsd_atoms[k].video.palette_count) { trak->stsd_atoms[k].video.palette[color_index].r = trak_atom[atom_pos + 0x5A + j * 8 + 2]; @@ -1131,7 +1131,7 @@ static qt_error parse_trak_atom (qt_trak *trak, /* copy the properties atom */ trak->stsd_atoms[k].audio.properties_atom_size = current_stsd_atom_size - 4; - trak->stsd_atoms[k].audio.properties_atom = + trak->stsd_atoms[k].audio.properties_atom = xine_xmalloc(trak->stsd_atoms[k].audio.properties_atom_size); if (!trak->stsd_atoms[k].audio.properties_atom) { last_error = QT_NO_MEMORY; @@ -1153,12 +1153,12 @@ static qt_error parse_trak_atom (qt_trak *trak, trak->stsd_atoms[k].audio.bits / 8; trak->stsd_atoms[k].audio.samples_per_frame = trak->stsd_atoms[k].audio.channels; - trak->stsd_atoms[k].audio.bytes_per_frame = - trak->stsd_atoms[k].audio.bytes_per_sample * + trak->stsd_atoms[k].audio.bytes_per_frame = + trak->stsd_atoms[k].audio.bytes_per_sample * trak->stsd_atoms[k].audio.samples_per_frame; - trak->stsd_atoms[k].audio.samples_per_packet = + trak->stsd_atoms[k].audio.samples_per_packet = trak->stsd_atoms[k].audio.samples_per_frame; - trak->stsd_atoms[k].audio.bytes_per_packet = + trak->stsd_atoms[k].audio.bytes_per_packet = trak->stsd_atoms[k].audio.bytes_per_sample; /* special case time: A lot of CBR audio codecs stored in the @@ -1166,7 +1166,7 @@ static qt_error parse_trak_atom (qt_trak *trak, if (trak->stsd_atoms[k].audio.codec_fourcc == IMA4_FOURCC) { trak->stsd_atoms[k].audio.samples_per_packet = 64; trak->stsd_atoms[k].audio.bytes_per_packet = 34; - trak->stsd_atoms[k].audio.bytes_per_frame = 34 * + trak->stsd_atoms[k].audio.bytes_per_frame = 34 * trak->stsd_atoms[k].audio.channels; trak->stsd_atoms[k].audio.bytes_per_sample = 2; trak->stsd_atoms[k].audio.samples_per_frame = 64 * @@ -1182,7 +1182,7 @@ static qt_error parse_trak_atom (qt_trak *trak, } else if (trak->stsd_atoms[k].audio.codec_fourcc == MAC6_FOURCC) { trak->stsd_atoms[k].audio.samples_per_packet = 6; trak->stsd_atoms[k].audio.bytes_per_packet = 1; - trak->stsd_atoms[k].audio.bytes_per_frame = 1 * + trak->stsd_atoms[k].audio.bytes_per_frame = 1 * trak->stsd_atoms[k].audio.channels; trak->stsd_atoms[k].audio.bytes_per_sample = 1; trak->stsd_atoms[k].audio.samples_per_frame = 6 * @@ -1190,7 +1190,7 @@ static qt_error parse_trak_atom (qt_trak *trak, } else if (trak->stsd_atoms[k].audio.codec_fourcc == ALAW_FOURCC) { trak->stsd_atoms[k].audio.samples_per_packet = 1; trak->stsd_atoms[k].audio.bytes_per_packet = 1; - trak->stsd_atoms[k].audio.bytes_per_frame = 1 * + trak->stsd_atoms[k].audio.bytes_per_frame = 1 * trak->stsd_atoms[k].audio.channels; trak->stsd_atoms[k].audio.bytes_per_sample = 2; trak->stsd_atoms[k].audio.samples_per_frame = 2 * @@ -1198,7 +1198,7 @@ static qt_error parse_trak_atom (qt_trak *trak, } else if (trak->stsd_atoms[k].audio.codec_fourcc == ULAW_FOURCC) { trak->stsd_atoms[k].audio.samples_per_packet = 1; trak->stsd_atoms[k].audio.bytes_per_packet = 1; - trak->stsd_atoms[k].audio.bytes_per_frame = 1 * + trak->stsd_atoms[k].audio.bytes_per_frame = 1 * trak->stsd_atoms[k].audio.channels; trak->stsd_atoms[k].audio.bytes_per_sample = 2; trak->stsd_atoms[k].audio.samples_per_frame = 2 * @@ -1217,20 +1217,20 @@ static qt_error parse_trak_atom (qt_trak *trak, (trak->stsd_atoms[k].audio.codec_fourcc != RAW_FOURCC)) { if (_X_BE_32(&trak_atom[atom_pos + 0x20])) - trak->stsd_atoms[k].audio.samples_per_packet = + trak->stsd_atoms[k].audio.samples_per_packet = _X_BE_32(&trak_atom[atom_pos + 0x20]); if (_X_BE_32(&trak_atom[atom_pos + 0x24])) - trak->stsd_atoms[k].audio.bytes_per_packet = + trak->stsd_atoms[k].audio.bytes_per_packet = _X_BE_32(&trak_atom[atom_pos + 0x24]); if (_X_BE_32(&trak_atom[atom_pos + 0x28])) - trak->stsd_atoms[k].audio.bytes_per_frame = + trak->stsd_atoms[k].audio.bytes_per_frame = _X_BE_32(&trak_atom[atom_pos + 0x28]); if (_X_BE_32(&trak_atom[atom_pos + 0x2C])) - trak->stsd_atoms[k].audio.bytes_per_sample = + trak->stsd_atoms[k].audio.bytes_per_sample = _X_BE_32(&trak_atom[atom_pos + 0x2C]); if (trak->stsd_atoms[k].audio.bytes_per_packet) trak->stsd_atoms[k].audio.samples_per_frame = - (trak->stsd_atoms[k].audio.bytes_per_frame / + (trak->stsd_atoms[k].audio.bytes_per_frame / trak->stsd_atoms[k].audio.bytes_per_packet) * trak->stsd_atoms[k].audio.samples_per_packet; } @@ -1252,13 +1252,13 @@ static qt_error parse_trak_atom (qt_trak *trak, trak->stsd_atoms[k].audio.vbr = 1; /* further, FFmpeg's ALAC decoder requires 36 out-of-band bytes */ trak->stsd_atoms[k].audio.properties_atom_size = 36; - trak->stsd_atoms[k].audio.properties_atom = + trak->stsd_atoms[k].audio.properties_atom = xine_xmalloc(trak->stsd_atoms[k].audio.properties_atom_size); if (!trak->stsd_atoms[k].audio.properties_atom) { last_error = QT_NO_MEMORY; goto free_trak; } - memcpy(trak->stsd_atoms[k].audio.properties_atom, + memcpy(trak->stsd_atoms[k].audio.properties_atom, &trak_atom[atom_pos + 0x20], trak->stsd_atoms[k].audio.properties_atom_size); } @@ -1274,7 +1274,7 @@ static qt_error parse_trak_atom (qt_trak *trak, (_X_BE_32(&trak_atom[atom_pos + 0x3C]) == FRMA_ATOM) && (_X_ME_32(&trak_atom[atom_pos + 0x48]) == trak->stsd_atoms[k].audio.codec_fourcc)) { int wave_size = _X_BE_32(&trak_atom[atom_pos + 0x44]) - 8; - + if ((wave_size >= sizeof(xine_waveformatex)) && (current_atom_size >= (0x4C + wave_size))) { trak->stsd_atoms[k].audio.wave_size = wave_size; @@ -1331,12 +1331,12 @@ static qt_error parse_trak_atom (qt_trak *trak, } else if (current_atom == ESDS_ATOM) { uint32_t len; - + debug_atom_load(" qt/mpeg-4 esds atom\n"); - if ((trak->type == MEDIA_VIDEO) || + if ((trak->type == MEDIA_VIDEO) || (trak->type == MEDIA_AUDIO)) { - + j = i + 8; if( trak_atom[j++] == 0x03 ) { j += mp4_read_descr_len( &trak_atom[j], &len ); @@ -1368,13 +1368,13 @@ static qt_error parse_trak_atom (qt_trak *trak, } } else if (current_atom == AVCC_ATOM) { - + debug_atom_load(" avcC atom\n"); - + trak->decoder_config_len = current_atom_size - 8; trak->decoder_config = realloc(trak->decoder_config, trak->decoder_config_len); memcpy(trak->decoder_config, &trak_atom[i + 4], trak->decoder_config_len); - + } else if (current_atom == STSZ_ATOM) { /* there should only be one of these atoms */ @@ -1682,9 +1682,9 @@ static qt_error parse_reference_atom (reference_t *ref, /* This is a little support function used to process the edit list when * building a frame table. */ #define MAX_DURATION 0x7FFFFFFFFFFFFFFFLL -static void get_next_edit_list_entry(qt_trak *trak, +static void get_next_edit_list_entry(qt_trak *trak, int *edit_list_index, - unsigned int *edit_list_media_time, + unsigned int *edit_list_media_time, int64_t *edit_list_duration, unsigned int global_timescale) { @@ -1701,9 +1701,9 @@ static void get_next_edit_list_entry(qt_trak *trak, /* otherwise, find an edit list entries whose media time != -1 */ if (trak->edit_list_table[*edit_list_index].media_time != -1) { - *edit_list_media_time = + *edit_list_media_time = trak->edit_list_table[*edit_list_index].media_time; - *edit_list_duration = + *edit_list_duration = trak->edit_list_table[*edit_list_index].track_duration; /* duration is in global timescale units; convert to trak timescale */ @@ -1717,8 +1717,8 @@ static void get_next_edit_list_entry(qt_trak *trak, *edit_list_index = *edit_list_index + 1; } - /* on the way out, check if this is the last edit list entry; if so, - * don't let the duration expire (so set it to an absurdly large value) + /* on the way out, check if this is the last edit list entry; if so, + * don't let the duration expire (so set it to an absurdly large value) */ if (*edit_list_index == trak->edit_list_count) *edit_list_duration = MAX_DURATION; @@ -1753,7 +1753,7 @@ static qt_error build_frame_table(qt_trak *trak, /* AUDIO and OTHER frame types follow the same rules; VIDEO and vbr audio * frame types follow a different set */ - if ((trak->type == MEDIA_VIDEO) || + if ((trak->type == MEDIA_VIDEO) || (trak->properties->audio.vbr)) { /* in this case, the total number of frames is equal to the number of @@ -1803,7 +1803,7 @@ static qt_error build_frame_table(qt_trak *trak, trak->stsd_atoms_count); trak->frames[frame_counter].media_id = 0; } else { - trak->frames[frame_counter].media_id = + trak->frames[frame_counter].media_id = trak->sample_to_chunk_table[i].media_id; media_id_counts[trak->sample_to_chunk_table[i].media_id - 1]++; } @@ -1863,11 +1863,11 @@ static qt_error build_frame_table(qt_trak *trak, debug_edit_list(" %d: (before) pts = %"PRId64"...", i, trak->frames[i].pts); - if (trak->frames[i].pts < edit_list_media_time) + if (trak->frames[i].pts < edit_list_media_time) trak->frames[i].pts = edit_list_pts_counter; else { if (i < trak->frame_count - 1) - frame_duration = + frame_duration = (trak->frames[i + 1].pts - trak->frames[i].pts); debug_edit_list("duration = %"PRId64"...", frame_duration); @@ -1946,7 +1946,7 @@ static qt_error build_frame_table(qt_trak *trak, trak->stsd_atoms_count); trak->frames[j].media_id = 0; } else { - trak->frames[j].media_id = + trak->frames[j].media_id = trak->sample_to_chunk_table[i].media_id; } @@ -2011,10 +2011,10 @@ static void parse_moov_atom(qt_info *info, unsigned char *moov_atom, /* create a new trak structure */ info->trak_count++; - info->traks = (qt_trak *)realloc(info->traks, + info->traks = (qt_trak *)realloc(info->traks, info->trak_count * sizeof(qt_trak)); - info->last_error = parse_trak_atom (&info->traks[info->trak_count - 1], + info->last_error = parse_trak_atom (&info->traks[info->trak_count - 1], &moov_atom[i - 4]); if (info->last_error != QT_OK) { info->trak_count--; @@ -2123,11 +2123,11 @@ static void parse_moov_atom(qt_info *info, unsigned char *moov_atom, /* iterate through 1..n-1 reference entries and decide on the right one */ for (i = 1; i < info->reference_count; i++) { - if (info->references[i].qtim_version > + if (info->references[i].qtim_version > info->references[info->chosen_reference].qtim_version) info->chosen_reference = i; else if ((info->references[i].data_rate <= bandwidth) && - (info->references[i].data_rate > + (info->references[i].data_rate > info->references[info->chosen_reference].data_rate)) info->chosen_reference = i; } @@ -2211,7 +2211,7 @@ static qt_error open_qt_file(qt_info *info, input_plugin_t *input, info->last_error = QT_FILE_READ_ERROR; return info->last_error; } - if (input->read(input, moov_atom, moov_atom_size) != + if (input->read(input, moov_atom, moov_atom_size) != moov_atom_size) { free(moov_atom); info->last_error = QT_FILE_READ_ERROR; @@ -2342,12 +2342,12 @@ static int demux_qt_send_chunk(demux_plugin_t *this_gen) { /* if audio is present, send pts of current audio frame, otherwise * send current video frame pts */ if (audio_trak) - _x_demux_control_newpts(this->stream, - audio_trak->frames[audio_trak->current_frame].pts, + _x_demux_control_newpts(this->stream, + audio_trak->frames[audio_trak->current_frame].pts, BUF_FLAG_SEEK); else - _x_demux_control_newpts(this->stream, - video_trak->frames[video_trak->current_frame].pts, + _x_demux_control_newpts(this->stream, + video_trak->frames[video_trak->current_frame].pts, BUF_FLAG_SEEK); } @@ -2454,7 +2454,7 @@ static int demux_qt_send_chunk(demux_plugin_t *this_gen) { frame_duration); debug_video_demux(" qt: sending off video frame %d from offset 0x%"PRIX64", %d bytes, media id %d, %"PRId64" pts\n", - i, + i, video_trak->frames[i].offset, video_trak->frames[i].size, video_trak->frames[i].media_id, @@ -2512,7 +2512,7 @@ static int demux_qt_send_chunk(demux_plugin_t *this_gen) { SEEK_SET); debug_audio_demux(" qt: sending off audio frame %d from offset 0x%"PRIX64", %d bytes, media id %d, %"PRId64" pts\n", - i, + i, audio_trak->frames[i].offset, audio_trak->frames[i].size, audio_trak->frames[i].media_id, @@ -2531,8 +2531,8 @@ static int demux_qt_send_chunk(demux_plugin_t *this_gen) { * turns around and sends out audio buffers as soon as they are * received. If 2 or more consecutive audio buffers are dispatched to * the audio out unit, the engine will compensate with pops. */ - if ((buf->type == BUF_AUDIO_LPCM_BE) || - (buf->type == BUF_AUDIO_LPCM_LE)) { + if ((buf->type == BUF_AUDIO_LPCM_BE) || + (buf->type == BUF_AUDIO_LPCM_LE)) { if (first_buf) { buf->extra_info->input_time = audio_trak->frames[i].pts / 90; buf->pts = audio_trak->frames[i].pts; @@ -2561,7 +2561,7 @@ static int demux_qt_send_chunk(demux_plugin_t *this_gen) { /* Special case alert: If this is signed, 8-bit data, transform * the data to unsigned. */ - if ((audio_trak->properties->audio.bits == 8) && + if ((audio_trak->properties->audio.bits == 8) && ((audio_trak->properties->audio.codec_fourcc == TWOS_FOURCC) || (audio_trak->properties->audio.codec_fourcc == SOWT_FOURCC))) for (j = 0; j < buf->size; j++) @@ -2630,7 +2630,7 @@ static void demux_qt_send_headers(demux_plugin_t *this_gen) { this->bih.biBitCount = video_trak->properties->video.depth; this->bih.biCompression = video_trak->properties->video.codec_fourcc; - video_trak->properties->video.codec_buftype = + video_trak->properties->video.codec_buftype = _x_fourcc_to_buf_video(this->bih.biCompression); /* hack: workaround a fourcc clash! 'mpg4' is used by MS and Sorenson @@ -2638,13 +2638,13 @@ static void demux_qt_send_headers(demux_plugin_t *this_gen) { */ if( video_trak->properties->video.codec_buftype == BUF_VIDEO_MSMPEG4_V1 ) video_trak->properties->video.codec_buftype = BUF_VIDEO_MPEG4; - - if( !video_trak->properties->video.codec_buftype && + + if( !video_trak->properties->video.codec_buftype && video_trak->properties->video.codec_fourcc ) video_trak->properties->video.codec_buftype = BUF_VIDEO_UNKNOWN; _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_VIDEO, 1); - _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_WIDTH, + _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_WIDTH, this->bih.biWidth); _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_HEIGHT, this->bih.biHeight); @@ -2677,7 +2677,7 @@ static void demux_qt_send_headers(demux_plugin_t *this_gen) { break; } } else { - audio_trak->properties->audio.codec_buftype = + audio_trak->properties->audio.codec_buftype = _x_formattag_to_buf_audio(audio_trak->properties->audio.codec_fourcc); } @@ -2692,7 +2692,7 @@ static void demux_qt_send_headers(demux_plugin_t *this_gen) { audio_trak->properties->audio.sample_rate); _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_BITS, audio_trak->properties->audio.bits); - _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_FOURCC, + _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_FOURCC, audio_trak->properties->audio.codec_fourcc); } else { @@ -2733,17 +2733,17 @@ static void demux_qt_send_headers(demux_plugin_t *this_gen) { (video_trak->properties->video.codec_buftype)) { buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); buf->decoder_flags = BUF_FLAG_HEADER|BUF_FLAG_STDHEADER|BUF_FLAG_FRAME_END; - + memcpy(buf->content, &this->bih, sizeof(this->bih)); buf->size = sizeof(this->bih); buf->type = video_trak->properties->video.codec_buftype; this->video_fifo->put (this->video_fifo, buf); - + /* send header info to decoder. some mpeg4 streams need this */ if( video_trak->decoder_config ) { buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); buf->type = video_trak->properties->video.codec_buftype; - + if (video_trak->properties->video.codec_fourcc == AVC1_FOURCC) { buf->size = 0; buf->decoder_flags = BUF_FLAG_SPECIAL|BUF_FLAG_HEADER; @@ -2787,9 +2787,9 @@ static void demux_qt_send_headers(demux_plugin_t *this_gen) { /* set the audio bitrate field (only for CBR audio) */ if (!audio_trak->properties->audio.vbr) { - audio_bitrate = + audio_bitrate = audio_trak->properties->audio.sample_rate / - audio_trak->properties->audio.samples_per_frame * + audio_trak->properties->audio.samples_per_frame * audio_trak->properties->audio.bytes_per_frame * audio_trak->properties->audio.channels * 8; @@ -2804,7 +2804,7 @@ static void demux_qt_send_headers(demux_plugin_t *this_gen) { buf->decoder_info[1] = audio_trak->properties->audio.sample_rate; buf->decoder_info[2] = audio_trak->properties->audio.bits; buf->decoder_info[3] = audio_trak->properties->audio.channels; - + if( audio_trak->properties->audio.wave_size ) { if( audio_trak->properties->audio.wave_size > buf->max_size ) buf->size = buf->max_size; @@ -2815,9 +2815,9 @@ static void demux_qt_send_headers(demux_plugin_t *this_gen) { buf->size = 0; buf->content = NULL; } - + this->audio_fifo->put (this->audio_fifo, buf); - + if( audio_trak->decoder_config ) { buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); buf->type = audio_trak->properties->audio.codec_buftype; @@ -2910,7 +2910,7 @@ static int demux_qt_seek (demux_plugin_t *this_gen, qt_trak *video_trak = NULL; qt_trak *audio_trak = NULL; int64_t keyframe_pts; - + start_pos = (off_t) ( (double) start_pos / 65535 * this->data_size ); @@ -3171,7 +3171,7 @@ static const demuxer_info_t demux_info_qt = { }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_DEMUX, 26, "quicktime", XINE_VERSION_CODE, &demux_info_qt, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/demuxers/demux_rawdv.c b/src/demuxers/demux_rawdv.c index d95fc9125..968542057 100644 --- a/src/demuxers/demux_rawdv.c +++ b/src/demuxers/demux_rawdv.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -89,17 +89,17 @@ static int demux_raw_dv_next (demux_raw_dv_t *this) { /* TODO: duplicate data and send to audio fifo. * however we don't have dvaudio decoder yet. */ - + buf->pts = this->pts; buf->extra_info->input_time = this->pts/90; if( this->input->get_length (this->input) ) - buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * + buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * 65535 / this->input->get_length (this->input) ); buf->extra_info->frame_number = this->cur_frame; buf->type = BUF_VIDEO_DV; - + this->video_fifo->put(this->video_fifo, buf); - + if (this->audio_fifo) { abuf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); abuf->content = abuf->mem; @@ -213,11 +213,11 @@ static void demux_raw_dv_send_headers (demux_plugin_t *this_gen) { bih->biSizeImage = bih->biWidth*bih->biHeight; this->video_fifo->put(this->video_fifo, buf); - + this->pts = 0; this->cur_frame = 0; this->bytes_left = this->frame_size; - + this->status = DEMUX_OK; _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_VIDEO, 1); @@ -305,18 +305,18 @@ static int demux_raw_dv_seek (demux_plugin_t *this_gen, /* Upcast start_time in case sizeof(off_t) > sizeof(int) */ start_pos = ((off_t) start_time * 90 / this->duration) * this->frame_size; } - - start_pos = start_pos - (start_pos % this->frame_size); + + start_pos = start_pos - (start_pos % this->frame_size); this->input->seek(this->input, start_pos, SEEK_SET); this->cur_frame = start_pos / this->frame_size; this->pts = this->cur_frame * this->duration; this->bytes_left = this->frame_size; - + _x_demux_flush_engine (this->stream); _x_demux_control_newpts (this->stream, this->pts, BUF_FLAG_SEEK); - + this->status = DEMUX_OK; return this->status; } @@ -368,7 +368,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str case METHOD_BY_CONTENT: { uint8_t buf[8]; - + if (_x_demux_read_header(input, buf, 8) != 8) { free (this); return NULL; diff --git a/src/demuxers/demux_real.c b/src/demuxers/demux_real.c index 774c74e2c..340083221 100644 --- a/src/demuxers/demux_real.c +++ b/src/demuxers/demux_real.c @@ -26,9 +26,9 @@ * * video packet sub-demuxer ported from mplayer code (www.mplayerhq.hu): * Real parser & demuxer - * + * * (C) Alex Beregszaszi - * + * * Based on FFmpeg's libav/rm.c. */ @@ -111,10 +111,10 @@ typedef struct { uint32_t fourcc; uint32_t buf_type; uint32_t format; - + real_index_entry_t *index; int index_entries; - + mdpr_t *mdpr; int sps, cfs, w, h; int block_align; @@ -159,7 +159,7 @@ typedef struct { int64_t last_pts[2]; int send_newpts; int buf_flag_seek; - + uint32_t last_ts; uint32_t next_ts; int last_seq; @@ -184,7 +184,7 @@ static void real_parse_index(demux_real_t *this) { unsigned char index_chunk_header[INDEX_CHUNK_HEADER_SIZE]; unsigned char index_record[INDEX_RECORD_SIZE]; int i; - + while(next_index_chunk) { lprintf("reading index chunk at %"PRIX64"\n", next_index_chunk); @@ -242,7 +242,7 @@ static void real_parse_index(demux_real_t *this) { if(index && entries) /* Allocate memory for index */ *index = calloc(entries, sizeof(real_index_entry_t)); - + if(index && entries && *index) { /* Read index */ for(i = 0; i < entries; i++) { @@ -357,7 +357,7 @@ static void real_parse_audio_specific_data (demux_real_t *this, const uint16_t codec_data_length = _X_BE_16 (data+40); const uint16_t coded_frame_size2 = _X_BE_16 (data+42); const uint16_t subpacket_size = _X_BE_16 (data+44); - + stream->sps = subpacket_size; stream->w = coded_frame_size2; stream->h = codec_data_length; @@ -382,7 +382,7 @@ static void real_parse_audio_specific_data (demux_real_t *this, break; default: - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_real: error, i don't handle buf type 0x%08x\n", stream->buf_type); } @@ -425,12 +425,12 @@ static void real_parse_headers (demux_real_t *this) { uint8_t signature[REAL_SIGNATURE_SIZE]; if (this->input->read(this->input, signature, REAL_SIGNATURE_SIZE) != REAL_SIGNATURE_SIZE) { - + lprintf ("signature not read\n"); this->status = DEMUX_FINISHED; return; } - + if ( !_x_is_fourcc(signature, ".RMF") ) { this->status = DEMUX_FINISHED; lprintf ("signature not found '%.4s'\n", signature); @@ -480,11 +480,11 @@ static void real_parse_headers (demux_real_t *this) { this->status = DEMUX_FINISHED; return; } - + uint16_t version = _X_BE_16(&chunk_buffer[0]); if (chunk_type == PROP_TAG) { - + if(version != 0) { xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demuxe_real: unknown object version in PROP: 0x%04x\n", version); @@ -516,7 +516,7 @@ static void real_parse_headers (demux_real_t *this) { free(chunk_buffer); continue; } - + mdpr_t *const mdpr = real_parse_mdpr (chunk_buffer, chunk_size); lprintf ("parsing type specific data...\n"); @@ -541,7 +541,7 @@ static void real_parse_headers (demux_real_t *this) { "demux_real: maximum number of audio stream exceeded\n"); goto unknown; } - + const uint16_t version = _X_BE_16(mdpr->type_specific_data + 4); lprintf("audio version %d detected\n", version); @@ -549,7 +549,7 @@ static void real_parse_headers (demux_real_t *this) { char *fourcc_ptr = "\0\0\0"; switch(version) { case 3: - /* Version 3 header stores fourcc after meta info - cheat by reading backwards from the + /* Version 3 header stores fourcc after meta info - cheat by reading backwards from the * end of the header instead of having to parse it all */ if (mdpr->type_specific_len >= 5) fourcc_ptr = mdpr->type_specific_data + mdpr->type_specific_len - 5; @@ -591,7 +591,7 @@ static void real_parse_headers (demux_real_t *this) { "demux_real: maximum number of video stream exceeded\n"); goto unknown; } - + lprintf ("video detected\n"); const uint32_t fourcc = _X_ME_32(mdpr->type_specific_data + 8); lprintf("fourcc = %.4s\n", (char *) &fourcc); @@ -632,7 +632,7 @@ static void real_parse_headers (demux_real_t *this) { /* load the title string */ SET_METADATA_STRING(XINE_META_INFO_TITLE); - + /* load the author string */ SET_METADATA_STRING(XINE_META_INFO_ARTIST); @@ -650,12 +650,12 @@ static void real_parse_headers (demux_real_t *this) { case DATA_TAG: { uint8_t data_chunk_header[DATA_CHUNK_HEADER_SIZE]; - if (this->input->read(this->input, data_chunk_header, + if (this->input->read(this->input, data_chunk_header, DATA_CHUNK_HEADER_SIZE) != DATA_CHUNK_HEADER_SIZE) { this->status = DEMUX_FINISHED; return ; } - + /* check version */ const uint16_t version = _X_BE_16(&data_chunk_header[0]); if(version != 0) { @@ -683,11 +683,11 @@ static void real_parse_headers (demux_real_t *this) { /* Read index tables */ if(INPUT_IS_SEEKABLE(this->input)) real_parse_index(this); - + /* Simple stream selection case - 0/1 audio/video streams */ this->video_stream = (this->num_video_streams == 1) ? &this->video_streams[0] : NULL; this->audio_stream = (this->num_audio_streams == 1) ? &this->audio_streams[0] : NULL; - + /* In the case of multiple audio/video streams select the first streams found in the file */ if((this->num_video_streams > 1) || (this->num_audio_streams > 1)) { @@ -698,23 +698,23 @@ static void real_parse_headers (demux_real_t *this) { /* Get data to search through for stream chunks */ if(INPUT_IS_SEEKABLE(this->input)) { original_pos = this->input->get_current_pos(this->input); - + if((len = this->input->read(this->input, search_buffer, MAX_PREVIEW_SIZE)) <= 0) { - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_real: failed to read header\n"); this->status = DEMUX_FINISHED; return; } - + offset = 0; } else if((this->input->get_capabilities(this->input) & INPUT_CAP_PREVIEW) != 0) { if((len = this->input->get_optional_data(this->input, search_buffer, INPUT_OPTIONAL_DATA_PREVIEW)) <= 0) { - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_real: failed to read header\n"); this->status = DEMUX_FINISHED; return; } - + /* Preview data starts at the beginning of the file */ offset = this->data_start + 18; } else { @@ -723,16 +723,16 @@ static void real_parse_headers (demux_real_t *this) { this->status = DEMUX_FINISHED; return; } - + while((offset < len) && ((!this->video_stream && (this->num_video_streams > 0)) || (!this->audio_stream && (this->num_audio_streams > 0)))) { int i; - + /* Check for end of the data chunk */ if (_x_is_fourcc(&search_buffer[offset], "INDX") || _x_is_fourcc(&search_buffer[offset], "DATA")) break; - + const int stream = _X_BE_16(&search_buffer[offset + 4]); for(i = 0; !this->video_stream && (i < this->num_video_streams); i++) { @@ -741,7 +741,7 @@ static void real_parse_headers (demux_real_t *this) { lprintf("selecting video stream: %d\n", stream); } } - + for(i = 0; !this->audio_stream && (i < this->num_audio_streams); i++) { if(stream == this->audio_streams[i].mdpr->stream_number) { this->audio_stream = &this->audio_streams[i]; @@ -751,11 +751,11 @@ static void real_parse_headers (demux_real_t *this) { offset += _X_BE_16(&search_buffer[offset + 2]); } - + if(INPUT_IS_SEEKABLE(this->input)) this->input->seek(this->input, original_pos, SEEK_SET); } - + /* Let the user know if we haven't managed to detect what streams to play */ if((!this->video_stream && this->num_video_streams) || (!this->audio_stream && this->num_audio_streams)) { @@ -764,17 +764,17 @@ static void real_parse_headers (demux_real_t *this) { this->status = DEMUX_FINISHED; return; } - + /* Send headers and set meta info */ if(this->video_stream) { /* Check for recognised codec*/ if(!this->video_stream->buf_type) this->video_stream->buf_type = BUF_VIDEO_UNKNOWN; - + /* Send header */ buf_element_t *const buf = this->video_fifo->buffer_pool_alloc(this->video_fifo); buf->content = buf->mem; - + memcpy(buf->content, this->video_stream->mdpr->type_specific_data, this->video_stream->mdpr->type_specific_len); @@ -792,7 +792,7 @@ static void real_parse_headers (demux_real_t *this) { this->video_stream->fourcc); _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_BITRATE, this->video_stream->mdpr->avg_bit_rate); - + /* Allocate fragment offset table */ this->fragment_tab = calloc(FRAGMENT_TAB_SIZE, sizeof(uint32_t)); this->fragment_tab_max = FRAGMENT_TAB_SIZE; @@ -802,7 +802,7 @@ static void real_parse_headers (demux_real_t *this) { /* Check for recognised codec */ if(!this->audio_stream->buf_type) this->audio_stream->buf_type = BUF_AUDIO_UNKNOWN; - + /* Send headers */ if(this->audio_fifo) { mdpr_t *const mdpr = this->audio_stream->mdpr; @@ -811,21 +811,21 @@ static void real_parse_headers (demux_real_t *this) { buf->type = this->audio_stream->buf_type; buf->decoder_flags = BUF_FLAG_HEADER|BUF_FLAG_FRAME_END; - + /* For AAC we send two header buffers, the first is a standard audio * header giving bits per sample, sample rate and number of channels. * The second is the codec initialisation data found at the end of * the type specific data for the audio stream */ if(buf->type == BUF_AUDIO_AAC) { const uint16_t version = _X_BE_16(mdpr->type_specific_data + 4); - + if(version != 5) { xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_real: unsupported audio header version for AAC: %d\n", version); buf->free_buffer(buf); goto unsupported; } - + buf->decoder_info[1] = _X_BE_16(mdpr->type_specific_data + 54); buf->decoder_info[2] = _X_BE_16(mdpr->type_specific_data + 58); buf->decoder_info[3] = _X_BE_16(mdpr->type_specific_data + 60); @@ -833,18 +833,18 @@ static void real_parse_headers (demux_real_t *this) { buf->decoder_flags |= BUF_FLAG_STDHEADER; buf->content = NULL; buf->size = 0; - + this->audio_fifo->put (this->audio_fifo, buf); - + buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); - + buf->type = this->audio_stream->buf_type; buf->decoder_flags = BUF_FLAG_HEADER|BUF_FLAG_FRAME_END|BUF_FLAG_SPECIAL; buf->decoder_info[1] = BUF_SPECIAL_DECODER_CONFIG; buf->decoder_info[2] = _X_BE_32(mdpr->type_specific_data + 74) - 1; buf->decoder_info_ptr[2] = buf->content; buf->size = 0; - + memcpy(buf->content, mdpr->type_specific_data + 79, buf->decoder_info[2]); @@ -892,7 +892,7 @@ static int demux_real_parse_references( demux_real_t *this) { lprintf("parsing references\n"); - + /* read file to memory. * warning: dumb code, but hopefuly ok since reference file is small */ do { @@ -911,7 +911,7 @@ static int demux_real_parse_references( demux_real_t *this) { if(buf_used) buf[buf_used] = '\0'; - + lprintf("received %d bytes [%s]\n", buf_used, buf); if (!strncmp(buf,"http://",7)) @@ -945,10 +945,10 @@ static int demux_real_parse_references( demux_real_t *this) { /* rpm files can contain comments which should be skipped */ if( !strncmp(&buf[i],"",3) ) comment = 0; - + if( (!strncmp(&buf[i],"pnm://",6) || !strncmp(&buf[i],"rtsp://",7)) && !comment ) { for(j=i; buf[j] && buf[j] != '"' && !isspace(buf[j]); j++ ) @@ -961,14 +961,14 @@ static int demux_real_parse_references( demux_real_t *this) { i = j; } - } - + } + free(buf); - + this->status = DEMUX_FINISHED; return this->status; } - + /* redefine abs as macro to handle 64-bit diffs. i guess llabs may not be available everywhere */ #define abs(x) ( ((x)<0) ? -(x) : (x) ) @@ -1004,7 +1004,7 @@ static uint32_t real_fix_timestamp (demux_real_t *this, uint8_t *hdr, uint32_t t int pict_type; int seq; uint32_t ts_out; - + switch(this->video_stream->buf_type) { case BUF_VIDEO_RV20: pict_type = (hdr[0] & 0xC0) >> 6; @@ -1019,35 +1019,35 @@ static uint32_t real_fix_timestamp (demux_real_t *this, uint8_t *hdr, uint32_t t seq = ((hdr[1] & 0x07) << 10) + (hdr[2] << 2) + ((hdr[3] & 0xC0) >> 6); break; default: - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, - "demux_real: can't fix timestamp for buf type 0x%08x\n", + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "demux_real: can't fix timestamp for buf type 0x%08x\n", this->video_stream->buf_type); return ts_in; break; } - + switch (pict_type) { case 0: - case 1: + case 1: /* I frame */ ts_out = this->next_ts; - + this->last_ts = this->next_ts; this->next_ts = ts_in; - + this->last_seq = this->next_seq; this->next_seq = seq; break; case 2: /* P frame */ ts_out = this->next_ts; - + this->last_ts = this->next_ts; if (seq < this->next_seq) this->next_ts += seq + 8192 - this->next_seq; else this->next_ts += seq - this->next_seq; - + this->last_seq = this->next_seq; this->next_seq = seq; break; @@ -1064,8 +1064,8 @@ static uint32_t real_fix_timestamp (demux_real_t *this, uint8_t *hdr, uint32_t t ts_out = 0; break; } - - return ts_out; + + return ts_out; } static int stream_read_char (demux_real_t *this) { @@ -1089,7 +1089,7 @@ static int demux_real_send_chunk(demux_plugin_t *this_gen) { if(this->reference_mode) return demux_real_parse_references(this); - + /* load a header from wherever the stream happens to be pointing */ if ( this->input->read(this->input, header, DATA_PACKET_HEADER_SIZE) != DATA_PACKET_HEADER_SIZE) { @@ -1116,14 +1116,14 @@ static int demux_real_send_chunk(demux_plugin_t *this_gen) { this->status = DEMUX_FINISHED; return this->status; } - + /* read the packet information */ const uint16_t stream = _X_BE_16(&header[4]); const off_t offset __attr_unused = this->input->get_current_pos(this->input); uint16_t size = _X_BE_16(&header[2]) - DATA_PACKET_HEADER_SIZE; const uint32_t timestamp= _X_BE_32(&header[6]); int64_t pts = (int64_t) timestamp * 90; - + /* Data packet header with version 1 contains 1 extra byte */ if(version == 0) keyframe = header[11] & PN_KEYFRAME_FLAG; @@ -1225,22 +1225,22 @@ static int demux_real_send_chunk(demux_plugin_t *this_gen) { if(this->video_stream->index) input_time = timestamp; else - input_time = (int)((int64_t) this->input->get_current_pos(this->input) + input_time = (int)((int64_t) this->input->get_current_pos(this->input) * 8 * 1000 / this->avg_bitrate); const off_t input_length = this->data_start + 18 + this->data_chunk_size; if( input_length > 18 ) normpos = (int)((double) this->input->get_current_pos(this->input) * 65535 / input_length); - + check_newpts (this, pts, PTS_VIDEO, 0); if (this->fragment_size == 0) { lprintf ("new packet starting\n"); - + /* send fragment offset table */ if(this->fragment_count) { lprintf("sending fragment offset table\n"); - + buf = this->video_fifo->buffer_pool_alloc(this->video_fifo); buf->decoder_flags = BUF_FLAG_SPECIAL | BUF_FLAG_FRAME_END; @@ -1253,18 +1253,18 @@ static int demux_real_send_chunk(demux_plugin_t *this_gen) { xine_fast_memcpy(buf->decoder_info_ptr[2], this->fragment_tab, this->fragment_count*8); - + this->video_fifo->put(this->video_fifo, buf); - + this->fragment_count = 0; } - + decoder_flags = BUF_FLAG_FRAME_START; } else { lprintf ("continuing packet \n"); decoder_flags = 0; } - + /* add entry to fragment offset table */ this->fragment_tab[2*this->fragment_count] = 1; this->fragment_tab[2*this->fragment_count+1] = this->fragment_size; @@ -1291,30 +1291,30 @@ static int demux_real_send_chunk(demux_plugin_t *this_gen) { /* * read fragment_size bytes of data */ - + int n = fragment_size; while(n) { buf = this->video_fifo->buffer_pool_alloc(this->video_fifo); - + buf->size = MIN(n, buf->max_size); buf->decoder_flags = decoder_flags; decoder_flags &= ~BUF_FLAG_FRAME_START; - + buf->type = this->video_stream->buf_type; - + if(this->input->read(this->input, buf->content, buf->size) < buf->size) { - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_real: failed to read video fragment"); buf->free_buffer(buf); this->status = DEMUX_FINISHED; return this->status; } - - /* RV30 and RV40 streams contain some fragments that shouldn't be passed - * to the decoder. The purpose of these fragments is unknown, but - * realplayer doesn't appear to pass them to the decoder either */ - if((n == fragment_size) && + + /* RV30 and RV40 streams contain some fragments that shouldn't be passed + * to the decoder. The purpose of these fragments is unknown, but + * realplayer doesn't appear to pass them to the decoder either */ + if((n == fragment_size) && (((buf->type == BUF_VIDEO_RV30) && (buf->content[0] & 0x20)) || ((buf->type == BUF_VIDEO_RV40) && (buf->content[0] & 0x80)))) { lprintf("ignoring fragment\n"); @@ -1326,12 +1326,12 @@ static int demux_real_send_chunk(demux_plugin_t *this_gen) { break; } - + /* if the video stream has b-frames fix the timestamps */ if((this->video_stream->format >= 0x20200002) && (buf->decoder_flags & BUF_FLAG_FRAME_START)) pts = (int64_t) real_fix_timestamp(this, buf->content, timestamp) * 90; - + /* this test was moved from ffmpeg video decoder. * fixme: is pts only valid on frame start? */ if( buf->decoder_flags & BUF_FLAG_FRAME_START ) @@ -1339,13 +1339,13 @@ static int demux_real_send_chunk(demux_plugin_t *this_gen) { else buf->pts = 0; pts = 0; - + buf->extra_info->input_normpos = normpos; buf->extra_info->input_time = input_time; buf->extra_info->total_time = this->duration; - + this->video_fifo->put(this->video_fifo, buf); - + n -= buf->size; } @@ -1370,49 +1370,49 @@ static int demux_real_send_chunk(demux_plugin_t *this_gen) { goto discard; else this->audio_need_keyframe = 0; - + /* if we have a seekable stream then use the timestamp for the data * packet for more accurate seeking - if not then estimate time using * average bitrate */ if(this->audio_stream->index) input_time = timestamp; else - input_time = (int)((int64_t) this->input->get_current_pos(this->input) - * 8 * 1000 / this->avg_bitrate); - + input_time = (int)((int64_t) this->input->get_current_pos(this->input) + * 8 * 1000 / this->avg_bitrate); + const off_t input_length = this->data_start + 18 + this->data_chunk_size; - + if( input_length > 18 ) normpos = (int)((double) this->input->get_current_pos(this->input) * 65535 / input_length); - + check_newpts (this, pts, PTS_AUDIO, 0); - + /* Each packet of AAC is made up of several AAC frames preceded by a * header defining the size of the frames */ if(this->audio_stream->buf_type == BUF_AUDIO_AAC) { int i; - + /* Upper 4 bits of second byte is frame count */ const int frames = (stream_read_word(this) & 0xf0) >> 4; - + /* 2 bytes per frame size */ int sizes[frames]; for(i = 0; i < frames; i++) sizes[i] = stream_read_word(this); - + for(i = 0; i < frames; i++) { - if(_x_demux_read_send_data(this->audio_fifo, this->input, sizes[i], pts, - this->audio_stream->buf_type, 0, normpos, + if(_x_demux_read_send_data(this->audio_fifo, this->input, sizes[i], pts, + this->audio_stream->buf_type, 0, normpos, input_time, this->duration, 0) < 0) { - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_real: failed to read AAC frame\n"); this->status = DEMUX_FINISHED; return this->status; } - + pts = 0; /* Only set pts on first frame */ } } else if (this->audio_stream->buf_type == BUF_AUDIO_COOK || @@ -1440,11 +1440,11 @@ static int demux_real_send_chunk(demux_plugin_t *this_gen) { for (x = 0; x < sph / 2; x++) { pos = x * 2 * w + spc * cfs; if(pos + cfs > fs || this->input->read(this->input, buffer + pos, cfs) < cfs) { - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_real: failed to read audio chunk\n"); - + this->status = DEMUX_FINISHED; - return this->status; + return this->status; } } break; @@ -1453,22 +1453,22 @@ static int demux_real_send_chunk(demux_plugin_t *this_gen) { for (x = 0; x < w / sps; x++) { pos = sps * (sph * x + ((sph + 1) / 2) * (spc & 1) + (spc >> 1)); if(pos + sps > fs || this->input->read(this->input, buffer + pos, sps) < sps) { - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_real: failed to read audio chunk\n"); - + this->status = DEMUX_FINISHED; - return this->status; + return this->status; } } break; case BUF_AUDIO_SIPRO: pos = spc * w; if(pos + w > fs || this->input->read(this->input, buffer + pos, w) < w) { - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_real: failed to read audio chunk\n"); - + this->status = DEMUX_FINISHED; - return this->status; + return this->status; } if (spc == sph - 1) demux_real_sipro_swap (buffer, sph * w * 2 / 96); @@ -1481,20 +1481,20 @@ static int demux_real_send_chunk(demux_plugin_t *this_gen) { this->duration, 0); } } else { - if(_x_demux_read_send_data(this->audio_fifo, this->input, size, pts, + if(_x_demux_read_send_data(this->audio_fifo, this->input, size, pts, this->audio_stream->buf_type, 0, normpos, input_time, this->duration, 0) < 0) { - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_real: failed to read audio chunk\n"); this->status = DEMUX_FINISHED; return this->status; } - + /* FIXME: dp->flags = (flags & 0x2) ? 0x10 : 0; */ } - + } else { /* discard */ @@ -1577,14 +1577,14 @@ static int demux_real_seek (demux_plugin_t *this_gen, demux_real_t *this = (demux_real_t *) this_gen; real_index_entry_t *index, *other_index = NULL; int i = 0, entries; - + lprintf("seek start_pos=%d, start_time=%d, playing=%d\n", (int)start_pos, start_time, playing); if((this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) && ((this->audio_stream && this->audio_stream->index) || (this->video_stream && this->video_stream->index))) { - + start_pos = (off_t) ( (double) start_pos / 65535 * this->input->get_length (this->input) ); @@ -1632,14 +1632,14 @@ static int demux_real_seek (demux_plugin_t *this_gen, /* RTSP supports only time based seek */ if (start_pos && !start_time) start_time = (int64_t) this->duration * start_pos / 65535; - + this->input->seek_time(this->input, start_time, SEEK_SET); } this->send_newpts = 1; this->old_seqnum = -1; this->fragment_size = 0; - + this->next_ts = 0; this->next_seq = 0; @@ -1656,13 +1656,13 @@ static void demux_real_dispose (demux_plugin_t *this_gen) { real_free_mdpr(this->video_streams[i].mdpr); free(this->video_streams[i].index); } - + for(i = 0; i < this->num_audio_streams; i++) { real_free_mdpr(this->audio_streams[i].mdpr); free(this->audio_streams[i].index); free(this->audio_streams[i].frame_buffer); } - + free(this->fragment_tab); free(this); } @@ -1702,7 +1702,7 @@ static int real_check_stream_type(input_plugin_t *input) if ( len < 4 ) return -1; - + if ( memcmp(buf, "\x2eRMF", 4) == 0 ) return 1; @@ -1730,7 +1730,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str case METHOD_BY_CONTENT: if ( stream_type < 1 ) return NULL; - + lprintf ("by content accepted.\n"); break; @@ -1796,7 +1796,7 @@ static const char *get_mimetypes (demux_class_t *this_gen) { return "audio/x-pn-realaudio: ra, rm, ram: Real Media file;" "audio/x-pn-realaudio-plugin: rpm: Real Media plugin file;" "audio/x-real-audio: ra, rm, ram: Real Media file;" - "application/vnd.rn-realmedia: ra, rm, ram: Real Media file;"; + "application/vnd.rn-realmedia: ra, rm, ram: Real Media file;"; } static void class_dispose (demux_class_t *this_gen) { diff --git a/src/demuxers/demux_realaudio.c b/src/demuxers/demux_realaudio.c index 44449667c..3c18f7ec3 100644 --- a/src/demuxers/demux_realaudio.c +++ b/src/demuxers/demux_realaudio.c @@ -63,7 +63,7 @@ typedef struct { off_t data_start; off_t data_size; - + uint32_t cfs; uint16_t w, h; int frame_len; @@ -95,7 +95,7 @@ static int open_ra_file(demux_ra_t *this) { /* read version */ const uint16_t version = _X_BE_16(&file_header[0x04]); - + /* read header size according to version */ if (version == 3) this->header_size = _X_BE_16(&file_header[0x06]) + 8; @@ -105,45 +105,45 @@ static int open_ra_file(demux_ra_t *this) { xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_realaudio: unknown version number %d\n", version); return 0; } - + /* allocate for and read header data */ this->header = malloc(this->header_size); - + if (!this->header || _x_demux_read_header(this->input, this->header, this->header_size) != this->header_size) { xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_realaudio: unable to read header\n"); free(this->header); return 0; } - + off_t offset; /* read header data according to version */ if((version == 3) && (this->header_size >= 32)) { this->data_size = _X_BE_32(&this->header[0x12]); - + this->block_align = 240; - + offset = 0x16; } else if(this->header_size >= 72) { - this->data_size = _X_BE_32(&this->header[0x1C]); - + this->data_size = _X_BE_32(&this->header[0x1C]); + this->block_align = _X_BE_16(&this->header[0x2A]); - + if(this->header[0x3D] == 4) this->fourcc = _X_ME_32(&this->header[0x3E]); else { - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_realaudio: invalid fourcc size %d\n", this->header[0x3D]); free(this->header); return 0; } - + offset = 0x45; } else { xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_realaudio: header too small\n"); free(this->header); return 0; } - + /* Read title */ { const uint8_t len = this->header[offset]; @@ -154,7 +154,7 @@ static int open_ra_file(demux_ra_t *this) { } else offset++; } - + /* Author */ { const uint8_t len = this->header[offset]; @@ -165,7 +165,7 @@ static int open_ra_file(demux_ra_t *this) { } else offset++; } - + /* Copyright/Date */ { const uint8_t len = this->header[offset]; @@ -176,23 +176,23 @@ static int open_ra_file(demux_ra_t *this) { } else offset++; } - + /* Fourcc for version 3 comes after meta info */ if(version == 3) { if (((offset+7) <= this->header_size)) { if(this->header[offset+2] == 4) this->fourcc = _X_ME_32(&this->header[offset+3]); else { - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_realaudio: invalid fourcc size %d\n", this->header[offset+2]); free(this->header); return 0; } } else { - this->fourcc = ME_FOURCC('l', 'p', 'c', 'J'); + this->fourcc = ME_FOURCC('l', 'p', 'c', 'J'); } } - + _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_FOURCC, this->fourcc); this->audio_type = _x_formattag_to_buf_audio(this->fourcc); @@ -219,7 +219,7 @@ static int open_ra_file(demux_ra_t *this) { if (this->audio_type == BUF_AUDIO_28_8 || this->audio_type == BUF_AUDIO_SIPRO) this->block_align = this->cfs; } - + /* seek to start of data */ this->data_start = this->header_size; if (this->input->seek(this->input, this->data_start, SEEK_SET) != @@ -242,7 +242,7 @@ static int demux_ra_send_chunk(demux_plugin_t *this_gen) { /* just load data chunks from wherever the stream happens to be * pointing; issue a DEMUX_FINISHED status if EOF is reached */ if( this->input->get_length (this->input) ) - current_normpos = (int)( (double) (this->input->get_current_pos (this->input) - this->data_start) * + current_normpos = (int)( (double) (this->input->get_current_pos (this->input) - this->data_start) * 65535 / this->data_size ); const int64_t current_pts = 0; /* let the engine sort out the pts for now */ @@ -255,11 +255,11 @@ static int demux_ra_send_chunk(demux_plugin_t *this_gen) { if (this->audio_type == BUF_AUDIO_28_8 || this->audio_type == BUF_AUDIO_SIPRO) { if (this->audio_type == BUF_AUDIO_SIPRO) { if(this->input->read(this->input, this->frame_buffer, this->frame_len) < this->frame_len) { - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_realaudio: failed to read audio chunk\n"); - + this->status = DEMUX_FINISHED; - return this->status; + return this->status; } demux_real_sipro_swap (this->frame_buffer, this->frame_len * 2 / 96); } else { @@ -270,25 +270,25 @@ static int demux_ra_send_chunk(demux_plugin_t *this_gen) { const int pos = x * 2 * this->w + y * this->cfs; if(this->input->read(this->input, this->frame_buffer + pos, this->cfs) < this->cfs) { - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_realaudio: failed to read audio chunk\n"); - + this->status = DEMUX_FINISHED; - return this->status; + return this->status; } } } _x_demux_send_data(this->audio_fifo, - this->frame_buffer, this->frame_size, + this->frame_buffer, this->frame_size, current_pts, this->audio_type, 0, current_normpos, current_pts / 90, 0, 0); - } else if(_x_demux_read_send_data(this->audio_fifo, this->input, this->block_align, - current_pts, this->audio_type, 0, current_normpos, + } else if(_x_demux_read_send_data(this->audio_fifo, this->input, this->block_align, + current_pts, this->audio_type, 0, current_normpos, current_pts / 90, 0, 0) < 0) { - this->status = DEMUX_FINISHED; + this->status = DEMUX_FINISHED; } - + return this->status; } @@ -314,9 +314,9 @@ static void demux_ra_send_headers(demux_plugin_t *this_gen) { buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); buf->type = this->audio_type; buf->decoder_flags = BUF_FLAG_HEADER|BUF_FLAG_FRAME_END; - + buf->size = MIN(this->header_size, buf->max_size); - + memcpy(buf->content, this->header, buf->size); this->audio_fifo->put (this->audio_fifo, buf); @@ -364,7 +364,7 @@ static int demux_ra_seek (demux_plugin_t *this_gen, static void demux_ra_dispose (demux_plugin_t *this_gen) { demux_ra_t *this = (demux_ra_t *) this_gen; - + if(this->header) free(this->header); if (this->frame_buffer) @@ -439,7 +439,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str } break; - + default: free (this); return NULL; diff --git a/src/demuxers/demux_roq.c b/src/demuxers/demux_roq.c index df2fb76a5..346d487aa 100644 --- a/src/demuxers/demux_roq.c +++ b/src/demuxers/demux_roq.c @@ -92,11 +92,11 @@ static int open_roq_file(demux_roq_t *this) { return 0; /* check for the RoQ magic numbers */ - static const uint8_t RoQ_MAGIC_STRING[] = + static const uint8_t RoQ_MAGIC_STRING[] = { 0x10, 0x84, 0xFF, 0xFF, 0xFF, 0xFF }; if( memcmp(preamble, RoQ_MAGIC_STRING, sizeof(RoQ_MAGIC_STRING)) != 0 ) return 0; - + this->bih.biSize = sizeof(xine_bmiheader); this->bih.biWidth = this->bih.biHeight = 0; this->wave.nChannels = 0; /* assume no audio at first */ @@ -119,7 +119,7 @@ static int open_roq_file(demux_roq_t *this) { while (i-- > 0) { /* if this read fails, then maybe it's just a really small RoQ file * (even less than 2 seconds) */ - if (this->input->read(this->input, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != + if (this->input->read(this->input, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != RoQ_CHUNK_PREAMBLE_SIZE) break; chunk_type = _X_LE_16(&preamble[0]); @@ -181,7 +181,7 @@ static int demux_roq_send_chunk(demux_plugin_t *this_gen) { off_t current_file_pos; /* fetch the next preamble */ - if (this->input->read(this->input, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != + if (this->input->read(this->input, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != RoQ_CHUNK_PREAMBLE_SIZE) { this->status = DEMUX_FINISHED; return this->status; @@ -193,21 +193,21 @@ static int demux_roq_send_chunk(demux_plugin_t *this_gen) { if ((chunk_type == RoQ_SOUND_MONO) || (chunk_type == RoQ_SOUND_STEREO)) { if( this->audio_fifo ) { - + /* do this calculation carefully because I can't trust the * 64-bit numerical manipulation */ audio_pts = this->audio_byte_count; audio_pts *= 90000; audio_pts /= (RoQ_AUDIO_SAMPLE_RATE * this->wave.nChannels); this->audio_byte_count += chunk_size - 8; /* do not count the preamble */ - + current_file_pos = this->input->get_current_pos(this->input); /* send out the preamble */ buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); buf->type = BUF_AUDIO_ROQ; if( this->input->get_length (this->input) ) - buf->extra_info->input_normpos = (int)( (double) (current_file_pos - RoQ_CHUNK_PREAMBLE_SIZE) * + buf->extra_info->input_normpos = (int)( (double) (current_file_pos - RoQ_CHUNK_PREAMBLE_SIZE) * 65535 / this->input->get_length (this->input) ); buf->pts = 0; buf->size = RoQ_CHUNK_PREAMBLE_SIZE; @@ -219,7 +219,7 @@ static int demux_roq_send_chunk(demux_plugin_t *this_gen) { buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); buf->type = BUF_AUDIO_ROQ; if( this->input->get_length (this->input) ) - buf->extra_info->input_normpos = (int)( (double) current_file_pos * + buf->extra_info->input_normpos = (int)( (double) current_file_pos * 65535 / this->input->get_length (this->input) ); buf->pts = audio_pts; @@ -256,7 +256,7 @@ static int demux_roq_send_chunk(demux_plugin_t *this_gen) { buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); buf->type = BUF_VIDEO_ROQ; if( this->input->get_length (this->input) ) - buf->extra_info->input_normpos = (int)( (double) (current_file_pos - RoQ_CHUNK_PREAMBLE_SIZE) * + buf->extra_info->input_normpos = (int)( (double) (current_file_pos - RoQ_CHUNK_PREAMBLE_SIZE) * 65535 / this->input->get_length (this->input) ); buf->pts = this->video_pts_counter; buf->size = RoQ_CHUNK_PREAMBLE_SIZE; @@ -267,7 +267,7 @@ static int demux_roq_send_chunk(demux_plugin_t *this_gen) { buf = this->video_fifo->buffer_pool_alloc (this->audio_fifo); buf->type = BUF_VIDEO_ROQ; if( this->input->get_length (this->input) ) - buf->extra_info->input_normpos = (int)( (double) current_file_pos * + buf->extra_info->input_normpos = (int)( (double) current_file_pos * 65535 / this->input->get_length (this->input) ); buf->pts = this->video_pts_counter; diff --git a/src/demuxers/demux_shn.c b/src/demuxers/demux_shn.c index ccc34b57f..b4f7c764b 100644 --- a/src/demuxers/demux_shn.c +++ b/src/demuxers/demux_shn.c @@ -83,7 +83,7 @@ static int demux_shn_send_chunk(demux_plugin_t *this_gen) { buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); buf->type = BUF_AUDIO_SHORTEN; if( this->input->get_length (this->input) ) - buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * + buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * 65535 / this->input->get_length (this->input) ); buf->pts = 0; @@ -92,7 +92,7 @@ static int demux_shn_send_chunk(demux_plugin_t *this_gen) { buf->free_buffer(buf); this->status = DEMUX_FINISHED; return this->status; - } else + } else buf->size = bytes_read; /* each buffer stands on its own */ diff --git a/src/demuxers/demux_slave.c b/src/demuxers/demux_slave.c index abb4d01e5..de530f224 100644 --- a/src/demuxers/demux_slave.c +++ b/src/demuxers/demux_slave.c @@ -2,19 +2,19 @@ * Copyright (C) 2000-2003 the xine project * May 2003 - Miguel Freitas * This plugin was sponsored by 1Control - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -51,7 +51,7 @@ #define CHECK_VPTS_INTERVAL 2*90000 #define NETWORK_PREBUFFER 90000 -typedef struct { +typedef struct { demux_plugin_t demux_plugin; xine_stream_t *stream; @@ -86,7 +86,7 @@ static int demux_slave_next (demux_slave_t *this) { char fifo_name[11]; uint8_t *p, *s; int64_t curvpts; - + /* fill the scratch buffer */ n = this->input->read(this->input, &this->scratch[this->scratch_used], SCRATCH_SIZE - this->scratch_used); @@ -433,7 +433,7 @@ static const demuxer_info_t demux_info_slave = { }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_DEMUX, 26, "slave", XINE_VERSION_CODE, &demux_info_slave, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/demuxers/demux_smjpeg.c b/src/demuxers/demux_smjpeg.c index aacd55503..04a46fa78 100644 --- a/src/demuxers/demux_smjpeg.c +++ b/src/demuxers/demux_smjpeg.c @@ -112,7 +112,7 @@ static int open_smjpeg_file(demux_smjpeg_t *this) { if (this->input->read(this->input, header_chunk, 4) != 4) return 0; this->duration = _X_BE_32(&header_chunk[0]); - + /* initial state: no video and no audio (until headers found) */ this->video_type = this->audio_type = 0; this->input_length = this->input->get_length (this->input); diff --git a/src/demuxers/demux_snd.c b/src/demuxers/demux_snd.c index b98b66758..66e2bd543 100644 --- a/src/demuxers/demux_snd.c +++ b/src/demuxers/demux_snd.c @@ -110,11 +110,11 @@ static int open_snd_file(demux_snd_t *this) { this->audio_bytes_per_second = this->audio_channels * this->audio_sample_rate; break; - + case 2: this->audio_type = BUF_AUDIO_LPCM_BE; this->audio_bits = 8; - this->audio_frames = this->data_size / + this->audio_frames = this->data_size / (this->audio_channels * this->audio_bits / 8); this->audio_block_align = PCM_BLOCK_ALIGN; this->audio_bytes_per_second = this->audio_channels * @@ -124,7 +124,7 @@ static int open_snd_file(demux_snd_t *this) { case 3: this->audio_type = BUF_AUDIO_LPCM_BE; this->audio_bits = 16; - this->audio_frames = this->data_size / + this->audio_frames = this->data_size / (this->audio_channels * this->audio_bits / 8); this->audio_block_align = PCM_BLOCK_ALIGN; this->audio_bytes_per_second = this->audio_channels * @@ -163,7 +163,7 @@ static int demux_snd_send_chunk(demux_plugin_t *this_gen) { /* just load data chunks from wherever the stream happens to be * pointing; issue a DEMUX_FINISHED status if EOF is reached */ remaining_sample_bytes = this->audio_block_align; - current_file_pos = + current_file_pos = this->input->get_current_pos(this->input) - this->data_start; current_pts = current_file_pos; @@ -205,7 +205,7 @@ static int demux_snd_send_chunk(demux_plugin_t *this_gen) { for (i = 0; i < buf->size; i++) buf->content[i] += 0x80; } - + this->audio_fifo->put (this->audio_fifo, buf); } return this->status; @@ -251,11 +251,11 @@ static int demux_snd_seek (demux_plugin_t *this_gen, off_t start_pos, int start_ demux_snd_t *this = (demux_snd_t *) this_gen; start_pos = (off_t) ( (double) start_pos / 65535 * this->data_size ); - + this->seek_flag = 1; this->status = DEMUX_OK; _x_demux_flush_engine (this->stream); - + /* if input is non-seekable, do not proceed with the rest of this * seek function */ if (!INPUT_IS_SEEKABLE(this->input)) @@ -346,7 +346,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str } } /* falling through is intended */ - + case METHOD_BY_CONTENT: case METHOD_EXPLICIT: @@ -380,7 +380,7 @@ static const char *get_extensions (demux_class_t *this_gen) { static const char *get_mimetypes (demux_class_t *this_gen) { return "audio/basic: snd,au: ULAW (Sun) audio;" "audio/x-basic: snd,au: ULAW (Sun) audio;" - "audio/x-pn-au: snd,au: ULAW (Sun) audio;"; + "audio/x-pn-au: snd,au: ULAW (Sun) audio;"; } diff --git a/src/demuxers/demux_str.c b/src/demuxers/demux_str.c index 442bffadc..d88432817 100644 --- a/src/demuxers/demux_str.c +++ b/src/demuxers/demux_str.c @@ -102,7 +102,7 @@ * - then follows 16-bit RLE data until the EOD * - RLE format: bits 15-10: # of 0s preceding this value (unsigned) * bits 9-0: this value (signed) - * - e.g. 3 bytes (2,10)(0,20)(3,30) -> 0 0 10 20 0 0 0 30 + * - e.g. 3 bytes (2,10)(0,20)(3,30) -> 0 0 10 20 0 0 0 30 * - 16 bits: EOD (0xFE00) * - 16 bits: 0xFE00 end-of-data footer */ @@ -367,7 +367,7 @@ static int demux_str_send_chunk(demux_plugin_t *this_gen) { */ if( this->data_size ) - buf->extra_info->input_normpos = (int)( (double) current_pos * + buf->extra_info->input_normpos = (int)( (double) current_pos * 65535 / this->data_size ); buf->extra_info->input_time = (current_pos*1000)/(CD_RAW_SECTOR_SIZE*75); @@ -405,7 +405,7 @@ static int demux_str_send_chunk(demux_plugin_t *this_gen) { } if( this->data_size ) - buf->extra_info->input_normpos = (int)( (double) current_pos * + buf->extra_info->input_normpos = (int)( (double) current_pos * 65535 / this->data_size ); buf->extra_info->input_time = (current_pos*1000)/(CD_RAW_SECTOR_SIZE*75); @@ -529,7 +529,7 @@ static int demux_str_get_status (demux_plugin_t *this_gen) { static int demux_str_get_stream_length (demux_plugin_t *this_gen) { demux_str_t *this = (demux_str_t *) this_gen; - return (int)((int64_t) this->input->get_length(this->input) + return (int)((int64_t) this->input->get_length(this->input) * 1000 / (CD_RAW_SECTOR_SIZE * 75)); } @@ -575,7 +575,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str mrl = input->get_mrl (input); extensions = class_gen->get_extensions (class_gen); - + if (!_x_demux_check_extension (mrl, extensions)) { free (this); return NULL; diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index d662bb0ed..cedcbb4a1 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -40,7 +40,7 @@ * - demux HDMV/BluRay bitmap subtitles * * 28-Nov-2004 Mike Lampard - * - Added support for PMT sections larger than 1 ts packet + * - Added support for PMT sections larger than 1 ts packet * * 28-Aug-2004 James Courtier-Dutton * - Improve PAT and PMT handling. Added some FIXME comments. @@ -58,7 +58,7 @@ * - dynamic allocation leaks fixes * * 27-May-2002 Giovanni Baronetti and Mauro Borghi - * - fill buffers before putting them in fifos + * - fill buffers before putting them in fifos * - force PMT reparsing when PMT PID changes * - accept non seekable input plugins -- FIX? * - accept dvb as input plugin @@ -173,7 +173,7 @@ #define PKT_SIZE 188 #define BODY_SIZE (188 - 4) /* more PIDS are needed due "auto-detection". 40 spare media entries */ -#define MAX_PIDS ((BODY_SIZE - 1 - 13) / 4) + 40 +#define MAX_PIDS ((BODY_SIZE - 1 - 13) / 4) + 40 #define MAX_PMTS ((BODY_SIZE - 1 - 13) / 4) + 10 #define SYNC_BYTE 0x47 @@ -283,7 +283,7 @@ typedef struct { int pid; int media_index; } demux_ts_spu_lang; - + /* Audio Channels */ #define MAX_AUDIO_TRACKS 32 @@ -335,10 +335,10 @@ typedef struct { unsigned int pid_count; unsigned int videoPid; unsigned int videoMedia; - + demux_ts_audio_track audio_tracks[MAX_AUDIO_TRACKS]; int audio_tracks_count; - + int send_end_buffers; int64_t last_pts[2]; int send_newpts; @@ -366,7 +366,7 @@ typedef struct { int32_t npkt_read; uint8_t buf[BUF_SIZE]; /* == PKT_SIZE * NPKT_PER_READ */ - + int numPreview; } demux_ts_t; @@ -394,7 +394,7 @@ static void demux_ts_build_crc32_table(demux_ts_t*this) { } } -static uint32_t demux_ts_compute_crc32(demux_ts_t*this, uint8_t *data, +static uint32_t demux_ts_compute_crc32(demux_ts_t*this, uint8_t *data, int32_t length, uint32_t crc32) { int32_t i; @@ -439,7 +439,7 @@ static void check_newpts( demux_ts_t *this, int64_t pts, int video ) The original code worked well when the wrap happend like this: V7 A7 V8 V9 A9 Dv V0 V1 da A1 V2 V3 A3 V4 - + Legend: Vn = video packet with timestamp n An = audio packet with timestamp n @@ -457,16 +457,16 @@ static void check_newpts( demux_ts_t *this, int64_t pts, int video ) a delay of almoust 26.5 hours! The new code gives the following sequences for the above examples: - + V7 A7 V8 V9 A9 Dv V0 V1 A1 V2 V3 A3 V4 V7 V8 A7 V9 Dv V0 Da A9 Dv V1 V2 A1 V3 V4 A3 After proving this code it should be cleaned up to use just a single variable "last_pts". */ - + /* this->last_pts[video] = pts; -*/ +*/ this->last_pts[video] = this->last_pts[1-video] = pts; } } @@ -492,7 +492,7 @@ static void demux_send_special_spu_buf( demux_ts_t *this, uint32_t spu_type, int static void demux_ts_update_spu_channel(demux_ts_t *this) { buf_element_t *buf; - + this->current_spu_channel = this->stream->spu_channel; buf = this->video_fifo->buffer_pool_alloc(this->video_fifo); @@ -501,7 +501,7 @@ static void demux_ts_update_spu_channel(demux_ts_t *this) buf->decoder_flags = BUF_FLAG_SPECIAL; buf->decoder_info[1] = BUF_SPECIAL_SPU_DVB_DESCRIPTOR; buf->size = 0; - + if (this->current_spu_channel >= 0 && this->current_spu_channel < this->spu_langs_count) { @@ -570,7 +570,7 @@ static void demux_ts_parse_pat (demux_ts_t*this, unsigned char *original_pkt, * indicator set. */ if (!pusi) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_ts: demux error! PAT without payload unit start indicator\n"); return; } @@ -580,7 +580,7 @@ static void demux_ts_parse_pat (demux_ts_t*this, unsigned char *original_pkt, */ pkt += pkt[4]; if (pkt - original_pkt > PKT_SIZE) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_ts: demux error! PAT with invalid pointer\n"); return; } @@ -614,13 +614,13 @@ static void demux_ts_parse_pat (demux_ts_t*this, unsigned char *original_pkt, } if (pkt - original_pkt > BODY_SIZE - 1 - 3 - section_length) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_ts: FIXME: (unsupported )PAT spans multiple TS packets\n"); return; } if ((section_number != 0) || (last_section_number != 0)) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_ts: FIXME: (unsupported) PAT consists of multiple (%d) sections\n", last_section_number); return; } @@ -629,11 +629,11 @@ static void demux_ts_parse_pat (demux_ts_t*this, unsigned char *original_pkt, calc_crc32 = demux_ts_compute_crc32 (this, pkt+5, section_length+3-4, 0xffffffff); if (crc32 != calc_crc32) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_ts: demux error! PAT with invalid CRC32: packet_crc32: %.8x calc_crc32: %.8x\n", crc32,calc_crc32); return; - } + } #ifdef TS_PAT_LOG else { printf ("demux_ts: PAT CRC32 ok.\n"); @@ -711,7 +711,7 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, /* we should have a PES packet here */ if (p[0] || p[1] || (p[2] != 1)) { - xprintf (xine, XINE_VERBOSITY_DEBUG, + xprintf (xine, XINE_VERBOSITY_DEBUG, "demux_ts: error %02x %02x %02x (should be 0x000001) \n", p[0], p[1], p[2]); return 0 ; } @@ -762,7 +762,7 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, /* sometimes corruption on header_len causes segfault in memcpy below */ if (header_len + 9 > pkt_len) { - xprintf (xine, XINE_VERBOSITY_DEBUG, + xprintf (xine, XINE_VERBOSITY_DEBUG, "demux_ts: illegal value for PES_header_data_length (0x%x)\n", header_len); return 0; } @@ -791,7 +791,7 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, if (stream_id == 0xbd || stream_id == 0xfd /* HDMV */) { int spu_id; - + lprintf ("audio buf = %02X %02X %02X %02X %02X %02X %02X %02X\n", p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]); @@ -801,7 +801,7 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, * these "raw" streams may begin with a byte that looks like a stream type. * For audio streams, m->type already contains the stream no. */ - if((m->descriptor_tag == STREAM_AUDIO_AC3) || /* ac3 - raw */ + if((m->descriptor_tag == STREAM_AUDIO_AC3) || /* ac3 - raw */ (p[0] == 0x0B && p[1] == 0x77)) { /* ac3 - syncword */ m->content = p; m->size = packet_len; @@ -893,7 +893,7 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, m->content = p; m->size = packet_len; switch (m->descriptor_tag) { - case ISO_11172_AUDIO: + case ISO_11172_AUDIO: case ISO_13818_AUDIO: lprintf ("demux_ts: found MPEG audio track.\n"); m->type |= BUF_AUDIO_MPEG; @@ -942,7 +942,7 @@ static void demux_ts_buffer_pes(demux_ts_t*this, unsigned char *ts, case (i.e. adaptation field only) when it does not get bumped. */ if (m->counter != INVALID_CC) { if ((m->counter & 0x0f) != cc) { - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_ts: PID 0x%.4x: unexpected cc %d (expected %d)\n", m->pid, cc, m->counter); } } @@ -972,9 +972,9 @@ static void demux_ts_buffer_pes(demux_ts_t*this, unsigned char *ts, } m->buf->pts = m->pts; m->buf->decoder_info[0] = 1; - + if( this->input->get_length (this->input) ) - m->buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * + m->buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * 65535 / this->input->get_length (this->input) ); if (this->rate) m->buf->extra_info->input_time = (int)((int64_t)this->input->get_current_pos (this->input) @@ -992,7 +992,7 @@ static void demux_ts_buffer_pes(demux_ts_t*this, unsigned char *ts, if (!demux_ts_parse_pes_header(this->stream->xine, m, ts, len, this->stream)) { m->buf->free_buffer(m->buf); m->buf = NULL; - + if (m->corrupted_pes > CORRUPT_PES_THRESHOLD && m->autodetected) { if (this->videoPid == m->pid) { this->videoPid = INVALID_PID; @@ -1000,7 +1000,7 @@ static void demux_ts_buffer_pes(demux_ts_t*this, unsigned char *ts, } } else { m->corrupted_pes++; - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_ts: PID 0x%.4x: corrupted pes encountered\n", m->pid); } } else { @@ -1019,7 +1019,7 @@ static void demux_ts_buffer_pes(demux_ts_t*this, unsigned char *ts, m->buf->pts = m->pts; m->buf->decoder_info[0] = 1; if( this->input->get_length (this->input) ) - m->buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * + m->buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * 65535 / this->input->get_length (this->input) ); if (this->rate) m->buf->extra_info->input_time = (int)((int64_t)this->input->get_current_pos (this->input) @@ -1104,7 +1104,7 @@ static void demux_ts_get_reg_desc(demux_ts_t *this, uint32_t *dest, { *dest = (d[2] << 24) | (d[3] << 16) | (d[4] << 8) | d[5]; - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_ts: found registration format identifier: 0x%.4x\n", *dest); return; } @@ -1126,7 +1126,7 @@ static inline int ts_payloadsize(unsigned char * tsp) } return 184; } - + /* * NAME demux_ts_parse_pmt @@ -1156,14 +1156,14 @@ static void demux_ts_parse_pmt (demux_ts_t *this, uint32_t crc32; uint32_t calc_crc32; uint32_t coded_length; - unsigned int pid; + unsigned int pid; unsigned char *stream; - unsigned int i; - int count; - char *ptr = NULL; + unsigned int i; + int count; + char *ptr = NULL; unsigned char len; - unsigned int offset=0; - + unsigned int offset=0; + /* * A new section should start with the payload unit start * indicator set. We allocate some mem (max. allowed for a PM section) @@ -1172,7 +1172,7 @@ static void demux_ts_parse_pmt (demux_ts_t *this, if (pusi) { pkt+=pkt[4]; /* pointer to start of section */ offset=1; - + if (this->pmt[program_count] != NULL) free(this->pmt[program_count]); this->pmt[program_count] = (uint8_t *) calloc(4096, sizeof(unsigned char)); this->pmt_write_ptr[program_count] = this->pmt[program_count]; @@ -1216,7 +1216,7 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num } if ((section_number != 0) || (last_section_number != 0)) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_ts: FIXME (unsupported) PMT consists of multiple (%d) sections\n", last_section_number); return; } @@ -1242,7 +1242,7 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num len = count-offset; memcpy (this->pmt_write_ptr[program_count], ptr, len); this->pmt_write_ptr[program_count] +=len; - + #ifdef TS_PMT_LOG printf ("ts_demux: wr_ptr: %p, will be %p when finished\n", this->pmt_write_ptr[program_count], @@ -1280,9 +1280,9 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num this->pmt[program_count], section_length+3-4, 0xffffffff); if (crc32 != calc_crc32) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_ts: demux error! PMT with invalid CRC32: packet_crc32: %#.8x calc_crc32: %#.8x\n", - crc32,calc_crc32); + crc32,calc_crc32); return; } else { @@ -1329,7 +1329,7 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num stream = &this->pmt[program_count][12] + program_info_length; coded_length = 13 + program_info_length; if (coded_length > section_length) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux error! PMT with inconsistent progInfo length\n"); return; } @@ -1346,7 +1346,7 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num stream_info_length = ((stream[3] << 8) | stream[4]) & 0x0fff; coded_length = 5 + stream_info_length; if (coded_length > section_length) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux error! PMT with inconsistent streamInfo length\n"); return; } @@ -1461,9 +1461,9 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num { int no = this->spu_langs_count; demux_ts_spu_lang *lang = &this->spu_langs[no]; - + this->spu_langs_count++; - + memcpy(lang->desc.lang, &stream[pos], 3); lang->desc.lang[3] = 0; lang->desc.comp_page_id = @@ -1525,7 +1525,7 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num * then we check the registration format identifier to see if it holds "AC-3" (0x41432d33) and * if is does, we tag this as an audio stream. * FIXME: This will need expanding if we ever see a DTS or other media format here. - */ + */ if ((this->audio_tracks_count < MAX_AUDIO_TRACKS) && (stream[0] >= 0x80) ) { int i, found = 0; for(i = 0; i < this->audio_tracks_count; i++) { @@ -1626,7 +1626,7 @@ static int sync_correct(demux_ts_t*this, uint8_t *buf, int32_t npkt_read) { n + p * this->pkt_size); /* FIXME: when read_length is not as required... we now stop demuxing */ if (read_length != (n + p * this->pkt_size)) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_ts_tsync_correct: sync found, but read failed\n"); return 0; } @@ -1695,7 +1695,7 @@ static unsigned char * demux_synchronise(demux_ts_t* this) { read_length = this->input->read(this->input, this->buf, this->pkt_size * NPKT_PER_READ); if (read_length < 0 || read_length % this->pkt_size) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_ts: read returned %d bytes (not a multiple of %d!)\n", read_length, this->pkt_size); this->status = DEMUX_FINISHED; @@ -1734,7 +1734,7 @@ static unsigned char * demux_synchronise(demux_ts_t* this) { } -static int64_t demux_ts_adaptation_field_parse(uint8_t *data, +static int64_t demux_ts_adaptation_field_parse(uint8_t *data, uint32_t adaptation_field_length) { uint32_t discontinuity_indicator=0; @@ -1856,7 +1856,7 @@ static void demux_ts_parse_packet (demux_ts_t*this) { transport_error_indicator = (originalPkt[1] >> 7) & 0x01; payload_unit_start_indicator = (originalPkt[1] >> 6) & 0x01; transport_priority = (originalPkt[1] >> 5) & 0x01; - pid = ((originalPkt[1] << 8) | + pid = ((originalPkt[1] << 8) | originalPkt[2]) & 0x1fff; transport_scrambling_control = (originalPkt[3] >> 6) & 0x03; adaptation_field_control = (originalPkt[3] >> 4) & 0x03; @@ -1877,7 +1877,7 @@ static void demux_ts_parse_packet (demux_ts_t*this) { * Discard packets that are obviously bad. */ if (sync_byte != SYNC_BYTE) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux error! invalid ts sync byte %.2x\n", sync_byte); return; } @@ -1892,7 +1892,7 @@ static void demux_ts_parse_packet (demux_ts_t*this) { if (transport_scrambling_control) { if (this->videoPid == pid) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_ts: selected videoPid is scrambled; skipping...\n"); } for (i=0; i < this->scrambled_npids; i++) { @@ -1917,7 +1917,7 @@ static void demux_ts_parse_packet (demux_ts_t*this) { */ data_offset += adaptation_field_length + 1; } - + if (! (adaptation_field_control & 0x1)) { return; } @@ -1929,10 +1929,10 @@ static void demux_ts_parse_packet (demux_ts_t*this) { */ program_count=0; if(this->media_numprogram_number[program_count] != INVALID_PROGRAM) && - (program_count < MAX_PMTS)) { + while ((this->program_number[program_count] != INVALID_PROGRAM) && + (program_count < MAX_PMTS)) { if (pid == this->pmt_pid[program_count]) { - + #ifdef TS_LOG printf ("demux_ts: PMT prog: 0x%.4x pid: 0x%.4x\n", this->program_number[program_count], @@ -1945,7 +1945,7 @@ static void demux_ts_parse_packet (demux_ts_t*this) { } program_count++; } - + if (payload_unit_start_indicator && this->media_num < MAX_PIDS){ int pes_stream_id; if (pid == 0) { @@ -1959,7 +1959,7 @@ static void demux_ts_parse_packet (demux_ts_t*this) { #ifdef TS_HEADER_LOG printf("demux_ts:ts_pes_header:stream_id=0x%.2x\n",pes_stream_id); #endif - + if ( (pes_stream_id >= VIDEO_STREAM_S) && (pes_stream_id <= VIDEO_STREAM_E) ) { if ( this->videoPid == INVALID_PID) { int i, found = 0; @@ -1969,7 +1969,7 @@ static void demux_ts_parse_packet (demux_ts_t*this) { break; } } - + if (found && (this->media[i].corrupted_pes == 0)) { this->videoPid = pid; this->videoMedia = i; @@ -1979,11 +1979,11 @@ static void demux_ts_parse_packet (demux_ts_t*this) { this->media[this->videoMedia].autodetected = 1; demux_ts_pes_new(this, this->media_num++, pid, this->video_fifo, 0x100 + pes_stream_id); } - + if (this->videoPid != INVALID_PID) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_ts: auto-detected video pid 0x%.4x\n", pid); - } + } } } else if ( (pes_stream_id >= AUDIO_STREAM_S) && (pes_stream_id <= AUDIO_STREAM_E) ) { if (this->audio_tracks_count < MAX_AUDIO_TRACKS) { @@ -2010,10 +2010,10 @@ static void demux_ts_parse_packet (demux_ts_t*this) { } } } - + if (data_len > PKT_SIZE) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_ts: demux error! invalid payload size %d\n", data_len); } else { @@ -2087,7 +2087,7 @@ static void demux_ts_event_handler (demux_ts_t *this) { this->last_pmt_crc = 0; _x_demux_control_start (this->stream); break; - + } xine_event_free (event); @@ -2126,7 +2126,7 @@ static void demux_ts_dispose (demux_plugin_t *this_gen) { } } for (i=0; i < MAX_PIDS; i++) { - if (this->media[i].buf != NULL) { + if (this->media[i].buf != NULL) { this->media[i].buf->free_buffer(this->media[i].buf); this->media[i].buf = NULL; } @@ -2163,23 +2163,23 @@ static void demux_ts_send_headers (demux_plugin_t *this_gen) { this->last_pmt_crc = 0; _x_demux_control_start (this->stream); - + this->input->seek (this->input, 0, SEEK_SET); this->send_newpts = 1; - + demux_ts_build_crc32_table (this); - + this->status = DEMUX_OK ; this->send_end_buffers = 1; this->scrambled_npids = 0; - + /* DVBSUB */ this->spu_pid = INVALID_PID; this->spu_langs_count = 0; this->current_spu_channel = -1; - + /* FIXME ? */ _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_VIDEO, 1); _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_AUDIO, 1); @@ -2206,11 +2206,11 @@ static int demux_ts_seek (demux_plugin_t *this_gen, } this->send_newpts = 1; - + for (i=0; imedia[i]; - if (m->buf != NULL) + if (m->buf != NULL) m->buf->free_buffer(m->buf); m->buf = NULL; m->counter = INVALID_CC; @@ -2219,7 +2219,7 @@ static int demux_ts_seek (demux_plugin_t *this_gen, } if( !playing ) { - + this->status = DEMUX_OK; this->buf_flag_seek = 0; @@ -2229,7 +2229,7 @@ static int demux_ts_seek (demux_plugin_t *this_gen, _x_demux_flush_engine(this->stream); } - + return this->status; } @@ -2238,7 +2238,7 @@ static int demux_ts_get_stream_length (demux_plugin_t *this_gen) { demux_ts_t*this = (demux_ts_t*)this_gen; if (this->rate) - return (int)((int64_t) this->input->get_length (this->input) + return (int)((int64_t) this->input->get_length (this->input) * 1000 / (this->rate * 50)); else return 0; @@ -2260,7 +2260,7 @@ static int demux_ts_get_optional_data(demux_plugin_t *this_gen, /* be a bit paranoid */ if (this == NULL || this->stream == NULL) return DEMUX_OPTIONAL_UNSUPPORTED; - + switch (data_type) { case DEMUX_OPTIONAL_DATA_AUDIOLANG: @@ -2279,7 +2279,7 @@ static int demux_ts_get_optional_data(demux_plugin_t *this_gen, if (channel>=0 && channelspu_langs_count) { memcpy(str, this->spu_langs[channel].desc.lang, 3); str[3] = 0;} - else + else strcpy(str, "none"); return DEMUX_OPTIONAL_SUCCESS; @@ -2315,10 +2315,10 @@ static int detect_ts(uint8_t *buf, size_t len, int ts_size) return ts_detected; } -static demux_plugin_t *open_plugin (demux_class_t *class_gen, - xine_stream_t *stream, +static demux_plugin_t *open_plugin (demux_class_t *class_gen, + xine_stream_t *stream, input_plugin_t *input) { - + demux_ts_t *this; int i; int hdmv = -1; @@ -2333,9 +2333,9 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, if (detect_ts(buf, sizeof(buf), PKT_SIZE)) hdmv = 0; - else if (detect_ts(buf, sizeof(buf), PKT_SIZE+4)) + else if (detect_ts(buf, sizeof(buf), PKT_SIZE+4)) hdmv = 1; - else + else return NULL; } break; @@ -2398,7 +2398,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, this->demux_plugin.get_capabilities = demux_ts_get_capabilities; this->demux_plugin.get_optional_data = demux_ts_get_optional_data; this->demux_plugin.demux_class = class_gen; - + /* * Initialise our specialised data. */ @@ -2423,7 +2423,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, this->last_pmt_crc = 0; this->rate = 16000; /* FIXME */ - + this->status = DEMUX_FINISHED; /* DVBSUB */ @@ -2440,7 +2440,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, this->pkt_size = PKT_SIZE + this->pkt_offset; this->numPreview=0; - + return &this->demux_plugin; } @@ -2451,7 +2451,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, static const char *get_description (demux_class_t *this_gen) { return "MPEG Transport Stream demuxer"; } - + static const char *get_identifier (demux_class_t *this_gen) { return "MPEG_TS"; } @@ -2472,9 +2472,9 @@ static void class_dispose (demux_class_t *this_gen) { } static void *init_class (xine_t *xine, void *data) { - + demux_ts_class_t *this; - + this = calloc(1, sizeof(demux_ts_class_t)); this->config = xine->config; this->xine = xine; @@ -2498,7 +2498,7 @@ static const demuxer_info_t demux_info_ts = { }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_DEMUX, 26, "mpeg-ts", XINE_VERSION_CODE, &demux_info_ts, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/demuxers/demux_tta.c b/src/demuxers/demux_tta.c index 7853c8182..9edad08bd 100644 --- a/src/demuxers/demux_tta.c +++ b/src/demuxers/demux_tta.c @@ -141,7 +141,7 @@ static int demux_tta_send_chunk(demux_plugin_t *this_gen) { if ( bytes_to_read <= 0 ) buf->decoder_flags |= BUF_FLAG_FRAME_END; - + this->audio_fifo->put(this->audio_fifo, buf); } diff --git a/src/demuxers/demux_vmd.c b/src/demuxers/demux_vmd.c index b81e4575e..6aec12580 100644 --- a/src/demuxers/demux_vmd.c +++ b/src/demuxers/demux_vmd.c @@ -19,7 +19,7 @@ */ /* - * Sierra Video and Music Data (.vmd) File Demuxer + * Sierra Video and Music Data (.vmd) File Demuxer * by Mike Melanson (melanson@pcisys.net) * For more information on the VMD file format, visit: * http://www.pcisys.net/~melanson/codecs/ @@ -109,7 +109,7 @@ static int open_vmd_file(demux_vmd_t *this) { unsigned int total_frames; int64_t current_video_pts = 0; - if (_x_demux_read_header(this->input, vmd_header, VMD_HEADER_SIZE) != + if (_x_demux_read_header(this->input, vmd_header, VMD_HEADER_SIZE) != VMD_HEADER_SIZE) return 0; @@ -234,7 +234,7 @@ static int demux_vmd_send_chunk(demux_plugin_t *this_gen) { buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); buf->type = BUF_VIDEO_VMD; if( this->data_size ) - buf->extra_info->input_normpos = (int)( (double) (frame->frame_offset - this->data_start) * + buf->extra_info->input_normpos = (int)( (double) (frame->frame_offset - this->data_start) * 65535 / this->data_size); memcpy(buf->content, frame->frame_record, BYTES_PER_FRAME_RECORD); buf->size = BYTES_PER_FRAME_RECORD; @@ -246,7 +246,7 @@ static int demux_vmd_send_chunk(demux_plugin_t *this_gen) { buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); buf->type = BUF_VIDEO_VMD; if( this->data_size ) - buf->extra_info->input_normpos = (int)( (double) (frame->frame_offset - this->data_start) * + buf->extra_info->input_normpos = (int)( (double) (frame->frame_offset - this->data_start) * 65535 / this->data_size); if (remaining_bytes > buf->max_size) @@ -277,7 +277,7 @@ static int demux_vmd_send_chunk(demux_plugin_t *this_gen) { buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); buf->type = BUF_AUDIO_VMD; if( this->data_size ) - buf->extra_info->input_normpos = (int)( (double) (frame->frame_offset - this->data_start) * + buf->extra_info->input_normpos = (int)( (double) (frame->frame_offset - this->data_start) * 65535 / this->data_size); memcpy(buf->content, frame->frame_record, BYTES_PER_FRAME_RECORD); buf->size = BYTES_PER_FRAME_RECORD; @@ -289,7 +289,7 @@ static int demux_vmd_send_chunk(demux_plugin_t *this_gen) { buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); buf->type = BUF_AUDIO_VMD; if( this->data_size ) - buf->extra_info->input_normpos = (int)( (double) (frame->frame_offset - this->data_start) * + buf->extra_info->input_normpos = (int)( (double) (frame->frame_offset - this->data_start) * 65535 / this->data_size); if (remaining_bytes > buf->max_size) diff --git a/src/demuxers/demux_voc.c b/src/demuxers/demux_voc.c index e825f6869..1ddbc1727 100644 --- a/src/demuxers/demux_voc.c +++ b/src/demuxers/demux_voc.c @@ -93,7 +93,7 @@ static int open_voc_file(demux_voc_t *this) { this->input->seek(this->input, first_block_offset, SEEK_SET); /* load the block preamble */ - if (this->input->read(this->input, preamble, BLOCK_PREAMBLE_SIZE) != + if (this->input->read(this->input, preamble, BLOCK_PREAMBLE_SIZE) != BLOCK_PREAMBLE_SIZE) return 0; @@ -142,7 +142,7 @@ static int demux_voc_send_chunk(demux_plugin_t *this_gen) { /* just load data chunks from wherever the stream happens to be * pointing; issue a DEMUX_FINISHED status if EOF is reached */ remaining_sample_bytes = PCM_BLOCK_ALIGN; - current_file_pos = + current_file_pos = this->input->get_current_pos(this->input) - this->data_start; current_pts = current_file_pos; @@ -231,7 +231,7 @@ static int demux_voc_seek (demux_plugin_t *this_gen, off_t start_pos, int start_ start_pos = (off_t) ( (double) start_pos / 65535 * this->data_size ); - + this->seek_flag = 1; this->status = DEMUX_OK; _x_demux_flush_engine (this->stream); diff --git a/src/demuxers/demux_vox.c b/src/demuxers/demux_vox.c index 1b34106ad..ccf9bf877 100644 --- a/src/demuxers/demux_vox.c +++ b/src/demuxers/demux_vox.c @@ -87,7 +87,7 @@ static int demux_vox_send_chunk (demux_plugin_t *this_gen) { buf->size = buf->max_size; if( this->input->get_length (this->input) ) - buf->extra_info->input_normpos = (int)( (double) current_file_pos * + buf->extra_info->input_normpos = (int)( (double) current_file_pos * 65535 / this->input->get_length (this->input) ); buf->extra_info->input_time = audio_pts / 90; buf->pts = audio_pts; @@ -166,7 +166,7 @@ static int demux_vox_get_status (demux_plugin_t *this_gen) { static int demux_vox_get_stream_length (demux_plugin_t *this_gen) { demux_vox_t *this = (demux_vox_t *) this_gen; - return (int)((int64_t)this->input->get_length(this->input) + return (int)((int64_t)this->input->get_length(this->input) * 2 * 1000 / DIALOGIC_SAMPLERATE); } diff --git a/src/demuxers/demux_vqa.c b/src/demuxers/demux_vqa.c index 5fb8273dd..578be14ee 100644 --- a/src/demuxers/demux_vqa.c +++ b/src/demuxers/demux_vqa.c @@ -25,7 +25,7 @@ * * Quick technical note: VQA files begin with a header that includes a * frame index. This ought to be useful for seeking within a VQA file. - * However, seeking is infeasible due to the audio encoding: Each audio + * However, seeking is infeasible due to the audio encoding: Each audio * block needs information from the previous audio block in order to be * decoded, thus making random seeking difficult. */ @@ -108,7 +108,7 @@ static int open_vqa_file(demux_vqa_t *this) { this->filesize = 1; /* load the VQA header */ - if (this->input->read(this->input, vqa_header, VQA_HEADER_SIZE) != + if (this->input->read(this->input, vqa_header, VQA_HEADER_SIZE) != VQA_HEADER_SIZE) return 0; diff --git a/src/demuxers/demux_wc3movie.c b/src/demuxers/demux_wc3movie.c index 7750c3e0e..36cc4eabb 100644 --- a/src/demuxers/demux_wc3movie.c +++ b/src/demuxers/demux_wc3movie.c @@ -177,7 +177,7 @@ static int demux_mve_send_chunk(demux_plugin_t *this_gen) { } } this->current_shot++; - + /* this is the start of a new shot; send a new palette */ if (this->input->read(this->input, preamble, 4) != 4) { this->status = DEMUX_FINISHED; @@ -205,7 +205,7 @@ static int demux_mve_send_chunk(demux_plugin_t *this_gen) { } else if (chunk_tag == AUDI_TAG) { if( this->audio_fifo ) { audio_pts = this->video_pts - WC3_PTS_INC; - + while (chunk_size) { buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); buf->type = BUF_AUDIO_LPCM_LE; @@ -213,23 +213,23 @@ static int demux_mve_send_chunk(demux_plugin_t *this_gen) { buf->extra_info->input_normpos = (int)( (double) current_file_pos * 65535 / this->data_size); buf->extra_info->input_time = audio_pts / 90; buf->pts = audio_pts; - + if (chunk_size > buf->max_size) buf->size = buf->max_size; else buf->size = chunk_size; chunk_size -= buf->size; - + if (this->input->read(this->input, buf->content, buf->size) != buf->size) { buf->free_buffer(buf); this->status = DEMUX_FINISHED; break; } - + if (!chunk_size) buf->decoder_flags |= BUF_FLAG_FRAME_END; - + this->audio_fifo->put (this->audio_fifo, buf); } }else{ @@ -293,7 +293,7 @@ static void demux_mve_send_headers(demux_plugin_t *this_gen) { /* load stream information */ _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_VIDEO, 1); - /* this is not strictly correct-- some WC3 MVE files do not contain + /* this is not strictly correct-- some WC3 MVE files do not contain * audio, but I'm too lazy to check if that is the case */ _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_AUDIO, 1); _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_WIDTH, @@ -376,7 +376,7 @@ static int open_mve_file(demux_mve_t *this) { if (this->input->read(this->input, preamble, 4) != 4) return 0; this->number_of_shots = _X_LE_32(&preamble[0]); - + /* allocate space for the shot offset index and set offsets to 0 */ this->shot_offsets = calloc(this->number_of_shots, sizeof(off_t)); this->current_shot = 0; @@ -540,13 +540,13 @@ static int demux_mve_seek (demux_plugin_t *this_gen, start_time /= 1000; start_pos = (off_t) ( (double) start_pos / 65535 * this->data_size ); - + this->status = DEMUX_OK; _x_demux_flush_engine(this->stream); this->seek_flag = 1; /* if input is non-seekable, do not proceed with the rest of this - * seek function */ + * seek function */ if (!INPUT_IS_SEEKABLE(this->input)) return this->status; @@ -566,7 +566,7 @@ static int demux_mve_seek (demux_plugin_t *this_gen, chunk_size = (_X_BE_32(&preamble[4]) + 1) & (~1); if (chunk_tag == SHOT_TAG) { - this->shot_offsets[0] = + this->shot_offsets[0] = this->input->get_current_pos(this->input) - PREAMBLE_SIZE; /* skip the four SHOT data bytes (palette index) */ this->input->seek(this->input, 4, SEEK_CUR); @@ -581,7 +581,7 @@ static int demux_mve_seek (demux_plugin_t *this_gen, start_pos += this->data_start; for (i = 0; i < this->number_of_shots - 1; i++) { - /* if the next shot offset has not been recorded, traverse through the + /* if the next shot offset has not been recorded, traverse through the * file until it is found */ if (this->shot_offsets[i + 1] == 0) { off_t current_pos; @@ -607,7 +607,7 @@ static int demux_mve_seek (demux_plugin_t *this_gen, chunk_size = (_X_BE_32(&preamble[4]) + 1) & (~1); if (chunk_tag == SHOT_TAG) { - this->shot_offsets[i + 1] = + this->shot_offsets[i + 1] = this->input->get_current_pos(this->input) - PREAMBLE_SIZE; /* skip the four SHOT data bytes (palette index) */ this->input->seek(this->input, 4, SEEK_CUR); @@ -620,7 +620,7 @@ static int demux_mve_seek (demux_plugin_t *this_gen, /* check if the seek-to offset falls in between this shot offset and * the next one */ - if ((start_pos >= this->shot_offsets[i]) && + if ((start_pos >= this->shot_offsets[i]) && (start_pos < this->shot_offsets[i + 1])) { new_shot = i; diff --git a/src/demuxers/demux_yuv4mpeg2.c b/src/demuxers/demux_yuv4mpeg2.c index 2387fc7a7..aa1a4dff6 100644 --- a/src/demuxers/demux_yuv4mpeg2.c +++ b/src/demuxers/demux_yuv4mpeg2.c @@ -69,7 +69,7 @@ typedef struct { int aspect_d; int progressive; int top_field_first; - + unsigned int frame_pts_inc; unsigned int frame_size; @@ -86,7 +86,7 @@ static int open_yuv4mpeg2_file(demux_yuv4mpeg2_t *this) { char *header_ptr, *header_endptr, *header_end; this->bih.biWidth = this->bih.biHeight = this->fps_n = this->fps_d = - this->aspect_n = this->aspect_d = this->progressive = + this->aspect_n = this->aspect_d = this->progressive = this->top_field_first = this->data_start = 0; if (_x_demux_read_header(this->input, header, Y4M_HEADER_BYTES) != Y4M_HEADER_BYTES) @@ -98,11 +98,11 @@ static int open_yuv4mpeg2_file(demux_yuv4mpeg2_t *this) { /* null terminate the read data */ header[Y4M_HEADER_BYTES] = '\0'; - + /* check for stream header terminator */ if ((header_end = strchr(header, '\n')) == NULL) return 0; - + /* read tagged fields in stream header */ header_ptr = &header[Y4M_SIGNATURE_SIZE]; while (header_ptr < header_end) { @@ -111,7 +111,7 @@ static int open_yuv4mpeg2_file(demux_yuv4mpeg2_t *this) { break; else header_ptr++; - + switch (*header_ptr) { case 'W': /* read the width */ @@ -153,31 +153,31 @@ static int open_yuv4mpeg2_file(demux_yuv4mpeg2_t *this) { return 0; else header_ptr = header_endptr; - + /* denominator */ this->fps_d = strtol(header_ptr + 1, &header_endptr, 10); if (header_endptr == header_ptr + 1) return 0; else header_ptr = header_endptr; - + break; case 'A': - /* read aspect ratio - stored as a ratio(!) + /* read aspect ratio - stored as a ratio(!) * numerator */ this->aspect_n = strtol(header_ptr + 1, &header_endptr, 10); if ((header_endptr == header_ptr + 1) || (*header_endptr != ':')) return 0; else header_ptr = header_endptr; - + /* denominator */ this->aspect_d = strtol(header_ptr + 1, &header_endptr, 10); if (header_endptr == header_ptr + 1) return 0; else header_ptr = header_endptr; - + break; default: /* skip whatever this is */ @@ -185,7 +185,7 @@ static int open_yuv4mpeg2_file(demux_yuv4mpeg2_t *this) { header_ptr++; } } - + /* make sure all the data was found */ if (!this->bih.biWidth || !this->bih.biHeight || !this->fps_n || !this->fps_d) return 0; @@ -194,8 +194,8 @@ static int open_yuv4mpeg2_file(demux_yuv4mpeg2_t *this) { this->frame_size = this->bih.biWidth * this->bih.biHeight * 3 / 2; /* pts difference between frames */ - this->frame_pts_inc = (90000 * this->fps_d) / this->fps_n; - + this->frame_pts_inc = (90000 * this->fps_d) / this->fps_n; + /* finally, look for the first frame */ char *data_start_ptr = memmem(header_ptr, Y4M_HEADER_BYTES, "FRAME", 5); @@ -204,7 +204,7 @@ static int open_yuv4mpeg2_file(demux_yuv4mpeg2_t *this) { return 0; this->data_start = data_start_ptr - header; - + /* compute size of all frames */ if (INPUT_IS_SEEKABLE(this->input)) { this->data_size = this->input->get_length(this->input) - @@ -271,9 +271,9 @@ static int demux_yuv4mpeg2_send_chunk(demux_plugin_t *this_gen) { buf->decoder_flags |= BUF_FLAG_FRAME_END; this->video_fifo->put(this->video_fifo, buf); } - + return this->status; -} +} static void demux_yuv4mpeg2_send_headers(demux_plugin_t *this_gen) { demux_yuv4mpeg2_t *this = (demux_yuv4mpeg2_t *) this_gen; @@ -299,13 +299,13 @@ static void demux_yuv4mpeg2_send_headers(demux_plugin_t *this_gen) { buf->decoder_flags = BUF_FLAG_HEADER|BUF_FLAG_STDHEADER|BUF_FLAG_FRAMERATE| BUF_FLAG_FRAME_END; buf->decoder_info[0] = this->frame_pts_inc; /* initial video step */ - + if(this->aspect_n && this->aspect_d) { buf->decoder_flags |= BUF_FLAG_ASPECT; buf->decoder_info[1] = this->bih.biWidth * this->aspect_n; buf->decoder_info[2] = this->bih.biHeight * this->aspect_d; } - + buf->decoder_info[3] = this->progressive; buf->decoder_info[4] = this->top_field_first; @@ -327,7 +327,7 @@ static int demux_yuv4mpeg2_seek (demux_plugin_t *this_gen, /* YUV4MPEG2 files are essentially constant bit-rate video. Seek along * the calculated frame boundaries. Divide the requested seek offset - * by the frame size integer-wise to obtain the desired frame number + * by the frame size integer-wise to obtain the desired frame number * and then multiply the frame number by the frame size to get the * starting offset. Add the data_start offset to obtain the final * offset. */ @@ -370,7 +370,7 @@ static int demux_yuv4mpeg2_get_status (demux_plugin_t *this_gen) { static int demux_yuv4mpeg2_get_stream_length (demux_plugin_t *this_gen) { demux_yuv4mpeg2_t *this = (demux_yuv4mpeg2_t *) this_gen; - return (int)(((int64_t) this->data_size * 1000 * this->fps_d) / + return (int)(((int64_t) this->data_size * 1000 * this->fps_d) / ((this->frame_size + Y4M_FRAME_SIGNATURE_SIZE) * this->fps_n)); } diff --git a/src/demuxers/demux_yuv_frames.c b/src/demuxers/demux_yuv_frames.c index 089207f58..81dd2b03a 100644 --- a/src/demuxers/demux_yuv_frames.c +++ b/src/demuxers/demux_yuv_frames.c @@ -1,19 +1,19 @@ /* * Copyright (C) 2003-2004 the xine project * Copyright (C) 2003 Jeroen Asselman - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -120,27 +120,27 @@ static void demux_yuv_frames_send_headers (demux_plugin_t *this_gen){ this->video_fifo = this->stream->video_fifo; this->audio_fifo = this->stream->audio_fifo; - + _x_demux_control_start(this->stream); if(_x_stream_info_get(this->stream, XINE_STREAM_INFO_HAS_AUDIO)) { buf = this->input->read_block(this->input, this->audio_fifo, 0); - + if (buf) this->audio_fifo->put(this->audio_fifo, buf); else this->status = DEMUX_FINISHED; } - + if(_x_stream_info_get(this->stream, XINE_STREAM_INFO_HAS_VIDEO)) { buf = this->input->read_block(this->input, this->video_fifo, 0); - + if (buf) this->video_fifo->put(this->video_fifo, buf); else this->status = DEMUX_FINISHED; } - + this->status = DEMUX_OK; } diff --git a/src/demuxers/ebml.c b/src/demuxers/ebml.c index 4ce8a549d..75fbfde75 100644 --- a/src/demuxers/ebml.c +++ b/src/demuxers/ebml.c @@ -40,7 +40,7 @@ ebml_parser_t *new_ebml_parser (xine_t *xine, input_plugin_t *input) { ebml_parser_t *ebml; - + ebml = malloc(sizeof(ebml_parser_t)); ebml->xine = xine; ebml->input = input; @@ -52,15 +52,15 @@ ebml_parser_t *new_ebml_parser (xine_t *xine, input_plugin_t *input) { ebml->doctype = NULL; ebml->doctype_version = 0; ebml->doctype_read_version = 0; - + ebml->level = 0; - + return ebml; } void dispose_ebml_parser(ebml_parser_t *ebml) { - free(ebml); + free(ebml); } @@ -132,7 +132,7 @@ static int ebml_read_elem_len(ebml_parser_t *ebml, uint64_t *len) { int ff_bytes; uint64_t value; int i; - + if (ebml->input->read(ebml->input, data, 1) != 1) { off_t pos = ebml->input->get_current_pos(ebml->input); xprintf(ebml->xine, XINE_VERBOSITY_LOG, @@ -162,7 +162,7 @@ static int ebml_read_elem_len(ebml_parser_t *ebml, uint64_t *len) { ff_bytes = 1; else ff_bytes = 0; - + /* read the rest of the len */ if (ebml->input->read(ebml->input, data + 1, size - 1) != (size - 1)) { off_t pos = ebml->input->get_current_pos(ebml->input); @@ -231,7 +231,7 @@ int ebml_read_uint(ebml_parser_t *ebml, ebml_elem_t *elem, uint64_t *num) { "ebml: Invalid integer element size %" PRIu64 "\n", size); return 0; } - + if (!ebml_read_elem_data (ebml, data, size)) return 0; @@ -253,7 +253,7 @@ int ebml_read_sint (ebml_parser_t *ebml, ebml_elem_t *elem, int64_t *num) { "ebml: Invalid integer element size %" PRIu64 "\n", size); return 0; } - + if (!ebml_read_elem_data(ebml, data, size)) return 0; @@ -262,7 +262,7 @@ int ebml_read_sint (ebml_parser_t *ebml, ebml_elem_t *elem, int64_t *num) { *num = -1; else *num = 0; - + while (size > 0) { *num = (*num << 8) | data[elem->len - size]; size--; @@ -310,7 +310,7 @@ int ebml_read_ascii(ebml_parser_t *ebml, ebml_elem_t *elem, char *str) { if (!ebml_read_elem_data(ebml, str, size)) return 0; - + return 1; } @@ -346,7 +346,7 @@ int ebml_read_master (ebml_parser_t *ebml, ebml_elem_t *elem) { top_elem->start = elem->start; top_elem->len = elem->len; top_elem->id = elem->id; - + ebml->level++; lprintf("id: 0x%x, len: %" PRIu64 ", level: %d\n", elem->id, elem->len, ebml->level); if (ebml->level >= EBML_STACK_SIZE) { @@ -378,20 +378,20 @@ int ebml_check_header(ebml_parser_t *ebml) { "ebml: invalid master element\n"); return 0; } - + if (master.id != EBML_ID_EBML) { xprintf(ebml->xine, XINE_VERBOSITY_LOG, "ebml: invalid master element\n"); return 0; } - + if (!ebml_read_master (ebml, &master)) return 0; next_level = 1; while (next_level == 1) { ebml_elem_t elem; - + if (!ebml_read_elem_head(ebml, &elem)) return 0; @@ -405,7 +405,7 @@ int ebml_check_header(ebml_parser_t *ebml) { ebml->version = num; break; } - + case EBML_ID_EBMLREADVERSION: { uint64_t num; diff --git a/src/demuxers/ebml.h b/src/demuxers/ebml.h index 9aa471c0b..6d750a98c 100644 --- a/src/demuxers/ebml.h +++ b/src/demuxers/ebml.h @@ -48,7 +48,7 @@ typedef struct ebml_parser_s { /* xine stuff */ xine_t *xine; input_plugin_t *input; - + /* EBML Parser Stack Management */ ebml_elem_t elem_stack[EBML_STACK_SIZE]; int level; @@ -61,7 +61,7 @@ typedef struct ebml_parser_s { char *doctype; uint64_t doctype_version; uint64_t doctype_read_version; - + } ebml_parser_t; diff --git a/src/demuxers/group_audio.c b/src/demuxers/group_audio.c index 2643a8b80..f405d0292 100644 --- a/src/demuxers/group_audio.c +++ b/src/demuxers/group_audio.c @@ -110,7 +110,7 @@ static const demuxer_info_t demux_info_mod = { #endif const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_DEMUX, 26, "aac", XINE_VERSION_CODE, &demux_info_aac, demux_aac_init_plugin }, { PLUGIN_DEMUX, 26, "ac3", XINE_VERSION_CODE, &demux_info_ac3, demux_ac3_init_plugin }, { PLUGIN_DEMUX, 26, "aud", XINE_VERSION_CODE, &demux_info_aud, demux_aud_init_plugin }, diff --git a/src/demuxers/group_audio.h b/src/demuxers/group_audio.h index 424e5c8e0..d2cd91875 100644 --- a/src/demuxers/group_audio.h +++ b/src/demuxers/group_audio.h @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2005 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA diff --git a/src/demuxers/group_games.c b/src/demuxers/group_games.c index ad257c2fb..f08e8477d 100644 --- a/src/demuxers/group_games.c +++ b/src/demuxers/group_games.c @@ -78,7 +78,7 @@ static const demuxer_info_t demux_info_vmd = { }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_DEMUX, 26, "wve", XINE_VERSION_CODE, &demux_info_eawve, demux_eawve_init_plugin}, { PLUGIN_DEMUX, 26, "idcin", XINE_VERSION_CODE, &demux_info_idcin, demux_idcin_init_plugin }, { PLUGIN_DEMUX, 26, "ipmovie", XINE_VERSION_CODE, &demux_info_ipmovie, demux_ipmovie_init_plugin }, diff --git a/src/demuxers/group_games.h b/src/demuxers/group_games.h index f93d4bb07..ea6b00e75 100644 --- a/src/demuxers/group_games.h +++ b/src/demuxers/group_games.h @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA diff --git a/src/demuxers/id3.c b/src/demuxers/id3.c index 070ca2650..15599ffea 100644 --- a/src/demuxers/id3.c +++ b/src/demuxers/id3.c @@ -29,7 +29,7 @@ * * ID3v2 specs: http://www.id3.org/ */ - + #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -84,7 +84,7 @@ static const char* const id3_encoding[] = { "UTF-16", /* 0x01 */ "UTF-16BE", /* 0x02 */ "UTF-8"}; /* 0x03 */ - + int id3v1_parse_tag (input_plugin_t *input, xine_stream_t *stream) { off_t len; @@ -113,7 +113,7 @@ int id3v1_parse_tag (input_plugin_t *input, xine_stream_t *stream) { if (tag.genre < ID3_GENRE_COUNT) { _x_meta_info_set(stream, XINE_META_INFO_GENRE, id3_genre[tag.genre]); } - + } return 1; } else { @@ -126,12 +126,12 @@ static int id3v2_parse_genre(char* dest, char *src, int len) { int state = 0; char *buf = dest; unsigned int index = 0; - + while (*src) { lprintf("state=%d\n", state); if ((buf - dest) >= len) return 0; - + switch (state) { case 0: /* initial state */ @@ -278,7 +278,7 @@ static int id3v22_interp_frame(input_plugin_t *input, const size_t bufsize = frame_header->size + 2; if ( bufsize < 3 ) /* frames has to be _at least_ 1 byte */ return 0; - + buf = malloc(bufsize); if (buf == NULL) { lprintf("malloc error"); @@ -296,7 +296,7 @@ static int id3v22_interp_frame(input_plugin_t *input, case ( FOURCC_TAG(0, 'T', 'C', 'O') ): { char tmp[1024]; - + if (id3v2_parse_genre(tmp, buf + 1, 1024)) { _x_meta_info_set(stream, XINE_META_INFO_GENRE, tmp); } @@ -352,21 +352,21 @@ static int id3v22_parse_tag(input_plugin_t *input, if (tag_header.flags & ID3V22_ZERO_FLAG) { /* invalid flags */ - xprintf(stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, LOG_MODULE ": invalid header flags (%02x)\n", tag_header.flags); input->seek (input, tag_header.size - pos, SEEK_CUR); return 0; } if (tag_header.flags & ID3V22_COMPRESS_FLAG) { /* compressed tag: not supported */ - xprintf(stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, LOG_MODULE ": compressed tags are not supported\n"); input->seek (input, tag_header.size - pos, SEEK_CUR); return 0; } if (tag_header.flags & ID3V22_UNSYNCH_FLAG) { /* unsynchronized tag: not supported */ - xprintf(stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, LOG_MODULE ": unsynchronized tags are not supported\n"); input->seek (input, tag_header.size - pos, SEEK_CUR); return 0; @@ -378,11 +378,11 @@ static int id3v22_parse_tag(input_plugin_t *input, if (tag_frame_header.id) { if ((pos + tag_frame_header.size) <= tag_header.size) { if (!id3v22_interp_frame(input, stream, &tag_frame_header)) { - xprintf(stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, LOG_MODULE ": invalid frame content\n"); } } else { - xprintf(stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, LOG_MODULE ": invalid frame header\n"); input->seek (input, tag_header.size - pos, SEEK_CUR); return 1; @@ -394,7 +394,7 @@ static int id3v22_parse_tag(input_plugin_t *input, return 1; } } else { - xprintf(stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, LOG_MODULE ": id3v2_parse_frame_header problem\n"); return 0; } @@ -433,9 +433,9 @@ static int id3v23_parse_frame_ext_header(input_plugin_t *input, uint8_t buf[14]; if (input->read (input, buf, 4) == 4) { - + frame_ext_header->size = _X_BE_32(&buf[0]); - + if (frame_ext_header->size == 6) { if (input->read (input, buf + 4, 6) == 6) { frame_ext_header->flags = _X_BE_16(buf + 4); @@ -443,7 +443,7 @@ static int id3v23_parse_frame_ext_header(input_plugin_t *input, frame_ext_header->crc = 0; } else { return 0; - } + } } else if (frame_ext_header->size == 10) { if (input->read (input, buf + 4, 10) == 10) { @@ -476,7 +476,7 @@ static int id3v23_interp_frame(input_plugin_t *input, const size_t bufsize = frame_header->size + 2; if ( bufsize < 3 ) /* frames has to be _at least_ 1 byte */ return 0; - + buf = malloc(bufsize); if (buf == NULL) { lprintf("malloc error"); @@ -494,7 +494,7 @@ static int id3v23_interp_frame(input_plugin_t *input, case ( FOURCC_TAG('T', 'C', 'O', 'N') ): { char tmp[1024]; - + if (id3v2_parse_genre(tmp, buf + 1, 1024)) { _x_meta_info_set(stream, XINE_META_INFO_GENRE, tmp); } @@ -550,14 +550,14 @@ static int id3v23_parse_tag(input_plugin_t *input, if (tag_header.flags & ID3V23_ZERO_FLAG) { /* invalid flags */ - xprintf(stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, LOG_MODULE ": invalid header flags (%02x)\n", tag_header.flags); input->seek (input, tag_header.size - pos, SEEK_CUR); return 0; } if (tag_header.flags & ID3V23_UNSYNCH_FLAG) { /* unsynchronized tag: not supported */ - xprintf(stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, LOG_MODULE ": unsynchronized tags are not supported\n"); input->seek (input, tag_header.size - pos, SEEK_CUR); return 0; @@ -576,11 +576,11 @@ static int id3v23_parse_tag(input_plugin_t *input, if (tag_frame_header.id) { if ((pos + tag_frame_header.size) <= tag_header.size) { if (!id3v23_interp_frame(input, stream, &tag_frame_header)) { - xprintf(stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, LOG_MODULE ": invalid frame content\n"); } } else { - xprintf(stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, LOG_MODULE ": invalid frame header\n"); input->seek (input, tag_header.size - pos, SEEK_CUR); return 1; @@ -593,7 +593,7 @@ static int id3v23_parse_tag(input_plugin_t *input, return 1; } } else { - xprintf(stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, LOG_MODULE ": id3v2_parse_frame_header problem\n"); return 0; } @@ -610,7 +610,7 @@ static int id3v23_parse_tag(input_plugin_t *input, /* id3v2 "genre" parsing code. what a ugly format ! */ static int id3v24_parse_genre(char* dest, char *src, int len) { unsigned int index = 0; - + dest[0] = '\0'; if (sscanf(src, "%u", &index) == 1) { if (index < ID3_GENRE_COUNT) { @@ -648,7 +648,7 @@ static int id3v24_parse_ext_header(input_plugin_t *input, uint8_t buf[5]; if (input->read (input, buf, 4) == 4) { - + frame_ext_header->size = _X_BE_32(&buf[0]); if (input->read (input, buf, 2) == 2) { @@ -731,7 +731,7 @@ static int id3v24_interp_frame(input_plugin_t *input, const size_t bufsize = frame_header->size + 2; if ( bufsize < 3 ) /* frames has to be _at least_ 1 byte */ return 0; - + buf = malloc(bufsize); if (buf == NULL) { lprintf("malloc error"); @@ -744,14 +744,14 @@ static int id3v24_interp_frame(input_plugin_t *input, enc = buf[0]; if( enc >= ID3_ENCODING_COUNT ) enc = 0; - + lprintf("data: %s\n", buf+1); switch (frame_header->id) { case ( FOURCC_TAG('T', 'C', 'O', 'N') ): { char tmp[1024]; - + if (id3v24_parse_genre(tmp, buf + 1, 1024)) { _x_meta_info_set(stream, XINE_META_INFO_GENRE, tmp); } @@ -808,7 +808,7 @@ static int id3v24_parse_tag(input_plugin_t *input, if (tag_header.flags & ID3V24_ZERO_FLAG) { /* invalid flags */ - xprintf(stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, LOG_MODULE ": invalid header flags (%02x)\n", tag_header.flags); input->seek (input, tag_header.size - pos, SEEK_CUR); return 0; @@ -833,11 +833,11 @@ static int id3v24_parse_tag(input_plugin_t *input, if (tag_frame_header.id) { if ((pos + tag_frame_header.size) <= tag_header.size) { if (!id3v24_interp_frame(input, stream, &tag_frame_header)) { - xprintf(stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, LOG_MODULE ": invalid frame content\n"); } } else { - xprintf(stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, LOG_MODULE ": invalid frame header\n"); input->seek (input, tag_header.size - pos, SEEK_CUR); return 1; @@ -849,7 +849,7 @@ static int id3v24_parse_tag(input_plugin_t *input, return 1; } } else { - xprintf(stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, LOG_MODULE ": id3v2_parse_frame_header problem\n"); return 0; } @@ -877,7 +877,7 @@ int id3v2_parse_tag(input_plugin_t *input, xprintf(stream->xine, XINE_VERBOSITY_LOG, LOG_MODULE ": ID3V2.2 tag\n"); result = id3v22_parse_tag(input, stream, mp3_frame_header); break; - + case 3: xprintf(stream->xine, XINE_VERBOSITY_LOG, LOG_MODULE ": ID3V2.3 tag\n"); result = id3v23_parse_tag(input, stream, mp3_frame_header); diff --git a/src/demuxers/matroska.h b/src/demuxers/matroska.h index b32725b3b..0a8226319 100644 --- a/src/demuxers/matroska.h +++ b/src/demuxers/matroska.h @@ -272,7 +272,7 @@ struct matroska_track_s { uint32_t codec_private_len; int default_flag; uint32_t compress_algo; - + uint32_t buf_type; fifo_buffer_t *fifo; diff --git a/src/demuxers/qtpalette.h b/src/demuxers/qtpalette.h index a8a44e916..422b570a9 100644 --- a/src/demuxers/qtpalette.h +++ b/src/demuxers/qtpalette.h @@ -11,7 +11,7 @@ static const unsigned char qt_default_palette_4[4 * 4] = { 0x93, 0x65, 0x5E, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xDF, 0xD0, 0xAB, 0x00, - 0x00, 0x00, 0x00, 0x00 + 0x00, 0x00, 0x00, 0x00 }; static const unsigned char qt_default_palette_16[16 * 4] = { @@ -30,7 +30,7 @@ static const unsigned char qt_default_palette_16[16 * 4] = { 0xFF, 0xFB, 0xF9, 0x00, 0xE8, 0xCA, 0xC5, 0x00, 0x8A, 0x7C, 0x77, 0x00, - 0x00, 0x00, 0x00, 0x00 + 0x00, 0x00, 0x00, 0x00 }; static const unsigned char qt_default_palette_256[256 * 4] = { diff --git a/src/dxr3/Makefile.am b/src/dxr3/Makefile.am index 3c2cbafbc..f6beb521a 100644 --- a/src/dxr3/Makefile.am +++ b/src/dxr3/Makefile.am @@ -6,7 +6,7 @@ AM_CFLAGS = $(X_CFLAGS) $(LIBFAME_CFLAGS) if HAVE_DXR3 dxr3_modules = xineplug_decode_dxr3_video.la \ xineplug_decode_dxr3_spu.la \ - xineplug_vo_out_dxr3.la + xineplug_vo_out_dxr3.la endif if HAVE_X11 link_x_libs = $(X_LIBS) -lXext @@ -18,7 +18,7 @@ if HAVE_LIBRTE link_rte = -lrte endif -xineplug_LTLIBRARIES = $(dxr3_modules) +xineplug_LTLIBRARIES = $(dxr3_modules) xineplug_decode_dxr3_video_la_SOURCES = dxr3_decode_video.c xineplug_decode_dxr3_video_la_LIBADD = $(XINE_LIB) $(LTLIBINTL) @@ -41,7 +41,7 @@ xineplug_vo_out_dxr3_la_SOURCES = \ dxr3_mpeg_encoders.c \ dxr3_spu_encoder.c \ dxr3_scr.c \ - video_out_dxr3.c + video_out_dxr3.c xineplug_vo_out_dxr3_la_LIBADD = $(XINE_LIB) $(link_fame) $(link_rte) $(link_x_libs) $(LTLIBINTL) $(DYNAMIC_LD_LIBS) -lm xineplug_vo_out_dxr3_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) diff --git a/src/dxr3/dxr3.h b/src/dxr3/dxr3.h index f08ddcd04..78e74a7b4 100644 --- a/src/dxr3/dxr3.h +++ b/src/dxr3/dxr3.h @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA diff --git a/src/dxr3/dxr3_decode_spu.c b/src/dxr3/dxr3_decode_spu.c index 82c8f8da0..7682455eb 100644 --- a/src/dxr3/dxr3_decode_spu.c +++ b/src/dxr3/dxr3_decode_spu.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -21,7 +21,7 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif - + /* dxr3 spu decoder plugin. * Accepts the spu data from xine and sends it directly to the * corresponding dxr3 device. Also handles dvd menu button highlights. @@ -76,7 +76,7 @@ static const decoder_info_t dxr3_spudec_info = { }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_SPU_DECODER, 16, "dxr3-spudec", XINE_VERSION_CODE, &dxr3_spudec_info, &dxr3_spudec_init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; @@ -114,7 +114,7 @@ struct pci_node_s { typedef struct dxr3_spudec_class_s { spu_decoder_class_t spu_decoder_class; - + int instance; /* we allow only one instance of this plugin */ } dxr3_spudec_class_t; @@ -124,10 +124,10 @@ typedef struct dxr3_spudec_s { xine_stream_t *stream; dxr3_driver_t *dxr3_vo; /* we need to talk to the video out */ xine_event_queue_t *event_queue; - + int devnum; int fd_spu; /* to access the dxr3 spu device */ - + dxr3_spu_stream_state_t spu_stream_state[MAX_SPU_STREAMS]; uint32_t clut[16]; /* the current color lookup table */ int menu; /* are we in a menu? */ @@ -135,7 +135,7 @@ typedef struct dxr3_spudec_s { pci_node_t pci_cur; /* a list of PCI packs, with the list head being current */ pthread_mutex_t pci_lock; uint32_t buttonN; /* currently highlighted button */ - + int anamorphic; /* this is needed to detect anamorphic menus */ } dxr3_spudec_t; @@ -154,7 +154,7 @@ static inline int dxr3_present(xine_stream_t *stream) plugin_node_t *node; video_driver_class_t *vo_class; int present = 0; - + if (stream->video_driver && stream->video_driver->node) { node = (plugin_node_t *)stream->video_driver->node; if (node->plugin_class) { @@ -181,7 +181,7 @@ static inline void dxr3_spudec_clear_nav_list(dxr3_spudec_t *this) static inline void dxr3_spudec_update_nav(dxr3_spudec_t *this) { metronom_clock_t *clock = this->stream->xine->clock; - + if (this->pci_cur.next && this->pci_cur.next->vpts <= clock->get_current_time(clock)) { pci_node_t *node = this->pci_cur.next; xine_fast_memcpy(&this->pci_cur, this->pci_cur.next, sizeof(pci_node_t)); @@ -201,17 +201,17 @@ static inline void dxr3_swab_clut(int *clut) static void *dxr3_spudec_init_plugin(xine_t *xine, void* data) { dxr3_spudec_class_t *this; - + this = calloc(1, sizeof(dxr3_spudec_class_t)); if (!this) return NULL; - + this->spu_decoder_class.open_plugin = dxr3_spudec_open_plugin; this->spu_decoder_class.get_identifier = dxr3_spudec_get_identifier; this->spu_decoder_class.get_description = dxr3_spudec_get_description; this->spu_decoder_class.dispose = dxr3_spudec_class_dispose; - + this->instance = 0; - + return &this->spu_decoder_class; } @@ -221,20 +221,20 @@ static spu_decoder_t *dxr3_spudec_open_plugin(spu_decoder_class_t *class_gen, xi dxr3_spudec_t *this; dxr3_spudec_class_t *class = (dxr3_spudec_class_t *)class_gen; char tmpstr[128]; - + if (class->instance) return NULL; if (!dxr3_present(stream)) return NULL; - + this = calloc(1, sizeof(dxr3_spudec_t)); if (!this) return NULL; - + this->spu_decoder.decode_data = dxr3_spudec_decode_data; this->spu_decoder.reset = dxr3_spudec_reset; this->spu_decoder.discontinuity = dxr3_spudec_discontinuity; this->spu_decoder.dispose = dxr3_spudec_dispose; this->spu_decoder.get_interact_info = dxr3_spudec_interact_info; this->spu_decoder.set_button = dxr3_spudec_set_button; - + this->class = class; this->stream = stream; /* We need to talk to dxr3 video out to coordinate spus and overlays */ @@ -243,7 +243,7 @@ static spu_decoder_t *dxr3_spudec_open_plugin(spu_decoder_class_t *class_gen, xi this->devnum = stream->xine->config->register_num(stream->xine->config, CONF_KEY, 0, CONF_NAME, CONF_HELP, 10, NULL, NULL); - + pthread_mutex_lock(&this->dxr3_vo->spu_device_lock); if (this->dxr3_vo->fd_spu) this->fd_spu = this->dxr3_vo->fd_spu; @@ -251,7 +251,7 @@ static spu_decoder_t *dxr3_spudec_open_plugin(spu_decoder_class_t *class_gen, xi /* open dxr3 spu device */ snprintf(tmpstr, sizeof(tmpstr), "/dev/em8300_sp-%d", this->devnum); if ((this->fd_spu = open(tmpstr, O_WRONLY)) < 0) { - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("dxr3_decode_spu: Failed to open spu device %s (%s)\n"), tmpstr, strerror(errno)); pthread_mutex_unlock(&this->dxr3_vo->spu_device_lock); free(this); @@ -263,19 +263,19 @@ static spu_decoder_t *dxr3_spudec_open_plugin(spu_decoder_class_t *class_gen, xi this->dxr3_vo->fd_spu = this->fd_spu; } pthread_mutex_unlock(&this->dxr3_vo->spu_device_lock); - + this->menu = 0; this->button_filter = 1; this->pci_cur.pci.hli.hl_gi.hli_ss = 0; this->pci_cur.next = NULL; this->buttonN = 1; - + this->anamorphic = 0; - + pthread_mutex_init(&this->pci_lock, NULL); - + class->instance = 1; - + return &this->spu_decoder; } @@ -303,11 +303,11 @@ static void dxr3_spudec_decode_data(spu_decoder_t *this_gen, buf_element_t *buf) dxr3_spu_stream_state_t *state = &this->spu_stream_state[stream_id]; uint32_t spu_channel = this->stream->spu_channel; xine_event_t *event; - + /* handle queued events */ while ((event = xine_event_get(this->event_queue))) { llprintf(LOG_SPU, "event caught: SPU_FD = %i\n",this->fd_spu); - + switch (event->type) { case XINE_EVENT_FRAME_FORMAT_CHANGE: /* we are in anamorphic mode, if the frame is 16:9, but not pan&scan'ed */ @@ -317,17 +317,17 @@ static void dxr3_spudec_decode_data(spu_decoder_t *this_gen, buf_element_t *buf) llprintf(LOG_BTN, "anamorphic mode %s\n", this->anamorphic ? "on" : "off"); break; } - + xine_event_free(event); } - + /* check, if we need to process the next PCI from the list */ pthread_mutex_lock(&this->pci_lock); dxr3_spudec_update_nav(this); pthread_mutex_unlock(&this->pci_lock); - + if ( (buf->type & 0xffff0000) != BUF_SPU_DVD || - !(buf->decoder_flags & BUF_FLAG_SPECIAL) || + !(buf->decoder_flags & BUF_FLAG_SPECIAL) || buf->decoder_info[1] != BUF_SPECIAL_SPU_DVD_SUBTYPE ) return; @@ -337,7 +337,7 @@ static void dxr3_spudec_decode_data(spu_decoder_t *this_gen, buf_element_t *buf) dxr3_swab_clut((int *)buf->content); pthread_mutex_lock(&this->dxr3_vo->spu_device_lock); if (ioctl(this->fd_spu, EM8300_IOCTL_SPU_SETPALETTE, buf->content)) - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "dxr3_decode_spu: failed to set CLUT (%s)\n", strerror(errno)); /* remember clut, when video out places some overlay we may need to restore it */ memcpy(this->clut, buf->content, 16 * sizeof(uint32_t)); @@ -347,20 +347,20 @@ static void dxr3_spudec_decode_data(spu_decoder_t *this_gen, buf_element_t *buf) } if (buf->decoder_info[2] == SPU_DVD_SUBTYPE_NAV) { uint8_t *p = buf->content; - + llprintf(LOG_BTN, "got NAV packet\n"); pthread_mutex_lock(&this->pci_lock); - + /* just watch out for menus */ if (p[3] == 0xbf && p[6] == 0x00) { /* Private stream 2 */ pci_t pci; - + navRead_PCI(&pci, p + 7); llprintf(LOG_BTN, "PCI packet hli_ss is %d\n", pci.hli.hl_gi.hli_ss); - + if (pci.hli.hl_gi.hli_ss == 1) { /* menu ahead */ - + /* NAV packets contain start and end presentation timestamps, which tell the * application, when the highlight information in the NAV is supposed to be valid. * We handle these timestamps only in a very stripped-down way: We keep a list @@ -389,7 +389,7 @@ static void dxr3_spudec_decode_data(spu_decoder_t *this_gen, buf_element_t *buf) dxr3_spudec_process_nav(this); } } - + if ((pci.hli.hl_gi.hli_ss == 0) && (this->pci_cur.pci.hli.hl_gi.hli_ss == 1)) { /* this is (or: should be, I hope I got this right) a subpicture plane, that hides all menu buttons */ @@ -413,7 +413,7 @@ static void dxr3_spudec_decode_data(spu_decoder_t *this_gen, buf_element_t *buf) pthread_mutex_unlock(&this->pci_lock); return; } - + /* We parse the SPUs command and end sequence here for two reasons: * 1. Look for the display duration entry in the spu packets. * If the spu is a menu button highlight pane, this entry must not exist, @@ -494,7 +494,7 @@ static void dxr3_spudec_decode_data(spu_decoder_t *this_gen, buf_element_t *buf) if (state->spu_length < 0) state->spu_length = 0; state->bytes_passed += buf->size; } - + /* filter unwanted streams */ if (buf->decoder_flags & BUF_FLAG_PREVIEW) { llprintf(LOG_SPU, "Dropping SPU channel %d. Preview data\n", stream_id); @@ -512,43 +512,43 @@ static void dxr3_spudec_decode_data(spu_decoder_t *this_gen, buf_element_t *buf) /* We used to filter for SPU forcing here as well, but this does not work * this way with the DXR3, because we have to evaluate the SPU command sequence * to detect, if a particular SPU is forced or not. See the parsing code above. */ - + pthread_mutex_lock(&this->dxr3_vo->spu_device_lock); - + /* write sync timestamp to the card */ if (buf->pts) { int64_t vpts; uint32_t vpts32; - + vpts = this->stream->metronom->got_spu_packet(this->stream->metronom, buf->pts); llprintf(LOG_PTS, "pts = %" PRId64 " vpts = %" PRIu64 "\n", buf->pts, vpts); vpts32 = vpts; if (ioctl(this->fd_spu, EM8300_IOCTL_SPU_SETPTS, &vpts32)) - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "dxr3_decode_spu: spu setpts failed (%s)\n", strerror(errno)); } - + /* has video out tampered with our palette */ if (this->dxr3_vo->clut_cluttered) { if (ioctl(this->fd_spu, EM8300_IOCTL_SPU_SETPALETTE, this->clut)) - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "dxr3_decode_spu: failed to set CLUT (%s)\n", strerror(errno)); this->dxr3_vo->clut_cluttered = 0; } - + /* write spu data to the card */ llprintf(LOG_SPU, "write: SPU_FD = %i\n",this->fd_spu); written = write(this->fd_spu, buf->content, buf->size); if (written < 0) { - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "dxr3_decode_spu: spu device write failed (%s)\n", strerror(errno)); pthread_mutex_unlock(&this->dxr3_vo->spu_device_lock); return; } if (written != buf->size) - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "dxr3_decode_spu: Could only write %zd of %d spu bytes.\n", written, buf->size); - + pthread_mutex_unlock(&this->dxr3_vo->spu_device_lock); } @@ -556,7 +556,7 @@ static void dxr3_spudec_reset(spu_decoder_t *this_gen) { dxr3_spudec_t *this = (dxr3_spudec_t *)this_gen; int i; - + for (i = 0; i < MAX_SPU_STREAMS; i++) this->spu_stream_state[i].spu_length = 0; pthread_mutex_lock(&this->pci_lock); @@ -567,7 +567,7 @@ static void dxr3_spudec_reset(spu_decoder_t *this_gen) static void dxr3_spudec_discontinuity(spu_decoder_t *this_gen) { dxr3_spudec_t *this = (dxr3_spudec_t *)this_gen; - + pthread_mutex_lock(&this->pci_lock); dxr3_spudec_clear_nav_list(this); pthread_mutex_unlock(&this->pci_lock); @@ -582,7 +582,7 @@ static void dxr3_spudec_dispose(spu_decoder_t *this_gen) 0x00, 0x01, 0x06, 0x00, 0x04, 0x00, 0x07, 0xFF, 0x00, 0x01, 0x00, 0x20, 0x02, 0xFF }; dxr3_spudec_t *this = (dxr3_spudec_t *)this_gen; - + llprintf(LOG_SPU, "close: SPU_FD = %i\n",this->fd_spu); pthread_mutex_lock(&this->dxr3_vo->spu_device_lock); /* clear any remaining spu */ @@ -592,7 +592,7 @@ static void dxr3_spudec_dispose(spu_decoder_t *this_gen) this->fd_spu = 0; this->dxr3_vo->fd_spu = 0; pthread_mutex_unlock(&this->dxr3_vo->spu_device_lock); - + dxr3_spudec_clear_nav_list(this); xine_event_dispose_queue(this->event_queue); pthread_mutex_destroy(&this->pci_lock); @@ -603,7 +603,7 @@ static void dxr3_spudec_dispose(spu_decoder_t *this_gen) static int dxr3_spudec_interact_info(spu_decoder_t *this_gen, void *data) { dxr3_spudec_t *this = (dxr3_spudec_t *)this_gen; - + pthread_mutex_lock(&this->pci_lock); dxr3_spudec_update_nav(this); memcpy(data, &this->pci_cur.pci, sizeof(pci_t)); @@ -615,7 +615,7 @@ static void dxr3_spudec_set_button(spu_decoder_t *this_gen, int32_t button, int3 { dxr3_spudec_t *this = (dxr3_spudec_t *)this_gen; em8300_button_t btn; - + llprintf(LOG_BTN, "setting button\n"); this->buttonN = button; pthread_mutex_lock(&this->pci_lock); @@ -624,7 +624,7 @@ static void dxr3_spudec_set_button(spu_decoder_t *this_gen, int32_t button, int3 (dxr3_spudec_copy_nav_to_btn(this, mode - 1, &btn ) > 0)) { pthread_mutex_lock(&this->dxr3_vo->spu_device_lock); if (ioctl(this->fd_spu, EM8300_IOCTL_SPU_BUTTON, &btn)) - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "dxr3_decode_spu: failed to set spu button (%s)\n", strerror(errno)); pthread_mutex_unlock(&this->dxr3_vo->spu_device_lock); } @@ -639,7 +639,7 @@ static void dxr3_spudec_set_button(spu_decoder_t *this_gen, int32_t button, int3 static void dxr3_spudec_process_nav(dxr3_spudec_t *this) { em8300_button_t btn; - + this->menu = 1; this->button_filter = 0; if (this->pci_cur.pci.hli.hl_gi.fosl_btnn > 0) { @@ -655,15 +655,15 @@ static void dxr3_spudec_process_nav(dxr3_spudec_t *this) if ((dxr3_spudec_copy_nav_to_btn(this, 0, &btn ) > 0)) { pthread_mutex_lock(&this->dxr3_vo->spu_device_lock); if (ioctl(this->fd_spu, EM8300_IOCTL_SPU_BUTTON, &btn)) - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "dxr3_decode_spu: failed to set spu button (%s)\n", strerror(errno)); pthread_mutex_unlock(&this->dxr3_vo->spu_device_lock); } else { /* current button does not exist -> use another one */ xine_event_t event; - + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("requested button not available\n")); - + if (this->buttonN > this->pci_cur.pci.hli.hl_gi.btn_ns) this->buttonN = this->pci_cur.pci.hli.hl_gi.btn_ns; else @@ -673,11 +673,11 @@ static void dxr3_spudec_process_nav(dxr3_spudec_t *this) event.data = &this->buttonN; event.data_length = sizeof(this->buttonN); xine_event_send(this->stream, &event); - + if ((dxr3_spudec_copy_nav_to_btn(this, 0, &btn ) > 0)) { pthread_mutex_lock(&this->dxr3_vo->spu_device_lock); if (ioctl(this->fd_spu, EM8300_IOCTL_SPU_BUTTON, &btn)) - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "dxr3_decode_spu: failed to set spu button (%s)\n", strerror(errno)); pthread_mutex_unlock(&this->dxr3_vo->spu_device_lock); } else { @@ -689,10 +689,10 @@ static void dxr3_spudec_process_nav(dxr3_spudec_t *this) static int dxr3_spudec_copy_nav_to_btn(dxr3_spudec_t *this, int32_t mode, em8300_button_t *btn) { btni_t *button_ptr = NULL; - + if ((this->buttonN <= 0) || (this->buttonN > this->pci_cur.pci.hli.hl_gi.btn_ns)) return -1; - + /* choosing a button from a matching button group */ if (this->anamorphic && !this->dxr3_vo->widescreen_enabled && @@ -700,7 +700,7 @@ static int dxr3_spudec_copy_nav_to_btn(dxr3_spudec_t *this, int32_t mode, em8300 this->stream->spu_channel_letterbox != this->stream->spu_channel && this->stream->spu_channel_letterbox >= 0) { unsigned int btns_per_group = 36 / this->pci_cur.pci.hli.hl_gi.btngr_ns; - + /* use a letterbox button group for letterboxed anamorphic menus on tv out */ if (!button_ptr && this->pci_cur.pci.hli.hl_gi.btngr_ns >= 1 && (this->pci_cur.pci.hli.hl_gi.btngr1_dsp_ty & 2)) button_ptr = &this->pci_cur.pci.hli.btnit[0 * btns_per_group + this->buttonN - 1]; @@ -708,13 +708,13 @@ static int dxr3_spudec_copy_nav_to_btn(dxr3_spudec_t *this, int32_t mode, em8300 button_ptr = &this->pci_cur.pci.hli.btnit[1 * btns_per_group + this->buttonN - 1]; if (!button_ptr && this->pci_cur.pci.hli.hl_gi.btngr_ns >= 3 && (this->pci_cur.pci.hli.hl_gi.btngr3_dsp_ty & 2)) button_ptr = &this->pci_cur.pci.hli.btnit[2 * btns_per_group + this->buttonN - 1]; - + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "No suitable letterbox button group found.\n"); _x_assert(button_ptr); - + } else { unsigned int btns_per_group = 36 / this->pci_cur.pci.hli.hl_gi.btngr_ns; - + /* otherwise use a normal 4:3 or widescreen button group */ if (!button_ptr && this->pci_cur.pci.hli.hl_gi.btngr_ns >= 1 && !(this->pci_cur.pci.hli.hl_gi.btngr1_dsp_ty & 6)) button_ptr = &this->pci_cur.pci.hli.btnit[0 * btns_per_group + this->buttonN - 1]; @@ -722,14 +722,14 @@ static int dxr3_spudec_copy_nav_to_btn(dxr3_spudec_t *this, int32_t mode, em8300 button_ptr = &this->pci_cur.pci.hli.btnit[1 * btns_per_group + this->buttonN - 1]; if (!button_ptr && this->pci_cur.pci.hli.hl_gi.btngr_ns >= 3 && !(this->pci_cur.pci.hli.hl_gi.btngr3_dsp_ty & 6)) button_ptr = &this->pci_cur.pci.hli.btnit[2 * btns_per_group + this->buttonN - 1]; - + } if (!button_ptr) { - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "dxr3_decode_spu: No suitable menu button group found, using group 1.\n"); button_ptr = &this->pci_cur.pci.hli.btnit[this->buttonN - 1]; } - + if(button_ptr->btn_coln != 0) { llprintf(LOG_BTN, "normal button clut, mode %d\n", mode); btn->color = (this->pci_cur.pci.hli.btn_colit.btn_coli[button_ptr->btn_coln-1][mode] >> 16); @@ -739,7 +739,7 @@ static int dxr3_spudec_copy_nav_to_btn(dxr3_spudec_t *this, int32_t mode, em8300 btn->right = button_ptr->x_end; btn->bottom = button_ptr->y_end; return 1; - } + } return -1; } diff --git a/src/dxr3/dxr3_decode_video.c b/src/dxr3/dxr3_decode_video.c index e68ba2b5c..75a371566 100644 --- a/src/dxr3/dxr3_decode_video.c +++ b/src/dxr3/dxr3_decode_video.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -21,7 +21,7 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif - + /* dxr3 video decoder plugin. * Accepts the video data from xine and sends it directly to the * corresponding dxr3 device. Takes precedence over the libmpeg2 @@ -77,7 +77,7 @@ static const decoder_info_t dxr3_video_decoder_info = { }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_VIDEO_DECODER, 18, "dxr3-mpeg2", XINE_VERSION_CODE, &dxr3_video_decoder_info, &dxr3_init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; @@ -99,9 +99,9 @@ static void dxr3_dispose(video_decoder_t *this_gen); /* plugin structures */ typedef struct dxr3_decoder_class_s { video_decoder_class_t video_decoder_class; - + int instance; /* we allow only one instance of this plugin */ - + metronom_clock_t *clock; /* used for syncing */ } dxr3_decoder_class_t; @@ -110,11 +110,11 @@ typedef struct dxr3_decoder_s { dxr3_decoder_class_t *class; xine_stream_t *stream; dxr3_scr_t *scr; /* shortcut to the scr plugin in the dxr3 video out */ - + int devnum; int fd_control; int fd_video; /* to access the dxr3 devices */ - + int have_header_info; int sequence_open; int width; @@ -123,26 +123,26 @@ typedef struct dxr3_decoder_s { int aspect_code; int frame_rate_code; int repeat_first_field; /* mpeg stream header data */ - + int force_aspect; /* when input plugin has better info, we are forced */ int force_pan_scan; /* to use a certain aspect or to do pan&scan */ - + int use_panscan; int panscan_smart_change; int afd_smart_change; int afd_code; /* use pan&scan info if present in stream */ - + int last_width; int last_height; int last_aspect_code; /* used to detect changes for event sending */ - + unsigned int dts_offset[3]; int sync_every_frame; int sync_retry; int enhanced_mode; int resync_window; int skip_count; /* syncing parameters */ - + int correct_durations; int64_t last_vpts; int force_duration_window; @@ -168,7 +168,7 @@ static inline int dxr3_present(xine_stream_t *stream) plugin_node_t *node; video_driver_class_t *vo_class; int present = 0; - + if (stream->video_driver && stream->video_driver->node) { node = (plugin_node_t *)stream->video_driver->node; if (node->plugin_class) { @@ -184,11 +184,11 @@ static inline int dxr3_present(xine_stream_t *stream) static inline int dxr3_mvcommand(int fd_control, int command) { em8300_register_t reg; - + reg.microcode_register = 1; reg.reg = 0; reg.val = command; - + return ioctl(fd_control, EM8300_IOCTL_WRITEREG, ®); } @@ -196,19 +196,19 @@ static inline int dxr3_mvcommand(int fd_control, int command) static void *dxr3_init_plugin(xine_t *xine, void *data) { dxr3_decoder_class_t *this; - + this = calloc(1, sizeof (dxr3_decoder_class_t)); if (!this) return NULL; - + this->video_decoder_class.open_plugin = dxr3_open_plugin; this->video_decoder_class.get_identifier = dxr3_get_identifier; this->video_decoder_class.get_description = dxr3_get_description; this->video_decoder_class.dispose = dxr3_class_dispose; - + this->instance = 0; - + this->clock = xine->clock; - + return &this->video_decoder_class; } @@ -220,40 +220,40 @@ static video_decoder_t *dxr3_open_plugin(video_decoder_class_t *class_gen, xine_ dxr3_decoder_class_t *class = (dxr3_decoder_class_t *)class_gen; config_values_t *cfg; char tmpstr[128]; - + if (class->instance) return NULL; if (!dxr3_present(stream)) return NULL; - + this = calloc(1, sizeof (dxr3_decoder_t)); if (!this) return NULL; - + cfg = stream->xine->config; - + this->video_decoder.decode_data = dxr3_decode_data; this->video_decoder.reset = dxr3_reset; this->video_decoder.discontinuity = dxr3_discontinuity; this->video_decoder.flush = dxr3_flush; this->video_decoder.dispose = dxr3_dispose; - + this->class = class; this->stream = stream; this->scr = NULL; - + this->devnum = cfg->register_num(cfg, CONF_KEY, 0, CONF_NAME, CONF_HELP, 10, NULL, NULL); - + snprintf(tmpstr, sizeof(tmpstr), "/dev/em8300-%d", this->devnum); llprintf(LOG_VID, "Entering video init, devname=%s.\n",tmpstr); - + /* open later, because dxr3_video_out might have it open until we request a frame */ this->fd_video = -1; - + if ((this->fd_control = open(tmpstr, O_WRONLY)) < 0) { - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("dxr3_decode_video: Failed to open control device %s (%s)\n"), tmpstr, strerror(errno)); free(this); return NULL; } - + this->use_panscan = cfg->register_enum(cfg, "dxr3.use_panscan", 0, panscan_types, _("use Pan & Scan info"), _("\"Pan & Scan\" is a special display mode which is sometimes used in MPEG " @@ -266,14 +266,14 @@ static video_decoder_t *dxr3_open_plugin(video_decoder_class_t *class_gen, xine_ "Enable Pan & Scan based on information embedded in DVB streams. This makes " "use of the Active Format Descriptor (AFD) used in some European DVB channels."), 10, dxr3_update_panscan, this); - + this->dts_offset[0] = 21600; this->dts_offset[1] = 21600; this->dts_offset[2] = 21600; - + this->force_duration_window = -FORCE_DURATION_WINDOW_SIZE; this->last_vpts = this->class->clock->get_current_time(this->class->clock); - + this->sync_every_frame = cfg->register_bool(cfg, "dxr3.playback.sync_every_frame", 0, _("try to sync video every frame"), _("Tries to set a synchronization timestamp for every frame. " @@ -292,14 +292,14 @@ static video_decoder_t *dxr3_open_plugin(video_decoder_class_t *class_gen, xine_ "correction for NTSC streams erroneously labeled as PAL " "streams is implemented. Enable only, when you encounter such streams."), 0, dxr3_update_correct_durations, this); - + /* the dxr3 needs a longer prebuffering to have time for its internal decoding */ this->stream->metronom->set_option(this->stream->metronom, METRONOM_PREBUFFER, 90000); - + (stream->video_out->open) (stream->video_out, stream); - + class->instance = 1; - + return &this->video_decoder; } @@ -317,7 +317,7 @@ static void dxr3_class_dispose(video_decoder_class_t *class_gen) { free(class_gen); } - + static void dxr3_decode_data(video_decoder_t *this_gen, buf_element_t *buf) { @@ -328,9 +328,9 @@ static void dxr3_decode_data(video_decoder_t *this_gen, buf_element_t *buf) vo_frame_t *img; uint8_t *buffer, byte; uint32_t shift; - + vpts = 0; - + /* handle aspect hints from xine-dvdnav */ if (buf->decoder_flags & BUF_FLAG_SPECIAL) { if (buf->decoder_info[1] == BUF_SPECIAL_ASPECT) { @@ -342,12 +342,12 @@ static void dxr3_decode_data(video_decoder_t *this_gen, buf_element_t *buf) this->force_pan_scan = 0; frame_format_change(this); - + this->last_aspect_code = this->aspect_code; } return; } - + /* parse frames in the buffer handed in, evaluate headers, * send frames to video_out and handle some syncing */ @@ -361,7 +361,7 @@ static void dxr3_decode_data(video_decoder_t *this_gen, buf_element_t *buf) } /* header code of some kind found */ shift = 0xffffff00; - + if (byte == 0xb2) { /* check for AFD data */ if (buffer + 5 < buf->content + buf->size) { @@ -450,7 +450,7 @@ static void dxr3_decode_data(video_decoder_t *this_gen, buf_element_t *buf) continue; if (buf->decoder_flags & BUF_FLAG_PREVIEW) continue; - + /* pretend like we have decoded a frame */ img = this->stream->video_out->get_frame(this->stream->video_out, this->width, this->height, this->ratio, @@ -458,20 +458,20 @@ static void dxr3_decode_data(video_decoder_t *this_gen, buf_element_t *buf) img->pts = buf->pts; img->bad_frame = 0; img->duration = get_duration(this); - + skip = img->draw(img, this->stream); - + if (skip <= 0) { /* don't skip */ vpts = img->vpts; /* copy so we can free img */ - + if (this->correct_durations) { /* calculate an average frame duration from metronom's vpts values */ this->avg_duration = this->avg_duration * 0.9 + (vpts - this->last_vpts) * 0.1; llprintf(LOG_PTS, "average frame duration %d\n", this->avg_duration); } - + if (this->skip_count) this->skip_count--; - + if (this->resync_window == 0 && this->scr && this->enhanced_mode && !this->scr->scanning) { /* we are in sync, so we can lock the stream now */ @@ -488,7 +488,7 @@ static void dxr3_decode_data(video_decoder_t *this_gen, buf_element_t *buf) llprintf(LOG_VID, "%d frames to skip\n", skip); vpts = 0; this->avg_duration = 0; - + /* handle frame skip conditions */ if (this->scr && !this->scr->scanning) this->skip_count += skip; if (this->skip_count > SKIP_TOLERANCE) { @@ -500,7 +500,7 @@ static void dxr3_decode_data(video_decoder_t *this_gen, buf_element_t *buf) this->skip_count = 0; this->resync_window = 0; } - + if (this->scr && this->scr->scanning) this->resync_window = 0; if (this->resync_window == 0 && this->scr && this->enhanced_mode && !this->scr->scanning) { @@ -519,7 +519,7 @@ static void dxr3_decode_data(video_decoder_t *this_gen, buf_element_t *buf) img->free(img); /* if sync_every_frame was disabled, decrease the counter - * for a retry + * for a retry * (it might be due to crappy studio logos and stuff * so we should give the main movie a chance) */ @@ -531,7 +531,7 @@ static void dxr3_decode_data(video_decoder_t *this_gen, buf_element_t *buf) } } if (buf->decoder_flags & BUF_FLAG_PREVIEW) return; - + /* ensure video device is open * (we open it late because on occasion the dxr3 video out driver * wants to open it) @@ -541,15 +541,15 @@ static void dxr3_decode_data(video_decoder_t *this_gen, buf_element_t *buf) metronom_clock_t *clock = this->class->clock; char tmpstr[128]; int64_t time; - + /* open the device for the decoder */ snprintf (tmpstr, sizeof(tmpstr), "/dev/em8300_mv-%d", this->devnum); if ((this->fd_video = open(tmpstr, O_WRONLY)) < 0) { - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - _("dxr3_decode_video: Failed to open video device %s (%s)\n"), tmpstr, strerror(errno)); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("dxr3_decode_video: Failed to open video device %s (%s)\n"), tmpstr, strerror(errno)); return; } - + /* We may want to issue a SETPTS, so make sure the scr plugin * is running and registered. Unfortuantely wa cannot do this * earlier, because the dxr3's internal scr gets confused @@ -562,11 +562,11 @@ static void dxr3_decode_data(video_decoder_t *this_gen, buf_element_t *buf) this->scr->scr_plugin.start(&this->scr->scr_plugin, time); clock->register_scr(clock, &this->scr->scr_plugin); } - + /* update the pts timestamp in the card, which tags the data we write to it */ if (vpts) { int64_t delay; - + /* The PTS values written to the DXR3 must be modified based on the difference * between stream's PTS and DTS (decoder timestamp). We receive this * difference via decoder_info */ @@ -582,7 +582,7 @@ static void dxr3_decode_data(video_decoder_t *this_gen, buf_element_t *buf) llprintf(LOG_PTS, "PTS to DTS correction: %d\n", this->dts_offset[1]); } vpts -= this->dts_offset[2]; - + delay = vpts - this->class->clock->get_current_time( this->class->clock); llprintf(LOG_PTS, "SETPTS got %" PRId64 "\n", vpts); @@ -596,7 +596,7 @@ static void dxr3_decode_data(video_decoder_t *this_gen, buf_element_t *buf) xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "dxr3_decode_video: set video pts failed (%s)\n", strerror(errno)); } - + if (delay >= 90000) /* frame more than 1 sec ahead */ xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "dxr3_decode_video: WARNING: vpts %" PRId64 " is %.02f seconds ahead of time!\n", @@ -606,7 +606,7 @@ static void dxr3_decode_data(video_decoder_t *this_gen, buf_element_t *buf) } else if (buf->pts) llprintf(LOG_PTS, "skip buf->pts = %" PRId64 " (no vpts)\n", buf->pts); - + /* now write the content to the dxr3 mpeg device and, in a dramatic * break with open source tradition, check the return value */ @@ -617,7 +617,7 @@ static void dxr3_decode_data(video_decoder_t *this_gen, buf_element_t *buf) _("dxr3_decode_video: write to device would block. flushing\n")); dxr3_flush(this_gen); } else { - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("dxr3_decode_video: video device write failed (%s)\n"), strerror(errno)); } return; @@ -630,7 +630,7 @@ static void dxr3_decode_data(video_decoder_t *this_gen, buf_element_t *buf) static void dxr3_reset(video_decoder_t *this_gen) { dxr3_decoder_t *this = (dxr3_decoder_t *)this_gen; - + this->sequence_open = 0; } @@ -638,10 +638,10 @@ static void dxr3_discontinuity(video_decoder_t *this_gen) { } -static void dxr3_flush(video_decoder_t *this_gen) +static void dxr3_flush(video_decoder_t *this_gen) { dxr3_decoder_t *this = (dxr3_decoder_t *)this_gen; - + if (this->sequence_open && ++this->sequence_open > 5 && _x_stream_info_get(this->stream, XINE_STREAM_INFO_VIDEO_HAS_STILL)) { /* The dxr3 needs a sequence end code for still menus to work correctly @@ -659,18 +659,18 @@ static void dxr3_dispose(video_decoder_t *this_gen) { dxr3_decoder_t *this = (dxr3_decoder_t *)this_gen; metronom_clock_t *clock = this->class->clock; - + if (this->scr) clock->unregister_scr(clock, &this->scr->scr_plugin); - + dxr3_mvcommand(this->fd_control, MVCOMMAND_FLUSHBUF); - + if (this->fd_video >= 0) close(this->fd_video); close(this->fd_control); - + this->stream->video_out->close(this->stream->video_out, this->stream); this->class->instance = 0; - + free(this); } @@ -684,11 +684,11 @@ static void parse_mpeg_header(dxr3_decoder_t *this, uint8_t * buffer) this->width = ((this->height >> 12) + 15) & ~15; this->height = ((this->height & 0xfff) + 15) & ~15; this->aspect_code = buffer[3] >> 4; - + this->have_header_info = 1; - + if (this->force_aspect) this->aspect_code = this->force_aspect; - + /* when width, height or aspect changes, * we have to send an event for dxr3 spu decoder */ if (!this->last_width || !this->last_height || !this->last_aspect_code || @@ -705,7 +705,7 @@ static void parse_mpeg_header(dxr3_decoder_t *this, uint8_t * buffer) static int get_duration(dxr3_decoder_t *this) { int duration; - + switch (this->frame_rate_code) { case 1: /* 23.976 */ duration = 3754; /* actually it's 3753.75 */ @@ -732,19 +732,19 @@ static int get_duration(dxr3_decoder_t *this) duration = 1500; break; default: - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("dxr3_decode_video: WARNING: unknown frame rate code %d\n"), this->frame_rate_code); duration = 0; break; } - + /* update stream metadata */ _x_stream_info_set(this->stream, XINE_STREAM_INFO_FRAME_DURATION, duration); - + if (this->correct_durations && duration) { /* we set an initial average frame duration here */ if (!this->avg_duration) this->avg_duration = duration; - + /* Apply a correction to the framerate-code if metronom * insists on a different frame duration. * The code below is for NTCS streams labeled as PAL streams. @@ -769,7 +769,7 @@ static int get_duration(dxr3_decoder_t *this) return 3000; } } - + if (this->force_duration_window == -FORCE_DURATION_WINDOW_SIZE) /* we are far from a force_duration window */ return duration; @@ -782,7 +782,7 @@ static int get_duration(dxr3_decoder_t *this) this->force_duration_window = -FORCE_DURATION_WINDOW_SIZE; } } - + return duration; } @@ -801,7 +801,7 @@ static void frame_format_change(dxr3_decoder_t *this) data.aspect = this->aspect_code; data.pan_scan = this->force_pan_scan; xine_event_send(this->stream, &event); - + /* update ratio */ switch (this->aspect_code) { case 2: @@ -817,12 +817,12 @@ static void frame_format_change(dxr3_decoder_t *this) if (this->have_header_info) this->ratio = (double)this->width / (double)this->height; } - + /* update stream metadata */ _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_WIDTH, this->width); _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_HEIGHT, this->height); _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_RATIO, 10000 * this->ratio); - + _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, "MPEG (DXR3)"); } diff --git a/src/dxr3/dxr3_mpeg_encoders.c b/src/dxr3/dxr3_mpeg_encoders.c index 0077a465b..8ca48c6ae 100644 --- a/src/dxr3/dxr3_mpeg_encoders.c +++ b/src/dxr3/dxr3_mpeg_encoders.c @@ -1,26 +1,26 @@ -/* +/* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a unix video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA */ - + /* mpeg encoders for the dxr3 video out plugin. * supports the libfame and librte mpeg encoder libraries. - */ + */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -51,7 +51,7 @@ #include "xineutils.h" #include "video_out_dxr3.h" -/* buffer size for encoded mpeg1 stream; will hold one intra frame +/* buffer size for encoded mpeg1 stream; will hold one intra frame * at 640x480 typical sizes are <50 kB. 512 kB should be plenty */ #define DEFAULT_BUFFER_SIZE 512*1024 @@ -67,7 +67,7 @@ static int rte_on_unneeded(dxr3_driver_t *drv); static int rte_on_close(dxr3_driver_t *drv); /* helper function */ -static void mp1e_callback(rte_context *context, void *data, ssize_t size, +static void mp1e_callback(rte_context *context, void *data, ssize_t size, void *user_data); /* encoder structure */ @@ -103,7 +103,7 @@ typedef struct { } fame_data_t; /* helper function */ -static int fame_prepare_frame(fame_data_t *this, dxr3_driver_t *drv, +static int fame_prepare_frame(fame_data_t *this, dxr3_driver_t *drv, dxr3_frame_t *frame); #endif @@ -118,15 +118,15 @@ static int lavc_on_close(dxr3_driver_t *drv); int dxr3_rte_init(dxr3_driver_t *drv) { rte_data_t* this; - + if (!rte_init()) { xprintf(drv->class->xine, XINE_VERBOSITY_LOG, _("dxr3_mpeg_encoder: failed to init librte\n")); return 0; } - + this = calloc(1, sizeof(rte_data_t)); if (!this) return 0; - + this->encoder_data.type = ENC_RTE; this->encoder_data.on_update_format = rte_on_update_format; this->encoder_data.on_frame_copy = NULL; @@ -134,7 +134,7 @@ int dxr3_rte_init(dxr3_driver_t *drv) this->encoder_data.on_unneeded = rte_on_unneeded; this->encoder_data.on_close = rte_on_close; this->context = 0; - + drv->enc = &this->encoder_data; return 1; } @@ -142,7 +142,7 @@ int dxr3_rte_init(dxr3_driver_t *drv) static int rte_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame) { rte_data_t *this = (rte_data_t *)drv->enc; - rte_context *context; + rte_context *context; rte_codec *codec; double fps; @@ -152,13 +152,13 @@ static int rte_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame) rte_context_destroy(this->context); this->context = 0; } - + if ((frame->vo_frame.pitches[0] % 16 != 0) || (frame->oheight % 16 != 0)) { - xprintf(drv->class->xine, XINE_VERBOSITY_LOG, + xprintf(drv->class->xine, XINE_VERBOSITY_LOG, _("dxr3_mpeg_encoder: rte only handles video dimensions which are multiples of 16\n")); return 0; } - + this->width = frame->vo_frame.pitches[0]; this->height = frame->oheight; @@ -172,7 +172,7 @@ static int rte_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame) #if LOG_ENC rte_set_verbosity(context, 2); #endif - + /* get mpeg codec handle */ codec = rte_codec_set(context, RTE_STREAM_VIDEO, 0, "mpeg1_video"); if (!codec) { @@ -181,26 +181,26 @@ static int rte_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame) this->context = 0; return 0; } - + this->rte_bitrate = drv->class->xine->config->register_range(drv->class->xine->config, "dxr3.encoding.rte_bitrate", 10000, 1000, 20000, - _("rte mpeg output bitrate (kbit/s)"), + _("rte mpeg output bitrate (kbit/s)"), _("The bitrate the mpeg encoder library librte should use for DXR3's encoding mode. " "Higher values will increase quality and CPU usage."), 10, NULL, NULL); this->rte_bitrate *= 1000; /* config in kbit/s, rte wants bit/s */ - - /* FIXME: this needs to be replaced with a codec option call. + + /* FIXME: this needs to be replaced with a codec option call. * However, there seems to be none for the colour format! - * So we'll use the deprecated set_video_parameters instead. + * So we'll use the deprecated set_video_parameters instead. * Alternative is to manually set context->video_format (RTE_YU... ) * and context->video_bytes (= width * height * bytes/pixel) */ - rte_set_video_parameters(context, + rte_set_video_parameters(context, (frame->vo_frame.format == XINE_IMGFMT_YV12 ? RTE_YUV420 : RTE_YUYV), - context->width, context->height, + context->width, context->height, context->video_rate, context->output_video_bits, context->gop_sequence); - + /* Now set a whole bunch of codec options * If I understand correctly, virtual_frame_rate is the frame rate * of the source (can be anything), while coded_frame_rate must be @@ -208,27 +208,27 @@ static int rte_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame) */ fps = 90000.0 / frame->vo_frame.duration; if (!rte_option_set(codec, "virtual_frame_rate", fps)) - xprintf(drv->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(drv->class->xine, XINE_VERBOSITY_DEBUG, "dxr3_mpeg_encoder: WARNING: rte_option_set failed; virtual_frame_rate = %g.\n", fps); if (!rte_option_set(codec, "coded_frame_rate", fps)) - xprintf(drv->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(drv->class->xine, XINE_VERBOSITY_DEBUG, "dxr3_mpeg_encoder: WARNING: rte_option_set failed; coded_frame_rate = %g.\n", fps); if (!rte_option_set(codec, "bit_rate", (int)this->rte_bitrate)) xprintf(drv->class->xine, XINE_VERBOSITY_DEBUG, "dxr3_mpeg_encoder: WARNING: rte_option_set failed; bit_rate = %d.\n", (int)this->rte_bitrate); if (!rte_option_set(codec, "gop_sequence", "I")) - xprintf(drv->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(drv->class->xine, XINE_VERBOSITY_DEBUG, "dxr3_mpeg_encoder: WARNING: rte_option_set failed; gop_sequence = \"I\".\n"); /* just to be sure, disable motion comp (not needed in I frames) */ if (!rte_option_set(codec, "motion_compensation", 0)) xprintf(drv->class->xine, XINE_VERBOSITY_DEBUG, "dxr3_mpeg_encoder: WARNING: rte_option_set failed; motion_compensation = 0.\n"); - + rte_set_input(context, RTE_VIDEO, RTE_PUSH, FALSE, NULL, NULL, NULL); rte_set_output(context, mp1e_callback, NULL, NULL); - + if (!rte_init_context(context)) { - xprintf(drv->class->xine, XINE_VERBOSITY_LOG, + xprintf(drv->class->xine, XINE_VERBOSITY_LOG, _("dxr3_mpeg_encoder: cannot init the context: %s\n"), context->error); rte_context_destroy(context); this->context = 0; @@ -236,7 +236,7 @@ static int rte_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame) } /* do the sync'ing and start encoding */ if (!rte_start_encoding(context)) { - xprintf(drv->class->xine, XINE_VERBOSITY_LOG, + xprintf(drv->class->xine, XINE_VERBOSITY_LOG, _("dxr3_mpeg_encoder: cannot start encoding: %s\n"), context->error); rte_context_destroy(context); this->context = 0; @@ -244,11 +244,11 @@ static int rte_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame) } this->rte_ptr = rte_push_video_data(context, NULL, 0); if (!this->rte_ptr) { - xprintf(drv->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(drv->class->xine, XINE_VERBOSITY_DEBUG, "dxr3_mpeg_encoder: failed to get encoder buffer pointer.\n"); return 0; } - + return 1; } @@ -274,7 +274,7 @@ static int rte_on_display_frame(dxr3_driver_t *drv, dxr3_frame_t *frame) static int rte_on_unneeded(dxr3_driver_t *drv) { rte_data_t *this = (rte_data_t *)drv->enc; - + if (this->context) { rte_stop(this->context); rte_context_destroy(this->context); @@ -297,15 +297,15 @@ static void mp1e_callback(rte_context *context, void *data, ssize_t size, void * dxr3_driver_t *drv = (dxr3_driver_t *)user_data; char tmpstr[128]; ssize_t written; - + written = write(drv->fd_video, data, size); if (written < 0) { - xprintf(drv->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(drv->class->xine, XINE_VERBOSITY_DEBUG, "dxr3_mpeg_encoder: video device write failed (%s)\n", strerror(errno)); return; } if (written != size) - xprintf(drv->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(drv->class->xine, XINE_VERBOSITY_DEBUG, "dxr3_mpeg_encoder: Could only write %d of %d mpeg bytes.\n", written, size); } #endif @@ -315,10 +315,10 @@ static void mp1e_callback(rte_context *context, void *data, ssize_t size, void * int dxr3_fame_init(dxr3_driver_t *drv) { fame_data_t *this; - + this = calloc(1, sizeof(fame_data_t)); if (!this) return 0; - + this->encoder_data.type = ENC_FAME; this->encoder_data.on_update_format = fame_on_update_format; this->encoder_data.on_frame_copy = NULL; @@ -326,36 +326,36 @@ int dxr3_fame_init(dxr3_driver_t *drv) this->encoder_data.on_unneeded = fame_on_unneeded; this->encoder_data.on_close = fame_on_close; this->context = 0; - + drv->enc = &this->encoder_data; return 1; } -static int fame_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame) +static int fame_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame) { fame_data_t *this = (fame_data_t *)drv->enc; fame_parameters_t init_fp = FAME_PARAMETERS_INITIALIZER; double fps; - if (this->buf) free(this->buf); + if (this->buf) free(this->buf); this->buf = 0; this->out[0] = this->out[1] = this->out[2] = 0; - + /* if YUY2 and dimensions changed, we need to re-allocate the * internal YV12 buffer */ if (frame->vo_frame.format == XINE_IMGFMT_YUY2) { int image_size = frame->vo_frame.width * frame->oheight; - this->out[0] = xine_xmalloc_aligned(16, image_size * 3/2, + this->out[0] = xine_xmalloc_aligned(16, image_size * 3/2, (void *)&this->buf); - this->out[1] = this->out[0] + image_size; - this->out[2] = this->out[1] + image_size/4; + this->out[1] = this->out[0] + image_size; + this->out[2] = this->out[1] + image_size/4; /* fill with black (yuv 16,128,128) */ memset(this->out[0], 16, image_size); memset(this->out[1], 128, image_size/4); memset(this->out[2], 128, image_size/4); - lprintf("Using YUY2->YV12 conversion\n"); + lprintf("Using YUY2->YV12 conversion\n"); } if (this->context) { @@ -363,18 +363,18 @@ static int fame_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame) fame_close(this->context); this->context = 0; } - + this->context = fame_open(); if (!this->context) { - xprintf(drv->class->xine, XINE_VERBOSITY_LOG, + xprintf(drv->class->xine, XINE_VERBOSITY_LOG, _("dxr3_mpeg_encoder: Couldn't start the FAME library\n")); return 0; } - + if (!this->buffer) this->buffer = (unsigned char *)malloc(DEFAULT_BUFFER_SIZE); if (!this->buffer) { - xprintf(drv->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(drv->class->xine, XINE_VERBOSITY_DEBUG, "dxr3_mpeg_encoder: Couldn't allocate temp buffer for mpeg data\n"); return 0; } @@ -406,23 +406,23 @@ static int fame_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame) if (fps < 23.988) { /* NTSC-FILM */ lprintf("setting mpeg output framerate to NTSC-FILM (23.976 Hz)\n"); this->fp.frame_rate_num = 24000; - this->fp.frame_rate_den = 1001; + this->fp.frame_rate_den = 1001; } else if (fps < 24.5) { /* FILM */ lprintf("setting mpeg output framerate to FILM (24 Hz)\n"); this->fp.frame_rate_num = 24; - this->fp.frame_rate_den = 1; + this->fp.frame_rate_den = 1; } else if (fps < 27.485) { /* PAL */ lprintf("setting mpeg output framerate to PAL (25 Hz)\n"); this->fp.frame_rate_num = 25; - this->fp.frame_rate_den = 1; + this->fp.frame_rate_den = 1; } else { /* NTSC */ lprintf("setting mpeg output framerate to NTSC (29.97 Hz)\n"); this->fp.frame_rate_num = 30000; this->fp.frame_rate_den = 1001; } - + fame_init (this->context, &this->fp, this->buffer, DEFAULT_BUFFER_SIZE); - + return 1; } @@ -448,17 +448,17 @@ static int fame_on_display_frame(dxr3_driver_t *drv, dxr3_frame_t *frame) size = fame_encode_frame(this->context, &this->yuv, NULL); #endif - frame->vo_frame.free(&frame->vo_frame); - + frame->vo_frame.free(&frame->vo_frame); + written = write(drv->fd_video, this->buffer, size); if (written < 0) { - xprintf(drv->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(drv->class->xine, XINE_VERBOSITY_DEBUG, "dxr3_mpeg_encoder: video device write failed (%s)\n", strerror(errno)); return 0; } if (written != size) - xprintf(drv->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(drv->class->xine, XINE_VERBOSITY_DEBUG, "dxr3_mpeg_encoder: Could only write %d of %d mpeg bytes.\n", written, size); return 1; @@ -467,7 +467,7 @@ static int fame_on_display_frame(dxr3_driver_t *drv, dxr3_frame_t *frame) static int fame_on_unneeded(dxr3_driver_t *drv) { fame_data_t *this = (fame_data_t *)drv->enc; - + if (this->context) { fame_close(this->context); this->context = 0; @@ -494,7 +494,7 @@ static int fame_prepare_frame(fame_data_t *this, dxr3_driver_t *drv, dxr3_frame_ if (frame->vo_frame.format == XINE_IMGFMT_YUY2) { /* need YUY2->YV12 conversion */ if (!(this->out[0] && this->out[1] && this->out[2]) ) { - xprintf(drv->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(drv->class->xine, XINE_VERBOSITY_DEBUG, "dxr3_mpeg_encoder: Internal YV12 buffer not created.\n"); return 0; } @@ -544,13 +544,13 @@ int dxr3_lavc_init(dxr3_driver_t *drv, plugin_node_t *node) void *ffmpeg; int (*init)(dxr3_driver_t *); int result; - + ffmpeg = dlopen(node->file->filename, RTLD_LAZY); if (!ffmpeg) return 0; - + init = dlsym(ffmpeg, "dxr3_encoder_init"); if (!init) return 0; - + result = init(drv); /* the close function is implemented here, because it will call dlclose() * and that should not be done be the library we are closing... */ diff --git a/src/dxr3/dxr3_scr.c b/src/dxr3/dxr3_scr.c index c95ab00a7..dd0ea5840 100644 --- a/src/dxr3/dxr3_scr.c +++ b/src/dxr3/dxr3_scr.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -55,11 +55,11 @@ static void dxr3_scr_update_priority(void *this_gen, xine_cfg_entry_t *entry) static inline int dxr3_mvcommand(int fd_control, int command) { em8300_register_t reg; - + reg.microcode_register = 1; reg.reg = 0; reg.val = command; - + return ioctl(fd_control, EM8300_IOCTL_WRITEREG, ®); } @@ -69,21 +69,21 @@ dxr3_scr_t *dxr3_scr_init(xine_t *xine) dxr3_scr_t *this; int devnum; char tmpstr[128]; - + this = calloc(1, sizeof(dxr3_scr_t)); - + devnum = xine->config->register_num(xine->config, CONF_KEY, 0, CONF_NAME, CONF_HELP, 10, NULL, NULL); snprintf(tmpstr, sizeof(tmpstr), "/dev/em8300-%d", devnum); if ((this->fd_control = open(tmpstr, O_WRONLY)) < 0) { - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "dxr3_scr: Failed to open control device %s (%s)\n", tmpstr, strerror(errno)); free(this); return NULL; } - + this->xine = xine; - + this->scr_plugin.interface_version = 3; this->scr_plugin.get_priority = dxr3_scr_get_priority; this->scr_plugin.start = dxr3_scr_start; @@ -91,7 +91,7 @@ dxr3_scr_t *dxr3_scr_init(xine_t *xine) this->scr_plugin.adjust = dxr3_scr_adjust; this->scr_plugin.set_fine_speed = dxr3_scr_set_speed; this->scr_plugin.exit = dxr3_scr_exit; - + this->priority = xine->config->register_num( xine->config, "dxr3.scr_priority", 10, _("SCR plugin priority"), _("Priority of the DXR3 SCR plugin. Values less than 5 mean that the " @@ -102,9 +102,9 @@ dxr3_scr_t *dxr3_scr_init(xine_t *xine) this->last_pts = 0; this->scanning = 0; this->sync = 0; - + pthread_mutex_init(&this->mutex, NULL); - + lprintf("init complete\n"); return this; } @@ -120,7 +120,7 @@ static void dxr3_scr_start(scr_plugin_t *scr, int64_t vpts) { dxr3_scr_t *this = (dxr3_scr_t *)scr; uint32_t vpts32 = vpts >> 1; - + pthread_mutex_lock(&this->mutex); this->last_pts = vpts32; this->offset = vpts - ((int64_t)vpts32 << 1); @@ -140,7 +140,7 @@ static int64_t dxr3_scr_get_current(scr_plugin_t *scr) dxr3_scr_t *this = (dxr3_scr_t *)scr; uint32_t pts; int64_t current; - + pthread_mutex_lock(&this->mutex); if (ioctl(this->fd_control, EM8300_IOCTL_SCR_GET, &pts)) xprintf(this->xine, XINE_VERBOSITY_DEBUG, "dxr3_scr: get current failed (%s)\n", strerror(errno)); @@ -152,7 +152,7 @@ static int64_t dxr3_scr_get_current(scr_plugin_t *scr) this->last_pts = pts; current = ((int64_t)pts << 1) + this->offset; pthread_mutex_unlock(&this->mutex); - + return current; } @@ -161,7 +161,7 @@ static void dxr3_scr_adjust(scr_plugin_t *scr, int64_t vpts) dxr3_scr_t *this = (dxr3_scr_t *)scr; uint32_t current_pts32; int32_t offset32; - + pthread_mutex_lock(&this->mutex); if (ioctl(this->fd_control, EM8300_IOCTL_SCR_GET, ¤t_pts32)) xprintf(this->xine, XINE_VERBOSITY_DEBUG, "dxr3_scr: adjust get failed (%s)\n", strerror(errno)); @@ -187,7 +187,7 @@ static int dxr3_scr_set_speed(scr_plugin_t *scr, int speed) int playmode; pthread_mutex_lock(&this->mutex); - + em_speed = 0x900LL * (int64_t)speed / XINE_FINE_SPEED_NORMAL; switch (em_speed) { case 0: @@ -200,24 +200,24 @@ static int dxr3_scr_set_speed(scr_plugin_t *scr, int speed) playmode = MVCOMMAND_SYNC; else playmode = MVCOMMAND_START; - break; + break; default: playmode = MVCOMMAND_START; } - + if (dxr3_mvcommand(this->fd_control, playmode)) xprintf(this->xine, XINE_VERBOSITY_DEBUG, "dxr3_scr: failed to playmode (%s)\n", strerror(errno)); - + if(em_speed > 0x900) this->scanning = 1; else this->scanning = 0; - + if (ioctl(this->fd_control, EM8300_IOCTL_SCR_SETSPEED, &em_speed)) xprintf(this->xine, XINE_VERBOSITY_DEBUG, "dxr3_scr: failed to set speed (%s)\n", strerror(errno)); - + pthread_mutex_unlock(&this->mutex); - + lprintf("speed set to mode %d\n", speed); return speed; } @@ -225,7 +225,7 @@ static int dxr3_scr_set_speed(scr_plugin_t *scr, int speed) static void dxr3_scr_exit(scr_plugin_t *scr) { dxr3_scr_t *this = (dxr3_scr_t *)scr; - + close(this->fd_control); pthread_mutex_destroy(&this->mutex); free(this); @@ -237,8 +237,8 @@ static void dxr3_scr_exit(scr_plugin_t *scr) static void dxr3_scr_update_priority(void *this_gen, xine_cfg_entry_t *entry) { dxr3_scr_t *this = (dxr3_scr_t *)this_gen; - + this->priority = entry->num_value; - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "dxr3_scr: setting scr priority to %d\n", entry->num_value); } diff --git a/src/dxr3/dxr3_scr.h b/src/dxr3/dxr3_scr.h index d0e155c27..612f16ccb 100644 --- a/src/dxr3/dxr3_scr.h +++ b/src/dxr3/dxr3_scr.h @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -25,11 +25,11 @@ typedef struct dxr3_scr_s { scr_plugin_t scr_plugin; pthread_mutex_t mutex; - + xine_t *xine; - + int fd_control; /* to access the dxr3 control device */ - + int priority; int64_t offset; /* difference between real scr and internal dxr3 clock */ uint32_t last_pts; /* last known value of internal dxr3 clock to detect wrap around */ diff --git a/src/dxr3/dxr3_spu_encoder.c b/src/dxr3/dxr3_spu_encoder.c index 2517063ac..4eb506e8c 100644 --- a/src/dxr3/dxr3_spu_encoder.c +++ b/src/dxr3/dxr3_spu_encoder.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -68,7 +68,7 @@ static void write_nibble(spu_encoder_t *this, int *offset, int *higher_nibble spu_encoder_t *dxr3_spu_encoder_init(void) { spu_encoder_t *this; - + this = (spu_encoder_t *)malloc(sizeof(spu_encoder_t)); this->target = NULL; this->need_reencode = 0; @@ -94,7 +94,7 @@ void dxr3_spu_encode(spu_encoder_t *this) static void convert_palette(spu_encoder_t *this) { int i, y, cb, cr, r, g, b; - + if (!this->overlay->rgb_clut) { for (i = 0; i < OVL_PALETTE_SIZE; i++) { y = (this->overlay->color[i] >> 16) & 0xff; @@ -137,7 +137,7 @@ static void create_histogram(spu_encoder_t *this) { rle_elem_t *rle; int i, x, y, len, part; - + for (i = 0; i < OVL_PALETTE_SIZE; i++) this->map[i] = this->clip_map[i] = 0; x = y = 0; @@ -180,14 +180,14 @@ static void generate_clut(spu_encoder_t *this) { int i, max, spu_color; double dist, diff; - + /* find first maximum -> first spu color */ max = 0; for (i = 1; i < OVL_PALETTE_SIZE; i++) if (this->map[i] > this->map[max]) max = i; this->color[0] = this->overlay->color[max]; this->trans[0] = this->overlay->trans[max]; - + for (spu_color = 1; spu_color < 4; spu_color++) { /* modify histogram and find next maximum -> next spu color */ max = 0; @@ -221,7 +221,7 @@ static void generate_clut(spu_encoder_t *this) if (this->clip_map[i] > this->clip_map[max]) max = i; this->hili_color[0] = this->overlay->hili_color[max]; this->hili_trans[0] = this->overlay->hili_trans[max]; - + for (spu_color = 1; spu_color < 4; spu_color++) { /* modify histogram and find next maximum -> next spu color */ max = 0; @@ -252,7 +252,7 @@ static void map_colors(spu_encoder_t *this) { int i, min, spu_color; double dist, diff, min_dist; - + /* for all colors in overlay palette find closest spu color */ for (i = 0; i < OVL_PALETTE_SIZE; i++) { min = 0; @@ -299,7 +299,7 @@ static void map_colors(spu_encoder_t *this) static void convert_clut(spu_encoder_t *this) { int i, r, g, b, y, cb, cr; - + for (i = 0; i < 4; i++) { r = (this->color[i] >> 16) & 0xff; g = (this->color[i] >> 8) & 0xff; @@ -311,7 +311,7 @@ static void convert_clut(spu_encoder_t *this) } for (i = 4; i < 16; i++) this->color[i] = 0x00008080; - + for (i = 0; i < 4; i++) { r = (this->hili_color[i] >> 16) & 0xff; g = (this->hili_color[i] >> 8) & 0xff; @@ -330,15 +330,15 @@ static void convert_overlay(spu_encoder_t *this) int offset = 0, field_start[2]; rle_elem_t *rle; int field, i, len, part, x, y, higher_nibble = 1; - + /* size will be determined later */ write_byte(this, &offset, 0x00); write_byte(this, &offset, 0x00); - + /* control sequence pointer will be determined later */ write_byte(this, &offset, 0x00); write_byte(this, &offset, 0x00); - + for (field = 0; field < 2; field++) { write_byte(this, &offset, 0x00); write_byte(this, &offset, 0x00); @@ -373,10 +373,10 @@ static void convert_overlay(spu_encoder_t *this) } } } - + /* we should be byte aligned here */ _x_assert(higher_nibble); - + /* control sequence starts here */ this->target[2] = offset >> 8; this->target[3] = offset & 0xff; diff --git a/src/dxr3/em8300.h b/src/dxr3/em8300.h index 44fd8cac3..b862f1d49 100644 --- a/src/dxr3/em8300.h +++ b/src/dxr3/em8300.h @@ -186,7 +186,7 @@ typedef struct { #define IRQSTATUS_AUDIO_FIFO 0x8 #define ENCODER_UNKNOWN 0 -#define ENCODER_ADV7175 1 +#define ENCODER_ADV7175 1 #define ENCODER_ADV7170 2 #define ENCODER_BT865 3 @@ -235,21 +235,21 @@ struct em8300_audio_s { struct em8300_s { char name[40]; - + int chip_revision; int pci_revision; - + int inuse[4]; int nonblock[4]; int ucodeloaded; - + struct pci_dev *dev; ulong adr; volatile unsigned *mem; ulong memsize; - + int playmode; - + /* Sysfs */ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,46) struct class_device classdev; @@ -263,7 +263,7 @@ struct em8300_s struct fifo_s *mafifo; struct fifo_s *spfifo; int mtrr_reg; - + /* DICOM */ int dicom_vertoffset; int dicom_horizoffset; @@ -272,47 +272,47 @@ struct em8300_s int dicom_saturation; int dicom_tvout; struct displaybuffer_info_s dbuf_info; - + /* I2C */ int i2c_pin_reg; int i2c_oe_reg; - + /* different between revision 1 and revision 2 boards */ int mystery_divisor; - + /* I2C bus 1*/ struct i2c_algo_bit_data i2c_data_1; struct i2c_adapter i2c_ops_1; - + /* I2C bus 2*/ struct i2c_algo_bit_data i2c_data_2; struct i2c_adapter i2c_ops_2; - + /* I2C clients */ int encoder_type; struct i2c_client *encoder; - + /* Microcode registers */ unsigned ucode_regs[MAX_UCODE_REGISTER]; int var_ucode_reg1; /* These are registers that differ */ int var_ucode_reg2; /* between versions 1 and 2 of the board */ int var_ucode_reg3; /* " */ - + /* Interrupt */ unsigned irqmask; - + /* Clockgenerator */ int clockgen; int clockgen_overlaymode; int clockgen_tvmode; - + /* Timing measurement */ struct timeval tv, last_status_time; long irqtimediff; int irqcount; int frames; int scr; - + /* Audio */ struct em8300_audio_s audio; int audio_mode; @@ -321,7 +321,7 @@ struct em8300_s /* */ int dword_DB4; unsigned char byte_D90[24]; - + /* Video */ int video_mode; int video_playmode; @@ -330,7 +330,7 @@ struct em8300_s uint32_t video_lastpts; int video_ptsvalid,video_offset,video_count; int video_ptsfifo_ptr; -#if LINUX_VERSION_CODE < 0x020314 +#if LINUX_VERSION_CODE < 0x020314 struct wait_queue *video_ptsfifo_wait; struct wait_queue *vbi_wait; #else @@ -340,20 +340,20 @@ struct em8300_s int video_ptsfifo_waiting; int video_first; int var_video_value; - + /* Sub Picture */ int sp_pts, sp_ptsvalid, sp_count; int sp_ptsfifo_ptr; -#if LINUX_VERSION_CODE < 0x020314 +#if LINUX_VERSION_CODE < 0x020314 struct wait_queue *sp_ptsfifo_wait; #else wait_queue_head_t sp_ptsfifo_wait; #endif int sp_ptsfifo_waiting; int sp_mode; - + int linecounter; - + /* EM9010 overlay processor */ int overlay_enabled; int overlay_mode; @@ -373,7 +373,7 @@ struct em8300_s #if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,0) /* Memory exported via mmap() */ struct list_head memory; -#endif +#endif /* To support different options for different cards */ unsigned int card_nr; diff --git a/src/dxr3/video_out_dxr3.c b/src/dxr3/video_out_dxr3.c index 189824183..3d38e6640 100644 --- a/src/dxr3/video_out_dxr3.c +++ b/src/dxr3/video_out_dxr3.c @@ -1,28 +1,28 @@ -/* +/* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA */ - -/* mpeg1 encoding video out plugin for the dxr3. + +/* mpeg1 encoding video out plugin for the dxr3. * - * modifications to the original dxr3 video out plugin by + * modifications to the original dxr3 video out plugin by * Mike Lampard - * this first standalone version by + * this first standalone version by * Harm van der Heijden */ @@ -90,7 +90,7 @@ static const vo_info_t vo_info_dxr3_aa = { }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ #ifdef HAVE_X11 { PLUGIN_VIDEO_OUT, 21, "dxr3", XINE_VERSION_CODE, &vo_info_dxr3_x11, &dxr3_x11_init_plugin }, #endif @@ -149,7 +149,7 @@ static void dxr3_update_enhanced_mode(void *this_gen, xine_cfg_entry_t *e static void *dxr3_x11_init_plugin(xine_t *xine, void *visual_gen) { dxr3_driver_class_t *this = dxr3_vo_init_plugin(xine, visual_gen); - + if (!this) return NULL; this->visual_type = XINE_VISUAL_TYPE_X11; return &this->video_driver_class; @@ -159,7 +159,7 @@ static void *dxr3_x11_init_plugin(xine_t *xine, void *visual_gen) static void *dxr3_aa_init_plugin(xine_t *xine, void *visual_gen) { dxr3_driver_class_t *this = dxr3_vo_init_plugin(xine, visual_gen); - + if (!this) return NULL; this->visual_type = XINE_VISUAL_TYPE_AA; return &this->video_driver_class; @@ -168,10 +168,10 @@ static void *dxr3_aa_init_plugin(xine_t *xine, void *visual_gen) static dxr3_driver_class_t *dxr3_vo_init_plugin(xine_t *xine, void *visual_gen) { dxr3_driver_class_t *this; - + this = calloc(1, sizeof(dxr3_driver_class_t)); if (!this) return NULL; - + this->devnum = xine->config->register_num(xine->config, CONF_KEY, 0, CONF_NAME, CONF_HELP, 10, NULL, NULL); @@ -179,13 +179,13 @@ static dxr3_driver_class_t *dxr3_vo_init_plugin(xine_t *xine, void *visual_gen) this->video_driver_class.get_identifier = dxr3_vo_get_identifier; this->video_driver_class.get_description = dxr3_vo_get_description; this->video_driver_class.dispose = dxr3_vo_class_dispose; - + this->xine = xine; - + this->instance = 0; - + this->scr = dxr3_scr_init(xine); - + return this; } @@ -202,7 +202,7 @@ static char *dxr3_vo_get_description(video_driver_class_t *class_gen) static void dxr3_vo_class_dispose(video_driver_class_t *class_gen) { dxr3_driver_class_t *class = (dxr3_driver_class_t *)class_gen; - + if(class->scr) class->scr->scr_plugin.exit(&class->scr->scr_plugin); free(class_gen); @@ -229,12 +229,12 @@ static vo_driver_t *dxr3_vo_open_plugin(video_driver_class_t *class_gen, const v static const char const *tv_modes[] = { "ntsc", "pal", "pal60" , "default", NULL }; int list_id, list_size; xine_sarray_t *plugin_list; - + if (class->instance) return NULL; - + this = calloc(1, sizeof(dxr3_driver_t)); if (!this) return NULL; - + this->vo_driver.get_capabilities = dxr3_get_capabilities; this->vo_driver.alloc_frame = dxr3_alloc_frame; this->vo_driver.update_frame_format = dxr3_update_frame_format; @@ -248,13 +248,13 @@ static vo_driver_t *dxr3_vo_open_plugin(video_driver_class_t *class_gen, const v this->vo_driver.get_property_min_max = dxr3_get_property_min_max; this->vo_driver.gui_data_exchange = dxr3_gui_data_exchange; this->vo_driver.dispose = dxr3_dispose; - + pthread_mutex_init(&this->video_device_lock, NULL); pthread_mutex_init(&this->spu_device_lock, NULL); - + _x_vo_scale_init(&this->scale, 0, 0, config); _x_alphablend_init(&this->alphablend_extra_data, class->xine); - + this->class = class; this->swap_fields = config->register_bool(config, "dxr3.encoding.swap_fields", 0, _("swap odd and even lines"), @@ -271,7 +271,7 @@ static vo_driver_t *dxr3_vo_open_plugin(video_driver_class_t *class_gen, const v _("use smooth play mode for mpeg encoder playback"), _("Enabling this option will utilise a smoother play mode for non-MPEG content."), 20, dxr3_update_enhanced_mode, this); - + snprintf(tmpstr, sizeof(tmpstr), "/dev/em8300-%d", class->devnum); llprintf(LOG_VID, "Entering video init, devname = %s.\n", tmpstr); if ((this->fd_control = open(tmpstr, O_WRONLY)) < 0) { @@ -281,10 +281,10 @@ static vo_driver_t *dxr3_vo_open_plugin(video_driver_class_t *class_gen, const v return 0; } - + snprintf (tmpstr, sizeof(tmpstr), "/dev/em8300_mv-%d", class->devnum); if ((this->fd_video = open (tmpstr, O_WRONLY | O_SYNC )) < 0) { - xprintf(this->class->xine, XINE_VERBOSITY_LOG, + xprintf(this->class->xine, XINE_VERBOSITY_LOG, _("video_out_dxr3: Failed to open video device %s (%s)\n"), tmpstr, strerror(errno)); return 0; } @@ -342,45 +342,45 @@ static vo_driver_t *dxr3_vo_open_plugin(video_driver_class_t *class_gen, const v "but xine support for them is outdated, so these might fail to work."), 0, NULL, NULL); if ((strcmp(available_encoders[encoder], "libavcodec") == 0) && !dxr3_lavc_init(this, node)) { - xprintf(this->class->xine, XINE_VERBOSITY_LOG, + xprintf(this->class->xine, XINE_VERBOSITY_LOG, _("video_out_dxr3: Mpeg encoder libavcodec failed to init.\n")); return 0; } #ifdef HAVE_LIBRTE if ((strcmp(available_encoders[encoder], "rte") == 0) && !dxr3_rte_init(this)) { - xprintf(this->class->xine, XINE_VERBOSITY_LOG, + xprintf(this->class->xine, XINE_VERBOSITY_LOG, _("video_out_dxr3: Mpeg encoder rte failed to init.\n")); return 0; } #endif #ifdef HAVE_LIBFAME if ((strcmp(available_encoders[encoder], "fame") == 0) && !dxr3_fame_init(this)) { - xprintf(this->class->xine, XINE_VERBOSITY_LOG, + xprintf(this->class->xine, XINE_VERBOSITY_LOG, _("video_out_dxr3: Mpeg encoder fame failed to init.\n")); return 0; } #endif if (strcmp(available_encoders[encoder], "none") == 0) - xprintf(this->class->xine, XINE_VERBOSITY_LOG, + xprintf(this->class->xine, XINE_VERBOSITY_LOG, _("video_out_dxr3: Mpeg encoding disabled.\n" "video_out_dxr3: that's ok, you don't need it for mpeg video like DVDs, but\n" "video_out_dxr3: you will not be able to play non-mpeg content using this video out\n" "video_out_dxr3: driver. See the README.dxr3 for details on configuring an encoder.\n")); } else - xprintf(this->class->xine, XINE_VERBOSITY_LOG, + xprintf(this->class->xine, XINE_VERBOSITY_LOG, _("video_out_dxr3: No mpeg encoder compiled in.\n" "video_out_dxr3: that's ok, you don't need it for mpeg video like DVDs, but\n" "video_out_dxr3: you will not be able to play non-mpeg content using this video out\n" "video_out_dxr3: driver. See the README.dxr3 for details on configuring an encoder.\n")); - + /* init aspect */ this->aspect = dxr3_set_property(&this->vo_driver, VO_PROP_ASPECT_RATIO, XINE_VO_ASPECT_4_3); - + /* init brightness/contrast/saturation */ dxr3_set_property(&this->vo_driver, VO_PROP_BRIGHTNESS, 500); dxr3_set_property(&this->vo_driver, VO_PROP_CONTRAST , 500); dxr3_set_property(&this->vo_driver, VO_PROP_SATURATION, 500); - + /* overlay or tvout? */ confnum = config->register_enum(config, "dxr3.output.mode", 0, videoout_modes, _("video output mode (TV or overlay)"), @@ -446,7 +446,7 @@ static vo_driver_t *dxr3_vo_open_plugin(video_driver_class_t *class_gen, const v _("Removes one pixel line from the top and bottom of the overlay. Enable this, if " "you see green lines at the top or bottom of the overlay."), 10, NULL, NULL); } else { - xprintf(this->class->xine, XINE_VERBOSITY_LOG, + xprintf(this->class->xine, XINE_VERBOSITY_LOG, _("video_out_dxr3: please run autocal, overlay disabled\n")); this->overlay_enabled = 0; this->tv_switchable = 0; @@ -454,7 +454,7 @@ static vo_driver_t *dxr3_vo_open_plugin(video_driver_class_t *class_gen, const v } #endif } - + /* init tvmode */ confnum = config->register_enum(config, "dxr3.output.tvmode", 3, tv_modes, _("preferred tv mode"), _("Selects the TV mode to be used by the DXR3. The values mean:\n\n" @@ -478,50 +478,50 @@ static vo_driver_t *dxr3_vo_open_plugin(video_driver_class_t *class_gen, const v } if (this->tv_mode != EM8300_VIDEOMODE_DEFAULT) if (ioctl(this->fd_control, EM8300_IOCTL_SET_VIDEOMODE, &this->tv_mode)) - xprintf(this->class->xine, XINE_VERBOSITY_LOG, + xprintf(this->class->xine, XINE_VERBOSITY_LOG, _("video_out_dxr3: setting video mode failed.\n")); - + #ifdef HAVE_X11 /* initialize overlay */ if (this->overlay_enabled) { em8300_overlay_screen_t scr; int value; XColor dummy; - + this->overlay.fd_control = this->fd_control; - + /* allocate keycolor */ this->key.red = ((this->overlay.colorkey >> 16) & 0xff) * 256; this->key.green = ((this->overlay.colorkey >> 8) & 0xff) * 256; this->key.blue = ((this->overlay.colorkey ) & 0xff) * 256; XAllocColor(this->display, DefaultColormap(this->display, 0), &this->key); - + /* allocate black for output area borders */ XAllocNamedColor(this->display, DefaultColormap(this->display, 0), "black", &this->black, &dummy); - + /* set the screen */ scr.xsize = this->overlay.screen_xres; scr.ysize = this->overlay.screen_yres; if (ioctl(this->fd_control, EM8300_IOCTL_OVERLAY_SETSCREEN, &scr)) - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "video_out_dxr3: setting the overlay screen failed.\n"); - + if (dxr3_overlay_set_keycolor(&this->overlay) != 0) - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "video_out_dxr3: setting the overlay key colour failed.\n"); if (dxr3_overlay_set_attributes(&this->overlay) != 0) - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "video_out_dxr3: setting an overlay attribute failed.\n"); - + /* finally switch to overlay mode */ value = EM8300_OVERLAY_MODE_OVERLAY; if (ioctl(this->fd_control, EM8300_IOCTL_OVERLAY_SETMODE, &value) != 0) - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "video_out_dxr3: switching to overlay mode failed.\n"); } #endif - + return &this->vo_driver; } @@ -535,9 +535,9 @@ static vo_frame_t *dxr3_alloc_frame(vo_driver_t *this_gen) { dxr3_frame_t *frame; dxr3_driver_t *this = (dxr3_driver_t *)this_gen; - + frame = calloc(1, sizeof(dxr3_frame_t)); - + pthread_mutex_init(&frame->vo_frame.mutex, NULL); if (this->enc && this->enc->on_frame_copy) { @@ -559,7 +559,7 @@ static void dxr3_frame_proc_frame(vo_frame_t *frame_gen) /* we reduce the vpts to give the card some extra decoding time */ if (frame_gen->format != XINE_IMGFMT_DXR3 && !frame_gen->proc_called) frame_gen->vpts -= DECODE_PIPE_PREBUFFER; - + frame_gen->proc_called = 1; } @@ -567,11 +567,11 @@ static void dxr3_frame_proc_slice(vo_frame_t *frame_gen, uint8_t **src) { dxr3_frame_t *frame = (dxr3_frame_t *)frame_gen; dxr3_driver_t *this = (dxr3_driver_t *)frame_gen->driver; - + /* we reduce the vpts to give the card some extra decoding time */ if (frame_gen->format != XINE_IMGFMT_DXR3 && !frame_gen->proc_called) frame_gen->vpts -= DECODE_PIPE_PREBUFFER; - + frame_gen->proc_called = 1; if (frame_gen->format != XINE_IMGFMT_DXR3 && this->enc && this->enc->on_frame_copy) @@ -586,7 +586,7 @@ static void dxr3_frame_field(vo_frame_t *vo_img, int which_field) static void dxr3_frame_dispose(vo_frame_t *frame_gen) { dxr3_frame_t *frame = (dxr3_frame_t *)frame_gen; - + if (frame->mem) free(frame->mem); pthread_mutex_destroy(&frame_gen->mutex); free(frame); @@ -595,8 +595,8 @@ static void dxr3_frame_dispose(vo_frame_t *frame_gen) static void dxr3_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_gen, uint32_t width, uint32_t height, double ratio, int format, int flags) { - dxr3_driver_t *this = (dxr3_driver_t *)this_gen; - dxr3_frame_t *frame = (dxr3_frame_t *)frame_gen; + dxr3_driver_t *this = (dxr3_driver_t *)this_gen; + dxr3_frame_t *frame = (dxr3_frame_t *)frame_gen; uint32_t oheight; if (format == XINE_IMGFMT_DXR3) { /* talking to dxr3 decoder */ @@ -605,7 +605,7 @@ static void dxr3_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_ge pthread_mutex_lock(&this->video_device_lock); if (this->fd_video >= 0) { metronom_clock_t *clock = this->class->xine->clock; - + clock->unregister_scr(clock, &this->class->scr->scr_plugin); close(this->fd_video); this->fd_video = -1; @@ -613,10 +613,10 @@ static void dxr3_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_ge this->need_update = 1; } pthread_mutex_unlock(&this->video_device_lock); - + /* for mpeg source, we don't have to do much. */ this->video_width = 0; - + frame->vo_frame.width = width; frame->vo_frame.height = height; frame->vo_frame.ratio = ratio; @@ -626,23 +626,23 @@ static void dxr3_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_ge else frame->aspect = XINE_VO_ASPECT_ANAMORPHIC; frame->pan_scan = flags & VO_PAN_SCAN_FLAG; - + if (frame->mem) { free(frame->mem); frame->mem = NULL; frame->real_base[0] = frame->real_base[1] = frame->real_base[2] = NULL; frame_gen->base[0] = frame_gen->base[1] = frame_gen->base[2] = NULL; } - + return; } /* the following is for the mpeg encoding part only */ - + if (!this->add_bars) /* don't add black bars; assume source is in 4:3 */ ratio = 4.0/3.0; - + frame->vo_frame.ratio = ratio; frame->pan_scan = 0; frame->aspect = this->video_aspect; @@ -653,18 +653,18 @@ static void dxr3_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_ge metronom_clock_t *clock = this->class->xine->clock; char tmpstr[128]; int64_t time; - + /* open the device for the encoder */ snprintf(tmpstr, sizeof(tmpstr), "/dev/em8300_mv-%d", this->class->devnum); if ((this->fd_video = open(tmpstr, O_WRONLY)) < 0) - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "video_out_dxr3: Failed to open video device %s (%s)\n", tmpstr, strerror(errno)); - + /* start the scr plugin */ time = clock->get_current_time(clock); this->class->scr->scr_plugin.start(&this->class->scr->scr_plugin, time); clock->register_scr(clock, &this->class->scr->scr_plugin); - + this->scale.force_redraw = 1; } pthread_mutex_unlock(&this->video_device_lock); @@ -684,20 +684,20 @@ static void dxr3_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_ge /* still too high, use full height */ oheight = height; } - + /* use next multiple of 16 */ oheight = ((oheight - 1) | 15) + 1; /* Tell the viewers about the aspect ratio stuff. */ if (oheight - height > 0) - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "video_out_dxr3: adding %d black lines to get %s aspect ratio.\n", oheight - height, frame->aspect == XINE_VO_ASPECT_4_3 ? "4:3" : "16:9"); - /* make top black bar multiple of 16, - * so old and new macroblocks overlap */ + /* make top black bar multiple of 16, + * so old and new macroblocks overlap */ this->top_bar = ((oheight - height) / 32) * 16; - + this->video_width = width; this->video_iheight = height; this->video_oheight = oheight; @@ -708,27 +708,27 @@ static void dxr3_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_ge if (!this->enc) { /* no encoder plugin! Let's bug the user! */ - xprintf(this->class->xine, XINE_VERBOSITY_LOG, + xprintf(this->class->xine, XINE_VERBOSITY_LOG, _("video_out_dxr3: Need an mpeg encoder to play non-mpeg videos on dxr3\n" "video_out_dxr3: Read the README.dxr3 for details.\n")); } } /* if dimensions changed, we need to re-allocate frame memory */ - if ((frame->vo_frame.width != width) || (frame->vo_frame.height != height) || + if ((frame->vo_frame.width != width) || (frame->vo_frame.height != height) || (frame->oheight != oheight) || (frame->vo_frame.format != format)) { if (frame->mem) { free (frame->mem); frame->mem = NULL; } - + if (format == XINE_IMGFMT_YUY2) { int i, image_size; - + /* calculate pitch and size including black bars */ frame->vo_frame.pitches[0] = 32 * ((width + 15) / 16); image_size = frame->vo_frame.pitches[0] * oheight; - + /* planar format, only base[0] */ /* add one extra line for field swap stuff */ frame->real_base[0] = xine_xmalloc_aligned(16, image_size + frame->vo_frame.pitches[0], @@ -749,7 +749,7 @@ static void dxr3_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_ge } else { /* XINE_IMGFMT_YV12 */ int image_size_y, image_size_u, image_size_v; - + /* calculate pitches and sizes including black bars */ frame->vo_frame.pitches[0] = 16*((width + 15) / 16); frame->vo_frame.pitches[1] = 8*((width + 15) / 16); @@ -771,7 +771,7 @@ static void dxr3_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_ge frame->vo_frame.base[0] = frame->real_base[0] + frame->vo_frame.pitches[0] * this->top_bar; frame->vo_frame.base[1] = frame->real_base[1] + frame->vo_frame.pitches[1] * this->top_bar / 2; frame->vo_frame.base[2] = frame->real_base[2] + frame->vo_frame.pitches[2] * this->top_bar / 2; - + /* fill with black (yuv 16,128,128) */ memset(frame->real_base[0], 16, image_size_y); memset(frame->real_base[1], 128, image_size_u); @@ -780,12 +780,12 @@ static void dxr3_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_ge } if (this->swap_fields != frame->swap_fields) { - if (this->swap_fields) + if (this->swap_fields) frame->vo_frame.base[0] -= frame->vo_frame.pitches[0]; - else + else frame->vo_frame.base[0] += frame->vo_frame.pitches[0]; } - + frame->vo_frame.width = width; frame->vo_frame.height = height; frame->oheight = oheight; @@ -795,20 +795,20 @@ static void dxr3_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_ge static void dxr3_overlay_begin(vo_driver_t *this_gen, vo_frame_t *frame_gen, int changed) { dxr3_driver_t *this = (dxr3_driver_t *)this_gen; - + /* special treatment is only necessary for mpeg frames */ if (frame_gen->format != XINE_IMGFMT_DXR3) return; - + if (!this->spu_enc) this->spu_enc = dxr3_spu_encoder_init(); - + if (!changed) { this->spu_enc->need_reencode = 0; return; } - + this->spu_enc->need_reencode = 1; this->spu_enc->overlay = NULL; - + this->alphablend_extra_data.offset_x = frame_gen->overlay_offset_x; this->alphablend_extra_data.offset_y = frame_gen->overlay_offset_y; } @@ -817,10 +817,10 @@ static void dxr3_overlay_blend(vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) { dxr3_driver_t *this = (dxr3_driver_t *)this_gen; - + if (frame_gen->format != XINE_IMGFMT_DXR3) { dxr3_frame_t *frame = (dxr3_frame_t *)frame_gen; - + if (overlay->rle) { if (frame_gen->format == XINE_IMGFMT_YV12) _x_blend_yuv(frame->vo_frame.base, overlay, @@ -844,26 +844,26 @@ static void dxr3_overlay_end(vo_driver_t *this_gen, vo_frame_t *frame_gen) em8300_button_t btn; char tmpstr[128]; ssize_t written; - + if (frame_gen->format != XINE_IMGFMT_DXR3) return; if (!this->spu_enc->need_reencode) return; - + dxr3_spu_encode(this->spu_enc); pthread_mutex_lock(&this->spu_device_lock); - + /* try to open the dxr3 spu device */ if (!this->fd_spu) { snprintf (tmpstr, sizeof(tmpstr), "/dev/em8300_sp-%d", this->class->devnum); if ((this->fd_spu = open (tmpstr, O_WRONLY)) < 0) { - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "video_out_dxr3: Failed to open spu device %s (%s)\n" "video_out_dxr3: Overlays are not available\n", tmpstr, strerror(errno)); pthread_mutex_unlock(&this->spu_device_lock); return; } } - + if (!this->spu_enc->overlay) { uint8_t empty_spu[] = { 0x00, 0x26, 0x00, 0x08, 0x80, 0x00, 0x00, 0x80, @@ -877,7 +877,7 @@ static void dxr3_overlay_end(vo_driver_t *this_gen, vo_frame_t *frame_gen) pthread_mutex_unlock(&this->spu_device_lock); return; } - + /* copy clip palette */ this->spu_enc->color[4] = this->spu_enc->hili_color[0]; this->spu_enc->color[5] = this->spu_enc->hili_color[1]; @@ -885,16 +885,16 @@ static void dxr3_overlay_end(vo_driver_t *this_gen, vo_frame_t *frame_gen) this->spu_enc->color[7] = this->spu_enc->hili_color[3]; /* set palette */ if (ioctl(this->fd_spu, EM8300_IOCTL_SPU_SETPALETTE, this->spu_enc->color)) - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "video_out_dxr3: failed to set CLUT (%s)\n", strerror(errno)); this->clut_cluttered = 1; /* write spu */ written = write(this->fd_spu, this->spu_enc->target, this->spu_enc->size); if (written < 0) - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "video_out_dxr3: spu device write failed (%s)\n", strerror(errno)); else if (written != this->spu_enc->size) - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "video_out_dxr3: Could only write %zd of %d spu bytes.\n", written, this->spu_enc->size); /* set clipping */ btn.color = 0x7654; @@ -908,9 +908,9 @@ static void dxr3_overlay_end(vo_driver_t *this_gen, vo_frame_t *frame_gen) btn.top = this->spu_enc->overlay->y + this->spu_enc->overlay->hili_top; btn.bottom = this->spu_enc->overlay->y + this->spu_enc->overlay->hili_bottom - 2; if (ioctl(this->fd_spu, EM8300_IOCTL_SPU_BUTTON, &btn)) - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "dxr3_decode_spu: failed to set spu button (%s)\n", strerror(errno)); - + pthread_mutex_unlock(&this->spu_device_lock); } @@ -968,22 +968,22 @@ static void dxr3_display_frame(vo_driver_t *this_gen, vo_frame_t *frame_gen) } } #endif - + if (frame_gen->format != XINE_IMGFMT_DXR3 && this->enc && this->enc->on_display_frame) { - + pthread_mutex_lock(&this->video_device_lock); if (this->fd_video < 0) { /* no need to encode, when the device is already reserved for the decoder */ frame_gen->free(frame_gen); } else { uint32_t vpts32 = (uint32_t)(frame_gen->vpts + DECODE_PIPE_PREBUFFER); - + if (this->need_update) { /* we cannot do this earlier, because vo_frame.duration is only valid here */ if (this->enc && this->enc->on_update_format) { /* set the dxr3 playmode */ if (this->enc->on_update_format(this, frame) && this->enhanced_mode) { - em8300_register_t reg; + em8300_register_t reg; reg.microcode_register = 1; reg.reg = 0; reg.val = MVCOMMAND_SYNC; @@ -995,19 +995,19 @@ static void dxr3_display_frame(vo_driver_t *this_gen, vo_frame_t *frame_gen) } this->need_update = 0; } - + /* inform the card on the timing */ if (ioctl(this->fd_video, EM8300_IOCTL_VIDEO_SETPTS, &vpts32)) - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "video_out_dxr3: set video pts failed (%s)\n", strerror(errno)); - /* for non-mpeg, the encoder plugin is responsible for calling + /* for non-mpeg, the encoder plugin is responsible for calling * frame_gen->free(frame_gen) ! */ this->enc->on_display_frame(this, frame); } pthread_mutex_unlock(&this->video_device_lock); - + } else { - + if (this->need_update) { /* we do not need the mpeg encoders any more */ if (this->enc && this->enc->on_unneeded) @@ -1015,7 +1015,7 @@ static void dxr3_display_frame(vo_driver_t *this_gen, vo_frame_t *frame_gen) this->need_update = 0; } frame_gen->free(frame_gen); - + } } @@ -1023,11 +1023,11 @@ static int dxr3_redraw_needed(vo_driver_t *this_gen) { dxr3_driver_t *this = (dxr3_driver_t *)this_gen; -#ifdef HAVE_X11 +#ifdef HAVE_X11 if (this->overlay_enabled) dxr3_overlay_update(this); #endif - + return 0; } @@ -1055,7 +1055,7 @@ static int dxr3_get_property(vo_driver_t *this_gen, int property) case VO_PROP_WINDOW_HEIGHT: return this->scale.gui_height; } - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "video_out_dxr3: property %d not implemented.\n", property); return 0; } @@ -1086,7 +1086,7 @@ static int dxr3_set_property(vo_driver_t *this_gen, int property, int value) /* We should send an anamorphic hint to widescreen tvs, so they * can switch to 16:9 mode. But the dxr3 cannot do this. */ break; - + switch(value) { case XINE_VO_ASPECT_SQUARE: case XINE_VO_ASPECT_4_3: @@ -1102,13 +1102,13 @@ static int dxr3_set_property(vo_driver_t *this_gen, int property, int value) } if (ioctl(this->fd_control, EM8300_IOCTL_SET_ASPECTRATIO, &val)) - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "video_out_dxr3: failed to set aspect ratio (%s)\n", strerror(errno)); - + this->scale.force_redraw = 1; break; case VO_PROP_COLORKEY: - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "video_out_dxr3: VO_PROP_COLORKEY not implemented!"); this->overlay.colorkey = value; break; @@ -1143,16 +1143,16 @@ static int dxr3_set_property(vo_driver_t *this_gen, int property, int value) } #endif if (ioctl(this->fd_control, EM8300_IOCTL_SET_VIDEOMODE, &this->tv_mode)) - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "video_out_dxr3: setting video mode failed (%s)\n", strerror(errno)); break; } if (bcs_changed) if (ioctl(this->fd_control, EM8300_IOCTL_SETBCS, &this->bcs)) - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "video_out_dxr3: bcs set failed (%s)\n", strerror(errno)); - + return value; } @@ -1261,7 +1261,7 @@ static void dxr3_dispose(vo_driver_t *this_gen) pthread_mutex_destroy(&this->spu_device_lock); _x_alphablend_free(&this->alphablend_extra_data); - + free(this); } @@ -1297,7 +1297,7 @@ static void gather_screen_vars(dxr3_driver_t *this, const x11_visual_t *vis) this->overlay.screen_depth = DisplayPlanes(this->display, scrn); this->scale.frame_output_cb = (void *)vis->frame_output_cb; - + llprintf(LOG_OVR, "xres: %d, yres: %d, depth: %d\n", this->overlay.screen_xres, this->overlay.screen_yres, this->overlay.screen_depth); } @@ -1309,9 +1309,9 @@ static void gather_screen_vars(dxr3_driver_t *this, const x11_visual_t *vis) #define TYPE_FLOAT 4 struct lut_entry { - char *name; - int type; - void *ptr; + char *name; + int type; + void *ptr; }; /* dxr3_overlay_read_state helper function */ @@ -1319,7 +1319,7 @@ static int lookup_parameter(struct lut_entry *lut, char *name, void **ptr, int *type) { int i; - + for (i = 0; lut[i].name; i++) if (strcmp(name, lut[i].name) == 0) { *ptr = lut[i].ptr; @@ -1359,11 +1359,11 @@ static int dxr3_overlay_read_state(dxr3_overlay_t *this) * (used by .overlay/res file) */ setlocale(LC_NUMERIC, "C"); - asprintf(&fname, "%s/.overlay/res_%dx%dx%d", getenv("HOME"), + asprintf(&fname, "%s/.overlay/res_%dx%dx%d", getenv("HOME"), this->screen_xres, this->screen_yres, this->screen_depth); llprintf(LOG_OVR, "attempting to open %s\n", fname); if (!(fp = fopen(fname, "r"))) { - xprintf(this->xine, XINE_VERBOSITY_LOG, + xprintf(this->xine, XINE_VERBOSITY_LOG, _("video_out_dxr3: ERROR Reading overlay init file. Run autocal!\n")); free(fname); return -1; @@ -1402,11 +1402,11 @@ static int dxr3_overlay_read_state(dxr3_overlay_t *this) } } } - + fclose(fp); /* restore original locale */ setlocale(LC_NUMERIC, loc); - + return 0; } @@ -1441,7 +1441,7 @@ static int dxr3_overlay_set_keycolor(dxr3_overlay_t *this) attr.attribute = EM9010_ATTRIBUTE_KEYCOLOR_LOWER; attr.value = overlay_limit; if ((ret = ioctl(this->fd_control, EM8300_IOCTL_OVERLAY_SET_ATTRIBUTE, &attr)) < 0) { - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_dxr3: WARNING: error setting overlay lower limit attribute\n"); return ret; } @@ -1454,7 +1454,7 @@ static int dxr3_overlay_set_keycolor(dxr3_overlay_t *this) attr.attribute = EM9010_ATTRIBUTE_KEYCOLOR_UPPER; attr.value = overlay_limit; if ((ret = ioctl(this->fd_control, EM8300_IOCTL_OVERLAY_SET_ATTRIBUTE, &attr)) < 0) - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_dxr3: WARNING: error setting overlay upper limit attribute\n"); return ret; } @@ -1462,7 +1462,7 @@ static int dxr3_overlay_set_keycolor(dxr3_overlay_t *this) static int dxr3_overlay_set_attributes(dxr3_overlay_t *this) { em8300_attribute_t attr; - + attr.attribute = EM9010_ATTRIBUTE_XOFFSET; attr.value = this->xoffset; if(ioctl(this->fd_control, EM8300_IOCTL_OVERLAY_SET_ATTRIBUTE, &attr) == -1) @@ -1489,9 +1489,9 @@ static void dxr3_overlay_update(dxr3_driver_t *this) { if (_x_vo_scale_redraw_needed(&this->scale)) { em8300_overlay_window_t win; - + _x_vo_scale_compute_output_size(&this->scale); - + /* fill video window with keycolor */ XLockDisplay(this->display); XSetForeground(this->display, this->gc, this->black.pixel); @@ -1504,24 +1504,24 @@ static void dxr3_overlay_update(dxr3_driver_t *this) this->scale.output_width, this->scale.output_height - 2 * this->overlay.shrink); XFlush(this->display); XUnlockDisplay(this->display); - + win.xpos = this->scale.output_xoffset + this->scale.gui_win_x; win.ypos = this->scale.output_yoffset + this->scale.gui_win_y; win.width = this->scale.output_width; win.height = this->scale.output_height; - + if (this->pan_scan) { win.xpos -= win.width / 6; win.width *= 4; win.width /= 3; } - + /* is some part of the picture visible? */ if (win.xpos + win.width < 0) return; if (win.ypos + win.height < 0) return; if (win.xpos > this->overlay.screen_xres) return; if (win.ypos > this->overlay.screen_yres) return; - + ioctl(this->fd_control, EM8300_IOCTL_OVERLAY_SETWINDOW, &win); } } @@ -1530,20 +1530,20 @@ static void dxr3_overlay_update(dxr3_driver_t *this) static void dxr3_zoomTV(dxr3_driver_t *this) { em8300_register_t frame, visible, update; - + /* change left bound */ frame.microcode_register = 1; frame.reg = 93; // dicom frame left frame.val = 0x10; - + visible.microcode_register = 1; visible.reg = 97; // dicom visible left visible.val = 0x10; - + update.microcode_register = 1; update.reg = 65; // dicom_update update.val = 1; - + ioctl(this->fd_control, EM8300_IOCTL_WRITEREG, &frame); ioctl(this->fd_control, EM8300_IOCTL_WRITEREG, &visible); ioctl(this->fd_control, EM8300_IOCTL_WRITEREG, &update); @@ -1552,15 +1552,15 @@ static void dxr3_zoomTV(dxr3_driver_t *this) frame.microcode_register = 1; frame.reg = 94; // dicom frame right frame.val = 0x10; - + visible.microcode_register = 1; visible.reg = 98; // dicom visible right visible.val = 968; - + update.microcode_register = 1; update.reg = 65; // dicom_update update.val = 1; - + ioctl(this->fd_control, EM8300_IOCTL_WRITEREG, &frame); ioctl(this->fd_control, EM8300_IOCTL_WRITEREG, &visible); ioctl(this->fd_control, EM8300_IOCTL_WRITEREG, &update); @@ -1571,7 +1571,7 @@ static void dxr3_update_add_bars(void *data, xine_cfg_entry_t *entry) { dxr3_driver_t *this = (dxr3_driver_t *)data; this->add_bars = entry->num_value; - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "video_out_dxr3: setting add_bars to correct aspect ratio to %s\n", (this->add_bars ? "on" : "off")); } @@ -1579,7 +1579,7 @@ static void dxr3_update_swap_fields(void *data, xine_cfg_entry_t *entry) { dxr3_driver_t *this = (dxr3_driver_t *)data; this->swap_fields = entry->num_value; - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "video_out_dxr3: setting swap fields to %s\n", (this->swap_fields ? "on" : "off")); } @@ -1587,6 +1587,6 @@ static void dxr3_update_enhanced_mode(void *data, xine_cfg_entry_t *entry) { dxr3_driver_t *this = (dxr3_driver_t *)data; this->enhanced_mode = entry->num_value; - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "video_out_dxr3: setting enhanced encoding playback to %s\n", (this->enhanced_mode ? "on" : "off")); } diff --git a/src/dxr3/video_out_dxr3.h b/src/dxr3/video_out_dxr3.h index 0297204dd..4dce49f4d 100644 --- a/src/dxr3/video_out_dxr3.h +++ b/src/dxr3/video_out_dxr3.h @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2001 the xine project - * + * * This file is part of xine, a unix video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -48,7 +48,7 @@ struct coeff { typedef struct dxr3_overlay_s { xine_t *xine; - + int fd_control; int xoffset; @@ -70,12 +70,12 @@ typedef struct dxr3_overlay_s { typedef struct dxr3_driver_class_s { video_driver_class_t video_driver_class; xine_t *xine; - + int visual_type; int instance; /* we allow only one instance of this plugin */ - + int devnum; - + dxr3_scr_t *scr; /* to provide dxr3 clocking */ } dxr3_driver_class_t; @@ -89,11 +89,11 @@ typedef struct dxr3_driver_s { pthread_mutex_t spu_device_lock; int fd_spu; /* to access the relevant dxr3 devices */ int clut_cluttered; /* to tell spu decoder that it has to restore the palette */ - + int enhanced_mode; int swap_fields; /* swap fields */ int add_bars; /* add black bars to correct a.r. */ - + int aspect; int tv_mode; int pan_scan; @@ -105,14 +105,14 @@ typedef struct dxr3_driver_s { encoder_data_t *enc; /* mpeg encoder data */ spu_encoder_t *spu_enc; /* spu encoder */ int need_update; /* the mpeg encoder needs to be updated */ - + uint32_t video_iheight; /* input height (before adding black bars) */ uint32_t video_oheight; /* output height (after adding black bars) */ uint32_t video_width; double video_ratio; int video_aspect; int top_bar; /* the height of the upper black bar */ - + vo_scale_t scale; alphablend_t alphablend_extra_data; @@ -143,10 +143,10 @@ struct encoder_data_s { int (*on_display_frame)(dxr3_driver_t *, dxr3_frame_t *); int (*on_unneeded)(dxr3_driver_t *); int (*on_close)(dxr3_driver_t *); - + /* this is only used by the libavcodec encoder */ void *handle; -}; +}; struct spu_encoder_s { vo_overlay_t *overlay; diff --git a/src/input/Makefile.am b/src/input/Makefile.am index 998fc6c81..0748c8f29 100644 --- a/src/input/Makefile.am +++ b/src/input/Makefile.am @@ -49,7 +49,7 @@ in_rtp = xineplug_inp_rtp.la endif if DVB -in_dvb = xineplug_inp_dvb.la +in_dvb = xineplug_inp_dvb.la endif AM_CFLAGS = -D_LARGEFILE64_SOURCE $(GNOME_VFS_CFLAGS) $(ALSA_CFLAGS) $(DVD_CFLAGS) diff --git a/src/input/base64.c b/src/input/base64.c index ffb039802..17fa6f48a 100644 --- a/src/input/base64.c +++ b/src/input/base64.c @@ -25,17 +25,17 @@ MusicBrainz -- The Internet music metadatabase Copyright (C) 2000 Robert Kaye - + 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 2.1 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, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA diff --git a/src/input/base64.h b/src/input/base64.h index 5cc94d7f0..107704a6a 100644 --- a/src/input/base64.h +++ b/src/input/base64.h @@ -25,17 +25,17 @@ MusicBrainz -- The Internet music metadatabase Copyright (C) 2000 Robert Kaye - + 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 2.1 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, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA diff --git a/src/input/dvb/Makefile.am b/src/input/dvb/Makefile.am index 229ac21bf..84310507c 100644 --- a/src/input/dvb/Makefile.am +++ b/src/input/dvb/Makefile.am @@ -2,4 +2,4 @@ include $(top_srcdir)/misc/Makefile.common noinst_HEADERS = \ dmx.h \ - frontend.h + frontend.h diff --git a/src/input/dvb/dmx.h b/src/input/dvb/dmx.h index 51d3c48cd..018c7de59 100644 --- a/src/input/dvb/dmx.h +++ b/src/input/dvb/dmx.h @@ -1,4 +1,4 @@ -/* +/* * dmx.h * * Copyright (C) 2000 Marcus Metzler @@ -149,7 +149,7 @@ struct dmx_event typedef struct dmx_caps { uint32_t caps; - int num_decoders; + int num_decoders; } dmx_caps_t; typedef enum { @@ -164,7 +164,7 @@ typedef enum { } dmx_source_t; -#define DMX_START _IO('o',41) +#define DMX_START _IO('o',41) #define DMX_STOP _IO('o',42) #define DMX_SET_FILTER _IOW('o',43,struct dmx_sct_filter_params) #define DMX_SET_PES_FILTER _IOW('o',44,struct dmx_pes_filter_params) diff --git a/src/input/http_helper.c b/src/input/http_helper.c index db93b9b45..eb28140ff 100644 --- a/src/input/http_helper.c +++ b/src/input/http_helper.c @@ -65,11 +65,11 @@ int _x_parse_url (char *url, char **proto, char** host, int *port, *password = NULL; *uri = NULL; - /* proto */ + /* proto */ start = strstr(url, "://"); if (!start || (start == url)) goto error; - + end = start + strlen(start) - 1; *proto = strndup(url, start - url); @@ -85,10 +85,10 @@ int _x_parse_url (char *url, char **proto, char** host, int *port, semicolon = strchr(start, ';'); if (semicolon && (!slash || (semicolon < slash))) slash = semicolon; - + if (at && slash && (at > slash)) at = NULL; - + if (at) { authcolon = strchr(start, ':'); if(authcolon && authcolon < at) { @@ -179,7 +179,7 @@ int _x_parse_url (char *url, char **proto, char** host, int *port, escapechars++; it++; } - + if ( escapechars == 0 ) *uri = strdup(start); else { @@ -204,9 +204,9 @@ int _x_parse_url (char *url, char **proto, char** host, int *port, } else { *uri = strdup("/"); } - + return 1; - + error: if (*proto) { free (*proto); @@ -231,7 +231,7 @@ error: free (*uri); *uri = NULL; } - return 0; + return 0; } char *_x_canonicalise_url (const char *base, const char *url) { @@ -267,7 +267,7 @@ static int check_url(char *url, int ok) { char *proto, *host, *user, *password, *uri; int port; int res; - + printf("--------------------------------\n"); printf("url=%s\n", url); res = _x_parse_url (url, @@ -310,7 +310,7 @@ static int check_paste(const char *base, const char *url, const char *ok) { int main(int argc, char** argv) { char *proto, host, port, user, password, uri; int res = 0; - + res += check_url("http://www.toto.com/test1.asx", 1); res += check_url("http://www.toto.com:8080/test2.asx", 1); res += check_url("http://titi:pass@www.toto.com:8080/test3.asx", 1); diff --git a/src/input/input_cdda.c b/src/input/input_cdda.c index 70bd34f35..1751f031c 100644 --- a/src/input/input_cdda.c +++ b/src/input/input_cdda.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * - * Compact Disc Digital Audio (CDDA) Input Plugin + * Compact Disc Digital Audio (CDDA) Input Plugin * by Mike Melanson (melanson@pcisys.net) */ @@ -129,8 +129,8 @@ typedef struct { int enabled; char *server; int port; - char *cache_dir; - + char *cache_dir; + char *cdiscid; char *disc_title; char *disc_year; @@ -178,7 +178,7 @@ typedef struct { char *cdda_device; int cddb_error; - + cdda_input_plugin_t *ip; int show_hidden_files; @@ -186,7 +186,7 @@ typedef struct { int mrls_allocated_entries; xine_mrl_t **mrls; - + char *autoplaylist[MAX_TRACKS]; } cdda_input_class_t; @@ -318,54 +318,54 @@ struct SRB_ExecSCSICmd #ifdef LOG static void print_cdrom_toc(cdrom_toc *toc) { - + int i; int time1; int time2; int timediff; - + printf("\ntoc:\n"); printf("\tfirst track = %d\n", toc->first_track); printf("\tlast track = %d\n", toc->last_track); printf("\ttotal tracks = %d\n", toc->total_tracks); printf("\ntoc entries:\n"); - - + + printf("leadout track: Control: %d MSF: %02d:%02d:%04d, first frame = %d\n", toc->leadout_track.track_mode, toc->leadout_track.first_frame_minute, toc->leadout_track.first_frame_second, toc->leadout_track.first_frame_frame, toc->leadout_track.first_frame); - + /* fetch each toc entry */ - if (toc->first_track > 0) { - for (i = toc->first_track; i <= toc->last_track; i++) { + if (toc->first_track > 0) { + for (i = toc->first_track; i <= toc->last_track; i++) { printf("\ttrack mode = %d", toc->toc_entries[i-1].track_mode); - printf("\ttrack %d, audio, MSF: %02d:%02d:%02d, first frame = %d\n", - i, + printf("\ttrack %d, audio, MSF: %02d:%02d:%02d, first frame = %d\n", + i, toc->toc_entries[i-1].first_frame_minute, toc->toc_entries[i-1].first_frame_second, toc->toc_entries[i-1].first_frame_frame, toc->toc_entries[i-1].first_frame); - - time1 = ((toc->toc_entries[i-1].first_frame_minute * 60) + + + time1 = ((toc->toc_entries[i-1].first_frame_minute * 60) + toc->toc_entries[i-1].first_frame_second); - + if (i == toc->last_track) { time2 = ((toc->leadout_track.first_frame_minute * 60) + toc->leadout_track.first_frame_second); } else { - time2 = ((toc->toc_entries[i].first_frame_minute * 60) + + time2 = ((toc->toc_entries[i].first_frame_minute * 60) + toc->toc_entries[i].first_frame_second); } - + timediff = time2 - time1; - + printf("\t time: %02d:%02d\n", timediff/60, timediff%60); } - } + } } #endif @@ -419,7 +419,7 @@ static int read_cdrom_toc(int fd, cdrom_toc *toc) { toc->ignore_last_track = 0; } toc->total_tracks = toc->last_track - toc->first_track + 1; - + /* allocate space for the toc entries */ toc->toc_entries = calloc(toc->total_tracks, sizeof(cdrom_toc_entry)); if (!toc->toc_entries) { @@ -790,7 +790,7 @@ static int read_cdrom_frames(cdda_input_plugin_t *this_gen, int frame, int num_f return -1; } #endif - + data += CD_RAW_FRAME_SIZE; frame++; num_frames--; @@ -807,44 +807,44 @@ static int read_cdrom_toc(cdda_input_plugin_t *this_gen, cdrom_toc *toc) { /* This is for ASPI which obviously isn't supported! */ lprintf("Windows ASPI support is not complete yet!\n"); return -1; - + } else { DWORD dwBytesReturned; CDROM_TOC cdrom_toc; int i; - + if( DeviceIoControl( this_gen->h_device_handle, IOCTL_CDROM_READ_TOC, NULL, 0, &cdrom_toc, sizeof(CDROM_TOC), &dwBytesReturned, NULL ) == 0 ) { #ifdef LOG - DWORD dw; + DWORD dw; printf( "input_cdda: could not read TOCHDR\n" ); dw = GetLastError(); - printf("GetLastError returned %u\n", dw); + printf("GetLastError returned %u\n", dw); #endif return -1; } - + toc->first_track = cdrom_toc.FirstTrack; toc->last_track = cdrom_toc.LastTrack; toc->total_tracks = toc->last_track - toc->first_track + 1; - + /* allocate space for the toc entries */ toc->toc_entries = calloc(toc->total_tracks, sizeof(cdrom_toc_entry)); if (!toc->toc_entries) { perror("calloc"); return -1; } - + /* fetch each toc entry */ for (i = toc->first_track; i <= toc->last_track; i++) { - + toc->toc_entries[i-1].track_mode = (cdrom_toc.TrackData[i-1].Control & 0x04) ? 1 : 0; toc->toc_entries[i-1].first_frame_minute = cdrom_toc.TrackData[i-1].Address[1]; toc->toc_entries[i-1].first_frame_second = cdrom_toc.TrackData[i-1].Address[2]; @@ -866,7 +866,7 @@ static int read_cdrom_toc(cdda_input_plugin_t *this_gen, cdrom_toc *toc) { (toc->leadout_track.first_frame_minute * CD_SECONDS_PER_MINUTE * CD_FRAMES_PER_SECOND) + (toc->leadout_track.first_frame_second * CD_FRAMES_PER_SECOND) + toc->leadout_track.first_frame_frame; - } + } return 0; } @@ -883,37 +883,37 @@ static int read_cdrom_frames(cdda_input_plugin_t *this_gen, int frame, int num_f /* This is for ASPI which obviously isn't supported! */ lprintf("Windows ASPI support is not complete yet!\n"); return -1; - + } else { memset(data, 0, CD_RAW_FRAME_SIZE * num_frames); - + while( num_frames ) { - + #ifdef LOG /*printf("\t Raw read frame %d\n", frame);*/ #endif raw_read_info.DiskOffset.QuadPart = frame * CD_SECTOR_SIZE; raw_read_info.SectorCount = 1; raw_read_info.TrackMode = CDDA; - + /* read a frame */ if( DeviceIoControl( this_gen->h_device_handle, IOCTL_CDROM_RAW_READ, - &raw_read_info, sizeof(RAW_READ_INFO), data, + &raw_read_info, sizeof(RAW_READ_INFO), data, CD_RAW_FRAME_SIZE, &dwBytesReturned, NULL ) == 0 ) { #ifdef LOG - DWORD dw; + DWORD dw; printf( "input_cdda: could not read frame\n" ); dw = GetLastError(); - printf("GetLastError returned %u\n", dw); + printf("GetLastError returned %u\n", dw); #endif return -1; } - + data += CD_RAW_FRAME_SIZE; frame++; num_frames--; @@ -1019,7 +1019,7 @@ network_command( xine_stream_t *stream, int socket, char *data_buf, char *msg, . if( n ) { if( !data_buf ) { if (stream) - xprintf(stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "input_cdda: protocol error, data returned but no buffer provided.\n"); return -1; } @@ -1144,12 +1144,12 @@ static int network_read_cdrom_frames(xine_stream_t *stream, int fd, int first_fr */ static void cdda_device_cb(void *data, xine_cfg_entry_t *cfg) { cdda_input_class_t *class = (cdda_input_class_t *) data; - + class->cdda_device = cfg->str_value; } static void enable_cddb_changed_cb(void *data, xine_cfg_entry_t *cfg) { cdda_input_class_t *class = (cdda_input_class_t *) data; - + if(class->ip) { cdda_input_plugin_t *this = class->ip; @@ -1160,7 +1160,7 @@ static void enable_cddb_changed_cb(void *data, xine_cfg_entry_t *cfg) { } static void server_changed_cb(void *data, xine_cfg_entry_t *cfg) { cdda_input_class_t *class = (cdda_input_class_t *) data; - + if(class->ip) { cdda_input_plugin_t *this = class->ip; @@ -1171,7 +1171,7 @@ static void server_changed_cb(void *data, xine_cfg_entry_t *cfg) { } static void port_changed_cb(void *data, xine_cfg_entry_t *cfg) { cdda_input_class_t *class = (cdda_input_class_t *) data; - + if(class->ip) { cdda_input_plugin_t *this = class->ip; @@ -1182,7 +1182,7 @@ static void port_changed_cb(void *data, xine_cfg_entry_t *cfg) { } static void cachedir_changed_cb(void *data, xine_cfg_entry_t *cfg) { cdda_input_class_t *class = (cdda_input_class_t *) data; - + if(class->ip) { cdda_input_plugin_t *this = class->ip; @@ -1192,7 +1192,7 @@ static void cachedir_changed_cb(void *data, xine_cfg_entry_t *cfg) { #ifdef CDROM_SELECT_SPEED static void speed_changed_cb(void *data, xine_cfg_entry_t *cfg) { cdda_input_class_t *class = (cdda_input_class_t *) data; - + if (class->ip) { cdda_input_plugin_t *this = class->ip; if (this->fd != -1) @@ -1209,21 +1209,21 @@ static void speed_changed_cb(void *data, xine_cfg_entry_t *cfg) { static int _cdda_is_cd_changed(cdda_input_plugin_t *this) { #ifdef CDROM_MEDIA_CHANGED int err, cd_changed=0; - + if(this == NULL || this->fd < 0) return -1; - + if((err = ioctl(this->fd, CDROM_MEDIA_CHANGED, cd_changed)) < 0) { xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "input_cdda: ioctl(CDROM_MEDIA_CHANGED) failed: %s.\n", strerror(errno)); return -1; } - + switch(err) { case 1: return 1; break; - + default: return 0; break; @@ -1233,7 +1233,7 @@ static int _cdda_is_cd_changed(cdda_input_plugin_t *this) { #else /* * At least on solaris, CDROM_MEDIA_CHANGED does not exist. Just return an - * error for now + * error for now */ return -1; #endif @@ -1243,18 +1243,18 @@ static int _cdda_is_cd_changed(cdda_input_plugin_t *this) { * create a directory, in safe mode */ static void _cdda_mkdir_safe(xine_t *xine, char *path) { - + if(path == NULL) return; - + #ifndef WIN32 { struct stat pstat; - + if((stat(path, &pstat)) < 0) { /* file or directory no exist, create it */ if(mkdir(path, 0755) < 0) { - xprintf(xine, XINE_VERBOSITY_DEBUG, + xprintf(xine, XINE_VERBOSITY_DEBUG, "input_cdda: mkdir(%s) failed: %s.\n", path, strerror(errno)); return; } @@ -1271,10 +1271,10 @@ static void _cdda_mkdir_safe(xine_t *xine, char *path) { HANDLE hList; TCHAR szDir[MAX_PATH+3]; WIN32_FIND_DATA FileData; - + // Get the proper directory path sprintf(szDir, "%s\\*", path); - + // Get the first file hList = FindFirstFile(szDir, &FileData); if (hList == INVALID_HANDLE_VALUE) @@ -1282,9 +1282,9 @@ static void _cdda_mkdir_safe(xine_t *xine, char *path) { if(_mkdir(path) != 0) { xprintf(xine, XINE_VERBOSITY_DEBUG, "input_cdda: mkdir(%s) failed.\n", path); return; - } + } } - + FindClose(hList); } #endif /* WIN32 */ @@ -1320,7 +1320,7 @@ static void _cdda_mkdir_recursive_safe(xine_t *xine, char *path) { snprintf(buf2, sizeof(buf2), "%s", p); } #endif /* WIN32 */ - + _cdda_mkdir_safe(xine, buf2); } } @@ -1331,10 +1331,10 @@ static void _cdda_mkdir_recursive_safe(xine_t *xine, char *path) { */ static char *_cdda_cddb_get_default_location(void) { static char buf[XINE_PATH_MAX + XINE_NAME_MAX + 1]; - + memset(&buf, 0, sizeof(buf)); snprintf(buf, sizeof(buf), "%s/.xine/cddbcache", (xine_get_homedir())); - + return buf; } @@ -1354,12 +1354,12 @@ static int _cdda_cddb_socket_read(cdda_input_plugin_t *this, char *str, int size * Send a command to socket */ static int _cdda_cddb_send_command(cdda_input_plugin_t *this, char *cmd) { - + if((this == NULL) || (this->cddb.fd < 0) || (cmd == NULL)) return -1; xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, ">>> %s\n", cmd); - + return (int)_x_io_tcp_write(this->stream, this->cddb.fd, cmd, strlen(cmd)); } @@ -1429,7 +1429,7 @@ static int _cdda_cddb_handle_code(char *buf) { break; } } - + return err; } @@ -1510,20 +1510,20 @@ static int _cdda_load_cached_cddb_infos(cdda_input_plugin_t *this) { if(this == NULL) return 0; - + cdir_size = snprintf(cdir, sizeof(cdir), "%s", this->cddb.cache_dir); - + if((dir = opendir(cdir)) != NULL) { struct dirent *pdir; - + while((pdir = readdir(dir)) != NULL) { char discid[9]; - + snprintf(discid, sizeof(discid), "%08" PRIx32, this->cddb.disc_id); - + if(!strcasecmp(pdir->d_name, discid)) { FILE *fd; - + cdir_size += snprintf(cdir + cdir_size, sizeof(cdir) - cdir_size, "/%s", discid); if((fd = fopen(cdir, "r")) == NULL) { xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, @@ -1534,7 +1534,7 @@ static int _cdda_load_cached_cddb_infos(cdda_input_plugin_t *this) { else { char buffer[2048], *ln; char *dtitle = NULL; - + while ((ln = fgets(buffer, sizeof (buffer) - 1, fd)) != NULL) { int length = strlen (buffer); @@ -1546,7 +1546,7 @@ static int _cdda_load_cached_cddb_infos(cdda_input_plugin_t *this) { fclose(fd); free(dtitle); } - + closedir(dir); return 1; } @@ -1555,7 +1555,7 @@ static int _cdda_load_cached_cddb_infos(cdda_input_plugin_t *this) { "input_cdda: cached entry for disc ID %08" PRIx32 " not found.\n", this->cddb.disc_id); closedir(dir); } - + return 0; } @@ -1565,19 +1565,19 @@ static int _cdda_load_cached_cddb_infos(cdda_input_plugin_t *this) { static void _cdda_save_cached_cddb_infos(cdda_input_plugin_t *this, char *filecontent) { char cfile[XINE_PATH_MAX + XINE_NAME_MAX + 1]; FILE *fd; - + if((this == NULL) || (filecontent == NULL)) return; - + memset(&cfile, 0, sizeof(cfile)); /* Ensure "~/.xine/cddbcache" exist */ snprintf(cfile, sizeof(cfile), "%s", this->cddb.cache_dir); - + _cdda_mkdir_recursive_safe(this->stream->xine, cfile); - + snprintf(cfile, sizeof(cfile), "%s/%08" PRIx32 , this->cddb.cache_dir, this->cddb.disc_id); - + if((fd = fopen(cfile, "w")) == NULL) { xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "input_cdda: fopen(%s) failed: %s.\n", cfile, strerror(errno)); @@ -1587,7 +1587,7 @@ static void _cdda_save_cached_cddb_infos(cdda_input_plugin_t *this, char *fileco fprintf(fd, "%s", filecontent); fclose(fd); } - + } /* @@ -1615,7 +1615,7 @@ static int _cdda_cddb_socket_open(cdda_input_plugin_t *this) { * Close the socket */ static void _cdda_cddb_socket_close(cdda_input_plugin_t *this) { - + if((this == NULL) || (this->cddb.fd < 0)) return; @@ -1635,7 +1635,7 @@ static int _cdda_cddb_retrieve(cdda_input_plugin_t *this) { if(this == NULL) { return 0; } - + if(_cdda_load_cached_cddb_infos(this)) { this->cddb.have_cddb_info = 1; return 1; @@ -1724,7 +1724,7 @@ static int _cdda_cddb_retrieve(cdda_input_plugin_t *this) { xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "input_cdda: error while sending cddb query command.\n"); _cdda_cddb_socket_close(this); - return 0; + return 0; } memset(&buffer, 0, sizeof(buffer)); @@ -1749,7 +1749,7 @@ static int _cdda_cddb_retrieve(cdda_input_plugin_t *this) { i++; } } - + if ((err == 210) || (err == 211)) { memset(&buffer, 0, sizeof(buffer)); err = _cdda_cddb_socket_read(this, buffer, sizeof(buffer) - 1); @@ -1780,7 +1780,7 @@ static int _cdda_cddb_retrieve(cdda_input_plugin_t *this) { return 0; } } - } + } /* Send read command */ memset(&buffer, 0, sizeof(buffer)); snprintf(buffer, sizeof(buffer), "cddb read %s %s\n", this->cddb.disc_category, this->cddb.cdiscid); @@ -1799,7 +1799,7 @@ static int _cdda_cddb_retrieve(cdda_input_plugin_t *this) { _cdda_cddb_socket_close(this); return 0; } - + this->cddb.have_cddb_info = 1; memset(&buffercache, 0, sizeof(buffercache)); @@ -1813,7 +1813,7 @@ static int _cdda_cddb_retrieve(cdda_input_plugin_t *this) { _cdda_parse_cddb_info (this, buffer, &dtitle); } free(dtitle); - + /* Save cddb info and close socket */ _cdda_save_cached_cddb_infos(this, buffercache); _cdda_cddb_socket_close(this); @@ -1829,7 +1829,7 @@ static int _cdda_cddb_retrieve(cdda_input_plugin_t *this) { */ static unsigned int _cdda_cddb_sum(int n) { unsigned int ret = 0; - + while(n > 0) { ret += (n % 10); n /= 10; @@ -1838,15 +1838,15 @@ static unsigned int _cdda_cddb_sum(int n) { } static uint32_t _cdda_calc_cddb_id(cdda_input_plugin_t *this) { int i, tsum = 0; - + if(this == NULL || (this->cddb.num_tracks <= 0)) return 0; - + for(i = 0; i < this->cddb.num_tracks; i++) tsum += _cdda_cddb_sum((this->cddb.track[i].start / CD_FRAMES_PER_SECOND)); - + return ((tsum % 0xff) << 24 - | (this->cddb.disc_length - (this->cddb.track[0].start / CD_FRAMES_PER_SECOND)) << 8 + | (this->cddb.disc_length - (this->cddb.track[0].start / CD_FRAMES_PER_SECOND)) << 8 | this->cddb.num_tracks); } @@ -1915,22 +1915,22 @@ static void _cdda_free_cddb_info(cdda_input_plugin_t *this) { } free(this->cddb.track); - + if(this->cddb.cdiscid) free(this->cddb.cdiscid); - + if(this->cddb.disc_title) free(this->cddb.disc_title); - + if(this->cddb.disc_artist) free(this->cddb.disc_artist); if(this->cddb.disc_category) free(this->cddb.disc_category); - + if(this->cddb.disc_year) free(this->cddb.disc_year); - + } } /* @@ -1943,7 +1943,7 @@ static int cdda_open(cdda_input_plugin_t *this_gen, int fd = -1; if ( !cdda_device ) return -1; - + *fdd = -1; if (this_gen) @@ -1958,7 +1958,7 @@ static int cdda_open(cdda_input_plugin_t *this_gen, if (this_gen) this_gen->fd = fd; - + #ifdef CDROM_SELECT_SPEED if (this_gen->stream) { int speed; @@ -1988,17 +1988,17 @@ static int cdda_open(cdda_input_plugin_t *this_gen, else return -1; - /* We are going to assume that we are opening a + /* We are going to assume that we are opening a * device and not a file! */ if( WIN_NT ) { char psz_win32_drive[7]; - + lprintf( "using winNT/2K/XP ioctl layer" ); - + sprintf( psz_win32_drive, "\\\\.\\%c:", cdda_device[0] ); - + this_gen->h_device_handle = CreateFile( psz_win32_drive, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, @@ -2014,7 +2014,7 @@ static int cdda_open(cdda_input_plugin_t *this_gen, DWORD dwSupportInfo; int i, j, i_hostadapters; char c_drive = cdda_device[0]; - + hASPI = LoadLibrary( "wnaspi32.dll" ); if( hASPI != NULL ) { @@ -2023,80 +2023,80 @@ static int cdda_open(cdda_input_plugin_t *this_gen, lpSendCommand = GetProcAddress( hASPI, "SendASPI32Command" ); } - + if( hASPI == NULL || lpGetSupport == NULL || lpSendCommand == NULL ) { lprintf( "unable to load aspi or get aspi function pointers" ); - + if( hASPI ) FreeLibrary( hASPI ); return -1; } - + /* ASPI support seems to be there */ - + dwSupportInfo = lpGetSupport(); - + if( HIBYTE( LOWORD ( dwSupportInfo ) ) == SS_NO_ADAPTERS ) { lprintf( "no host adapters found (aspi)" ); FreeLibrary( hASPI ); return -1; } - + if( HIBYTE( LOWORD ( dwSupportInfo ) ) != SS_COMP ) { lprintf( "unable to initalize aspi layer" ); - + FreeLibrary( hASPI ); return -1; } - + i_hostadapters = LOBYTE( LOWORD( dwSupportInfo ) ); if( i_hostadapters == 0 ) { FreeLibrary( hASPI ); return -1; } - + c_drive = c_drive > 'Z' ? c_drive - 'a' : c_drive - 'A'; - + for( i = 0; i < i_hostadapters; i++ ) { for( j = 0; j < 15; j++ ) { struct SRB_GetDiskInfo srbDiskInfo; - + srbDiskInfo.SRB_Cmd = SC_GET_DISK_INFO; srbDiskInfo.SRB_HaId = i; srbDiskInfo.SRB_Flags = 0; srbDiskInfo.SRB_Hdr_Rsvd = 0; srbDiskInfo.SRB_Target = j; srbDiskInfo.SRB_Lun = 0; - + lpSendCommand( (void*) &srbDiskInfo ); - + if( (srbDiskInfo.SRB_Status == SS_COMP) && (srbDiskInfo.SRB_Int13HDriveInfo == c_drive) ) { /* Make sure this is a cdrom device */ struct SRB_GDEVBlock srbGDEVBlock; - + memset( &srbGDEVBlock, 0, sizeof(struct SRB_GDEVBlock) ); srbGDEVBlock.SRB_Cmd = SC_GET_DEV_TYPE; srbGDEVBlock.SRB_HaId = i; srbGDEVBlock.SRB_Target = j; - + lpSendCommand( (void*) &srbGDEVBlock ); - + if( ( srbGDEVBlock.SRB_Status == SS_COMP ) && ( srbGDEVBlock.SRB_DeviceType == DTYPE_CDROM ) ) { this_gen->i_sid = MAKEWORD( i, j ); this_gen->hASPI = (long)hASPI; this_gen->lpSendCommand = lpSendCommand; - + lprintf( "using aspi layer" ); - + return 0; } else @@ -2108,12 +2108,12 @@ static int cdda_open(cdda_input_plugin_t *this_gen, } } } - + FreeLibrary( hASPI ); - + lprintf( "unable to get haid and target (aspi)" ); } - + #endif /* WIN32 */ return -1; @@ -2184,9 +2184,9 @@ static off_t cdda_plugin_read (input_plugin_t *this_gen, char *buf, off_t len) { this->cache_last = this->current_frame + CACHED_FRAMES - 1; if( this->cache_last > this->last_frame ) this->cache_last = this->last_frame; - -#ifndef WIN32 - if ( this->fd != -1 ) + +#ifndef WIN32 + if ( this->fd != -1 ) #else if ( this->h_device_handle ) #endif /* WIN32 */ @@ -2202,7 +2202,7 @@ static off_t cdda_plugin_read (input_plugin_t *this_gen, char *buf, off_t len) { if( err < 0 ) return 0; - + memcpy(buf, this->cache[this->current_frame-this->cache_first], CD_RAW_FRAME_SIZE); this->current_frame++; @@ -2301,7 +2301,7 @@ static int cdda_plugin_open (input_plugin_t *this_gen ) { int fd = -1; char *cdda_device; int err = -1; - + lprintf("cdda_plugin_open\n"); /* get the CD TOC */ @@ -2312,7 +2312,7 @@ static int cdda_plugin_open (input_plugin_t *this_gen ) { else cdda_device = class->cdda_device; -#ifndef WIN32 +#ifndef WIN32 if( strchr(cdda_device,':') ) { fd = network_connect(this->stream, cdda_device); if( fd != -1 ) { @@ -2330,7 +2330,7 @@ static int cdda_plugin_open (input_plugin_t *this_gen ) { return 0; } -#ifndef WIN32 +#ifndef WIN32 err = read_cdrom_toc(this->fd, toc); #else err = read_cdrom_toc(this, toc); @@ -2342,18 +2342,18 @@ static int cdda_plugin_open (input_plugin_t *this_gen ) { } - - if ( (err < 0) || (toc->first_track > (this->track + 1)) || + + if ( (err < 0) || (toc->first_track > (this->track + 1)) || (toc->last_track < (this->track + 1))) { cdda_close(this); - + free_cdrom_toc(toc); return 0; } /* set up the frame boundaries for this particular track */ - this->first_frame = this->current_frame = + this->first_frame = this->current_frame = toc->toc_entries[this->track].first_frame; if (this->track + 1 == toc->last_track) this->last_frame = toc->leadout_track.first_frame - 1; @@ -2364,8 +2364,8 @@ static int cdda_plugin_open (input_plugin_t *this_gen ) { this->cache_first = this->cache_last = -1; /* get the Musicbrainz CDIndex */ - _cdda_cdindex (this, toc); - + _cdda_cdindex (this, toc); + /* * CDDB */ @@ -2379,23 +2379,23 @@ static int cdda_plugin_open (input_plugin_t *this_gen ) { this->cddb.track = (trackinfo_t *) calloc(this->cddb.num_tracks, sizeof(trackinfo_t)); for(t = 0; t < this->cddb.num_tracks; t++) { - int length = (toc->toc_entries[t].first_frame_minute * CD_SECONDS_PER_MINUTE + + int length = (toc->toc_entries[t].first_frame_minute * CD_SECONDS_PER_MINUTE + toc->toc_entries[t].first_frame_second); - - this->cddb.track[t].start = (length * CD_FRAMES_PER_SECOND + + + this->cddb.track[t].start = (length * CD_FRAMES_PER_SECOND + toc->toc_entries[t].first_frame_frame); this->cddb.track[t].title = NULL; } - + } - this->cddb.disc_length = (toc->leadout_track.first_frame_minute * CD_SECONDS_PER_MINUTE + + this->cddb.disc_length = (toc->leadout_track.first_frame_minute * CD_SECONDS_PER_MINUTE + toc->leadout_track.first_frame_second); this->cddb.disc_id = _cdda_get_cddb_id(this); if((this->cddb.have_cddb_info == 0) || (_cdda_is_cd_changed(this) == 1)) _cdda_cddb_retrieve(this); - + if(this->cddb.disc_title) { lprintf("Disc Title: %s\n", this->cddb.disc_title); @@ -2403,7 +2403,7 @@ static int cdda_plugin_open (input_plugin_t *this_gen ) { } if(this->cddb.track[this->track].title) { - /* Check for track 'titles' of the form / . */ + /* Check for track 'titles' of the form <artist> / <title>. */ char *pt; pt = strstr(this->cddb.track[this->track].title, " / "); if (pt != NULL) { @@ -2419,10 +2419,10 @@ static int cdda_plugin_open (input_plugin_t *this_gen ) { else { if(this->cddb.disc_artist) { lprintf("Disc Artist: %s\n", this->cddb.disc_artist); - + _x_meta_info_set_utf8(this->stream, XINE_META_INFO_ARTIST, this->cddb.disc_artist); } - + pt = this->cddb.track[this->track].title; } lprintf("Track %d Title: %s\n", this->track+1, pt); @@ -2432,7 +2432,7 @@ static int cdda_plugin_open (input_plugin_t *this_gen ) { _x_meta_info_set_utf8(this->stream, XINE_META_INFO_TRACK_NUMBER, tracknum); _x_meta_info_set_utf8(this->stream, XINE_META_INFO_TITLE, pt); } - + if(this->cddb.disc_category) { lprintf("Disc Category: %s\n", this->cddb.disc_category); @@ -2450,8 +2450,8 @@ static int cdda_plugin_open (input_plugin_t *this_gen ) { return 1; } -static xine_mrl_t** cdda_class_get_dir(input_class_t *this_gen, - const char *filename, +static xine_mrl_t** cdda_class_get_dir(input_class_t *this_gen, + const char *filename, int *num_files) { cdda_input_class_t *this = (cdda_input_class_t *) this_gen; cdda_input_plugin_t *ip; @@ -2516,8 +2516,8 @@ static xine_mrl_t** cdda_class_get_dir(input_class_t *this_gen, print_cdrom_toc(toc); #endif - cdda_close(ip); - + cdda_close(ip); + if ( err < 0 ) { free(ip); return NULL; @@ -2545,7 +2545,7 @@ static xine_mrl_t** cdda_class_get_dir(input_class_t *this_gen, } for (i = 0 ; i < num_tracks ; i++) { if (i < this->mrls_allocated_entries) { - if (this->mrls[i]->origin) + if (this->mrls[i]->origin) free(this->mrls[i]->origin); if (this->mrls[i]->mrl) free(this->mrls[i]->mrl); @@ -2578,7 +2578,7 @@ static xine_mrl_t** cdda_class_get_dir(input_class_t *this_gen, return this->mrls; } -static char ** cdda_class_get_autoplay_list (input_class_t *this_gen, +static char ** cdda_class_get_autoplay_list (input_class_t *this_gen, int *num_files) { cdda_input_class_t *this = (cdda_input_class_t *) this_gen; @@ -2592,8 +2592,8 @@ static char ** cdda_class_get_autoplay_list (input_class_t *this_gen, /* free old playlist */ for( i = 0; this->autoplaylist[i]; i++ ) { free( this->autoplaylist[i] ); - this->autoplaylist[i] = NULL; - } + this->autoplaylist[i] = NULL; + } /* get the CD TOC */ toc = init_cdrom_toc(); @@ -2639,13 +2639,13 @@ static char ** cdda_class_get_autoplay_list (input_class_t *this_gen, print_cdrom_toc(toc); #endif - cdda_close(ip); - + cdda_close(ip); + if ( err < 0 ) { if (ip != this->ip) free(ip); return NULL; } - + num_tracks = toc->last_track - toc->first_track; if (toc->ignore_last_track) num_tracks--; @@ -2705,19 +2705,19 @@ static input_plugin_t *cdda_class_get_instance (input_class_t *cls_gen, xine_str return NULL; this = calloc(1, sizeof (cdda_input_plugin_t)); - + class->ip = this; this->stream = stream; this->mrl = strdup(mrl); this->cdda_device = cdda_device; - + /* CD tracks start from 1; internal data structure indexes from 0 */ this->track = track - 1; this->cddb.track = NULL; this->fd = -1; this->net_fd = -1; this->class = (input_class_t *) class; - + this->input_plugin.open = cdda_plugin_open; this->input_plugin.get_capabilities = cdda_plugin_get_capabilities; this->input_plugin.read = cdda_plugin_read; @@ -2730,24 +2730,24 @@ static input_plugin_t *cdda_class_get_instance (input_class_t *cls_gen, xine_str this->input_plugin.get_optional_data = cdda_plugin_get_optional_data; this->input_plugin.dispose = cdda_plugin_dispose; this->input_plugin.input_class = cls_gen; - + /* * Lookup config entries. */ - if(xine_config_lookup_entry(this->stream->xine, "media.audio_cd.use_cddb", - &enable_entry)) + if(xine_config_lookup_entry(this->stream->xine, "media.audio_cd.use_cddb", + &enable_entry)) enable_cddb_changed_cb(class, &enable_entry); - if(xine_config_lookup_entry(this->stream->xine, "media.audio_cd.cddb_server", - &server_entry)) + if(xine_config_lookup_entry(this->stream->xine, "media.audio_cd.cddb_server", + &server_entry)) server_changed_cb(class, &server_entry); - - if(xine_config_lookup_entry(this->stream->xine, "media.audio_cd.cddb_port", - &port_entry)) + + if(xine_config_lookup_entry(this->stream->xine, "media.audio_cd.cddb_port", + &port_entry)) port_changed_cb(class, &port_entry); - if(xine_config_lookup_entry(this->stream->xine, "media.audio_cd.cddb_cachedir", - &cachedir_entry)) + if(xine_config_lookup_entry(this->stream->xine, "media.audio_cd.cddb_cachedir", + &cachedir_entry)) cachedir_changed_cb(class, &cachedir_entry); class->cddb_error = cddb_error; @@ -2810,15 +2810,15 @@ static void *init_plugin (xine_t *xine, void *data) { this->mrls = NULL; this->mrls_allocated_entries = 0; this->ip = NULL; - - this->cdda_device = config->register_filename(config, "media.audio_cd.device", + + this->cdda_device = config->register_filename(config, "media.audio_cd.device", DEFAULT_CDDA_DEVICE, XINE_CONFIG_STRING_IS_DEVICE_NAME, _("device used for CD audio"), _("The path to the device, usually a " "CD or DVD drive, which you intend to use " "for playing audio CDs."), 10, cdda_device_cb, (void *) this); - + config->register_bool(config, "media.audio_cd.use_cddb", 1, _("query CDDB"), _("Enables CDDB queries, which will give you " "convenient title and track names for your audio CDs.\n" @@ -2826,7 +2826,7 @@ static void *init_plugin (xine_t *xine, void *data) { "is retrieved from an internet server which might collect a profile " "of your listening habits."), 10, enable_cddb_changed_cb, (void *) this); - + config->register_string(config, "media.audio_cd.cddb_server", CDDB_SERVER, _("CDDB server name"), _("The CDDB server used to retrieve the " "title and track information from.\nThis setting is security critical, " @@ -2834,18 +2834,18 @@ static void *init_plugin (xine_t *xine, void *data) { "and could answer the queries with malicious replies. Be sure to enter " "a server you can trust."), XINE_CONFIG_SECURITY, server_changed_cb, (void *) this); - + config->register_num(config, "media.audio_cd.cddb_port", CDDB_PORT, _("CDDB server port"), _("The server port used to retrieve the " "title and track information from."), XINE_CONFIG_SECURITY, port_changed_cb, (void *) this); - - config->register_filename(config, "media.audio_cd.cddb_cachedir", + + config->register_filename(config, "media.audio_cd.cddb_cachedir", (_cdda_cddb_get_default_location()), XINE_CONFIG_STRING_IS_DIRECTORY_NAME, _("CDDB cache directory"), _("The replies from the CDDB server will be " "cached in this directory.\nThis setting is security critical, because files " "with uncontrollable names will be created in this directory. Be sure to use " - "a dedicated directory not used for anything but CDDB caching."), XINE_CONFIG_SECURITY, + "a dedicated directory not used for anything but CDDB caching."), XINE_CONFIG_SECURITY, cachedir_changed_cb, (void *) this); #ifdef CDROM_SELECT_SPEED diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c index 54c40087e..e6abfd3d5 100644 --- a/src/input/input_dvb.c +++ b/src/input/input_dvb.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2008 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -30,7 +30,7 @@ * 01-Feb-2005 Pekka Jääskeläinen <poj@iki.fi> * * - This history log started. - * - Disabled the automatic EPG updater thread until EPG demuxer + * - Disabled the automatic EPG updater thread until EPG demuxer * is done (it caused pausing of video stream), now EPG is * updated only on demand when the EPG OSD is displayed and * no data is in cache. @@ -39,10 +39,10 @@ * - Now tuning to an erroneus channel shouldn't hang but stop * the playback and output a log describing the error. * - Style cleanups here and there. - * + * * 06-Apr-2006 Jack Steven Kelliher * - Add ATSC support - * + * * TODO/Wishlist: (not in any order) * - Parse all Administrative PIDs - NIT,SDT,CAT etc * - As per James' suggestion, we need a way for the demuxer @@ -52,7 +52,7 @@ * Alevtd can read it. * - Allow the user to view one set of PIDs (channel) while * recording another on the same transponder - this will require either remuxing or - * perhaps bypassing the TS demuxer completely - we could easily have access to the + * perhaps bypassing the TS demuxer completely - we could easily have access to the * individual audio/video streams via seperate read calls, so send them to the decoders * and save the TS output to disk instead of passing it to the demuxer. * This also gives us full control over the streams being played..hmm..control... @@ -60,7 +60,7 @@ * - Allow the user to find and tune new stations from within xine, and * do away with the need for dvbscan & channels.conf file. * - Enable use of Conditional Access devices for scrambled content. - * - if multiple cards are available, optionally use these to record/gather si info, + * - if multiple cards are available, optionally use these to record/gather si info, * and leave primary card for viewing. * - allow for handing off of EPG data to specialised frontends, instead of displaying via * OSD - this will allow for filtering/searching of epg data - useful for automatic recording :) @@ -117,7 +117,7 @@ #define DVB_NOPID 0xffff -/* define stream types +/* define stream types * administrative/system PIDs first */ #define INTERNAL_FILTER 0 #define PATFILTER 1 @@ -190,7 +190,7 @@ #define EPG_PIXELS_BETWEEN_TEXT_ROWS 2 #define EPG_PIXELS_BETWEEN_PROGRAM_ENTRIES 2 -/* How many pixels the background of the OSD is bigger than the text area? +/* How many pixels the background of the OSD is bigger than the text area? The margin is for each side of the background box. */ #define EPG_BACKGROUND_MARGIN 5 @@ -201,10 +201,10 @@ /* How many seconds an EPG entry with the running flag on can be "late" according to the system time before discarding it as an old program? - - This margin is needed because in channel list OSD some EPG entries of + + This margin is needed because in channel list OSD some EPG entries of some channels may be updated a very long ago (if user has watched another - channel in different mux) so we have to resort to system clock for + channel in different mux) so we have to resort to system clock for figuring out the current program. */ #define MAX_EPG_ENTRY_LATENESS 5*60.0 @@ -226,13 +226,13 @@ typedef struct { int fd_subfilter[MAX_SUBTITLES]; struct dvb_frontend_info feinfo; - + int adapter_num; char frontend_device[100]; - char dvr_device[100]; + char dvr_device[100]; char demux_device[100]; - + struct dmx_pes_filter_params pesFilterParams[MAX_FILTERS]; struct dmx_pes_filter_params subFilterParams[MAX_SUBTITLES]; struct dmx_sct_filter_params sectFilterParams[MAX_FILTERS]; @@ -244,16 +244,16 @@ typedef struct { typedef struct { /* Program's name. */ - char *progname; + char *progname; /* Textual description of the program. */ char *description; /* The content type string. */ - char *content; + char *content; /* Age recommendation. 0 if not available. */ - int rating; + int rating; time_t starttime; @@ -262,7 +262,7 @@ typedef struct { char duration_minutes; /* Is this program running currently according to EPG data? */ - char running; + char running; } epg_entry_t; @@ -288,7 +288,7 @@ typedef struct { char *mrls[6]; - int numchannels; + int numchannels; char *autoplaylist[MAX_AUTOCHANNELS]; char *default_channels_conf_filename; @@ -321,14 +321,14 @@ typedef struct { osd_object_t *rec_osd; osd_object_t *name_osd; osd_object_t *paused_osd; - osd_object_t *proginfo_osd; + osd_object_t *proginfo_osd; osd_object_t *channel_osd; osd_object_t *background; - + xine_event_queue_t *event_queue; /* CRC table for PAT rebuilding */ unsigned long crc32_table[256]; - + /* scratch buffer for forward seeking */ char seek_buf[BUFSIZE]; @@ -339,7 +339,7 @@ typedef struct { int record_fd; int record_paused; /* centre cutout zoom */ - int zoom_ok; + int zoom_ok; /* Is EPG displaying? */ int epg_displaying; @@ -348,8 +348,8 @@ typedef struct { pthread_t epg_updater_thread; /* buffer for EIT data */ - /*char *eitbuffer;*/ - int num_streams_in_this_ts; + /*char *eitbuffer;*/ + int num_streams_in_this_ts; /* number of timedout reads in plugin_read */ int read_failcount; #ifdef DVB_NO_BUFFERING @@ -464,7 +464,7 @@ static void ts_build_crc32_table(dvb_input_plugin_t *this) { } } -static uint32_t ts_compute_crc32(dvb_input_plugin_t *this, uint8_t *data, +static uint32_t ts_compute_crc32(dvb_input_plugin_t *this, uint8_t *data, uint32_t length, uint32_t crc32) { uint32_t i; @@ -488,7 +488,7 @@ static unsigned int getbits(unsigned char *buffer, unsigned int bitpos, unsigned } -static int find_descriptor(uint8_t tag, const unsigned char *buf, int descriptors_loop_len, +static int find_descriptor(uint8_t tag, const unsigned char *buf, int descriptors_loop_len, const unsigned char **desc, int *desc_len) { @@ -526,7 +526,7 @@ time_t dvb_mjdtime (char *buf) time_t t; _x_assert(tma != NULL); - + mjd = (unsigned int)(buf[0] & 0xff) << 8; mjd +=(unsigned int)(buf[1] & 0xff); hour =(unsigned char)bcdtoint(buf[2] & 0xff); @@ -535,14 +535,14 @@ time_t dvb_mjdtime (char *buf) year =(unsigned long)((mjd - 15078.2)/365.25); month=(unsigned long)((mjd - 14956.1 - (unsigned long)(year * 365.25))/30.6001); day = mjd - 14956 - (unsigned long)(year * 365.25) - (unsigned long)(month * 30.6001); - + if (month == 14 || month == 15) i = 1; else i = 0; year += i; month = month - 1 - i * 12; - + tma->tm_sec=sec; tma->tm_min=min; tma->tm_hour=hour; @@ -552,7 +552,7 @@ time_t dvb_mjdtime (char *buf) t = timegm(tma); - + free(tma); return t; } @@ -574,7 +574,7 @@ static void tuner_dispose(tuner_t * this) for (x = 0; x < MAX_SUBTITLES; x++) if (this->fd_subfilter[x] >= 0) close(this->fd_subfilter[x]); - + if(this) free(this); } @@ -589,7 +589,7 @@ static tuner_t *XINE_MALLOC tuner_init(xine_t * xine, int adapter) char *video_device=malloc(100); _x_assert(video_device != NULL); - + this = calloc(1, sizeof(tuner_t)); _x_assert(this != NULL); @@ -600,12 +600,12 @@ static tuner_t *XINE_MALLOC tuner_init(xine_t * xine, int adapter) this->xine = xine; this->adapter_num = adapter; - + snprintf(this->frontend_device,100,"/dev/dvb/adapter%i/frontend0",this->adapter_num); snprintf(this->demux_device,100,"/dev/dvb/adapter%i/demux0",this->adapter_num); snprintf(this->dvr_device,100,"/dev/dvb/adapter%i/dvr0",this->adapter_num); snprintf(video_device,100,"/dev/dvb/adapter%i/video0",this->adapter_num); - + if ((this->fd_frontend = open(this->frontend_device, O_RDWR)) < 0) { xprintf(this->xine, XINE_VERBOSITY_DEBUG, "FRONTEND DEVICE: %s\n", strerror(errno)); tuner_dispose(this); @@ -641,7 +641,7 @@ static tuner_t *XINE_MALLOC tuner_init(xine_t * xine, int adapter) xprintf(this->xine,XINE_VERBOSITY_DEBUG,"input_dvb: couldn't set INTERNAL to nonblock: %s\n",strerror(errno)); /* and the frontend */ fcntl(this->fd_frontend, F_SETFL, O_NONBLOCK); - + xprintf(this->xine,XINE_VERBOSITY_DEBUG,"input_dvb: Frontend is <%s> ",this->feinfo.name); if(this->feinfo.type==FE_QPSK) xprintf(this->xine,XINE_VERBOSITY_DEBUG,"SAT Card\n"); if(this->feinfo.type==FE_QAM) xprintf(this->xine,XINE_VERBOSITY_DEBUG,"CAB Card\n"); @@ -656,7 +656,7 @@ static tuner_t *XINE_MALLOC tuner_init(xine_t * xine, int adapter) } free(video_device); - + return this; } @@ -668,7 +668,7 @@ static int dvb_set_pidfilter(dvb_input_plugin_t * this, int filter, ushort pid, if(this->channels[this->channel].pid [filter] !=DVB_NOPID) { ioctl(tuner->fd_pidfilter[filter], DMX_STOP); } - + this->channels[this->channel].pid [filter] = pid; tuner->pesFilterParams[filter].pid = pid; tuner->pesFilterParams[filter].input = DMX_IN_FRONTEND; @@ -691,7 +691,7 @@ static int dvb_set_sectfilter(dvb_input_plugin_t * this, int filter, ushort pid, if(this->channels[this->channel].pid [filter] !=DVB_NOPID) { ioctl(tuner->fd_pidfilter[filter], DMX_STOP); } - + this->channels[this->channel].pid [filter] = pid; tuner->sectFilterParams[filter].pid = pid; memset(&tuner->sectFilterParams[filter].filter.filter,0,DMX_FILTER_SIZE); @@ -725,14 +725,14 @@ static int extract_channel_from_string_internal(channel_t * channel,char * str,f <bw>:<fec_hp>:<fec_lp>:<qam>: <transmissionm>:<guardlist>:<hierarchinfo>:<vpid>:<apid> (DVBA) ATSC: <channel name>:<frequency>:<qam>:<vpid>:<apid> - + <channel name> = any string not containing ':' <frequency> = unsigned long <polarisation> = 'v' or 'h' <sat_no> = unsigned long, usually 0 :D <sym_rate> = symbol rate in MSyms/sec - - + + <inversion> = INVERSION_ON | INVERSION_OFF | INVERSION_AUTO <fec> = FEC_1_2, FEC_2_3, FEC_3_4 .... FEC_AUTO ... FEC_NONE <qam> = QPSK, QAM_128, QAM_16, ATSC ... @@ -749,7 +749,7 @@ static int extract_channel_from_string_internal(channel_t * channel,char * str,f char *field, *tmp; tmp = str; - + /* find the channel name */ if(!(field = strsep(&tmp,":")))return -1; channel->name = strdup(field); @@ -770,8 +770,8 @@ static int extract_channel_from_string_internal(channel_t * channel,char * str,f channel->tone = 0; } channel->front_param.inversion = INVERSION_AUTO; - - /* find out the polarisation */ + + /* find out the polarisation */ if(!(field = strsep(&tmp, ":")))return -1; channel->pol = (field[0] == 'h' ? 0 : 1); @@ -787,7 +787,7 @@ static int extract_channel_from_string_internal(channel_t * channel,char * str,f break; case FE_QAM: channel->front_param.frequency = freq; - + /* find out the inversion */ if(!(field = strsep(&tmp, ":")))return -1; channel->front_param.inversion = find_param(inversion_list, field); @@ -805,10 +805,10 @@ static int extract_channel_from_string_internal(channel_t * channel,char * str,f channel->front_param.u.qam.modulation = find_param(qam_list, field); break; case FE_OFDM: - /* DVB-T frequency is in kHz - workaround broken channels.confs */ - if (freq < 1000000) - freq*=1000; - + /* DVB-T frequency is in kHz - workaround broken channels.confs */ + if (freq < 1000000) + freq*=1000; + channel->front_param.frequency = freq; /* find out the inversion */ @@ -844,7 +844,7 @@ static int extract_channel_from_string_internal(channel_t * channel,char * str,f break; case FE_ATSC: channel->front_param.frequency = freq; - + /* find out the qam */ if(!(field = strsep(&tmp, ":")))return -1; channel->front_param.u.vsb.modulation = find_param(atsc_list, field); @@ -870,9 +870,9 @@ static int extract_channel_from_string_internal(channel_t * channel,char * str,f /* some channel.conf files are generated with the service ID 1 to the right this needs investigation */ if ((field = strsep(&tmp, ":"))) - if(strtoul(field,NULL,0)>0) + if(strtoul(field,NULL,0)>0) channel->service_id = strtoul(field, NULL, 0); - + return 0; } @@ -897,7 +897,7 @@ static channel_t *load_channels(xine_t *xine, xine_stream_t *stream, int *num_ch char *filename; xine_config_lookup_entry(xine, "media.dvb.channels_conf", &channels_conf); - filename = channels_conf.str_value; + filename = channels_conf.str_value; f = fopen(filename, "r"); if (!f) { @@ -913,7 +913,7 @@ static channel_t *load_channels(xine_t *xine, xine_stream_t *stream, int *num_ch } /* - * load channel list + * load channel list */ while ( fgets (str, BUFSIZE, f)) { @@ -927,7 +927,7 @@ static channel_t *load_channels(xine_t *xine, xine_stream_t *stream, int *num_ch continue; str[i] = 0; - if (extract_channel_from_string(&channel,str,fe_type) < 0) + if (extract_channel_from_string(&channel,str,fe_type) < 0) continue; if (num_channels >= num_alloc) { @@ -951,14 +951,14 @@ static channel_t *load_channels(xine_t *xine, xine_stream_t *stream, int *num_ch /* free any trailing unused entries */ channels = realloc (channels, num_channels * sizeof (channel_t)); - if(num_channels > 0) + if(num_channels > 0) xprintf (xine, XINE_VERBOSITY_DEBUG, "input_dvb: found %d channels...\n", num_channels); else { xprintf (xine, XINE_VERBOSITY_DEBUG, "input_dvb: no channels found in the file: giving up.\n"); free(channels); return NULL; } - + *num_ch = num_channels; return channels; } @@ -1052,7 +1052,7 @@ static int tuner_tune_it (tuner_t *this, struct dvb_frontend_parameters } xprintf(this->xine, XINE_VERBOSITY_DEBUG, "input_dvb: tuner_tune_it - waiting for lock...\n" ); - + do { status = 0; if (ioctl(this->fd_frontend, FE_READ_STATUS, &status) < 0) { @@ -1079,25 +1079,25 @@ static int tuner_tune_it (tuner_t *this, struct dvb_frontend_parameters usleep(10000); xprintf(this->xine, XINE_VERBOSITY_DEBUG, "Trying to get lock..."); } while (!(status & FE_TIMEDOUT)); - - /* inform the user of frontend status */ + + /* inform the user of frontend status */ xprintf(this->xine,XINE_VERBOSITY_LOG,"input_dvb: Tuner status: "); /* if (ioctl(this->fd_frontend, FE_READ_STATUS, &status) >= 0){ */ - if (status & FE_HAS_SIGNAL) + if (status & FE_HAS_SIGNAL) xprintf(this->xine,XINE_VERBOSITY_LOG," FE_HAS_SIGNAL"); - if (status & FE_TIMEDOUT) + if (status & FE_TIMEDOUT) xprintf(this->xine,XINE_VERBOSITY_LOG," FE_TIMEDOUT"); - if (status & FE_HAS_LOCK) + if (status & FE_HAS_LOCK) xprintf(this->xine,XINE_VERBOSITY_LOG," FE_HAS_LOCK"); - if (status & FE_HAS_CARRIER) + if (status & FE_HAS_CARRIER) xprintf(this->xine,XINE_VERBOSITY_LOG," FE_HAS_CARRIER"); - if (status & FE_HAS_VITERBI) + if (status & FE_HAS_VITERBI) xprintf(this->xine,XINE_VERBOSITY_LOG," FE_HAS_VITERBI"); - if (status & FE_HAS_SYNC) + if (status & FE_HAS_SYNC) xprintf(this->xine,XINE_VERBOSITY_LOG," FE_HAS_SYNC"); /* } */ xprintf(this->xine,XINE_VERBOSITY_LOG,"\n"); - + strength=0; if(ioctl(this->fd_frontend,FE_READ_BER,&strength) >= 0) xprintf(this->xine,XINE_VERBOSITY_LOG,"input_dvb: Bit error rate: %i\n",strength); @@ -1109,9 +1109,9 @@ static int tuner_tune_it (tuner_t *this, struct dvb_frontend_parameters strength=0; if(ioctl(this->fd_frontend,FE_READ_SNR,&strength) >= 0) xprintf(this->xine,XINE_VERBOSITY_LOG,"input_dvb: Signal/Noise Ratio: %u\n",strength); - + if (status & FE_HAS_LOCK && !(status & FE_TIMEDOUT)) { - xprintf(this->xine,XINE_VERBOSITY_LOG,"input_dvb: Lock achieved at %lu Hz\n",(unsigned long)front_param->frequency); + xprintf(this->xine,XINE_VERBOSITY_LOG,"input_dvb: Lock achieved at %lu Hz\n",(unsigned long)front_param->frequency); return 1; } else { xprintf(this->xine,XINE_VERBOSITY_LOG,"input_dvb: Unable to achieve lock at %lu Hz\n",(unsigned long)front_param->frequency); @@ -1120,13 +1120,13 @@ static int tuner_tune_it (tuner_t *this, struct dvb_frontend_parameters } -/* Parse the PMT, and add filters for all stream types associated with - * the 'channel'. We leave it to the demuxer to sort out which PIDs to +/* Parse the PMT, and add filters for all stream types associated with + * the 'channel'. We leave it to the demuxer to sort out which PIDs to * use. to simplify things slightly, (and because the demuxer can't handle it) * allow only one of each media type */ static void parse_pmt(dvb_input_plugin_t *this, const unsigned char *buf, int section_length) { - + int program_info_len; int pcr_pid; int has_video=0; @@ -1158,9 +1158,9 @@ static void parse_pmt(dvb_input_plugin_t *this, const unsigned char *buf, int se xprintf(this->stream->xine,XINE_VERBOSITY_LOG,"input_dvb: Adding VIDEO : PID 0x%04x\n", elementary_pid); dvb_set_pidfilter(this, VIDFILTER, elementary_pid, DMX_PES_VIDEO, DMX_OUT_TS_TAP); has_video=1; - } + } break; - + case 0x03: case 0x04: case 0x0f: @@ -1171,14 +1171,14 @@ static void parse_pmt(dvb_input_plugin_t *this, const unsigned char *buf, int se has_audio=1; } break; - + case 0x06: if (find_descriptor(0x56, buf + 5, descriptor_len, NULL, NULL)) { if(!has_text) { xprintf(this->stream->xine,XINE_VERBOSITY_LOG,"input_dvb: Adding TELETEXT : PID 0x%04x\n", elementary_pid); dvb_set_pidfilter(this,TXTFILTER, elementary_pid, DMX_PES_OTHER,DMX_OUT_TS_TAP); has_text=1; - } + } break; } else if (find_descriptor (0x59, buf + 5, descriptor_len, NULL, NULL)) { /* Note: The subtitling descriptor can also signal @@ -1199,7 +1199,7 @@ static void parse_pmt(dvb_input_plugin_t *this, const unsigned char *buf, int se this->tuner->subFilterParams[has_subs].flags = DMX_IMMEDIATE_START; if (ioctl(this->tuner->fd_subfilter[has_subs], DMX_SET_PES_FILTER, &this->tuner->subFilterParams[has_subs]) < 0) { - xprintf(this->tuner->xine, XINE_VERBOSITY_DEBUG, "input_dvb: set_pid: %s\n", strerror(errno)); + xprintf(this->tuner->xine, XINE_VERBOSITY_DEBUG, "input_dvb: set_pid: %s\n", strerror(errno)); break; } has_subs++; @@ -1207,7 +1207,7 @@ static void parse_pmt(dvb_input_plugin_t *this, const unsigned char *buf, int se break; } else if (find_descriptor (0x6a, buf + 5, descriptor_len, NULL, NULL)) { if(!has_ac3) { - dvb_set_pidfilter(this, AC3FILTER, elementary_pid, DMX_PES_OTHER,DMX_OUT_TS_TAP); + dvb_set_pidfilter(this, AC3FILTER, elementary_pid, DMX_PES_OTHER,DMX_OUT_TS_TAP); xprintf(this->stream->xine,XINE_VERBOSITY_LOG,"input_dvb: Adding AC3 : PID 0x%04x\n", elementary_pid); has_ac3=1; } @@ -1215,7 +1215,7 @@ static void parse_pmt(dvb_input_plugin_t *this, const unsigned char *buf, int se } break; case 0x81: /* AC3 audio */ - fprintf(stderr, " pid type 0x%x, has audio %d\n",buf[0],has_audio); + fprintf(stderr, " pid type 0x%x, has audio %d\n",buf[0],has_audio); if(!has_audio) { xprintf(this->stream->xine,XINE_VERBOSITY_LOG,"input_dvb: Adding AUDIO : PID 0x%04x\n", elementary_pid); dvb_set_pidfilter(this, AUDFILTER, elementary_pid, DMX_PES_AUDIO, DMX_OUT_TS_TAP); @@ -1223,7 +1223,7 @@ static void parse_pmt(dvb_input_plugin_t *this, const unsigned char *buf, int se } break; - }; + }; buf += descriptor_len + 5; section_length -= descriptor_len + 5; @@ -1234,12 +1234,12 @@ static void dvb_parse_si(dvb_input_plugin_t *this) { char *tmpbuffer; char *bufptr; - int service_id; + int service_id; int result; - int section_len; - int x; + int section_len; + int x; struct pollfd pfd; - + tuner_t *tuner = this->tuner; tmpbuffer = calloc(1, 8192); @@ -1253,8 +1253,8 @@ static void dvb_parse_si(dvb_input_plugin_t *this) { xprintf(this->stream->xine,XINE_VERBOSITY_DEBUG,"input_dvb: Setting up Internal PAT filter\n"); xine_usec_sleep(500000); - - /* first - the PAT. retrieve the entire section...*/ + + /* first - the PAT. retrieve the entire section...*/ dvb_set_sectfilter(this, INTERNAL_FILTER, 0, DMX_PES_OTHER, 0, 0xff); /* wait for up to 15 seconds */ @@ -1267,13 +1267,13 @@ static void dvb_parse_si(dvb_input_plugin_t *this) { return; } result = read (tuner->fd_pidfilter[INTERNAL_FILTER], tmpbuffer, 3); - + if(result!=3) xprintf(this->stream->xine,XINE_VERBOSITY_DEBUG,"input_dvb: error reading PAT table - no data!\n"); section_len = getbits(tmpbuffer,12,12); result = read (tuner->fd_pidfilter[INTERNAL_FILTER], tmpbuffer+5,section_len); - + if(result!=section_len) xprintf(this->stream->xine,XINE_VERBOSITY_DEBUG,"input_dvb: error reading in the PAT table\n"); @@ -1281,7 +1281,7 @@ static void dvb_parse_si(dvb_input_plugin_t *this) { bufptr+=10; this->num_streams_in_this_ts=0; - section_len-=5; + section_len-=5; while(section_len>4){ service_id = getbits (bufptr,0,16); @@ -1293,7 +1293,7 @@ static void dvb_parse_si(dvb_input_plugin_t *this) { section_len-=4; bufptr+=4; if(service_id>0) /* ignore NIT table for now */ - this->num_streams_in_this_ts++; + this->num_streams_in_this_ts++; } bufptr = tmpbuffer; @@ -1318,7 +1318,7 @@ static void dvb_parse_si(dvb_input_plugin_t *this) { ioctl(tuner->fd_pidfilter[INTERNAL_FILTER], DMX_STOP); parse_pmt(this,tmpbuffer+8,section_len); - + /* dvb_set_pidfilter(this, TSDTFILTER, 0x02,DMX_PES_OTHER,DMX_OUT_TS_TAP); dvb_set_pidfilter(this, RSTFILTER, 0x13,DMX_PES_OTHER,DMX_OUT_TS_TAP); @@ -1331,8 +1331,8 @@ static void dvb_parse_si(dvb_input_plugin_t *this) { /* we use the section filter for EIT because we are guarenteed a complete section */ if(ioctl(tuner->fd_pidfilter[EITFILTER],DMX_SET_BUFFER_SIZE,8192*this->num_streams_in_this_ts)<0) - xprintf(this->stream->xine,XINE_VERBOSITY_DEBUG,"input_dvb: couldn't increase buffer size for EIT: %s \n",strerror(errno)); - dvb_set_sectfilter(this, EITFILTER, 0x12,DMX_PES_OTHER,0x4e, 0xff); + xprintf(this->stream->xine,XINE_VERBOSITY_DEBUG,"input_dvb: couldn't increase buffer size for EIT: %s \n",strerror(errno)); + dvb_set_sectfilter(this, EITFILTER, 0x12,DMX_PES_OTHER,0x4e, 0xff); xprintf(this->stream->xine,XINE_VERBOSITY_DEBUG,"input_dvb: Setup of PID filters complete\n"); @@ -1344,7 +1344,7 @@ static void dvb_parse_si(dvb_input_plugin_t *this) { static int channel_index(dvb_input_plugin_t* this, unsigned int service_id) { unsigned int n; for (n=0; n < this->num_channels; n++) - if (this->channels[n].service_id == service_id) + if (this->channels[n].service_id == service_id) return n; return -1; @@ -1359,7 +1359,7 @@ static int compare_epg_by_starttime(const void* a, const void* b) { return -1; } else if ((*epg_a)->starttime > (*epg_b)->starttime) { return 1; - } + } return 0; } @@ -1382,7 +1382,7 @@ static void pthread_sleep(int seconds) { struct timespec timeout; /* Create a dummy mutex which doesn't unlock for sure while waiting. */ - pthread_mutex_init(&dummy_mutex, NULL); + pthread_mutex_init(&dummy_mutex, NULL); pthread_mutex_lock(&dummy_mutex); /* Create a dummy condition variable. */ @@ -1422,7 +1422,7 @@ static void* epg_data_updater(void *t) { } #endif -/* This function parses the EIT table and saves the data used in +/* This function parses the EIT table and saves the data used in EPG OSD of all channels found in the currently tuned stream. */ static void load_epg_data(dvb_input_plugin_t *this) { @@ -1431,7 +1431,7 @@ static void load_epg_data(dvb_input_plugin_t *this) int descriptor_id; int section_len = 0; unsigned int service_id=-1; - int n; + int n; char *eit = NULL; char *foo = NULL; char *seen_channels = NULL; @@ -1446,8 +1446,8 @@ static void load_epg_data(dvb_input_plugin_t *this) pthread_mutex_lock(&this->channel_change_mutex); /* seen_channels array is used to store information of channels that were - already "found" in the stream. This information is used to initialize the - channel's EPG structs when the EPG information for the channel is seen in + already "found" in the stream. This information is used to initialize the + channel's EPG structs when the EPG information for the channel is seen in the stream the first time. */ seen_channels = calloc(this->num_channels, sizeof(char)); _x_assert(seen_channels != NULL); @@ -1457,7 +1457,7 @@ static void load_epg_data(dvb_input_plugin_t *this) fd.fd = this->tuner->fd_pidfilter[EITFILTER]; fd.events = POLLPRI; - + for (loops = 0; loops <= this->num_streams_in_this_ts*2; loops++) { eit = foo; @@ -1466,7 +1466,7 @@ static void load_epg_data(dvb_input_plugin_t *this) pthread_mutex_unlock(&this->channel_change_mutex); free(seen_channels); free(foo); - return; + return; } n = read(this->tuner->fd_pidfilter[EITFILTER], eit, 3); table_id = getbits(eit, 0, 8); @@ -1479,8 +1479,8 @@ static void load_epg_data(dvb_input_plugin_t *this) xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,"input_dvb: load_epg_data(): unknown service_id: %d!\n", service_id); continue; } - - + + if (section_len > 15) { current_channel = &this->channels[current_channel_index]; @@ -1498,14 +1498,14 @@ static void load_epg_data(dvb_input_plugin_t *this) continue; } - /* Initialize the EPG struct if there's not one we can reuse. + /* Initialize the EPG struct if there's not one we can reuse. Allocate space for the strings. */ if (current_channel->epg[current_channel->epg_count] == NULL) { current_channel->epg[current_channel->epg_count] = calloc(1, sizeof(epg_entry_t)); _x_assert(current_channel->epg[current_channel->epg_count] != NULL); - current_channel->epg[current_channel->epg_count]->progname = + current_channel->epg[current_channel->epg_count]->progname = malloc(MAX_EPG_PROGRAM_NAME_LENGTH + 1); _x_assert(current_channel->epg[current_channel->epg_count]->progname != NULL); @@ -1513,7 +1513,7 @@ static void load_epg_data(dvb_input_plugin_t *this) malloc(MAX_EPG_PROGRAM_DESCRIPTION_LENGTH + 1); _x_assert(current_channel->epg[current_channel->epg_count]->description != NULL); - current_channel->epg[current_channel->epg_count]->content = + current_channel->epg[current_channel->epg_count]->content = malloc(MAX_EPG_CONTENT_TYPE_LENGTH + 1); _x_assert(current_channel->epg[current_channel->epg_count]->content != NULL); current_channel->epg[current_channel->epg_count]->running = 0; @@ -1528,12 +1528,12 @@ static void load_epg_data(dvb_input_plugin_t *this) 1 not running 2 starts in a few seconds 3 pausing - 4 running + 4 running */ if (getbits(foo,192,3) == 4){ - current_epg->running = 1; + current_epg->running = 1; } else { - current_epg->running = 0; + current_epg->running = 0; } @@ -1546,7 +1546,7 @@ static void load_epg_data(dvb_input_plugin_t *this) current_epg->duration_minutes = (char)bcdtoint(eit[22] & 0xff); descriptor_id = eit[26]; - eit += 27; + eit += 27; section_len -= 27; /* run the descriptor loop for the length of section_len */ while (section_len > 1) @@ -1559,23 +1559,23 @@ static void load_epg_data(dvb_input_plugin_t *this) desc_len = getbits(eit, 0, 8); - /* Let's get the EPG data only in the wanted language. */ + /* Let's get the EPG data only in the wanted language. */ if (xine_config_lookup_entry( - this->stream->xine, + this->stream->xine, "media.dvd.language", &language) && - language.str_value && strlen(language.str_value) >= 2 && + language.str_value && strlen(language.str_value) >= 2 && strncasecmp(language.str_value, &eit[1], 2)) { - + #ifdef DEBUG_EPG printf("input_dvb: EPG Skipping language: %C%C%C\n", - eit[1],eit[2],eit[3]); - printf("input_dvb: EPG language.str_value: %s\n", + eit[1],eit[2],eit[3]); + printf("input_dvb: EPG language.str_value: %s\n", language.str_value); -#endif +#endif break; - } + } /* program name */ name_len = (unsigned char)eit[4]; @@ -1584,20 +1584,20 @@ static void load_epg_data(dvb_input_plugin_t *this) break; } - /* the first char of the string contains sometimes the character + /* the first char of the string contains sometimes the character encoding information, which should not be copied to the string. (FIXME - we ought to be using this byte to change charsets)*/ - + if (!isalnum(*(eit + 5))) skip_byte = 1; else skip_byte = 0; - memcpy(current_epg->progname, eit + 5 + skip_byte, - name_len - skip_byte); + memcpy(current_epg->progname, eit + 5 + skip_byte, + name_len - skip_byte); current_epg->progname[name_len - skip_byte] = '\0'; - /* detailed program information (max 256 chars)*/ + /* detailed program information (max 256 chars)*/ text_len = (unsigned char)eit[5 + name_len]; if (text_len == 0) { current_epg->description[0] = '\0'; @@ -1609,7 +1609,7 @@ static void load_epg_data(dvb_input_plugin_t *this) else skip_byte = 0; - memcpy(current_epg->description, eit + 6 + name_len + skip_byte, + memcpy(current_epg->description, eit + 6 + name_len + skip_byte, text_len - skip_byte); current_epg->description[text_len - skip_byte] = '\0'; } @@ -1625,7 +1625,7 @@ static void load_epg_data(dvb_input_plugin_t *this) snprintf(current_epg->content, MAX_EPG_CONTENT_TYPE_LENGTH, "%s", content[content_bits]); } break; - case 0x55: { /* Parental Rating descriptor describes minimum recommened age -3 */ + case 0x55: { /* Parental Rating descriptor describes minimum recommened age -3 */ /* A rating value of 0 means that there is no rating defined. Ratings greater than 0xF are "defined by broadcaster", which is not supported @@ -1635,7 +1635,7 @@ static void load_epg_data(dvb_input_plugin_t *this) else current_epg->rating = 0; } - break; + break; default: break; } @@ -1644,28 +1644,28 @@ static void load_epg_data(dvb_input_plugin_t *this) eit += getbits(eit, 0, 8); descriptor_id = eit[1]; eit += 2; - } + } /* Store the entry if we got enough data. */ - if (current_epg->progname && strlen(current_epg->progname)) + if (current_epg->progname && strlen(current_epg->progname)) current_channel->epg_count++; } } /* Sort the EPG arrays by starttime. */ for (i = 0; i < this->num_channels; ++i) { - if (!seen_channels[i]) + if (!seen_channels[i]) continue; - qsort(this->channels[i].epg, this->channels[i].epg_count, + qsort(this->channels[i].epg, this->channels[i].epg_count, sizeof(epg_entry_t*), compare_epg_by_starttime); } free(seen_channels); - free(foo); + free(foo); pthread_mutex_unlock(&this->channel_change_mutex); } /* Prints text to an area, tries to cut the lines in between words. */ static void render_text_area(osd_renderer_t* renderer, osd_object_t* osd, const char* text, - int x, int y, int row_space, + int x, int y, int row_space, int max_x, int max_y, int* height, int color_base) { /* The position of the text to be printed. */ @@ -1677,7 +1677,7 @@ static void render_text_area(osd_renderer_t* renderer, osd_object_t* osd, const int text_width, text_height; size_t old_line_length, line_cursor; const char* bound, *old_bound; - + *height = 0; while (cursor < text_end) { bound = cursor; @@ -1691,12 +1691,12 @@ static void render_text_area(osd_renderer_t* renderer, osd_object_t* osd, const line_cursor = old_line_length; /* Strip leading white space. */ - while (isspace(*bound)) + while (isspace(*bound)) bound++; - + /* Copy text to the text_line until end of word or end of string. */ while (!isspace(*bound) && *bound != '\0') { - text_line[line_cursor] = *bound; + text_line[line_cursor] = *bound; bound++; line_cursor++; } @@ -1709,13 +1709,13 @@ static void render_text_area(osd_renderer_t* renderer, osd_object_t* osd, const if (x + text_width > max_x) { /* It didn't fit, restore the old line and stop trying to fit more.*/ text_line[old_line_length] = '\0'; - + /* If no words did fit to the line, fit as many characters as possible in it. */ if (old_line_length == 0) { text_width = 0; bound = bound - line_cursor + 1; /* rewind to the beginning of the word */ line_cursor = 0; - while (!isspace(*bound) && + while (!isspace(*bound) && *bound != '\0') { text_line[line_cursor++] = *bound++; text_line[line_cursor] = '\0'; @@ -1734,10 +1734,10 @@ static void render_text_area(osd_renderer_t* renderer, osd_object_t* osd, const bound = old_bound; break; } - + /* OK, it did fit, let's try to fit some more. */ } while (bound < text_end); - + if (y + text_height + row_space > max_y) { break; } @@ -1748,7 +1748,7 @@ static void render_text_area(osd_renderer_t* renderer, osd_object_t* osd, const } } -/* Finds the EPG of the ith next program. 0 means the current program, 1 next. +/* Finds the EPG of the ith next program. 0 means the current program, 1 next. If not found, returns NULL. All these functions expect the EPG entries are sorted by starting time. */ static epg_entry_t* ith_next_epg(channel_t* channel, int count) { @@ -1756,14 +1756,14 @@ static epg_entry_t* ith_next_epg(channel_t* channel, int count) { int counter = 0; /* Discard the entries of past programs. */ - while (counter + 1 < channel->epg_count && + while (counter + 1 < channel->epg_count && difftime(channel->epg[counter + 1]->starttime, current_time) < 0.0) counter++; /* Check whether the previous program has still the running bit on, and if it's not more late than the given margin, assume it's still running. */ - if (counter >= 1 && channel->epg[counter - 1]->running && + if (counter >= 1 && channel->epg[counter - 1]->running && difftime(current_time, channel->epg[counter]->starttime) < MAX_EPG_ENTRY_LATENESS) { counter--; } @@ -1778,13 +1778,13 @@ static epg_entry_t* ith_next_epg(channel_t* channel, int count) { ago. In that case do not return any EPG. This fixes the "very last program of the day sticking until morning" bug. */ if (counter == channel->epg_count - 1) { - if (difftime(current_time, - channel->epg[counter]->starttime + + if (difftime(current_time, + channel->epg[counter]->starttime + channel->epg[counter]->duration_hours*60*60 + channel->epg[counter]->duration_minutes*60) > MAX_EPG_ENTRY_LATENESS) { return NULL; } - } + } return channel->epg[counter]; } @@ -1795,7 +1795,7 @@ static epg_entry_t* current_epg(channel_t* channel) { #ifdef DEBUG_EPG if (next != NULL) printf("input_dvb: EPG current: %s (%d)\n", next->progname, next->running); -#endif +#endif return next; } @@ -1805,13 +1805,13 @@ static epg_entry_t* next_epg(channel_t* channel) { #ifdef DEBUG_EPG if (next != NULL) printf("input_dvb: EPG next: %s (%d)\n", next->progname, next->running); -#endif +#endif return next; } /* Displays the program info of an EPG entry in OSD. - + x,y The upper left coordinates of the program information area. max_x, max_y The maximum right coordinate of the program information area. last_y The position of y after printing the entry. @@ -1820,7 +1820,7 @@ static epg_entry_t* next_epg(channel_t* channel) { Returns the height of the entry in the OSD in pixels. */ static void show_program_info(int x, int y, int max_x, int max_y, int* last_y, - epg_entry_t* epg_data, osd_renderer_t* renderer, + epg_entry_t* epg_data, osd_renderer_t* renderer, osd_object_t* osd) { char* buffer; int time_width, text_width, dummy; @@ -1859,7 +1859,7 @@ static void show_program_info(int x, int y, int max_x, int max_y, int* last_y, snprintf(buffer + strlen(buffer), 7, " (%i+)", prog_rating); } if (!renderer->set_font(osd, "sans", EPG_CONTENT_FONT_SIZE)) { - print_error("Setting content type font failed."); + print_error("Setting content type font failed."); } renderer->get_text_size(osd, buffer, &content_width, &dummy); renderer->render_text(osd, max_x - 2 - content_width, y, buffer, OSD_TEXT3); @@ -1867,14 +1867,14 @@ static void show_program_info(int x, int y, int max_x, int max_y, int* last_y, text_width = max_x - x - time_width - content_width - 2; - renderer->set_font(osd, "sans", EPG_TITLE_FONT_SIZE); + renderer->set_font(osd, "sans", EPG_TITLE_FONT_SIZE); render_text_area(renderer, osd, epg_data->progname, - x + time_width, y, EPG_PIXELS_BETWEEN_TEXT_ROWS, - x + text_width + time_width, max_y, &text_height, + x + time_width, y, EPG_PIXELS_BETWEEN_TEXT_ROWS, + x + text_width + time_width, max_y, &text_height, OSD_TEXT4); - if (text_height == 0) + if (text_height == 0) *last_y = y + time_height; else *last_y = y + text_height; @@ -1893,15 +1893,15 @@ static void show_program_info(int x, int y, int max_x, int max_y, int* last_y, /* If duration_hours is zero, do not print them. */ if (epg_data->duration_hours > 0) - sprintf(buffer + strlen(buffer), " (%dh%02dmin)", + sprintf(buffer + strlen(buffer), " (%dh%02dmin)", epg_data->duration_hours, epg_data->duration_minutes); else if (epg_data->duration_minutes > 0) - sprintf(buffer + strlen(buffer), " (%dmin)", + sprintf(buffer + strlen(buffer), " (%dmin)", epg_data->duration_minutes); - render_text_area(renderer, osd, buffer, x + time_width, - *last_y + EPG_PIXELS_BETWEEN_TEXT_ROWS, - EPG_PIXELS_BETWEEN_TEXT_ROWS, + render_text_area(renderer, osd, buffer, x + time_width, + *last_y + EPG_PIXELS_BETWEEN_TEXT_ROWS, + EPG_PIXELS_BETWEEN_TEXT_ROWS, max_x, max_y, &text_height, OSD_TEXT3); *last_y += EPG_PIXELS_BETWEEN_TEXT_ROWS + text_height; @@ -1923,7 +1923,7 @@ static void show_eit(dvb_input_plugin_t *this) { if (!this->epg_displaying) { #ifndef EPG_UPDATE_IN_BACKGROUND - if (current_epg(&this->channels[this->channel]) == NULL || + if (current_epg(&this->channels[this->channel]) == NULL || next_epg(&this->channels[this->channel]) == NULL) { load_epg_data(this); } @@ -1933,12 +1933,12 @@ static void show_eit(dvb_input_plugin_t *this) { this->stream->osd_renderer->hide(this->proginfo_osd, 0); this->stream->osd_renderer->clear(this->proginfo_osd); - /* Channel Name */ + /* Channel Name */ if (!this->stream->osd_renderer->set_font( this->proginfo_osd, "sans", EPG_CHANNEL_FONT_SIZE)) { print_error("Error setting channel name font."); } - + this->stream->osd_renderer->render_text( this->proginfo_osd, 0, 0, this->channels[this->channel].name, OSD_TEXT4); @@ -1956,11 +1956,11 @@ static void show_eit(dvb_input_plugin_t *this) { this->proginfo_osd, this->channels[this->channel].name, &temp1, &temp2); this->stream->osd_renderer->render_text( - this->proginfo_osd, EPG_WIDTH - 45, + this->proginfo_osd, EPG_WIDTH - 45, EPG_CHANNEL_FONT_SIZE - EPG_CLOCK_FONT_SIZE, clock, OSD_TEXT4); - + show_program_info(0, EPG_CHANNEL_FONT_SIZE + 2, EPG_WIDTH, EPG_HEIGHT, &y_pos, - current_epg(&this->channels[this->channel]), + current_epg(&this->channels[this->channel]), this->stream->osd_renderer, this->proginfo_osd); y = y_pos; @@ -1971,11 +1971,11 @@ static void show_eit(dvb_input_plugin_t *this) { this->proginfo_osd); y = y_pos; - window_width = + window_width = this->stream->video_out->get_property( this->stream->video_out, VO_PROP_WINDOW_WIDTH); - window_height = + window_height = this->stream->video_out->get_property( this->stream->video_out, VO_PROP_WINDOW_HEIGHT); @@ -1992,8 +1992,8 @@ static void show_eit(dvb_input_plugin_t *this) { this->stream->osd_renderer->set_text_palette( this->background, XINE_TEXTPALETTE_YELLOW_BLACK_TRANSPARENT, OSD_TEXT3); this->stream->osd_renderer->filled_rect( - this->background, 0, 0, - EPG_WIDTH + EPG_BACKGROUND_MARGIN*2, + this->background, 0, 0, + EPG_WIDTH + EPG_BACKGROUND_MARGIN*2, y + EPG_BACKGROUND_MARGIN*2, 4); /* In case video is downscaled and the EPG fits, show it unscaled to make it @@ -2007,8 +2007,8 @@ static void show_eit(dvb_input_plugin_t *this) { centered_y = (centered_y > 0)?(centered_y):(EPG_TOP); this->stream->osd_renderer->set_position( - this->proginfo_osd, - centered_x + EPG_BACKGROUND_MARGIN, + this->proginfo_osd, + centered_x + EPG_BACKGROUND_MARGIN, centered_y + EPG_BACKGROUND_MARGIN); this->stream->osd_renderer->set_position(this->background, centered_x, centered_y); @@ -2024,15 +2024,15 @@ static void show_eit(dvb_input_plugin_t *this) { /* Center the OSD to stream. */ this->stream->osd_renderer->set_position( - this->proginfo_osd, - centered_x + EPG_BACKGROUND_MARGIN, + this->proginfo_osd, + centered_x + EPG_BACKGROUND_MARGIN, centered_y + EPG_BACKGROUND_MARGIN); this->stream->osd_renderer->set_position(this->background, centered_x, centered_y); this->stream->osd_renderer->show(this->background, 0); this->stream->osd_renderer->show(this->proginfo_osd, 0); } - + } else { this->epg_displaying = 0; this->stream->osd_renderer->hide (this->proginfo_osd,0); @@ -2062,7 +2062,7 @@ static int tuner_set_channel (dvb_input_plugin_t *this, channel_t *c) { if (lastchannel.num_value){ /* Remember last watched channel. never show this entry*/ config->update_num(config, "media.dvb.last_channel", this->channel+1); - } + } #ifdef DVB_NO_BUFFERING this->newchannel=1; #endif @@ -2092,14 +2092,14 @@ static void osd_show_channel (dvb_input_plugin_t *this, int channel) { this->channel_osd, 110, 10+i*35, this->channels[channel_to_print].name, (channel_to_print == channel)?(OSD_TEXT4):(OSD_TEXT3)); - + if ((current_program = current_epg(&this->channels[channel_to_print])) && current_program->progname && strlen(current_program->progname) > 0) { this->stream->osd_renderer->set_font(this->channel_osd, "sans", 16); render_text_area(this->stream->osd_renderer, this->channel_osd, - current_program->progname, 400, 10+i*35, + current_program->progname, 400, 10+i*35, -5, CHSEL_WIDTH, 10+i*35+CHSEL_CHANNEL_FONT_SIZE+2, &temp, (channel_to_print == channel)?(OSD_TEXT4):(OSD_TEXT3)); } @@ -2122,19 +2122,19 @@ static void osd_show_channel (dvb_input_plugin_t *this, int channel) { } static int switch_channel(dvb_input_plugin_t *this, int channel) { - + int x; xine_event_t event; xine_pids_data_t data; xine_ui_data_t ui_data; - - /* control_nop appears to stop an occasional (quite long) pause between + + /* control_nop appears to stop an occasional (quite long) pause between channel-changes, which the user may see as a lockup. */ _x_demux_control_nop(this->stream, BUF_FLAG_END_STREAM); - _x_demux_flush_engine(this->stream); + _x_demux_flush_engine(this->stream); pthread_mutex_lock (&this->channel_change_mutex); - + close (this->fd); this->tuned_in = 0; @@ -2142,9 +2142,9 @@ static int switch_channel(dvb_input_plugin_t *this, int channel) { close(this->tuner->fd_pidfilter[x]); this->tuner->fd_pidfilter[x] = open(this->tuner->demux_device, O_RDWR); } - + if (!tuner_set_channel (this, &this->channels[channel])) { - xprintf (this->class->xine, XINE_VERBOSITY_LOG, + xprintf (this->class->xine, XINE_VERBOSITY_LOG, _("input_dvb: tuner_set_channel failed\n")); pthread_mutex_unlock (&this->channel_change_mutex); return 0; @@ -2178,7 +2178,7 @@ static int switch_channel(dvb_input_plugin_t *this, int channel) { this->tuned_in = 1; pthread_mutex_unlock (&this->channel_change_mutex); - + /* now read the pat, find all accociated PIDs and add them to the stream */ dvb_parse_si(this); @@ -2190,7 +2190,7 @@ static int switch_channel(dvb_input_plugin_t *this, int channel) { /* show eit for this channel if necessary */ if (this->epg_displaying==1){ - this->epg_displaying=0; + this->epg_displaying=0; show_eit(this); } return 1; @@ -2199,7 +2199,7 @@ static int switch_channel(dvb_input_plugin_t *this, int channel) { static void do_record (dvb_input_plugin_t *this) { struct tm *tma; - time_t *t; + time_t *t; char filename [256]; char dates[64]; int x=0; @@ -2225,7 +2225,7 @@ static void do_record (dvb_input_plugin_t *this) { free(t); t = NULL; strftime(dates,63,"%Y-%m-%d_%H%M",tma); - + if (xine_config_lookup_entry(this->stream->xine, "media.capture.save_dir", &savedir)){ if(strlen(savedir.str_value)>1){ if((dir = opendir(savedir.str_value))==NULL){ @@ -2251,7 +2251,7 @@ static void do_record (dvb_input_plugin_t *this) { this->record_fd = open (filename, O_CREAT | O_APPEND | O_WRONLY, 0644); this->stream->osd_renderer->clear (this->rec_osd); - + this->stream->osd_renderer->render_text (this->rec_osd, 10, 10, "Recording to:", OSD_TEXT3); @@ -2267,7 +2267,7 @@ static void dvb_event_handler (dvb_input_plugin_t *this) { xine_event_t *event; static int channel_menu_visible = 0; - static int next_channel = -1; + static int next_channel = -1; while ((event = xine_event_get (this->event_queue))) { @@ -2293,7 +2293,7 @@ static void dvb_event_handler (dvb_input_plugin_t *this) { } else this->stream->osd_renderer->hide(this->channel_osd, 0); - } + } #ifdef LEFT_MOUSE_DOES_EPG else { /* show EPG on left click of videowindow */ show_eit(this); @@ -2452,27 +2452,27 @@ static void dvb_event_handler (dvb_input_plugin_t *this) { static void ts_rewrite_packets (dvb_input_plugin_t *this, unsigned char * originalPkt, int len) { #define PKT_SIZE 188 -#define BODY_SIZE (188-4) +#define BODY_SIZE (188-4) unsigned int sync_byte; unsigned int data_offset; unsigned int data_len; - unsigned int pid; + unsigned int pid; while(len>0){ - + sync_byte = originalPkt[0]; pid = ((originalPkt[1] << 8) | originalPkt[2]) & 0x1fff; - + /* * Discard packets that are obviously bad. */ data_offset = 4; originalPkt+=data_offset; - + if (pid == 0 && sync_byte==0x47) { unsigned long crc; - + originalPkt[3]=13; /* section length including CRC - first 3 bytes */ originalPkt[2]=0x80; originalPkt[7]=0; /* section number */ @@ -2483,13 +2483,13 @@ static void ts_rewrite_packets (dvb_input_plugin_t *this, unsigned char * origin originalPkt[12]=this->channels[this->channel].pmtpid & 0xff; crc= ts_compute_crc32 (this, originalPkt+1, 12, 0xffffffff); - + originalPkt[13]=(crc>>24) & 0xff; originalPkt[14]=(crc>>16) & 0xff; originalPkt[15]=(crc>>8) & 0xff; originalPkt[16]=crc & 0xff; memset(originalPkt+17,0xFF,PKT_SIZE-21); /* stuff the remainder */ - + } data_len = PKT_SIZE - data_offset; @@ -2518,32 +2518,32 @@ static off_t dvb_plugin_read (input_plugin_t *this_gen, /* protect against channel changes */ have_mutex = pthread_mutex_lock(&this->channel_change_mutex); total=0; - - while (total<len){ + + while (total<len){ pfd.fd = this->fd; pfd.events = POLLPRI | POLLIN | POLLERR; pfd.revents = 0; - + if (!this->tuned_in) { pthread_mutex_unlock( &this->channel_change_mutex ); xprintf(this->class->xine, XINE_VERBOSITY_LOG, "input_dvb: Channel \"%s\" could not be tuned in. " "Possibly erroneus settings in channels.conf " - "(frequency changed?).\n", + "(frequency changed?).\n", this->channels[this->channel].name); return 0; } - - if (poll(&pfd, 1, 1500) < 1) { + + if (poll(&pfd, 1, 1500) < 1) { xprintf(this->class->xine, XINE_VERBOSITY_LOG, "input_dvb: No data available. Signal Lost?? \n"); - _x_demux_control_end(this->stream, BUF_FLAG_END_USER); + _x_demux_control_end(this->stream, BUF_FLAG_END_USER); this->read_failcount++; break; } - if (this->read_failcount) { - /* signal/stream regained after loss - + if (this->read_failcount) { + /* signal/stream regained after loss - kick the net_buf_control layer. */ this->read_failcount=0; xprintf(this->class->xine,XINE_VERBOSITY_LOG, @@ -2553,22 +2553,22 @@ static off_t dvb_plugin_read (input_plugin_t *this_gen, if (pfd.revents & POLLPRI || pfd.revents & POLLIN) { n = read (this->fd, &buf[total], len-total); - } else + } else if (pfd.revents & POLLERR) { xprintf(this->class->xine, XINE_VERBOSITY_LOG, "input_dvb: No data available. Signal Lost?? \n"); - _x_demux_control_end(this->stream, BUF_FLAG_END_USER); + _x_demux_control_end(this->stream, BUF_FLAG_END_USER); this->read_failcount++; break; - } + } #ifdef LOG_READS xprintf(this->class->xine,XINE_VERBOSITY_DEBUG, - "input_dvb: got %" PRIdMAX " bytes (%" PRIdMAX "/%" PRIdMAX " bytes read)\n", + "input_dvb: got %" PRIdMAX " bytes (%" PRIdMAX "/%" PRIdMAX " bytes read)\n", (intmax_t)n, (intmax_t)total, (intmax_t)len); #endif - - if (n > 0){ + + if (n > 0){ this->curpos += n; total += n; } else if (n < 0 && errno!=EAGAIN) { @@ -2585,7 +2585,7 @@ static off_t dvb_plugin_read (input_plugin_t *this_gen, /* no data for several seconds - tell the user a possible reason */ if(this->read_failcount==5){ - _x_message(this->stream,1,"DVB Signal Lost. Please check connections.", NULL); + _x_message(this->stream,1,"DVB Signal Lost. Please check connections.", NULL); } #ifdef DVB_NO_BUFFERING if(this->newchannel){ @@ -2673,7 +2673,7 @@ static void dvb_plugin_dispose (input_plugin_t *this_gen) { } if (this->nbc) { - nbc_close (this->nbc); + nbc_close (this->nbc); this->nbc = NULL; } @@ -2778,7 +2778,7 @@ static int dvb_plugin_open(input_plugin_t * this_gen) xine_cfg_entry_t adapter; xine_cfg_entry_t lastchannel; xine_cfg_entry_t gui_enabled; - + xine_config_lookup_entry(this->stream->xine, "media.dvb.gui_enabled", &gui_enabled); this->dvb_gui_enabled = gui_enabled.num_value; xprintf(this->class->xine, XINE_VERBOSITY_LOG, _("input_dvb: DVB GUI %s\n"), this->dvb_gui_enabled ? "enabled" : "disabled"); @@ -2798,7 +2798,7 @@ static int dvb_plugin_open(input_plugin_t * this_gen) * and assume that its format is valid for our tuner type */ - if (!(channels = load_channels(this->class->xine, this->stream, &num_channels, tuner->feinfo.type))) + if (!(channels = load_channels(this->class->xine, this->stream, &num_channels, tuner->feinfo.type))) { /* failed to load the channels */ tuner_dispose(tuner); @@ -2834,7 +2834,7 @@ static int dvb_plugin_open(input_plugin_t * this_gen) } else { /* * try a partial match too - * be smart and compare starting from the first char, then from + * be smart and compare starting from the first char, then from * the second etc.. * Yes, this is expensive, but it happens really often * that the channels have really ugly names, sometimes prefixed @@ -2852,7 +2852,7 @@ static int dvb_plugin_open(input_plugin_t * this_gen) if (strlen(channels[idx].name) > offset) { if (strncasecmp(channels[idx].name + offset, channame, chanlen) == 0) { xprintf(this->class->xine, XINE_VERBOSITY_LOG, _("input_dvb: found matching channel %s\n"), channels[idx].name); - break; + break; } } idx++; @@ -2925,12 +2925,12 @@ static int dvb_plugin_open(input_plugin_t * this_gen) return 0; } this->channel = 0; - } else if (strncasecmp(this->mrl, "dvbc://", 7) == 0) + } else if (strncasecmp(this->mrl, "dvbc://", 7) == 0) { /* * This is dvbc://<channel name>:<qam tuning parameters> */ - if (tuner->feinfo.type != FE_QAM) + if (tuner->feinfo.type != FE_QAM) { xprintf(this->class->xine, XINE_VERBOSITY_LOG, _("input_dvb: dvbc mrl specified but the tuner doesn't appear to be QAM (DVB-C)\n")); @@ -2949,15 +2949,15 @@ static int dvb_plugin_open(input_plugin_t * this_gen) return 0; } this->channel = 0; - } else if (strncasecmp(this->mrl, "dvba://", 7) == 0) + } else if (strncasecmp(this->mrl, "dvba://", 7) == 0) { - fprintf(stderr,"input_dvb: 2a %x\n",tuner->feinfo.type); + fprintf(stderr,"input_dvb: 2a %x\n",tuner->feinfo.type); /* * This is dvba://<channel name>:<atsc tuning parameters> */ - if (tuner->feinfo.type != FE_ATSC) + if (tuner->feinfo.type != FE_ATSC) { - fprintf(stderr,"input_dvb: FAILED 1\n"); + fprintf(stderr,"input_dvb: FAILED 1\n"); xprintf(this->class->xine, XINE_VERBOSITY_LOG, _("input_dvb: dvba mrl specified but the tuner doesn't appear to be ATSC (DVB-A)\n")); tuner_dispose(tuner); @@ -2969,7 +2969,7 @@ static int dvb_plugin_open(input_plugin_t * this_gen) _x_assert(channels != NULL); if (extract_channel_from_string(channels, ptr, tuner->feinfo.type) < 0) { - fprintf(stderr,"input_dvb: FAILED 2\n"); + fprintf(stderr,"input_dvb: FAILED 2\n"); free(channels); channels = NULL; tuner_dispose(tuner); @@ -2985,7 +2985,7 @@ static int dvb_plugin_open(input_plugin_t * this_gen) this->tuner = tuner; this->channels = channels; this->num_channels = num_channels; - + if (!tuner_set_channel(this, &this->channels[this->channel])) { xprintf(this->class->xine, XINE_VERBOSITY_LOG, _("input_dvb: tuner_set_channel failed\n")); @@ -2998,7 +2998,7 @@ static int dvb_plugin_open(input_plugin_t * this_gen) return 0; } this->tuned_in = 1; - + /* now read the pat, find all accociated PIDs and add them to the stream */ dvb_parse_si(this); @@ -3013,14 +3013,14 @@ static int dvb_plugin_open(input_plugin_t * this_gen) if (this->dvb_gui_enabled) { /* Start the EPG updater thread. */ this->epg_updater_stop = 0; - if (pthread_create(&this->epg_updater_thread, NULL, + if (pthread_create(&this->epg_updater_thread, NULL, epg_data_updater, this) != 0) { xprintf( this->class->xine, XINE_VERBOSITY_LOG, _("input_dvb: cannot create EPG updater thread\n")); return 0; } - } + } #endif /* * this osd is used to draw the "recording" sign @@ -3039,8 +3039,8 @@ static int dvb_plugin_open(input_plugin_t * this_gen) this->stream->osd_renderer->set_position(this->channel_osd, 20, 10); this->stream->osd_renderer->set_encoding(this->channel_osd, NULL); - /* - * this osd is for displaying currently shown channel name + /* + * this osd is for displaying currently shown channel name */ this->name_osd = this->stream->osd_renderer->new_object(this->stream->osd_renderer, 301, 61); this->stream->osd_renderer->set_position(this->name_osd, 20, 10); @@ -3048,8 +3048,8 @@ static int dvb_plugin_open(input_plugin_t * this_gen) this->stream->osd_renderer->set_encoding(this->name_osd, NULL); this->stream->osd_renderer->set_text_palette(this->name_osd, XINE_TEXTPALETTE_YELLOW_BLACK_TRANSPARENT, OSD_TEXT3); - /* - * this osd is for displaying Recording Paused + /* + * this osd is for displaying Recording Paused */ this->paused_osd = this->stream->osd_renderer->new_object(this->stream->osd_renderer, 301, 161); this->stream->osd_renderer->set_position(this->paused_osd, 10, 50); @@ -3057,10 +3057,10 @@ static int dvb_plugin_open(input_plugin_t * this_gen) this->stream->osd_renderer->set_encoding(this->paused_osd, NULL); this->stream->osd_renderer->set_text_palette(this->paused_osd, XINE_TEXTPALETTE_YELLOW_BLACK_TRANSPARENT, OSD_TEXT3); - /* + /* * This osd is for displaying Program Information (EIT), i.e., EPG. */ - this->proginfo_osd = + this->proginfo_osd = this->stream->osd_renderer->new_object( this->stream->osd_renderer, EPG_WIDTH, EPG_HEIGHT); @@ -3069,10 +3069,10 @@ static int dvb_plugin_open(input_plugin_t * this_gen) this->stream->osd_renderer->set_text_palette(this->proginfo_osd, XINE_TEXTPALETTE_WHITE_NONE_TRANSLUCID, OSD_TEXT3); this->stream->osd_renderer->set_text_palette(this->proginfo_osd, XINE_TEXTPALETTE_YELLOW_BLACK_TRANSPARENT, OSD_TEXT4); - this->background = + this->background = this->stream->osd_renderer->new_object( - this->stream->osd_renderer, - EPG_WIDTH + EPG_BACKGROUND_MARGIN*2, + this->stream->osd_renderer, + EPG_WIDTH + EPG_BACKGROUND_MARGIN*2, EPG_HEIGHT + EPG_BACKGROUND_MARGIN*2); this->epg_displaying = 0; @@ -3106,7 +3106,7 @@ static int dvb_plugin_open(input_plugin_t * this_gen) /* Clear all pids, the pmt will tell us which to use */ for (x = 0; x < MAX_FILTERS; x++){ this->channels[this->channel].pid[x] = DVB_NOPID; - } + } return 1; @@ -3142,16 +3142,16 @@ static input_plugin_t *dvb_class_get_instance (input_class_t *class_gen, this->fd = -1; this->tuned_in = 0; #ifndef DVB_NO_BUFFERING - this->nbc = nbc_init (this->stream); + this->nbc = nbc_init (this->stream); #else - this->nbc = NULL; + this->nbc = NULL; #endif this->osd = NULL; this->event_queue = NULL; this->record_fd = -1; this->read_failcount = 0; this->epg_updater_stop = 0; - + this->input_plugin.open = dvb_plugin_open; this->input_plugin.get_capabilities = dvb_plugin_get_capabilities; this->input_plugin.read = dvb_plugin_read; @@ -3187,7 +3187,7 @@ static void dvb_class_dispose(input_class_t * this_gen) int x; free(class->default_channels_conf_filename); - + for(x=0;x<class->numchannels;x++) free(class->autoplaylist[x]); @@ -3233,7 +3233,7 @@ static char **dvb_class_get_autoplay_list(input_class_t * this_gen, tuner_dispose(tuner); return class->mrls; } - + tuner_dispose(tuner); if (xine_config_lookup_entry(class->xine, "media.dvb.remember_channel", &lastchannel_enable) @@ -3295,7 +3295,7 @@ static void *init_class (xine_t *xine, void *data) { this->mrls[3] = "dvbt://"; this->mrls[4] = "dvba://"; this->mrls[5] = 0; - + asprintf(&this->default_channels_conf_filename, "%s/.xine/channels.conf", xine_get_homedir()); @@ -3331,7 +3331,7 @@ static void *init_class (xine_t *xine, void *data) { "really have more than 1 card " "in your system."), 0, NULL, (void *) this); - + /* set to 0 to turn off the GUI built into this input plugin */ config->register_bool(config, "media.dvb.gui_enabled", 1, diff --git a/src/input/input_dvd.c b/src/input/input_dvd.c index 4f8827dbd..400f82aca 100644 --- a/src/input/input_dvd.c +++ b/src/input/input_dvd.c @@ -1,26 +1,26 @@ -/* - * Copyright (C) 2000-2005 the xine project, +/* + * Copyright (C) 2000-2005 the xine project, * Rich Wareham <richwareham@users.sourceforge.net> - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA */ /* This file was origninally part of the xine-dvdnav project - * at http://dvd.sf.net/. + * at http://dvd.sf.net/. */ /* TODO: @@ -123,7 +123,7 @@ #else #define DVD_PATH "/dev/dvd" #define RDVD_PATH "/dev/rdvd" -#endif +#endif /* Some misc. defines */ #ifdef DVD_VIDEO_LB_LEN @@ -153,7 +153,7 @@ /* Array to hold MRLs returned by get_autoplay_list */ #define MAX_DIR_ENTRIES 1250 -#define MAX_STR_LEN 255 +#define MAX_STR_LEN 255 #if defined (__FreeBSD__) # define off64_t off_t @@ -176,7 +176,7 @@ typedef struct { xine_stream_t *stream; xine_event_queue_t *event_queue; - + int pause_timer; /* Cell still-time timer */ int pause_counter; time_t pause_end_time; @@ -186,7 +186,7 @@ typedef struct { int64_t pg_start; int32_t buttonN; int typed_buttonN;/* for XINE_EVENT_INPUT_NUMBER_* */ - + int32_t mouse_buttonN; int mouse_in; @@ -195,13 +195,13 @@ typedef struct { int seekable; /* are we seekable? */ int mode; /* MODE_NAVIGATE / MODE_TITLE */ int tt, pr; /* title / chapter */ - + /* xine specific variables */ const char *current_dvd_device; /* DVD device currently open */ char *mrl; /* Current MRL */ dvdnav_t *dvdnav; /* Handle for libdvdnav */ const char *dvd_name; - + /* special buffer handling for libdvdnav caching */ pthread_mutex_t buf_mutex; void *source; @@ -240,16 +240,16 @@ static void xine_dvd_send_button_update(dvd_input_plugin_t *this, int mode); /* Callback on device name change */ static void device_change_cb(void *data, xine_cfg_entry_t *cfg) { dvd_input_class_t *class = (dvd_input_class_t *) data; - + class->dvd_device = cfg->str_value; } static uint32_t dvd_plugin_get_capabilities (input_plugin_t *this_gen) { dvd_input_plugin_t *this = (dvd_input_plugin_t*)this_gen; - + trace_print("Called\n"); - return INPUT_CAP_BLOCK | + return INPUT_CAP_BLOCK | /* TODO: figure out if there is any "allow copying" flag on DVD. * maybe set INPUT_CAP_RIP_FORBIDDEN only for encrypted media? */ @@ -257,7 +257,7 @@ static uint32_t dvd_plugin_get_capabilities (input_plugin_t *this_gen) { #if CAN_SEEK (this->seekable ? INPUT_CAP_SEEKABLE : 0) | #endif - INPUT_CAP_AUDIOLANG | INPUT_CAP_SPULANG | INPUT_CAP_CHAPTERS; + INPUT_CAP_AUDIOLANG | INPUT_CAP_SPULANG | INPUT_CAP_CHAPTERS; } static void read_ahead_cb(void *this_gen, xine_cfg_entry_t *entry) { @@ -274,7 +274,7 @@ static void read_ahead_cb(void *this_gen, xine_cfg_entry_t *entry) { dvdnav_set_readahead_flag(this->dvdnav, entry->num_value); } } - + static void seek_mode_cb(void *this_gen, xine_cfg_entry_t *entry) { dvd_input_class_t *class = (dvd_input_class_t*)this_gen; @@ -289,7 +289,7 @@ static void seek_mode_cb(void *this_gen, xine_cfg_entry_t *entry) { dvdnav_set_PGC_positioning_flag(this->dvdnav, !entry->num_value); } } - + static void region_changed_cb (void *this_gen, xine_cfg_entry_t *entry) { dvd_input_class_t *class = (dvd_input_class_t*)this_gen; @@ -312,10 +312,10 @@ static void language_changed_cb(void *this_gen, xine_cfg_entry_t *entry) { return; class->language = entry->str_value[0] << 8 | entry->str_value[1]; - + if(class->ip) { dvd_input_plugin_t *this = class->ip; - + dvdnav_menu_language_select(this->dvdnav, entry->str_value); dvdnav_audio_language_select(this->dvdnav, entry->str_value); dvdnav_spu_language_select(this->dvdnav, entry->str_value); @@ -342,20 +342,20 @@ static void send_mouse_enter_leave_event(dvd_input_plugin_t *this, int direction spu_event.direction = direction; spu_event.button = this->mouse_buttonN; - + event.type = XINE_EVENT_SPU_BUTTON; event.stream = this->stream; event.data = &spu_event; event.data_length = sizeof(spu_event); xine_event_send(this->stream, &event); - + this->mouse_in = direction; } if(!direction) this->mouse_buttonN = -1; } - + static int update_title_display(dvd_input_plugin_t *this) { xine_ui_data_t data; xine_event_t uevent = { @@ -367,7 +367,7 @@ static int update_title_display(dvd_input_plugin_t *this) { int tt=-1, pr=-1; int num_tt = 0; - if(!this || !(this->stream)) + if(!this || !(this->stream)) return 0; /* Set title/chapter display */ @@ -385,22 +385,22 @@ static int update_title_display(dvd_input_plugin_t *this) { dvdnav_get_number_of_titles(this->dvdnav, &num_tt ); - - if(tt >= 1) { + + if(tt >= 1) { int num_angle = 0, cur_angle = 0; int num_part = 0; - /* no menu here */ + /* no menu here */ /* Reflect angle info if appropriate */ dvdnav_get_number_of_parts(this->dvdnav, tt, &num_part); dvdnav_get_angle_info(this->dvdnav, &cur_angle, &num_angle); if(num_angle > 1) { data.str_len = snprintf(data.str, sizeof(data.str), "Title %i, Chapter %i, Angle %i of %i", - tt,pr,cur_angle, num_angle); + tt,pr,cur_angle, num_angle); _x_stream_info_set(this->stream,XINE_STREAM_INFO_DVD_ANGLE_NUMBER,cur_angle); _x_stream_info_set(this->stream,XINE_STREAM_INFO_DVD_ANGLE_COUNT,num_angle); } else { - data.str_len = snprintf(data.str, sizeof(data.str), + data.str_len = snprintf(data.str, sizeof(data.str), "Title %i, Chapter %i", tt,pr); _x_stream_info_set(this->stream,XINE_STREAM_INFO_DVD_ANGLE_NUMBER,0); @@ -430,10 +430,10 @@ static int update_title_display(dvd_input_plugin_t *this) { _x_stream_info_set(this->stream,XINE_STREAM_INFO_DVD_ANGLE_NUMBER,0); _x_stream_info_set(this->stream,XINE_STREAM_INFO_DVD_ANGLE_COUNT,0); } - + if (this->dvd_name && this->dvd_name[0] && (data.str_len + strlen(this->dvd_name) < sizeof(data.str))) { - data.str_len += snprintf(data.str+data.str_len, sizeof(data.str) - data.str_len, + data.str_len += snprintf(data.str+data.str_len, sizeof(data.str) - data.str_len, ", %s", this->dvd_name); } #ifdef INPUT_DEBUG @@ -446,16 +446,16 @@ static int update_title_display(dvd_input_plugin_t *this) { static void dvd_plugin_dispose (input_plugin_t *this_gen) { dvd_input_plugin_t *this = (dvd_input_plugin_t*)this_gen; - + trace_print("Called\n"); - + if (this->event_queue) xine_event_dispose_queue (this->event_queue); - + ((dvd_input_class_t *)this_gen->input_class)->ip = NULL; if (this->dvdnav) dvdnav_close(this->dvdnav); - + pthread_mutex_lock(&this->buf_mutex); if (this->mem_stack) { /* raise the freeing flag, so that the plugin will be freed as soon @@ -489,11 +489,11 @@ static void dvd_build_mrl_list(dvd_input_plugin_t *this) { this->class->num_mrls = 0; } - if (dvdnav_open(&(this->dvdnav), + if (dvdnav_open(&(this->dvdnav), this->dvd_device) == DVDNAV_STATUS_ERR) { return; } - + this->current_dvd_device = this->dvd_device; this->opened = 1; @@ -515,7 +515,7 @@ static void dvd_build_mrl_list(dvd_input_plugin_t *this) { /* allocate enough memory for: * - a list of pointers to mrls sizeof(xine_mrl_t *) * (num_mrls+1) - * - possible alignment of the mrl array + * - possible alignment of the mrl array * - an array of mrl structures sizeof(xine_mrl_t) * num_mrls * - enough chars for every filename sizeof(char)*25 * num_mrls * - "dvd:/000000.000000\0" = 25 chars @@ -523,7 +523,7 @@ static void dvd_build_mrl_list(dvd_input_plugin_t *this) { if ((this->mrls = (xine_mrl_t **) malloc(sizeof(xine_mrl_t *) + num_mrls * (sizeof(xine_mrl_t*) + sizeof(xine_mrl_t) + 25*sizeof(char)) + xine_mrl_alignment))) { - + /* the first mrl struct comes after the pointer list */ xine_mrl_t *mrl = PTR_ALIGN(&this->mrls[num_mrls+1], xine_mrl_alignment); @@ -556,7 +556,7 @@ static void dvd_build_mrl_list(dvd_input_plugin_t *this) { static void dvd_plugin_free_buffer(buf_element_t *buf) { dvd_input_plugin_t *this = buf->source; - + pthread_mutex_lock(&this->buf_mutex); /* give this buffer back to libdvdnav */ dvdnav_free_cache_block(this->dvdnav, buf->mem); @@ -576,7 +576,7 @@ static void dvd_plugin_free_buffer(buf_element_t *buf) { } } -static buf_element_t *dvd_plugin_read_block (input_plugin_t *this_gen, +static buf_element_t *dvd_plugin_read_block (input_plugin_t *this_gen, fifo_buffer_t *fifo, off_t nlen) { dvd_input_plugin_t *this = (dvd_input_plugin_t*)this_gen; buf_element_t *buf; @@ -597,7 +597,7 @@ static buf_element_t *dvd_plugin_read_block (input_plugin_t *this_gen, while(!finished) { dvd_handle_events(this); - + if (block != buf->mem) { /* if we already have a dvdnav cache block, give it back first */ dvdnav_free_cache_block(this->dvdnav, block); @@ -615,17 +615,17 @@ static buf_element_t *dvd_plugin_read_block (input_plugin_t *this_gen, } switch(event) { - case DVDNAV_BLOCK_OK: + case DVDNAV_BLOCK_OK: { buf->content = block; buf->type = BUF_DEMUX_BLOCK; /* Make sure we don't think we are still paused */ this->pause_timer = 0; - + /* we got a block, so we might be seekable here */ this->seekable = 1; - + finished = 1; } break; @@ -637,7 +637,7 @@ static buf_element_t *dvd_plugin_read_block (input_plugin_t *this_gen, (dvdnav_still_event_t*)block; buf->type = BUF_CONTROL_NOP; finished = 1; - + /* stills are not seekable */ this->seekable = 0; @@ -658,7 +658,7 @@ static buf_element_t *dvd_plugin_read_block (input_plugin_t *this_gen, xine_usec_sleep(50000); break; } - if ((this->pause_timer != 0xff) && + if ((this->pause_timer != 0xff) && (time(NULL) >= this->pause_end_time)) { this->pause_timer = 0; this->pause_end_time = 0; @@ -678,7 +678,7 @@ static buf_element_t *dvd_plugin_read_block (input_plugin_t *this_gen, break; case DVDNAV_SPU_STREAM_CHANGE: { - dvdnav_spu_stream_change_event_t *stream_event = + dvdnav_spu_stream_change_event_t *stream_event = (dvdnav_spu_stream_change_event_t*) (block); buf->content = block; buf->type = BUF_CONTROL_SPU_CHANNEL; @@ -696,7 +696,7 @@ static buf_element_t *dvd_plugin_read_block (input_plugin_t *this_gen, break; case DVDNAV_AUDIO_STREAM_CHANGE: { - dvdnav_audio_stream_change_event_t *stream_event = + dvdnav_audio_stream_change_event_t *stream_event = (dvdnav_audio_stream_change_event_t*) (block); buf->content = block; buf->type = BUF_CONTROL_AUDIO_CHANNEL; @@ -730,7 +730,7 @@ static buf_element_t *dvd_plugin_read_block (input_plugin_t *this_gen, break; case DVDNAV_CELL_CHANGE: { - dvdnav_cell_change_event_t *cell_event = + dvdnav_cell_change_event_t *cell_event = (dvdnav_cell_change_event_t*) (block); xine_event_t event; @@ -740,14 +740,14 @@ static buf_element_t *dvd_plugin_read_block (input_plugin_t *this_gen, event.data = NULL; event.data_length = 0; xine_event_send(this->stream, &event); - + if( !update_title_display(this) ) { if (buf->mem != block) dvdnav_free_cache_block(this->dvdnav, block); buf->free_buffer(buf); /* return NULL to indicate end of stream */ return NULL; } - + this->pg_length = cell_event->pg_length; this->pgc_length = cell_event->pgc_length; this->cell_start = cell_event->cell_start; @@ -799,7 +799,7 @@ static buf_element_t *dvd_plugin_read_block (input_plugin_t *this_gen, break; } } - + if (block != buf->mem) { /* we have received a buffer from the libdvdnav cache, store all * necessary values to reconstruct xine's buffer and modify it according to @@ -835,7 +835,7 @@ static buf_element_t *dvd_plugin_read_block (input_plugin_t *this_gen, } pthread_mutex_unlock(&this->buf_mutex); } - + if (this->pg_length && this->pgc_length) { switch (((dvd_input_class_t *)this->input_plugin.input_class)->seek_mode) { case 0: /* PGC based seeking */ @@ -848,7 +848,7 @@ static buf_element_t *dvd_plugin_read_block (input_plugin_t *this_gen, break; } } - + return buf; } @@ -865,7 +865,7 @@ static off_t dvd_plugin_read (input_plugin_t *this_gen, char *ch_buf, off_t len) ch_buf[3] = 0xba; return 1; } - + static off_t dvd_plugin_get_current_pos (input_plugin_t *this_gen){ dvd_input_plugin_t *this = (dvd_input_plugin_t*)this_gen; uint32_t pos=0; @@ -882,28 +882,28 @@ static off_t dvd_plugin_get_current_pos (input_plugin_t *this_gen){ static off_t dvd_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin) { dvd_input_plugin_t *this = (dvd_input_plugin_t*)this_gen; - + trace_print("Called\n"); if(!this || !this->dvdnav) { return -1; } - + dvdnav_sector_search(this->dvdnav, offset / DVD_BLOCK_SIZE , origin); return dvd_plugin_get_current_pos(this_gen); } static off_t dvd_plugin_seek_time (input_plugin_t *this_gen, int time_offset, int origin) { dvd_input_plugin_t *this = (dvd_input_plugin_t*)this_gen; - + trace_print("Called\n"); - + if(!this || !this->dvdnav || origin != SEEK_SET) { return -1; } - + dvdnav_time_search(this->dvdnav, time_offset * 90); - + return dvd_plugin_get_current_pos(this_gen); } @@ -912,7 +912,7 @@ static off_t dvd_plugin_get_length (input_plugin_t *this_gen) { uint32_t pos=0; uint32_t length=1; dvdnav_status_t result; - + trace_print("Called\n"); if(!this || !this->dvdnav) { @@ -930,7 +930,7 @@ static uint32_t dvd_plugin_get_blocksize (input_plugin_t *this_gen) { static const char* dvd_plugin_get_mrl (input_plugin_t *this_gen) { dvd_input_plugin_t *this = (dvd_input_plugin_t*)this_gen; - + trace_print("Called\n"); return this->mrl; @@ -942,17 +942,17 @@ static void xine_dvd_send_button_update(dvd_input_plugin_t *this, int mode) { if (!this || !this->stream || _x_stream_info_get(this->stream,XINE_STREAM_INFO_IGNORE_SPU)) return; - + if (!this->stream->spu_decoder_plugin || this->stream->spu_decoder_streamtype != ((BUF_SPU_DVD >> 16) & 0xFF)) { /* the proper SPU decoder has not been initialized yet, * so we send a dummy buffer to trigger this */ buf_element_t *buf = this->stream->video_fifo->buffer_pool_alloc(this->stream->video_fifo); - + buf->size = 0; buf->type = BUF_SPU_DVD; this->stream->video_fifo->insert(this->stream->video_fifo, buf); - + while (!this->stream->spu_decoder_plugin || this->stream->spu_decoder_streamtype != ((BUF_SPU_DVD >> 16) & 0xFF)) xine_usec_sleep(50000); @@ -961,7 +961,7 @@ static void xine_dvd_send_button_update(dvd_input_plugin_t *this, int mode) { dvdnav_get_current_highlight(this->dvdnav, &button); if (button == this->buttonN && (mode == 0) ) return; - + this->buttonN = button; /* Avoid duplicate sending of button info */ #ifdef INPUT_DEBUG @@ -976,11 +976,11 @@ static void xine_dvd_send_button_update(dvd_input_plugin_t *this, int mode) { static void dvd_handle_events(dvd_input_plugin_t *this) { dvd_input_class_t *class = (dvd_input_class_t*)this->input_plugin.input_class; - config_values_t *config = class->config; /* Pointer to XineRC config file */ + config_values_t *config = class->config; /* Pointer to XineRC config file */ xine_event_t *event; while ((event = xine_event_get(this->event_queue))) { - + if(!this->dvdnav) { xine_event_free(event); return; @@ -1054,7 +1054,7 @@ static void dvd_handle_events(dvd_input_plugin_t *this) { } } break; - case XINE_EVENT_INPUT_ANGLE_NEXT: + case XINE_EVENT_INPUT_ANGLE_NEXT: { int num = 0, current = 0; dvdnav_get_angle_info(this->dvdnav, ¤t, &num); @@ -1071,7 +1071,7 @@ static void dvd_handle_events(dvd_input_plugin_t *this) { update_title_display(this); } break; - case XINE_EVENT_INPUT_ANGLE_PREVIOUS: + case XINE_EVENT_INPUT_ANGLE_PREVIOUS: { int num = 0, current = 0; dvdnav_get_angle_info(this->dvdnav, ¤t, &num); @@ -1100,7 +1100,7 @@ static void dvd_handle_events(dvd_input_plugin_t *this) { } } break; - case XINE_EVENT_INPUT_MOUSE_BUTTON: + case XINE_EVENT_INPUT_MOUSE_BUTTON: { pci_t nav_pci; if(!this->stream || !this->stream->spu_decoder_plugin) { @@ -1108,7 +1108,7 @@ static void dvd_handle_events(dvd_input_plugin_t *this) { } if (this->stream->spu_decoder_plugin->get_interact_info(this->stream->spu_decoder_plugin, &nav_pci) ) { xine_input_data_t *input = event->data; - if((input->button == 1) && dvdnav_mouse_activate(this->dvdnav, + if((input->button == 1) && dvdnav_mouse_activate(this->dvdnav, &nav_pci, input->x, input->y) == DVDNAV_STATUS_OK) { xine_dvd_send_button_update(this, 1); @@ -1134,7 +1134,7 @@ static void dvd_handle_events(dvd_input_plugin_t *this) { dvdnav_button_select(this->dvdnav, &nav_pci, *but); } break; - case XINE_EVENT_INPUT_MOUSE_MOVE: + case XINE_EVENT_INPUT_MOUSE_MOVE: { pci_t nav_pci; if(!this->stream || !this->stream->spu_decoder_plugin) @@ -1144,19 +1144,19 @@ static void dvd_handle_events(dvd_input_plugin_t *this) { /* printf("input_dvd: Mouse move (x,y) = (%i,%i)\n", input->x, input->y); */ if(dvdnav_mouse_select(this->dvdnav, &nav_pci, input->x, input->y) == DVDNAV_STATUS_OK) { int32_t button; - + dvdnav_get_current_highlight(this->dvdnav, &button); - + if(this->mouse_buttonN != button) { this->mouse_buttonN = button; send_mouse_enter_leave_event(this, 1); } - + } else { if(this->mouse_in) send_mouse_enter_leave_event(this, 0); - + } } } @@ -1236,14 +1236,14 @@ static void dvd_handle_events(dvd_input_plugin_t *this) { case XINE_EVENT_INPUT_NUMBER_1: this->typed_buttonN++; case XINE_EVENT_INPUT_NUMBER_0: - { + { pci_t nav_pci; if(!this->stream || !this->stream->spu_decoder_plugin) return; if (this->stream->spu_decoder_plugin->get_interact_info(this->stream->spu_decoder_plugin, &nav_pci) ) { if (dvdnav_button_select_and_activate(this->dvdnav, &nav_pci, this->typed_buttonN) == DVDNAV_STATUS_OK) { xine_dvd_send_button_update(this, 1); - + if(this->mouse_in) send_mouse_enter_leave_event(this, 0); } @@ -1255,23 +1255,23 @@ static void dvd_handle_events(dvd_input_plugin_t *this) { case XINE_EVENT_INPUT_NUMBER_10_ADD: this->typed_buttonN += 10; } - + xine_event_free(event); } return; } -static int dvd_plugin_get_optional_data (input_plugin_t *this_gen, +static int dvd_plugin_get_optional_data (input_plugin_t *this_gen, void *data, int data_type) { - dvd_input_plugin_t *this = (dvd_input_plugin_t *) this_gen; - + dvd_input_plugin_t *this = (dvd_input_plugin_t *) this_gen; + switch(data_type) { case INPUT_OPTIONAL_DATA_AUDIOLANG: { uint16_t lang; int channel = *((int *)data); int8_t dvd_channel; - + /* Be paranoid */ if(this && this->stream && this->dvdnav) { @@ -1282,7 +1282,7 @@ static int dvd_plugin_get_optional_data (input_plugin_t *this_gen, else return INPUT_OPTIONAL_UNSUPPORTED; } - + if (channel == -1) dvd_channel = dvdnav_get_audio_logical_stream(this->dvdnav, this->stream->audio_channel_auto); else @@ -1290,7 +1290,7 @@ static int dvd_plugin_get_optional_data (input_plugin_t *this_gen, if(dvd_channel != -1) { lang = dvdnav_audio_stream_to_lang(this->dvdnav, dvd_channel); - + if(lang != 0xffff) sprintf(data, " %c%c", lang >> 8, lang & 0xff); /* TODO: provide long version in XINE_META_INFO_FULL_LANG */ @@ -1303,7 +1303,7 @@ static int dvd_plugin_get_optional_data (input_plugin_t *this_gen, return INPUT_OPTIONAL_SUCCESS; } } - } + } return INPUT_OPTIONAL_UNSUPPORTED; } break; @@ -1313,7 +1313,7 @@ static int dvd_plugin_get_optional_data (input_plugin_t *this_gen, uint16_t lang; int channel = *((int *)data); int8_t dvd_channel; - + /* Be paranoid */ if(this && this->stream && this->dvdnav) { @@ -1349,14 +1349,14 @@ static int dvd_plugin_get_optional_data (input_plugin_t *this_gen, return INPUT_OPTIONAL_UNSUPPORTED; } break; - + } - + return INPUT_OPTIONAL_UNSUPPORTED; } #ifdef __sun -/* +/* * Check the environment, if we're running under sun's * vold/rmmount control. */ @@ -1388,7 +1388,7 @@ check_solaris_vold_device(dvd_input_class_t *this) static int dvd_parse_try_open(dvd_input_plugin_t *this, const char *locator) { const char *intended_dvd_device; - + /* FIXME: we temporarily special-case "dvd:/" for compatibility; * actually "dvd:/" should play a DVD image stored in /, but for * now we have it use the default device */ @@ -1410,7 +1410,7 @@ static int dvd_parse_try_open(dvd_input_plugin_t *this, const char *locator) xine_setenv("DVDCSS_RAW_DEVICE", raw_device.str_value, 1); intended_dvd_device = class->dvd_device; } - + /* attempt to open DVD */ if (this->opened) { if (intended_dvd_device == this->current_dvd_device) { @@ -1420,7 +1420,7 @@ static int dvd_parse_try_open(dvd_input_plugin_t *this, const char *locator) /* Changing DVD device */ dvdnav_close(this->dvdnav); this->dvdnav = NULL; - this->opened = 0; + this->opened = 0; } } if (!this->opened) { @@ -1429,14 +1429,14 @@ static int dvd_parse_try_open(dvd_input_plugin_t *this, const char *locator) this->current_dvd_device = intended_dvd_device; } } - + return this->opened; } static int dvd_parse_mrl(dvd_input_plugin_t *this, char **locator, char **title_part) { *title_part = NULL; - + if (dvd_parse_try_open(this, *locator)) { return MODE_NAVIGATE; } else { @@ -1461,7 +1461,7 @@ static int dvd_parse_mrl(dvd_input_plugin_t *this, char **locator, char **title_ *locator = ""; } else return MODE_FAIL; - + if (dvd_parse_try_open(this, *locator)) if (strlen(*title_part)) return MODE_TITLE; @@ -1475,25 +1475,25 @@ static int dvd_parse_mrl(dvd_input_plugin_t *this, char **locator, char **title_ static int dvd_plugin_open (input_plugin_t *this_gen) { dvd_input_plugin_t *this = (dvd_input_plugin_t*)this_gen; dvd_input_class_t *class = (dvd_input_class_t*)this_gen->input_class; - + char *locator, *locator_orig; char *title_part; xine_event_t event; xine_cfg_entry_t region_entry, lang_entry, cfg_entry; - + trace_print("Called\n"); /* we already checked the "dvd:/" MRL before */ locator_orig = locator = strdup (this->mrl + (sizeof("dvd:") - 1)); /* FIXME: call a generic xine-lib MRL parser here to pre-parse - * the MRL for ?title=<title>&part=<part> stuff and to expand + * the MRL for ?title=<title>&part=<part> stuff and to expand * escaped characters properly */ _x_mrl_unescape (locator); this->mode = dvd_parse_mrl(this, &locator, &title_part); - + if (this->mode == MODE_FAIL) { /* opening failed and we have nothing left to try */ xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("input_dvd: Error opening DVD device\n")); @@ -1507,26 +1507,26 @@ static int dvd_plugin_open (input_plugin_t *this_gen) { dvdnav_get_title_string(this->dvdnav, &this->dvd_name); if(this->dvd_name) _x_meta_info_set(this->stream, XINE_META_INFO_TITLE, this->dvd_name); - + /* Set region code */ - if (xine_config_lookup_entry (this->stream->xine, "media.dvd.region", - ®ion_entry)) + if (xine_config_lookup_entry (this->stream->xine, "media.dvd.region", + ®ion_entry)) region_changed_cb (class, ®ion_entry); - + /* Set languages */ if (xine_config_lookup_entry (this->stream->xine, "media.dvd.language", - &lang_entry)) + &lang_entry)) language_changed_cb (class, &lang_entry); - + /* Set cache usage */ if (xine_config_lookup_entry(this->stream->xine, "media.dvd.readahead", &cfg_entry)) read_ahead_cb(class, &cfg_entry); - + /* Set seek mode */ if (xine_config_lookup_entry(this->stream->xine, "media.dvd.seek_behaviour", &cfg_entry)) - seek_mode_cb(class, &cfg_entry); + seek_mode_cb(class, &cfg_entry); /* Set single chapter mode */ if (xine_config_lookup_entry(this->stream->xine, "media.dvd.play_single_chapter", @@ -1537,7 +1537,7 @@ static int dvd_plugin_open (input_plugin_t *this_gen) { char *delimiter; int tt, pr; int titles, parts; - + /* a <title>.<part> was specified -> resume parsing */ /* See if there is a period. */ @@ -1547,7 +1547,7 @@ static int dvd_plugin_open (input_plugin_t *this_gen) { tt = strtol(title_part, NULL, 10); dvdnav_get_number_of_titles(this->dvdnav, &titles); if((tt < 0) || (tt > titles)) { - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "input_dvd: Title %i is out of range (1 to %i).\n", tt, titles); dvdnav_close(this->dvdnav); this->dvdnav = NULL; @@ -1561,7 +1561,7 @@ static int dvd_plugin_open (input_plugin_t *this_gen) { pr = strtol(delimiter+1, NULL, 10); dvdnav_get_number_of_parts(this->dvdnav, tt, &parts); if ((pr < 0) || (pr > parts)) { - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "input_dvd: Part %i is out of range (1 to %i).\n", pr, parts); dvdnav_close(this->dvdnav); this->dvdnav = NULL; @@ -1622,7 +1622,7 @@ static input_plugin_t *dvd_class_get_instance (input_class_t *class_gen, xine_st static char *handled_mrl = "dvd:/"; trace_print("Called\n"); - + /* Check we can handle this MRL */ if (strncasecmp (data, handled_mrl, strlen(handled_mrl) ) != 0) return NULL; @@ -1672,9 +1672,9 @@ static input_plugin_t *dvd_class_get_instance (input_class_t *class_gen, xine_st pthread_mutex_init(&this->buf_mutex, NULL); this->freeing = 0; - + this->event_queue = xine_event_new_queue (this->stream); - + /* config callbacks may react now */ class->ip = this; @@ -1695,7 +1695,7 @@ static const char *dvd_class_get_identifier (input_class_t *this_gen) { /* FIXME: adapt to new api. */ #if 0 -static xine_mrl_t **dvd_class_get_dir (input_class_t *this_gen, +static xine_mrl_t **dvd_class_get_dir (input_class_t *this_gen, const char *filename, int *nFiles) { dvd_input_class_t *this = (dvd_input_class_t*)this_gen; @@ -1712,11 +1712,11 @@ static xine_mrl_t **dvd_class_get_dir (input_class_t *this_gen, } #endif -static char **dvd_class_get_autoplay_list (input_class_t *this_gen, +static char **dvd_class_get_autoplay_list (input_class_t *this_gen, int *num_files) { dvd_input_class_t *this = (dvd_input_class_t *) this_gen; - trace_print("get_autoplay_list entered\n"); + trace_print("get_autoplay_list entered\n"); this->filelist[0] = "dvd:/"; this->filelist[1] = NULL; @@ -1763,7 +1763,7 @@ static void *init_class (xine_t *xine, void *data) { this = (dvd_input_class_t *) calloc(1, sizeof (dvd_input_class_t)); if (!this) return NULL; - + this->input_class.get_instance = dvd_class_get_instance; this->input_class.get_identifier = dvd_class_get_identifier; this->input_class.get_description = dvd_class_get_description; @@ -1774,7 +1774,7 @@ static void *init_class (xine_t *xine, void *data) { this->input_class.get_autoplay_list = dvd_class_get_autoplay_list; this->input_class.dispose = dvd_class_dispose; this->input_class.eject_media = dvd_class_eject_media; - + this->config = config; this->xine = xine; @@ -1799,7 +1799,7 @@ static void *init_class (xine_t *xine, void *data) { static const char *decrypt_modes[] = { "key", "disc", "title", NULL }; char *css_cache_default, *css_cache; int mode; - + raw_device = config->register_filename(config, "media.dvd.raw_device", RDVD_PATH, XINE_CONFIG_STRING_IS_DEVICE_NAME, _("raw device set up for DVD access"), @@ -1814,14 +1814,14 @@ static void *init_class (xine_t *xine, void *data) { "(man raw) for further information."), 10, NULL, NULL); if (raw_device) xine_setenv("DVDCSS_RAW_DEVICE", raw_device, 0); - + mode = config->register_enum(config, "media.dvd.css_decryption_method", 0, decrypt_modes, _("CSS decryption method"), _("Selects the decryption method libdvdcss will use to descramble " "copy protected DVDs. Try the various methods, if you have problems " "playing scrambled DVDs."), 20, NULL, NULL); xine_setenv("DVDCSS_METHOD", decrypt_modes[mode], 0); - + asprintf(&css_cache_default, "%s/.dvdcss/", xine_get_homedir()); css_cache = config->register_filename(config, "media.dvd.css_cache_path", css_cache_default, XINE_CONFIG_STRING_IS_DIRECTORY_NAME, _("path to the title key cache"), @@ -1835,7 +1835,7 @@ static void *init_class (xine_t *xine, void *data) { if (strlen(css_cache) > 0) xine_setenv("DVDCSS_CACHE", css_cache, 0); free(css_cache_default); - + if(xine->verbosity > XINE_VERBOSITY_NONE) xine_setenv("DVDCSS_VERBOSE", "2", 0); @@ -1844,7 +1844,7 @@ static void *init_class (xine_t *xine, void *data) { dlclose(dvdcss); } - + config->register_num(config, "media.dvd.region", 1, _("region the DVD player claims to be in (1 to 8)"), @@ -1916,7 +1916,7 @@ static void *init_class (xine_t *xine, void *data) { const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_INPUT | PLUGIN_MUST_PRELOAD, 17, "DVD", XINE_VERSION_CODE, NULL, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/input/input_file.c b/src/input/input_file.c index 2187f0007..208a5420e 100644 --- a/src/input/input_file.c +++ b/src/input/input_file.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2005 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -63,18 +63,18 @@ typedef struct { xine_t *xine; config_values_t *config; - + char *origin_path; int show_hidden_files; int mrls_allocated_entries; xine_mrl_t **mrls; - + } file_input_class_t; typedef struct { input_plugin_t input_plugin; - + xine_stream_t *stream; int fh; @@ -153,10 +153,10 @@ static off_t file_plugin_read (input_plugin_t *this_gen, char *buf, off_t len) { off_t l = len; if ( (this->mmap_curr + len) > (this->mmap_base + this->mmap_len) ) l = (this->mmap_base + this->mmap_len) - this->mmap_curr; - + memcpy(buf, this->mmap_curr, l); this->mmap_curr += l; - + return l; } #endif @@ -191,7 +191,7 @@ static buf_element_t *file_plugin_read_block (input_plugin_t *this_gen, fifo_buf /* FIXME: it's completely illegal to free buffer->mem here * - buffer->mem has not been allocated by malloc - * - demuxers expect buffer->mem != NULL + * - demuxers expect buffer->mem != NULL */ /* free(buf->mem); buf->mem = NULL; */ @@ -200,7 +200,7 @@ static buf_element_t *file_plugin_read_block (input_plugin_t *this_gen, fifo_buf #endif { off_t num_bytes, total_bytes = 0; - + buf->content = buf->mem; while (total_bytes < todo) { @@ -218,11 +218,11 @@ static buf_element_t *file_plugin_read_block (input_plugin_t *this_gen, fifo_buf } total_bytes += num_bytes; } - + if( buf != NULL ) buf->size = total_bytes; } - + return buf; } @@ -296,7 +296,7 @@ static uint32_t file_plugin_get_blocksize (input_plugin_t *this_gen) { */ static int is_a_dir(char *filepathname) { struct stat pstat; - + stat(filepathname, &pstat); return (S_ISDIR(pstat.st_mode)); @@ -308,9 +308,9 @@ static const char* file_plugin_get_mrl (input_plugin_t *this_gen) { return this->mrl; } -static int file_plugin_get_optional_data (input_plugin_t *this_gen, +static int file_plugin_get_optional_data (input_plugin_t *this_gen, void *data, int data_type) { - + return INPUT_OPTIONAL_UNSUPPORTED; } @@ -417,7 +417,7 @@ static int file_plugin_open (input_plugin_t *this_gen ) { return 1; } -static input_plugin_t *file_class_get_instance (input_class_t *cls_gen, xine_stream_t *stream, +static input_plugin_t *file_class_get_instance (input_class_t *cls_gen, xine_stream_t *stream, const char *data) { /* file_input_class_t *cls = (file_input_class_t *) cls_gen; */ @@ -484,12 +484,12 @@ static input_plugin_t *file_class_get_instance (input_class_t *cls_gen, xine_str */ static void hidden_bool_cb(void *data, xine_cfg_entry_t *cfg) { file_input_class_t *this = (file_input_class_t *) data; - + this->show_hidden_files = cfg->num_value; } static void origin_change_cb(void *data, xine_cfg_entry_t *cfg) { file_input_class_t *this = (file_input_class_t *) data; - + this->origin_path = cfg->str_value; } @@ -540,20 +540,20 @@ static int _strverscmp(const char *s1, const char *s2) { c2 = *p2++; state |= (c1 == '0') + (ISDIGIT(c1) != 0); } - + state = result_type[state << 2 | ((c2 == '0') + (ISDIGIT(c2) != 0))]; - + switch(state) { case CMP: return diff; - + case LEN: while(ISDIGIT(*p1++)) if(!ISDIGIT(*p2++)) return 1; - + return ISDIGIT(*p2) ? -1 : diff; - + default: return state; } @@ -583,11 +583,11 @@ static uint32_t get_file_type(char *filepathname, char *origin, xine_t *xine) { return file_type; } } - + file_type |= mrl_file; - + mode = pstat.st_mode; - + if(S_ISLNK(mode)) file_type |= mrl_file_symlink; else if(S_ISDIR(mode)) @@ -607,10 +607,10 @@ static uint32_t get_file_type(char *filepathname, char *origin, xine_t *xine) { if(mode & S_IXUGO) file_type |= mrl_file_exec; } - + if(filepathname[strlen(filepathname) - 1] == '~') file_type |= mrl_file_backup; - + return file_type; } @@ -638,7 +638,7 @@ static const char *file_class_get_identifier (input_class_t *this_gen) { return "file"; } -static xine_mrl_t **file_class_get_dir (input_class_t *this_gen, +static xine_mrl_t **file_class_get_dir (input_class_t *this_gen, const char *filename, int *nFiles) { /* FIXME: this code needs cleanup badly */ @@ -660,7 +660,7 @@ static xine_mrl_t **file_class_get_dir (input_class_t *this_gen, *nFiles = 0; memset(current_dir, 0, sizeof(current_dir)); - /* + /* * No origin location, so got the content of the current directory */ if(!filename) { @@ -668,7 +668,7 @@ static xine_mrl_t **file_class_get_dir (input_class_t *this_gen, } else { snprintf(current_dir, XINE_PATH_MAX, "%s", filename); - + /* Remove exceed '/' */ while((current_dir[strlen(current_dir) - 1] == '/') && strlen(current_dir) > 1) current_dir[strlen(current_dir) - 1] = '\0'; @@ -676,14 +676,14 @@ static xine_mrl_t **file_class_get_dir (input_class_t *this_gen, /* Store new origin path */ try_again_from_home: - + this->config->update_string(this->config, "media.files.origin_path", current_dir); if(strcasecmp(current_dir, "/")) snprintf(current_dir_slashed, sizeof(current_dir_slashed), "%s/", current_dir); else sprintf(current_dir_slashed, "/"); - + /* * Ooch! */ @@ -698,28 +698,28 @@ static xine_mrl_t **file_class_get_dir (input_class_t *this_gen, return NULL; } - + dir_files = (xine_mrl_t *) calloc(MAXFILES, sizeof(xine_mrl_t)); hide_files = (xine_mrl_t *) calloc(MAXFILES, sizeof(xine_mrl_t)); norm_files = (xine_mrl_t *) calloc(MAXFILES, sizeof(xine_mrl_t)); - + while((pdirent = readdir(pdir)) != NULL) { - + memset(fullfilename, 0, sizeof(fullfilename)); snprintf(fullfilename, sizeof(fullfilename), "%s/%s", current_dir, pdirent->d_name); - + if(is_a_dir(fullfilename)) { - + /* if user don't want to see hidden files, ignore them */ - if(this->show_hidden_files == 0 && + if(this->show_hidden_files == 0 && ((strlen(pdirent->d_name) > 1) && (pdirent->d_name[0] == '.' && pdirent->d_name[1] != '.'))) { ; } else { - + dir_files[num_dir_files].origin = strdup(current_dir); - asprintf(&(dir_files[num_dir_files].mrl), "%s%s", + asprintf(&(dir_files[num_dir_files].mrl), "%s%s", current_dir_slashed, pdirent->d_name); dir_files[num_dir_files].link = NULL; dir_files[num_dir_files].type = get_file_type(fullfilename, current_dir, this->xine); @@ -729,11 +729,11 @@ static xine_mrl_t **file_class_get_dir (input_class_t *this_gen, if(dir_files[num_dir_files].type & mrl_file_symlink) { char linkbuf[XINE_PATH_MAX + XINE_NAME_MAX + 1]; int linksize; - + memset(linkbuf, 0, sizeof(linkbuf)); linksize = readlink(fullfilename, linkbuf, XINE_PATH_MAX + XINE_NAME_MAX); - - if(linksize < 0) + + if(linksize < 0) xprintf (this->xine, XINE_VERBOSITY_DEBUG, "input_file: readlink() failed: %s\n", strerror(errno)); else { @@ -743,7 +743,7 @@ static xine_mrl_t **file_class_get_dir (input_class_t *this_gen, dir_files[num_dir_files].type |= get_file_type(dir_files[num_dir_files].link, current_dir, this->xine); } } - + num_dir_files++; } @@ -755,20 +755,20 @@ static xine_mrl_t **file_class_get_dir (input_class_t *this_gen, if(this->show_hidden_files) { hide_files[num_hide_files].origin = strdup(current_dir); - asprintf(&(hide_files[num_hide_files].mrl), "%s%s", + asprintf(&(hide_files[num_hide_files].mrl), "%s%s", current_dir_slashed, pdirent->d_name); hide_files[num_hide_files].link = NULL; hide_files[num_hide_files].type = get_file_type(fullfilename, current_dir, this->xine); hide_files[num_hide_files].size = get_file_size(fullfilename, current_dir); - + /* The file is a link, follow it */ if(hide_files[num_hide_files].type & mrl_file_symlink) { char linkbuf[XINE_PATH_MAX + XINE_NAME_MAX + 1]; int linksize; - + memset(linkbuf, 0, sizeof(linkbuf)); linksize = readlink(fullfilename, linkbuf, XINE_PATH_MAX + XINE_NAME_MAX); - + if(linksize < 0) { xprintf (this->xine, XINE_VERBOSITY_DEBUG, "input_file: readlink() failed: %s\n", strerror(errno)); @@ -779,7 +779,7 @@ static xine_mrl_t **file_class_get_dir (input_class_t *this_gen, hide_files[num_hide_files].type |= get_file_type(hide_files[num_hide_files].link, current_dir, this->xine); } } - + num_hide_files++; } @@ -787,39 +787,39 @@ static xine_mrl_t **file_class_get_dir (input_class_t *this_gen, else { norm_files[num_norm_files].origin = strdup(current_dir); - asprintf(&(norm_files[num_norm_files].mrl), "%s%s", + asprintf(&(norm_files[num_norm_files].mrl), "%s%s", current_dir_slashed, pdirent->d_name); norm_files[num_norm_files].link = NULL; norm_files[num_norm_files].type = get_file_type(fullfilename, current_dir, this->xine); norm_files[num_norm_files].size = get_file_size(fullfilename, current_dir); - + /* The file is a link, follow it */ if(norm_files[num_norm_files].type & mrl_file_symlink) { char linkbuf[XINE_PATH_MAX + XINE_NAME_MAX + 1]; int linksize; - + memset(linkbuf, 0, sizeof(linkbuf)); linksize = readlink(fullfilename, linkbuf, XINE_PATH_MAX + XINE_NAME_MAX); - + if(linksize < 0) { xprintf (this->xine, XINE_VERBOSITY_DEBUG, "input_file: readlink() failed: %s\n", strerror(errno)); } else { - norm_files[num_norm_files].link = + norm_files[num_norm_files].link = strndup(linkbuf, linksize); norm_files[num_norm_files].type |= get_file_type(norm_files[num_norm_files].link, current_dir, this->xine); } } - + num_norm_files++; } - + num_files++; } - + closedir(pdir); - + /* * Ok, there are some files here, so sort * them then store them into global mrls array. @@ -834,18 +834,18 @@ static xine_mrl_t **file_class_get_dir (input_class_t *this_gen, */ if(num_dir_files) qsort(dir_files, num_dir_files, sizeof(xine_mrl_t), func); - + if(num_hide_files) qsort(hide_files, num_hide_files, sizeof(xine_mrl_t), func); - + if(num_norm_files) qsort(norm_files, num_norm_files, sizeof(xine_mrl_t), func); - + /* * Add directories entries */ for(i = 0; i < num_dir_files; i++) { - + if(num_files >= this->mrls_allocated_entries) { ++this->mrls_allocated_entries; this->mrls = realloc(this->mrls, (this->mrls_allocated_entries+1) * sizeof(xine_mrl_t*)); @@ -853,8 +853,8 @@ static xine_mrl_t **file_class_get_dir (input_class_t *this_gen, } else memset(this->mrls[num_files], 0, sizeof(xine_mrl_t)); - - MRL_DUPLICATE(&dir_files[i], this->mrls[num_files]); + + MRL_DUPLICATE(&dir_files[i], this->mrls[num_files]); num_files++; } @@ -863,7 +863,7 @@ static xine_mrl_t **file_class_get_dir (input_class_t *this_gen, * Add hidden files entries */ for(i = 0; i < num_hide_files; i++) { - + if(num_files >= this->mrls_allocated_entries) { ++this->mrls_allocated_entries; this->mrls = realloc(this->mrls, (this->mrls_allocated_entries+1) * sizeof(xine_mrl_t*)); @@ -871,13 +871,13 @@ static xine_mrl_t **file_class_get_dir (input_class_t *this_gen, } else memset(this->mrls[num_files], 0, sizeof(xine_mrl_t)); - - MRL_DUPLICATE(&hide_files[i], this->mrls[num_files]); + + MRL_DUPLICATE(&hide_files[i], this->mrls[num_files]); num_files++; } - - /* + + /* * Add other files entries */ for(i = 0; i < num_norm_files; i++) { @@ -890,24 +890,24 @@ static xine_mrl_t **file_class_get_dir (input_class_t *this_gen, else memset(this->mrls[num_files], 0, sizeof(xine_mrl_t)); - MRL_DUPLICATE(&norm_files[i], this->mrls[num_files]); + MRL_DUPLICATE(&norm_files[i], this->mrls[num_files]); num_files++; } - + /* Some cleanups before leaving */ for(i = num_dir_files; i == 0; i--) MRL_ZERO(&dir_files[i]); free(dir_files); - + for(i = num_hide_files; i == 0; i--) MRL_ZERO(&hide_files[i]); free(hide_files); - + for(i = num_norm_files; i == 0; i--) MRL_ZERO(&norm_files[i]); free(norm_files); - + } else { free(hide_files); @@ -915,12 +915,12 @@ static xine_mrl_t **file_class_get_dir (input_class_t *this_gen, free(norm_files); return NULL; } - + /* * Inform caller about files found number. */ *nFiles = num_files; - + /* * Freeing exceeded mrls if exists. */ @@ -928,7 +928,7 @@ static xine_mrl_t **file_class_get_dir (input_class_t *this_gen, MRL_ZERO(this->mrls[this->mrls_allocated_entries - 1]); free(this->mrls[this->mrls_allocated_entries--]); } - + /* * This is useful to let UI know where it should stops ;-). */ @@ -970,7 +970,7 @@ static void *init_plugin (xine_t *xine, void *data) { this->xine = xine; this->config = xine->config; config = xine->config; - + this->input_class.get_instance = file_class_get_instance; this->input_class.get_identifier = file_class_get_identifier; this->input_class.get_description = file_class_get_description; @@ -984,7 +984,7 @@ static void *init_plugin (xine_t *xine, void *data) { { char current_dir[XINE_PATH_MAX + 1]; - + if(getcwd(current_dir, sizeof(current_dir)) == NULL) strcpy(current_dir, "."); @@ -995,14 +995,14 @@ static void *init_plugin (xine_t *xine, void *data) { "start at this location."), 0, origin_change_cb, (void *) this); } - - this->show_hidden_files = config->register_bool(config, - "media.files.show_hidden_files", + + this->show_hidden_files = config->register_bool(config, + "media.files.show_hidden_files", 0, _("list hidden files"), _("If enabled, the browser to select the file to " "play will also show hidden files."), 10, hidden_bool_cb, (void *) this); - + return this; } @@ -1011,7 +1011,7 @@ static void *init_plugin (xine_t *xine, void *data) { */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_INPUT | PLUGIN_MUST_PRELOAD, 17, "FILE", XINE_VERSION_CODE, NULL, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/input/input_gnome_vfs.c b/src/input/input_gnome_vfs.c index a3dfafdd5..cf97074ee 100644 --- a/src/input/input_gnome_vfs.c +++ b/src/input/input_gnome_vfs.c @@ -1,19 +1,19 @@ /* * Copyright (C) 2000-2003 the xine project * 2002 Bastien Nocera <hadess@hadess.net> - * + * * This file is part of totem, - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -230,7 +230,7 @@ static const char } static int -gnomevfs_plugin_get_optional_data (input_plugin_t *this_gen, +gnomevfs_plugin_get_optional_data (input_plugin_t *this_gen, void *data, int data_type) { D ("input_gnomevfs: get optional data, type %08x\n", data_type); diff --git a/src/input/input_http.c b/src/input/input_http.c index 4eece116f..35fff8ce0 100644 --- a/src/input/input_http.c +++ b/src/input/input_http.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -68,15 +68,15 @@ typedef struct { input_plugin_t input_plugin; xine_stream_t *stream; - + int fh; char *mrl; - nbc_t *nbc; + nbc_t *nbc; off_t curpos; off_t contentlength; - + char buf[BUFSIZE]; char proxybuf[BUFSIZE]; @@ -84,7 +84,7 @@ typedef struct { char proxyauth[BUFSIZE]; char *mime_type; - + char *proto; char *user; char *password; @@ -93,10 +93,10 @@ typedef struct { char *uri; const char *user_agent; - + char preview[MAX_PREVIEW_SIZE]; off_t preview_size; - + /* Last.FM streaming server */ unsigned char is_lastfm; @@ -112,7 +112,7 @@ typedef struct { /* scratch buffer for forward seeking */ char seek_buf[BUFSIZE]; - + } http_input_plugin_t; typedef struct { @@ -140,7 +140,7 @@ static void proxy_host_change_cb (void *this_gen, xine_cfg_entry_t *cfg) { static void proxy_port_change_cb(void *this_gen, xine_cfg_entry_t *cfg) { http_input_class_t *this = (http_input_class_t *)this_gen; - + this->proxyport = cfg->num_value; } @@ -172,17 +172,17 @@ static int _x_use_proxy(http_input_class_t *this, const char *host) { struct hostent *info; size_t i = 0, host_len, noprox_len; - /* - * get full host name + /* + * get full host name */ if ((info = gethostbyname(host)) == NULL) { - xine_log(this->xine, XINE_LOG_MSG, + xine_log(this->xine, XINE_LOG_MSG, _("input_http: gethostbyname(%s) failed: %s\n"), host, hstrerror(h_errno)); return 1; } if (!info->h_name) return 1; - + if ( info->h_addr_list[0] ) { /* \177\0\0\1 is the *octal* representation of 127.0.0.1 */ if ( info->h_addrtype == AF_INET && !memcmp(info->h_addr_list[0], "\177\0\0\1", 4) ) { @@ -241,11 +241,11 @@ static int http_plugin_basicauth (const char *user, const char *password, char* char *dptr; size_t count; int enclen; - + count = asprintf(&tmp, "%s:%s", user, (password != NULL) ? password : ""); enclen = ((count + 2) / 3 ) * 4 + 1; - + if (len < enclen) return -1; @@ -260,29 +260,29 @@ static int http_plugin_basicauth (const char *user, const char *password, char* sptr += 3; dptr += 4; } - + if (count > 0) { dptr[0] = enctable[(sptr[0] & 0xFC) >> 2]; dptr[1] = enctable[(sptr[0] & 0x3) << 4]; dptr[2] = '='; - + if (count > 1) { dptr[1] = enctable[((sptr[0] & 0x3) << 4) | ((sptr[1] & 0xF0) >> 4)]; dptr[2] = enctable[(sptr[1] & 0x0F) << 2]; } - + dptr[3] = '='; dptr += 4; } - + dptr[0] = '\0'; - + free(tmp); return 0; } static int http_plugin_read_metainf (http_input_plugin_t *this) { - + char metadata_buf[255 * 16]; unsigned char len = 0; char *title_end; @@ -290,19 +290,19 @@ static int http_plugin_read_metainf (http_input_plugin_t *this) { const char *radio; xine_event_t uevent; xine_ui_data_t data; - + /* get the length of the metadata */ if (_x_io_tcp_read (this->stream, this->fh, (char*)&len, 1) != 1) return 0; lprintf ("http_plugin_read_metainf: len=%d\n", len); - + if (len > 0) { if (_x_io_tcp_read (this->stream, this->fh, metadata_buf, len * 16) != (len * 16)) return 0; - + metadata_buf[len * 16] = '\0'; - + lprintf ("http_plugin_read_metainf: %s\n", metadata_buf); /* Extract the title of the current song */ @@ -315,13 +315,13 @@ static int http_plugin_read_metainf (http_input_plugin_t *this) { } if ((title_end = strstr(songtitle, terminator))) { *title_end = '\0'; - + if ((!this->shoutcast_songtitle || (strcmp(songtitle, this->shoutcast_songtitle))) && (strlen(songtitle) > 0)) { - + lprintf ("http_plugin_read_metainf: songtitle: %s\n", songtitle); - + if (this->shoutcast_songtitle) free(this->shoutcast_songtitle); this->shoutcast_songtitle = strdup(songtitle); @@ -358,7 +358,7 @@ static off_t http_plugin_read_int (http_input_plugin_t *this, char *buf, off_t total) { int read_bytes = 0; int nlen; - + lprintf("total=%"PRId64"\n", total); while (total) { nlen = total; @@ -373,7 +373,7 @@ static off_t http_plugin_read_int (http_input_plugin_t *this, if (!http_plugin_read_metainf(this)) goto error; this->shoutcast_pos = 0; - + } else { nlen = _x_io_tcp_read (this->stream, this->fh, &buf[read_bytes], nlen); if (nlen < 0) @@ -400,7 +400,7 @@ static off_t http_plugin_read_int (http_input_plugin_t *this, this->shoutcast_pos += nlen; } - + /* end of file */ if (nlen == 0) return read_bytes; @@ -408,9 +408,9 @@ static off_t http_plugin_read_int (http_input_plugin_t *this, total -= nlen; } return read_bytes; - + error: - if (!_x_action_pending(this->stream)) + if (!_x_action_pending(this->stream)) _x_message (this->stream, XINE_MSG_READ_ERROR, this->host, NULL); xine_log (this->stream->xine, XINE_LOG_MSG, _("input_http: read error %d\n"), errno); return read_bytes; @@ -445,7 +445,7 @@ static off_t http_plugin_read (input_plugin_t *this_gen, if (n > 0) { int read_bytes; read_bytes = http_plugin_read_int (this, &buf[num_bytes], n); - + if (read_bytes < 0) return read_bytes; @@ -463,7 +463,7 @@ static int resync_nsv(http_input_plugin_t *this) { lprintf("resyncing NSV stream\n"); while ((pos < 3) && (read_bytes < (1024*1024))) { - + if (http_plugin_read_int(this, (char*)&c, 1) != 1) return 1; @@ -495,7 +495,7 @@ static int resync_nsv(http_input_plugin_t *this) { if (pos == 3) { lprintf("NSV stream resynced\n"); } else { - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "http: cannot resync NSV stream!\n"); return 0; } @@ -580,10 +580,10 @@ static off_t http_plugin_seek(input_plugin_t *this_gen, off_t offset, int origin if( this->curpos <= this->preview_size ) this->curpos = offset; else - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "http: cannot seek back! (%" PRIdMAX " > %" PRIdMAX ")\n", (intmax_t)this->curpos, (intmax_t)offset); - + } else { offset -= this->curpos; @@ -632,7 +632,7 @@ static void http_plugin_dispose (input_plugin_t *this_gen ) { close(this->fh); this->fh = -1; } - + if (this->nbc) { nbc_close (this->nbc); this->nbc = NULL; @@ -652,7 +652,7 @@ static void report_progress (xine_stream_t *stream, int p) { xine_event_t event; xine_progress_data_t prg; - + prg.description = _("Connecting HTTP server..."); prg.percent = p; @@ -677,7 +677,7 @@ static int http_plugin_open (input_plugin_t *this_gen ) { mime_type[0] = 0; use_proxy = this_class->proxyhost && strlen(this_class->proxyhost); - + if (use_proxy) { if (this_class->proxyuser && strlen(this_class->proxyuser)) { if (http_plugin_basicauth (this_class->proxyuser, @@ -688,8 +688,8 @@ static int http_plugin_open (input_plugin_t *this_gen ) { } } } - - + + if (!_x_parse_url(this->mrl, &this->proto, &this->host, &this->port, &this->user, &this->password, &this->uri, &this->user_agent)) { @@ -700,14 +700,14 @@ static int http_plugin_open (input_plugin_t *this_gen ) { if (this->port == 0) this->port = DEFAULT_HTTP_PORT; - + if (this->user && strlen(this->user)) { if (http_plugin_basicauth (this->user, this->password, this->auth, BUFSIZE)) { _x_message(this->stream, XINE_MSG_CONNECTION_REFUSED, "basic auth error", NULL); return -1; } } - + if (this_class->proxyport == 0) proxyport = DEFAULT_HTTP_PORT; else @@ -721,10 +721,10 @@ static int http_plugin_open (input_plugin_t *this_gen ) { printf ("input_http: password : >%s<\n", this->password); printf ("input_http: path : >%s<\n", this->uri); - + if (use_proxy) printf (" via proxy >%s:%d<", this_class->proxyhost, proxyport); - + printf ("\n"); } @@ -734,13 +734,13 @@ static int http_plugin_open (input_plugin_t *this_gen ) { this->fh = _x_io_tcp_connect (this->stream, this_class->proxyhost, proxyport); else this->fh = _x_io_tcp_connect (this->stream, this->host, this->port); - + this->curpos = 0; - + if (this->fh == -1) return -2; - { + { uint32_t timeout, progress; xine_cfg_entry_t cfgentry; if (xine_config_lookup_entry (this->stream->xine, "media.network.timeout", &cfgentry)) { @@ -770,17 +770,17 @@ static int http_plugin_open (input_plugin_t *this_gen ) { buflen = snprintf (this->buf, BUFSIZE, "GET http://%s%s HTTP/1.0\015\012", this->host, this->uri); } - } + } else buflen = snprintf (this->buf, BUFSIZE, "GET %s HTTP/1.0\015\012", this->uri); - + if (this->port != DEFAULT_HTTP_PORT) buflen += snprintf (this->buf + buflen, BUFSIZE - buflen, "Host: %s:%d\015\012", this->host, this->port); else buflen += snprintf (this->buf + buflen, BUFSIZE - buflen, "Host: %s\015\012", this->host); - + if (this_class->proxyuser && strlen(this_class->proxyuser)) { buflen += snprintf (this->buf + buflen, BUFSIZE - buflen, "Proxy-Authorization: Basic %s\015\012", this->proxyauth); @@ -789,7 +789,7 @@ static int http_plugin_open (input_plugin_t *this_gen ) { buflen += snprintf (this->buf + buflen, BUFSIZE - buflen, "Authorization: Basic %s\015\012", this->auth); } - + buflen += snprintf(this->buf + buflen, BUFSIZE - buflen, "User-Agent: %s%sxine/%s\015\012" "Accept: */*\015\012" @@ -821,14 +821,14 @@ static int http_plugin_open (input_plugin_t *this_gen ) { this->buf[len] = '\0'; len--; - + if (len >= 0 && this->buf[len] == '\015') { this->buf[len] = '\0'; len--; } linenum++; - + lprintf ("answer: >%s<\n", this->buf); if (linenum == 1) { @@ -844,13 +844,13 @@ static int http_plugin_open (input_plugin_t *this_gen ) { &httpcode, httpstatus) != 2) ) { _x_message(this->stream, XINE_MSG_CONNECTION_REFUSED, "invalid http answer", NULL); - xine_log (this->stream->xine, XINE_LOG_MSG, + xine_log (this->stream->xine, XINE_LOG_MSG, _("input_http: invalid http answer\n")); return -6; } if (httpcode >= 300 && httpcode < 400) { - xine_log (this->stream->xine, XINE_LOG_MSG, + xine_log (this->stream->xine, XINE_LOG_MSG, _("input_http: 3xx redirection: >%d %s<\n"), httpcode, httpstatus); } else if (httpcode == 404) { @@ -868,7 +868,7 @@ static int http_plugin_open (input_plugin_t *this_gen ) { } else if (httpcode < 200 || httpcode >= 300) { _x_message(this->stream, XINE_MSG_CONNECTION_REFUSED, "http status not 2xx: ", httpstatus, NULL); - xine_log (this->stream->xine, XINE_LOG_MSG, + xine_log (this->stream->xine, XINE_LOG_MSG, _("input_http: http status not 2xx: >%d %s<\n"), httpcode, httpstatus); return -9; @@ -876,18 +876,18 @@ static int http_plugin_open (input_plugin_t *this_gen ) { } else { if (this->contentlength == 0) { intmax_t contentlength; - + if (sscanf(this->buf, "Content-Length: %" SCNdMAX , &contentlength) == 1) { - xine_log (this->stream->xine, XINE_LOG_MSG, + xine_log (this->stream->xine, XINE_LOG_MSG, _("input_http: content length = %" PRIdMAX " bytes\n"), contentlength); this->contentlength = (off_t)contentlength; } } - + if (!strncasecmp(this->buf, "Location: ", 10)) { char *href = (this->buf + 10); - + lprintf ("trying to open target of redirection: >%s<\n", href); href = _x_canonicalise_url (this->mrl, href); @@ -915,13 +915,13 @@ static int http_plugin_open (input_plugin_t *this_gen ) { (this->buf + sizeof(TAG_ICY_NAME) - 1 + (*(this->buf + sizeof(TAG_ICY_NAME) - 1) == ' '))); } - + if (!strncasecmp(this->buf, TAG_ICY_GENRE, sizeof(TAG_ICY_GENRE) - 1)) { _x_meta_info_set(this->stream, XINE_META_INFO_GENRE, (this->buf + sizeof(TAG_ICY_GENRE) - 1 + (*(this->buf + sizeof(TAG_ICY_GENRE) - 1) == ' '))); } - + /* icy-notice1 is always the same */ if (!strncasecmp(this->buf, TAG_ICY_NOTICE2, sizeof(TAG_ICY_NOTICE2) - 1)) { char *end; @@ -932,14 +932,14 @@ static int http_plugin_open (input_plugin_t *this_gen ) { (this->buf + sizeof(TAG_ICY_NOTICE2) - 1 + (*(this->buf + sizeof(TAG_ICY_NOTICE2) - 1) == ' '))); } - + /* metadata interval (in byte) */ if (sscanf(this->buf, TAG_ICY_METAINT"%d", &this->shoutcast_metaint) == 1) { lprintf("shoutcast_metaint: %d\n", this->shoutcast_metaint); this->shoutcast_mode = 1; this->shoutcast_pos = 0; } - + /* content type */ if (!strncasecmp(this->buf, TAG_CONTENT_TYPE, sizeof(TAG_CONTENT_TYPE) - 1)) { const char *type = this->buf + sizeof (TAG_CONTENT_TYPE) - 1; @@ -956,7 +956,7 @@ static int http_plugin_open (input_plugin_t *this_gen ) { this->is_lastfm = 1; } } - + if (len == -1) done = 1; else @@ -989,7 +989,7 @@ static int http_plugin_open (input_plugin_t *this_gen ) { *newline = '\0'; lprintf("mpegurl pointing to %s\n", buf); - + href = _x_canonicalise_url (this->mrl, buf); free(this->mrl); this->mrl = href; @@ -1004,7 +1004,7 @@ static int http_plugin_open (input_plugin_t *this_gen ) { if (this->is_nsv) { if (!resync_nsv(this)) return -11; - + /* the first 3 chars are "NSV" */ this->preview_size = http_plugin_read_int (this, this->preview + 3, MAX_PREVIEW_SIZE - 3); } else { @@ -1015,12 +1015,12 @@ static int http_plugin_open (input_plugin_t *this_gen ) { xine_log (this->stream->xine, XINE_LOG_MSG, _("input_http: read error %d\n"), errno); return -12; } - + lprintf("preview_size=%"PRId64"\n", this->preview_size); this->curpos = 0; if (*mime_type) this->mime_type = strdup (mime_type); - + return 1; } @@ -1031,8 +1031,8 @@ static input_plugin_t *http_class_get_instance (input_class_t *cls_gen, xine_str const char *mrl) { /* http_input_class_t *cls = (http_input_class_t *) cls_gen;*/ http_input_plugin_t *this; - - if (strncasecmp (mrl, "http://", 7) && + + if (strncasecmp (mrl, "http://", 7) && strncasecmp (mrl, "unsv://", 7) && strncasecmp (mrl, "peercast://pls/", 15) && !_x_url_user_agent (mrl) /* user agent hacks */) { @@ -1042,14 +1042,14 @@ static input_plugin_t *http_class_get_instance (input_class_t *cls_gen, xine_str if (!strncasecmp (mrl, "peercast://pls/", 15)) { asprintf (&this->mrl, "http://127.0.0.1:7144/stream/%s", mrl+15); - } else { + } else { this->mrl = strdup (mrl); } - + this->stream = stream; this->fh = -1; this->nbc = nbc_init (this->stream); - + this->input_plugin.open = http_plugin_open; this->input_plugin.get_capabilities = http_plugin_get_capabilities; this->input_plugin.read = http_plugin_read; @@ -1076,7 +1076,7 @@ static const char *http_class_get_identifier (input_class_t *this_gen) { static void http_class_dispose (input_class_t *this_gen) { http_input_class_t *this = (http_input_class_t *) this_gen; - + if(this->proxyhost_env) free(this->proxyhost_env); @@ -1102,23 +1102,23 @@ static void *init_class (xine_t *xine, void *data) { this->input_class.dispose = http_class_dispose; this->input_class.eject_media = NULL; - /* - * honour http_proxy envvar + /* + * honour http_proxy envvar */ if((proxy_env = getenv("http_proxy")) && *proxy_env) { int proxy_port = DEFAULT_HTTP_PORT; char *p; - + if(!strncmp(proxy_env, "http://", 7)) proxy_env += 7; this->proxyhost_env = strdup(proxy_env); - + if((p = strrchr(this->proxyhost_env, ':')) && (strlen(p) > 1)) { *p++ = '\0'; proxy_port = (int) strtol(p, &p, 10); } - + this->proxyport_env = proxy_port; } else @@ -1127,7 +1127,7 @@ static void *init_class (xine_t *xine, void *data) { /* * proxy settings */ - this->proxyhost = config->register_string(config, + this->proxyhost = config->register_string(config, "media.network.http_proxy_host", proxy_env ? this->proxyhost_env : "", _("HTTP proxy host"), _("The hostname of the HTTP proxy."), 10, proxy_host_change_cb, (void *) this); @@ -1135,13 +1135,13 @@ static void *init_class (xine_t *xine, void *data) { "media.network.http_proxy_port", proxy_env ? this->proxyport_env : DEFAULT_HTTP_PORT, _("HTTP proxy port"), _("The port number of the HTTP proxy."), 10, proxy_port_change_cb, (void *) this); - + /* registered entries could be empty. Don't ignore envvar */ if(!strlen(this->proxyhost) && (proxy_env && strlen(proxy_env))) { config->update_string(config, "media.network.http_proxy_host", this->proxyhost_env); config->update_num(config, "media.network.http_proxy_port", this->proxyport_env); } - + this->proxyuser = config->register_string(config, "media.network.http_proxy_user", "", _("HTTP proxy username"), _("The user name for the HTTP proxy."), 10, @@ -1154,7 +1154,7 @@ static void *init_class (xine_t *xine, void *data) { "media.network.http_no_proxy", "", _("Domains for which to ignore the HTTP proxy"), _("A comma-separated list of domain names for which the proxy is to be ignored.\nIf a domain name is prefixed with '=' then it is treated as a host name only (full match required)."), 10, no_proxy_list_change_cb, (void *) this); - + return this; } @@ -1163,7 +1163,7 @@ static void *init_class (xine_t *xine, void *data) { */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_INPUT | PLUGIN_MUST_PRELOAD, 17, "http", XINE_VERSION_CODE, NULL, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/input/input_mms.c b/src/input/input_mms.c index cd88a0609..05c6722ed 100644 --- a/src/input/input_mms.c +++ b/src/input/input_mms.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2002-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -76,26 +76,26 @@ typedef struct { char *mrl; - nbc_t *nbc; + nbc_t *nbc; char scratch[1025]; int bandwidth; int protocol; /* mmst or mmsh */ - + } mms_input_plugin_t; typedef struct { input_class_t input_class; - + mms_input_plugin_t *ip; int protocol; /* autoprobe, mmst or mmsh */ xine_t *xine; } mms_input_class_t; -static off_t mms_plugin_read (input_plugin_t *this_gen, +static off_t mms_plugin_read (input_plugin_t *this_gen, char *buf, off_t len) { mms_input_plugin_t *this = (mms_input_plugin_t *) this_gen; off_t n = 0; @@ -131,7 +131,7 @@ static buf_element_t *mms_plugin_read_block (input_plugin_t *this_gen, buf->content = buf->mem; buf->type = BUF_DEMUX_BLOCK; - + total_bytes = mms_plugin_read (this_gen, (char*)buf->content, todo); if (total_bytes != todo) { @@ -145,7 +145,7 @@ static buf_element_t *mms_plugin_read_block (input_plugin_t *this_gen, } static off_t mms_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin) { - mms_input_plugin_t *this = (mms_input_plugin_t *) this_gen; + mms_input_plugin_t *this = (mms_input_plugin_t *) this_gen; off_t dest = 0; off_t curpos = 0; @@ -160,7 +160,7 @@ static off_t mms_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin curpos = mmsh_get_current_pos (this->mmsh); break; } - + switch (origin) { case SEEK_SET: dest = offset; @@ -177,7 +177,7 @@ static off_t mms_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin printf ("input_mms: cannot seek back!\n"); return curpos; } - + while (curpos < dest) { int n = 0; int diff; @@ -195,7 +195,7 @@ static off_t mms_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin n = mmsh_read (this->mmsh, this->scratch, diff); break; } - + curpos += n; if (n < diff) @@ -211,7 +211,7 @@ static off_t mms_plugin_seek_time (input_plugin_t *this_gen, int time_offset, in off_t curpos = 0; lprintf ("seek_time %d msec, origin %d\n", time_offset, origin); - + switch (this->protocol) { case PROTOCOL_MMST: if (origin == SEEK_SET) @@ -224,12 +224,12 @@ static off_t mms_plugin_seek_time (input_plugin_t *this_gen, int time_offset, in curpos = mmsh_get_current_pos (this->mmsh); break; } - + return curpos; } static off_t mms_plugin_get_length (input_plugin_t *this_gen) { - mms_input_plugin_t *this = (mms_input_plugin_t *) this_gen; + mms_input_plugin_t *this = (mms_input_plugin_t *) this_gen; off_t length = 0; if (!this->mms) @@ -261,7 +261,7 @@ static uint32_t mms_plugin_get_blocksize (input_plugin_t *this_gen) { static off_t mms_plugin_get_current_pos (input_plugin_t *this_gen){ mms_input_plugin_t *this = (mms_input_plugin_t *) this_gen; off_t curpos = 0; - + switch (this->protocol) { case PROTOCOL_MMST: curpos = mms_get_current_pos(this->mms); @@ -279,10 +279,10 @@ static void mms_plugin_dispose (input_plugin_t *this_gen) { if (this->mms) mms_close (this->mms); - + if (this->mmsh) mmsh_close (this->mmsh); - + this->mms = NULL; this->mmsh = NULL; @@ -290,10 +290,10 @@ static void mms_plugin_dispose (input_plugin_t *this_gen) { nbc_close (this->nbc); this->nbc = NULL; } - + if(this->mrl) free(this->mrl); - + free (this); } @@ -303,7 +303,7 @@ static const char* mms_plugin_get_mrl (input_plugin_t *this_gen) { return this->mrl; } -static int mms_plugin_get_optional_data (input_plugin_t *this_gen, +static int mms_plugin_get_optional_data (input_plugin_t *this_gen, void *data, int data_type) { mms_input_plugin_t *this = (mms_input_plugin_t *) this_gen; @@ -319,7 +319,7 @@ static int mms_plugin_get_optional_data (input_plugin_t *this_gen, break; } break; - + default: return INPUT_OPTIONAL_UNSUPPORTED; break; @@ -357,7 +357,7 @@ static int mms_plugin_open (input_plugin_t *this_gen) { mms_input_plugin_t *this = (mms_input_plugin_t *) this_gen; mms_t *mms = NULL; mmsh_t *mmsh = NULL; - + switch (this->protocol) { case PROTOCOL_UNDEFINED: mms = mms_connect (this->stream, this->mrl, this->bandwidth); @@ -375,18 +375,18 @@ static int mms_plugin_open (input_plugin_t *this_gen) { mmsh = mmsh_connect (this->stream, this->mrl, this->bandwidth); break; } - + if (!mms && !mmsh) { return 0; } - + this->mms = mms; this->mmsh = mmsh; - + return 1; } -static input_plugin_t *mms_class_get_instance (input_class_t *cls_gen, xine_stream_t *stream, +static input_plugin_t *mms_class_get_instance (input_class_t *cls_gen, xine_stream_t *stream, const char *data) { mms_input_class_t *cls = (mms_input_class_t *) cls_gen; @@ -394,7 +394,7 @@ static input_plugin_t *mms_class_get_instance (input_class_t *cls_gen, xine_stre char *mrl = strdup(data); xine_cfg_entry_t bandwidth_entry; int protocol; - + lprintf ("trying to open '%s'\n", mrl); if (!strncasecmp (mrl, "mms://", 6)) { @@ -414,10 +414,10 @@ static input_plugin_t *mms_class_get_instance (input_class_t *cls_gen, xine_stre this->mms = NULL; this->mmsh = NULL; this->protocol = protocol; - this->mrl = mrl; + this->mrl = mrl; this->nbc = nbc_init (this->stream); - if (xine_config_lookup_entry (stream->xine, "media.network.bandwidth", + if (xine_config_lookup_entry (stream->xine, "media.network.bandwidth", &bandwidth_entry)) { bandwidth_changed_cb(cls, &bandwidth_entry); } @@ -436,7 +436,7 @@ static input_plugin_t *mms_class_get_instance (input_class_t *cls_gen, xine_stre this->input_plugin.get_optional_data = mms_plugin_get_optional_data; this->input_plugin.input_class = cls_gen; - + return &this->input_plugin; } @@ -456,7 +456,7 @@ static void mms_class_dispose (input_class_t *this_gen) { mms_input_class_t *this = (mms_input_class_t *) this_gen; this->xine->config->unregister_callback(this->xine->config, - "media.network.bandwidth"); + "media.network.bandwidth"); this->xine->config->unregister_callback(this->xine->config, "media.network.mms_protocol"); free (this); @@ -488,12 +488,12 @@ static void *init_class (xine_t *xine, void *data) { 0, bandwidth_changed_cb, (void*) this); this->protocol = xine->config->register_enum(xine->config, - "media.network.mms_protocol", - 0, - mms_protocol_strs, + "media.network.mms_protocol", + 0, + mms_protocol_strs, _("MMS protocol"), _("Select the protocol to encapsulate MMS.\nTCP is better but you may need HTTP behind a firewall."), - 20, + 20, protocol_changed_cb, (void*)this); return this; @@ -504,7 +504,7 @@ static void *init_class (xine_t *xine, void *data) { */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_INPUT | PLUGIN_MUST_PRELOAD, 17, "mms", XINE_VERSION_CODE, NULL, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/input/input_net.c b/src/input/input_net.c index d9da27b54..55339b2bb 100644 --- a/src/input/input_net.c +++ b/src/input/input_net.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -21,9 +21,9 @@ * other end and you can watch tv anywhere in the house ..) * * how to set up mp1e for use with this plugin: - * + * * use mp1 to capture the live stream, e.g. - * mp1e -b 1200 -R 4,32 -a 0 -B 160 -v >live.mpg + * mp1e -b 1200 -R 4,32 -a 0 -B 160 -v >live.mpg * * add an extra service "xine" to /etc/services and /etc/inetd.conf, e.g.: * /etc/services: @@ -78,11 +78,11 @@ typedef struct { input_plugin_t input_plugin; xine_stream_t *stream; - + int fh; char *mrl; char *host_port; - + char preview[MAX_PREVIEW_SIZE]; off_t preview_size; @@ -122,21 +122,21 @@ static int host_connect_attempt_ipv4(struct in_addr ia, int port, xine_t *xine) return -1; } - sin.sin_family = AF_INET; + sin.sin_family = AF_INET; sin.sin_addr = ia; sin.sin_port = htons(port); - + #ifndef WIN32 - if (connect(s, (struct sockaddr *)&sin, sizeof(sin))==-1 && errno != EINPROGRESS) + if (connect(s, (struct sockaddr *)&sin, sizeof(sin))==-1 && errno != EINPROGRESS) #else - if (connect(s, (struct sockaddr *)&sin, sizeof(sin))==-1 && WSAGetLastError() != WSAEINPROGRESS) + if (connect(s, (struct sockaddr *)&sin, sizeof(sin))==-1 && WSAGetLastError() != WSAEINPROGRESS) #endif { xine_log(xine, XINE_LOG_MSG, _("input_net: connect(): %s\n"), strerror(errno)); close(s); return -1; - } + } return s; } @@ -144,7 +144,7 @@ static int host_connect_attempt_ipv4(struct in_addr ia, int port, xine_t *xine) static int host_connect_attempt(int family, struct sockaddr* sin, int addrlen, xine_t *xine) { int s; - + s = socket(family, SOCK_STREAM, IPPROTO_TCP); if (s==-1) { xine_log(xine, XINE_LOG_MSG, @@ -153,16 +153,16 @@ static int host_connect_attempt(int family, struct sockaddr* sin, int addrlen, x } #ifndef WIN32 - if (connect(s, sin, addrlen)==-1 && errno != EINPROGRESS) + if (connect(s, sin, addrlen)==-1 && errno != EINPROGRESS) #else - if (connect(s, sin, addrlen)==-1 && WSAGetLastError() != WSAEINPROGRESS) + if (connect(s, sin, addrlen)==-1 && WSAGetLastError() != WSAEINPROGRESS) #endif { xine_log(xine, XINE_LOG_MSG, _("input_net: connect(): %s\n"), strerror(errno)); close(s); return -1; - } + } return s; } @@ -173,14 +173,14 @@ static int host_connect_ipv4(const char *host, int port, xine_t *xine) { struct hostent *h; int i; int s; - + h = gethostbyname(host); if (h==NULL) { xine_log(xine, XINE_LOG_MSG, _("input_net: unable to resolve '%s'.\n"), host); return -1; } - + for (i=0; h->h_addr_list[i]; i++) { struct in_addr ia; memcpy (&ia, h->h_addr_list[i],4); @@ -205,36 +205,36 @@ static int host_connect(const char *host, int port, xine_t *xine) { int error; char strport[16]; int s; - + memset(&hints, 0, sizeof(hints)); hints.ai_socktype = SOCK_STREAM; - hints.ai_family = PF_UNSPEC; - + hints.ai_family = PF_UNSPEC; + snprintf(strport, sizeof(strport), "%d", port); lprintf("Resolving host '%s' at port '%s'\n", host, strport); error = getaddrinfo(host, strport, &hints, &res); - + if (error) { - + xine_log(xine, XINE_LOG_MSG, _("input_net: unable to resolve '%s'.\n"), host); return -1; } - + /* We loop over all addresses and try to connect */ tmpaddr = res; while (tmpaddr) { - - s = host_connect_attempt (tmpaddr->ai_family, + + s = host_connect_attempt (tmpaddr->ai_family, tmpaddr->ai_addr, tmpaddr->ai_addrlen, xine); if (s != -1) return s; tmpaddr = tmpaddr->ai_next; } - + xine_log(xine, XINE_LOG_MSG, _("input_net: unable to connect to '%s'.\n"), host); return -1; @@ -246,7 +246,7 @@ static int host_connect(const char *host, int port, xine_t *xine) { #define LOW_WATER_MARK 50 #define HIGH_WATER_MARK 100 -static off_t net_plugin_read (input_plugin_t *this_gen, +static off_t net_plugin_read (input_plugin_t *this_gen, char *buf, off_t len) { net_input_plugin_t *this = (net_input_plugin_t *) this_gen; off_t n, total; @@ -273,7 +273,7 @@ static off_t net_plugin_read (input_plugin_t *this_gen, n = _x_read_abort (this->stream, this->fh, &buf[total], len-total); xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "input_net: got %" PRIdMAX " bytes (%" PRIdMAX "/%" PRIdMAX " bytes read)\n", (intmax_t)n, (intmax_t)total, (intmax_t)len); - + if (n < 0) { _x_message(this->stream, XINE_MSG_READ_ERROR, this->host_port, NULL); return 0; @@ -285,7 +285,7 @@ static off_t net_plugin_read (input_plugin_t *this_gen, return total; } -static buf_element_t *net_plugin_read_block (input_plugin_t *this_gen, +static buf_element_t *net_plugin_read_block (input_plugin_t *this_gen, fifo_buffer_t *fifo, off_t todo) { /* net_input_plugin_t *this = (net_input_plugin_t *) this_gen; */ buf_element_t *buf = fifo->buffer_pool_alloc (fifo); @@ -300,7 +300,7 @@ static buf_element_t *net_plugin_read_block (input_plugin_t *this_gen, buf->content = buf->mem; buf->type = BUF_DEMUX_BLOCK; - + total_bytes = net_plugin_read (this_gen, (char*)buf->content, todo); if (total_bytes != todo) { @@ -381,7 +381,7 @@ static const char* net_plugin_get_mrl (input_plugin_t *this_gen) { return this->mrl; } -static int net_plugin_get_optional_data (input_plugin_t *this_gen, +static int net_plugin_get_optional_data (input_plugin_t *this_gen, void *data, int data_type) { net_input_plugin_t *this = (net_input_plugin_t *) this_gen; @@ -404,10 +404,10 @@ static void net_plugin_dispose (input_plugin_t *this_gen ) { close(this->fh); this->fh = -1; } - + free (this->mrl); free (this->host_port); - + if (this->nbc) { nbc_close (this->nbc); this->nbc = NULL; @@ -464,28 +464,28 @@ static input_plugin_t *net_class_get_instance (input_class_t *cls_gen, xine_stre if (!strncasecmp (mrl, "tcp://", 6)) { filename = (char *) &mrl[6]; - + if((!filename) || (strlen(filename) == 0)) { return NULL; } - + nbc = nbc_init (stream); - + } else if (!strncasecmp (mrl, "slave://", 8)) { - + filename = (char *) &mrl[8]; - + if((!filename) || (strlen(filename) == 0)) { return NULL; } - + /* the only difference for slave:// is that network buffering control * is not used. otherwise, dvd still menus are not displayed (it freezes * with "buffering..." all the time) */ - + nbc = NULL; - + } else { return NULL; } @@ -519,7 +519,7 @@ static input_plugin_t *net_class_get_instance (input_class_t *cls_gen, xine_stre /* * net plugin class */ - + static const char *net_class_get_description (input_class_t *this_gen) { return _("net input plugin as shipped with xine"); } @@ -558,7 +558,7 @@ static void *init_class (xine_t *xine, void *data) { */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_INPUT, 17, "tcp", XINE_VERSION_CODE, NULL, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/input/input_plugin.h b/src/input/input_plugin.h index 080e05476..c2cfd6455 100644 --- a/src/input/input_plugin.h +++ b/src/input/input_plugin.h @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -36,7 +36,7 @@ #endif #define INPUT_PLUGIN_IFACE_VERSION 17 - + typedef struct input_class_s input_class_t ; typedef struct input_plugin_s input_plugin_t; @@ -55,7 +55,7 @@ struct input_class_s { const char* (*get_identifier) (input_class_t *this); /* - * return human readable (verbose = 1 line) description for + * return human readable (verbose = 1 line) description for * this plugin class */ const char* (*get_description) (input_class_t *this); @@ -97,7 +97,7 @@ struct input_plugin_s { * return capabilities of the current playable entity. See * get_current_pos below for a description of a "playable entity" * Capabilities a created by "OR"ing a mask of constants listed - * below which start "INPUT_CAP". + * below which start "INPUT_CAP". * * depending on the values set, some of the functions below * will or will not get called or should (not) be able to @@ -128,7 +128,7 @@ struct input_plugin_s { /* - * seek position, return new position + * seek position, return new position * * if seeking failed, -1 is returned */ @@ -136,7 +136,7 @@ struct input_plugin_s { /* - * seek to time position, return new position + * seek to time position, return new position * time_offset is given in miliseconds * * if seeking failed, -1 is returned @@ -153,7 +153,7 @@ struct input_plugin_s { */ off_t (*get_current_pos) (input_plugin_t *this); - + /* * get current time position in stream in miliseconds. * @@ -165,7 +165,7 @@ struct input_plugin_s { /* * return number of bytes in the next playable entity or -1 if the * input is unlimited, as would be the case in a network stream. - * + * * A "playable entity" tends to be the entities listed in a playback * list or the units on which playback control generally works on. * It might be the number of bytes in a VCD "segment" or "track" (if @@ -186,7 +186,7 @@ struct input_plugin_s { * return block size in bytes of next complete playable entity (if * supported, 0 otherwise). See the description above under * get_length for a description of a "complete playable entity". - * + * * this block size is only used for mpeg streams stored on * a block oriented storage media, e.g. DVDs and VCDs, to speed * up the demuxing process. only set this (and the INPUT_CAP_BLOCK @@ -231,11 +231,11 @@ struct input_plugin_s { #define INPUT_CAP_NOCAP 0x00000000 /* - * INPUT_CAP_SEEKABLE: - * seek () works reliably. + * INPUT_CAP_SEEKABLE: + * seek () works reliably. * even for plugins that do not have this flag set - * it is a good idea to implement the seek() function - * in a "best effort" style anyway, so at least + * it is a good idea to implement the seek() function + * in a "best effort" style anyway, so at least * throw away data for network streams when seeking forward */ @@ -243,9 +243,9 @@ struct input_plugin_s { /* * INPUT_CAP_BLOCK: - * means more or less that a block device sits behind - * this input plugin. get_blocksize must be implemented. - * will be used for fast and efficient demuxing of + * means more or less that a block device sits behind + * this input plugin. get_blocksize must be implemented. + * will be used for fast and efficient demuxing of * mpeg streams (demux_mpeg_block). */ @@ -254,8 +254,8 @@ struct input_plugin_s { /* * INPUT_CAP_AUDIOLANG: * INPUT_CAP_SPULANG: - * input plugin knows something about audio/spu languages, - * e.g. knows that audio stream #0 is english, + * input plugin knows something about audio/spu languages, + * e.g. knows that audio stream #0 is english, * audio stream #1 is german, ... * *((int *)data) will provide the requested channel number * and awaits the language back in (char *)data @@ -263,20 +263,20 @@ struct input_plugin_s { #define INPUT_CAP_AUDIOLANG 0x00000008 #define INPUT_CAP_SPULANG 0x00000010 - -/* + +/* * INPUT_CAP_PREVIEW: - * get_optional_data can handle INPUT_OPTIONAL_DATA_PREVIEW - * so a non-seekable stream plugin can povide the first - * few bytes for demuxers to look at them and decide wheter - * they can handle the stream or not. the preview data must - * be buffered and delivered again through subsequent + * get_optional_data can handle INPUT_OPTIONAL_DATA_PREVIEW + * so a non-seekable stream plugin can povide the first + * few bytes for demuxers to look at them and decide wheter + * they can handle the stream or not. the preview data must + * be buffered and delivered again through subsequent * read() calls. - * caller must provide a buffer allocated with at least + * caller must provide a buffer allocated with at least * MAX_PREVIEW_SIZE bytes. */ -#define INPUT_CAP_PREVIEW 0x00000040 +#define INPUT_CAP_PREVIEW 0x00000040 /* * INPUT_CAP_CHAPTERS: @@ -359,13 +359,13 @@ struct input_plugin_s { #define MRL_DUPLICATE(s, d) { \ _x_assert((s) != NULL); \ _x_assert((d) != NULL); \ - \ + \ free((d)->origin); \ (d)->origin = (s)->origin ? strdup((s)->origin) : NULL; \ - \ + \ free((d)->mrl); \ (d)->mrl = (s)->mrl ? strdup((s)->mrl) : NULL; \ - \ + \ free((d)->link); \ (d)->link = (s)->link ? strdup((s)->link) : NULL; \ \ diff --git a/src/input/input_pnm.c b/src/input/input_pnm.c index f609695d5..6d9809a6a 100644 --- a/src/input/input_pnm.c +++ b/src/input/input_pnm.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2002-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -61,21 +61,21 @@ typedef struct { input_plugin_t input_plugin; xine_stream_t *stream; - + pnm_t *pnm; char *mrl; off_t curpos; - nbc_t *nbc; + nbc_t *nbc; char scratch[BUFSIZE]; } pnm_input_plugin_t; -static off_t pnm_plugin_read (input_plugin_t *this_gen, +static off_t pnm_plugin_read (input_plugin_t *this_gen, char *buf, off_t len) { pnm_input_plugin_t *this = (pnm_input_plugin_t *) this_gen; off_t n; @@ -89,7 +89,7 @@ static off_t pnm_plugin_read (input_plugin_t *this_gen, return n; } -static buf_element_t *pnm_plugin_read_block (input_plugin_t *this_gen, +static buf_element_t *pnm_plugin_read_block (input_plugin_t *this_gen, fifo_buffer_t *fifo, off_t todo) { /*pnm_input_plugin_t *this = (pnm_input_plugin_t *) this_gen; */ buf_element_t *buf = fifo->buffer_pool_alloc (fifo); @@ -106,7 +106,7 @@ static buf_element_t *pnm_plugin_read_block (input_plugin_t *this_gen, buf->content = buf->mem; buf->type = BUF_DEMUX_BLOCK; - + total_bytes = pnm_plugin_read (this_gen, (char*)buf->content, todo); if (total_bytes != todo) { @@ -149,7 +149,7 @@ static off_t pnm_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin static off_t pnm_plugin_get_length (input_plugin_t *this_gen) { /* - pnm_input_plugin_t *this = (pnm_input_plugin_t *) this_gen; + pnm_input_plugin_t *this = (pnm_input_plugin_t *) this_gen; off_t length; */ @@ -186,10 +186,10 @@ static void pnm_plugin_dispose (input_plugin_t *this_gen) { nbc_close (this->nbc); this->nbc = NULL; } - + if(this->mrl) free(this->mrl); - + free (this); } @@ -199,7 +199,7 @@ static const char* pnm_plugin_get_mrl (input_plugin_t *this_gen) { return this->mrl; } -static int pnm_plugin_get_optional_data (input_plugin_t *this_gen, +static int pnm_plugin_get_optional_data (input_plugin_t *this_gen, void *data, int data_type) { pnm_input_plugin_t *this = (pnm_input_plugin_t *) this_gen; @@ -227,11 +227,11 @@ static int pnm_plugin_open (input_plugin_t *this_gen) { } this->pnm = pnm; - + return 1; } -static input_plugin_t *pnm_class_get_instance (input_class_t *cls_gen, xine_stream_t *stream, +static input_plugin_t *pnm_class_get_instance (input_class_t *cls_gen, xine_stream_t *stream, const char *data) { /* pnm_input_class_t *cls = (pnm_input_class_t *) cls_gen; */ @@ -247,9 +247,9 @@ static input_plugin_t *pnm_class_get_instance (input_class_t *cls_gen, xine_stre this->stream = stream; this->pnm = NULL; - this->mrl = mrl; + this->mrl = mrl; this->nbc = nbc_init (this->stream); - + this->input_plugin.open = pnm_plugin_open; this->input_plugin.get_capabilities = pnm_plugin_get_capabilities; this->input_plugin.read = pnm_plugin_read; @@ -262,7 +262,7 @@ static input_plugin_t *pnm_class_get_instance (input_class_t *cls_gen, xine_stre this->input_plugin.dispose = pnm_plugin_dispose; this->input_plugin.get_optional_data = pnm_plugin_get_optional_data; this->input_plugin.input_class = cls_gen; - + return &this->input_plugin; } @@ -308,7 +308,7 @@ static void *init_class (xine_t *xine, void *data) { */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_INPUT, 17, "pnm", XINE_VERSION_CODE, NULL, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/input/input_pvr.c b/src/input/input_pvr.c index a9c92e42e..7b08ef5ea 100644 --- a/src/input/input_pvr.c +++ b/src/input/input_pvr.c @@ -4,17 +4,17 @@ * This plugin was sponsored by 1Control * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -32,26 +32,26 @@ * - audio.synchronization.av_sync_method=resample * - ivtv driver (01 Jul 2003 cvs is known to work) * - * MRL: + * MRL: * pvr:/<prefix_to_tmp_files>!<prefix_to_saved_files>!<max_page_age> * - * usage: + * usage: * xine pvr:/<prefix_to_tmp_files>\!<prefix_to_saved_files>\!<max_page_age> */ /************************************************************************** - + Programmer's note (or how to write your PVR frontend): - + - in order to use live pause functionality you must capture data to disk. this is done using XINE_EVENT_SET_V4L2 event. it is important to set the inputs/channel/frequency you want to capture data from. - + comments: 1) session_id must be set: it is used to create the temporary filenames. - + 2) if session_id = -1 no data will be recorded to disk (no pause/replay) - + 3) if session_id is the same as previous value it will just set the "sync point". sync point (show_page) may be used by the PVR frontend to tell that a new show has began. of course, the PVR frontend should be aware @@ -60,18 +60,18 @@ - when user wants to start recording (that is: temporary data will be made permanent) it should issue a XINE_EVENT_PVR_SAVE. mode can be one of the following: - + -1 = do nothing, just set the name (see below) 0 = truncate current session and save from now on 1 = save from last sync point 2 = save everything on current session - + saving actually means just marking the current pages as not temporary. when a session is finished, instead of erasing the files they will be renamed using the save file prefix. - the permanent name can be set in two ways: - + 1) passing a name with the XINE_EVENT_PVR_SAVE before closing the current session. (id = -1) 2) when a saved session is closed without setting the name, it will be @@ -81,7 +81,7 @@ pass back a XINE_EVENT_PVR_SAVE with id set. pvr plugin will rename the files again. -***************************************************************************/ +***************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" @@ -167,7 +167,7 @@ typedef struct { config_values_t *config; char *devname; - + } pvr_input_class_t; @@ -175,18 +175,18 @@ typedef struct { input_plugin_t input_plugin; pvr_input_class_t *class; - + xine_stream_t *stream; - + xine_event_queue_t *event_queue; - + pvrscr_t *scr; int scr_tunning; int speed_before_pause; - + uint32_t session; /* session number used to identify the pvr file */ int new_session; /* force going to realtime for new sessions */ - + int dev_fd; /* fd of the mpeg2 encoder device */ int rec_fd; /* fd of the current recording file (session/page) */ int play_fd; /* fd of the current playback (-1 when realtime) */ @@ -200,22 +200,22 @@ typedef struct { uint32_t show_page; /* first page of current show */ uint32_t save_page; /* first page to save */ uint32_t page_block[MAX_PAGES]; /* first block of each page */ - + char *mrl; char *tmp_prefix; char *save_prefix; char *save_name; xine_list_t *saved_shows; int saved_id; - + time_t start_time; /* time when recording started */ time_t show_time; /* time when current show started */ - + /* buffer to pass data from pvr thread to xine */ uint8_t data[PVR_BLOCK_SIZE]; int valid_data; int want_data; - + pthread_mutex_t lock; pthread_mutex_t dev_lock; pthread_cond_t has_valid_data; @@ -224,14 +224,14 @@ typedef struct { int pvr_running; int pvr_playing; int pvr_play_paused; - + int preview_buffers; - + /* device properties */ int input; int channel; - uint32_t frequency; - + uint32_t frequency; + } pvr_input_plugin_t; typedef struct { @@ -245,7 +245,7 @@ typedef struct { * unix System Clock Reference + fine tunning * * on an ideal world we would be using scr from mpeg2 - * encoder just like dxr3 does. + * encoder just like dxr3 does. * unfortunately it is not supported by ivtv driver, * and perhaps not even possible with wintv cards. * @@ -279,19 +279,19 @@ static void pvrscr_set_pivot (pvrscr_t *this) { struct timeval tv; int64_t pts; - double pts_calc; + double pts_calc; xine_monotonic_clock(&tv, NULL); pts_calc = (tv.tv_sec - this->cur_time.tv_sec) * this->speed_factor; pts_calc += (tv.tv_usec - this->cur_time.tv_usec) * this->speed_factor / 1e6; pts = this->cur_pts + pts_calc; -/* This next part introduces a one off inaccuracy - * to the scr due to rounding tv to pts. +/* This next part introduces a one off inaccuracy + * to the scr due to rounding tv to pts. */ this->cur_time.tv_sec=tv.tv_sec; this->cur_time.tv_usec=tv.tv_usec; - this->cur_pts=pts; + this->cur_pts=pts; return ; } @@ -303,7 +303,7 @@ static int pvrscr_set_speed (scr_plugin_t *scr, int speed) { pvrscr_set_pivot( this ); this->xine_speed = speed; - this->speed_factor = (double) speed * 90000.0 / XINE_FINE_SPEED_NORMAL * + this->speed_factor = (double) speed * 90000.0 / XINE_FINE_SPEED_NORMAL * this->speed_tunning; pthread_mutex_unlock (&this->lock); @@ -316,7 +316,7 @@ static void pvrscr_speed_tunning (pvrscr_t *this, double factor) { pvrscr_set_pivot( this ); this->speed_tunning = factor; - this->speed_factor = (double) this->xine_speed * 90000.0 / XINE_FINE_SPEED_NORMAL * + this->speed_factor = (double) this->xine_speed * 90000.0 / XINE_FINE_SPEED_NORMAL * this->speed_tunning; pthread_mutex_unlock (&this->lock); @@ -345,7 +345,7 @@ static void pvrscr_start (scr_plugin_t *scr, int64_t start_vpts) { this->cur_pts = start_vpts; pthread_mutex_unlock (&this->lock); - + pvrscr_set_speed (&this->scr, XINE_FINE_SPEED_NORMAL); } @@ -354,16 +354,16 @@ static int64_t pvrscr_get_current (scr_plugin_t *scr) { struct timeval tv; int64_t pts; - double pts_calc; + double pts_calc; pthread_mutex_lock (&this->lock); xine_monotonic_clock(&tv, NULL); - + pts_calc = (tv.tv_sec - this->cur_time.tv_sec) * this->speed_factor; pts_calc += (tv.tv_usec - this->cur_time.tv_usec) * this->speed_factor / 1e6; pts = this->cur_pts + pts_calc; - + pthread_mutex_unlock (&this->lock); return pts; @@ -388,9 +388,9 @@ static pvrscr_t *XINE_MALLOC pvrscr_init (void) { this->scr.start = pvrscr_start; this->scr.get_current = pvrscr_get_current; this->scr.exit = pvrscr_exit; - + pthread_mutex_init (&this->lock, NULL); - + pvrscr_speed_tunning(this, 1.0 ); pvrscr_set_speed (&this->scr, XINE_SPEED_PAUSE); #ifdef SCRLOG @@ -405,10 +405,10 @@ static pvrscr_t *XINE_MALLOC pvrscr_init (void) { static uint32_t block_to_page(pvr_input_plugin_t *this, uint32_t block) { uint32_t page; - + for( page = 0; page < this->rec_page; page++ ) { if( block < this->page_block[page+1] ) - break; + break; } return page; } @@ -436,7 +436,7 @@ static off_t pvr_plugin_read (input_plugin_t *this_gen, char *buf, off_t len) { } -/* +/* * this function will adjust playback speed to control buffer utilization. * we must avoid: * - overflow: buffer runs full. no data is read from the mpeg2 card so it will discard @@ -447,15 +447,15 @@ static off_t pvr_plugin_read (input_plugin_t *this_gen, char *buf, off_t len) { * OBS: use with audio.synchronization.av_sync_method=resample */ static void pvr_adjust_realtime_speed(pvr_input_plugin_t *this, fifo_buffer_t *fifo, int speed ) { - + int num_used, num_free; int scr_tunning = this->scr_tunning; - + num_used = fifo->size(fifo); num_free = fifo->num_free(fifo); - + if( num_used == 0 && scr_tunning != -2 ) { - + /* buffer is empty. pause it for a while */ this->scr_tunning = -2; /* marked as paused */ pvrscr_speed_tunning(this->scr, 1.0); @@ -464,44 +464,44 @@ static void pvr_adjust_realtime_speed(pvr_input_plugin_t *this, fifo_buffer_t *f #ifdef SCRLOG printf("input_pvr: buffer empty, pausing playback\n" ); #endif - + } else if( scr_tunning == -2 ) { - + /* currently paused, revert to normal if 1/3 full */ if( 2*num_used > num_free ) { this->scr_tunning = 0; - + pvrscr_speed_tunning(this->scr, 1.0 ); _x_set_speed(this->stream, this->speed_before_pause); #ifdef SCRLOG printf("input_pvr: resuming playback\n" ); #endif } - + } else if( speed == XINE_SPEED_NORMAL && this->play_fd == -1 ) { - + /* when playing realtime, adjust the scr to make xine buffers half full */ if( num_used > 2*num_free ) - scr_tunning = +1; /* play faster */ + scr_tunning = +1; /* play faster */ else if( num_free > 2*num_used ) scr_tunning = -1; /* play slower */ else if( (scr_tunning > 0 && num_free > num_used) || (scr_tunning < 0 && num_used > num_free) ) scr_tunning = 0; - + if( scr_tunning != this->scr_tunning ) { this->scr_tunning = scr_tunning; #ifdef SCRLOG printf("input_pvr: scr_tunning = %d (used: %d free: %d)\n", scr_tunning, num_used, num_free ); #endif - + /* make it play .5% faster or slower */ pvrscr_speed_tunning(this->scr, 1.0 + (0.005 * scr_tunning) ); } - + } else if( this->scr_tunning ) { this->scr_tunning = 0; - + pvrscr_speed_tunning(this->scr, 1.0 ); } } @@ -510,21 +510,21 @@ static void pvr_adjust_realtime_speed(pvr_input_plugin_t *this, fifo_buffer_t *f static char *make_temp_name(pvr_input_plugin_t *this, int page) { char *filename; - + asprintf(&filename, PVR_FILENAME, this->tmp_prefix, this->session, page); - + return filename; } - + #define SAVE_BASE_FILENAME "ch%03d %02d-%02d-%04d %02d:%02d:%02d" - + static char *make_base_save_name(int channel, time_t tm) { struct tm rec_time; char *filename; - + localtime_r(&tm, &rec_time); - - asprintf(&filename, SAVE_BASE_FILENAME, + + asprintf(&filename, SAVE_BASE_FILENAME, channel, rec_time.tm_mon+1, rec_time.tm_mday, rec_time.tm_year+1900, rec_time.tm_hour, rec_time.tm_min, rec_time.tm_sec); @@ -535,9 +535,9 @@ static char *make_base_save_name(int channel, time_t tm) { static char *make_save_name(pvr_input_plugin_t *this, char *base, int page) { char *filename; - + asprintf(&filename, SAVE_FILENAME, this->save_prefix, base, page); - + return filename; } @@ -562,27 +562,27 @@ static void pvr_report_realtime (pvr_input_plugin_t *this, int mode) { * close current recording page and open a new one */ static int pvr_break_rec_page (pvr_input_plugin_t *this) { - + char *filename; - + if( this->session == (unsigned)-1 ) /* not recording */ return 1; - + if( this->rec_fd != -1 && this->rec_fd != this->play_fd ) { - close(this->rec_fd); + close(this->rec_fd); } - + if( this->rec_fd == -1 ) this->rec_page = 0; else this->rec_page++; - + this->page_block[this->rec_page] = this->rec_blk; - + filename = make_temp_name(this, this->rec_page); - + lprintf("opening pvr file for writing (%s)\n", filename); - + this->rec_fd = open(filename, O_RDWR | O_CREAT | O_TRUNC, 0666 ); if( this->rec_fd == -1 ) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, @@ -591,39 +591,39 @@ static int pvr_break_rec_page (pvr_input_plugin_t *this) { return 0; } free(filename); - + /* erase first_page if old and not to be saved */ - if( this->max_page_age != (unsigned)-1 && + if( this->max_page_age != (unsigned)-1 && this->rec_page - this->max_page_age == this->first_page && (this->save_page == (unsigned)-1 || this->first_page < this->save_page) ) { - + filename = make_temp_name(this, this->first_page); lprintf("erasing old pvr file (%s)\n", filename); - + this->first_page++; if(this->play_fd != -1 && this->play_page < this->first_page) { this->play_blk = this->page_block[this->first_page]; close(this->play_fd); this->play_fd = -1; } - + remove(filename); free(filename); - } + } return 1; } /* - * check the status of recording file, open new one as needed and write the current data. + * check the status of recording file, open new one as needed and write the current data. */ static int pvr_rec_file(pvr_input_plugin_t *this) { - + off_t pos; if( this->session == (unsigned)-1 ) /* not recording */ return 1; - + /* check if it's time to change page/file */ if( this->rec_fd == -1 || (this->rec_blk - this->page_block[this->rec_page]) >= BLOCKS_PER_PAGE ) { if( !pvr_break_rec_page(this) ) @@ -631,61 +631,61 @@ static int pvr_rec_file(pvr_input_plugin_t *this) { } pos = (off_t)(this->rec_blk - this->page_block[this->rec_page]) * PVR_BLOCK_SIZE; if( lseek (this->rec_fd, pos, SEEK_SET) != pos ) { - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "input_pvr: error setting position for writing %" PRIdMAX "\n", (intmax_t)pos); return 0; } if( this->rec_fd != -1 ) { if( write(this->rec_fd, this->data, PVR_BLOCK_SIZE) < PVR_BLOCK_SIZE ) { - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "input_pvr: short write to pvr file (out of disk space?)\n"); return 0; } this->rec_blk++; } - + return 1; } -/* +/* * check for playback mode, switching realtime <-> non-realtime. * gets data from file in non-realtime mode. */ static int pvr_play_file(pvr_input_plugin_t *this, fifo_buffer_t *fifo, uint8_t *buffer, int speed) { - + off_t pos; - + /* check for realtime. don't switch back unless enough buffers are * free to not block the pvr thread */ if( this->new_session || (this->play_blk+1 >= this->rec_blk && speed >= XINE_SPEED_NORMAL && (this->play_fd == -1 || fifo->size(fifo) < fifo->num_free(fifo))) ) { - + this->play_blk = (this->rec_blk) ? (this->rec_blk-1) : 0; - + if( speed > XINE_SPEED_NORMAL ) _x_set_speed(this->stream, XINE_SPEED_NORMAL); - + if( this->play_fd != -1 ) { if(this->play_fd != this->rec_fd ) - close(this->play_fd); + close(this->play_fd); this->play_fd = -1; - + lprintf("switching back to realtime\n"); pvr_report_realtime(this,1); - + } else if (this->new_session) { lprintf("starting new session in realtime\n"); pvr_report_realtime(this,1); } - + this->want_data = 1; this->new_session = 0; - + } else { - if( this->rec_fd == -1 ) + if( this->rec_fd == -1 ) return 1; if(speed != XINE_SPEED_PAUSE) { @@ -699,30 +699,30 @@ static int pvr_play_file(pvr_input_plugin_t *this, fifo_buffer_t *fifo, uint8_t } } - if( this->play_fd == -1 || + if( this->play_fd == -1 || ((this->play_blk - this->page_block[this->play_page]) >= BLOCKS_PER_PAGE) || (this->rec_page > this->play_page && this->play_blk >= this->page_block[this->play_page+1]) ) { - + if(this->play_fd == -1) { lprintf("switching to non-realtime\n"); pvr_report_realtime(this,0); } - + if( this->play_fd != -1 && this->play_fd != this->rec_fd ) { - close(this->play_fd); + close(this->play_fd); } - + if( this->play_fd == -1 ) this->play_page = block_to_page(this, this->play_blk); else this->play_page++; - + if( this->play_page < this->first_page ) { this->play_page = this->first_page; this->play_blk = this->page_block[this->play_page]; } - + /* should be impossible */ if( this->play_page > this->rec_page || this->play_blk > this->rec_blk ) { @@ -735,11 +735,11 @@ static int pvr_play_file(pvr_input_plugin_t *this, fifo_buffer_t *fifo, uint8_t this->play_fd = this->rec_fd; } else { char *filename; - + filename = make_temp_name(this, this->play_page); lprintf("opening pvr file for reading (%s)\n", filename); - + this->play_fd = open(filename, O_RDONLY ); if( this->play_fd == -1 ) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, @@ -752,7 +752,7 @@ static int pvr_play_file(pvr_input_plugin_t *this, fifo_buffer_t *fifo, uint8_t this->want_data = 0; pthread_cond_signal (&this->wake_pvr); } - + if(speed != XINE_SPEED_PAUSE) { pos = (off_t)(this->play_blk - this->page_block[this->play_page]) * PVR_BLOCK_SIZE; @@ -803,29 +803,29 @@ static void *pvr_loop (void *this_gen) { int lost_sync; while( this->pvr_running ) { - + pthread_mutex_lock(&this->lock); this->valid_data = 0; pthread_mutex_unlock(&this->lock); - + total_bytes = 0; do { - + lost_sync = 0; - + pthread_mutex_lock(&this->dev_lock); while (total_bytes < PVR_BLOCK_SIZE) { num_bytes = read (this->dev_fd, this->data + total_bytes, PVR_BLOCK_SIZE-total_bytes); if (num_bytes <= 0) { - if (num_bytes < 0) + if (num_bytes < 0) xprintf (this->stream->xine, XINE_VERBOSITY_LOG, _("input_pvr: read error (%s)\n"), strerror(errno)); - this->pvr_running = 0; + this->pvr_running = 0; break; } total_bytes += num_bytes; } - + if( this->data[0] || this->data[1] || this->data[2] != 1 || this->data[3] != 0xba ) { xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "resyncing mpeg stream\n"); @@ -836,28 +836,28 @@ static void *pvr_loop (void *this_gen) { this->data[0] = 0; this->data[1] = 0; this->data[2] = 1; this->data[3] = 0xba; total_bytes = 4; } - } + } pthread_mutex_unlock(&this->dev_lock); - - } while( lost_sync ); - + + } while( lost_sync ); + pthread_mutex_lock(&this->lock); - + if( !pvr_rec_file(this) ) { - this->pvr_running = 0; + this->pvr_running = 0; } - + this->valid_data = 1; pthread_cond_signal (&this->has_valid_data); - while(this->valid_data && this->play_fd == -1 && + while(this->valid_data && this->play_fd == -1 && this->want_data && this->pvr_playing) { pthread_cond_wait (&this->wake_pvr, &this->lock); } - + pthread_mutex_unlock(&this->lock); } - + pthread_exit(NULL); } @@ -868,7 +868,7 @@ static void *pvr_loop (void *this_gen) { * name (save_name) or a default one using channel and time. */ static void pvr_finish_recording (pvr_input_plugin_t *this) { - + char *src_filename; char *save_base; char *dst_filename; @@ -877,31 +877,31 @@ static void pvr_finish_recording (pvr_input_plugin_t *this) { lprintf("finish_recording\n"); if( this->rec_fd != -1 ) { - close(this->rec_fd); - + close(this->rec_fd); + if( this->play_fd != -1 && this->play_fd != this->rec_fd ) close(this->play_fd); - + this->rec_fd = this->play_fd = -1; - + if( this->save_page == this->show_page ) save_base = make_base_save_name(this->channel, this->show_time); else save_base = make_base_save_name(this->channel, this->start_time); - + for( i = this->first_page; i <= this->rec_page; i++ ) { - + src_filename = make_temp_name(this, i); - + if( this->save_page == (unsigned)-1 || i < this->save_page ) { lprintf("erasing old pvr file (%s)\n", src_filename); remove(src_filename); } else { - + if( !this->save_name || !strlen(this->save_name) ) dst_filename = make_save_name(this, save_base, i-this->save_page+1); - else + else dst_filename = make_save_name(this, this->save_name, i-this->save_page+1); lprintf("moving (%s) to (%s)\n", src_filename, dst_filename); @@ -911,17 +911,17 @@ static void pvr_finish_recording (pvr_input_plugin_t *this) { } free(src_filename); } - + if( this->save_page != (unsigned)-1 && (!this->save_name || !strlen(this->save_name)) ) { saved_show_t *show = malloc(sizeof(saved_show_t)); xine_event_t event; xine_pvr_save_data_t data; - + show->base_name = save_base; show->id = ++this->saved_id; show->pages = this->rec_page - this->save_page + 1; xine_list_push_back (this->saved_shows, show); - + lprintf("sending event with base name [%s]\n", show->base_name); /* tell frontend the name of the saved show */ @@ -930,18 +930,18 @@ static void pvr_finish_recording (pvr_input_plugin_t *this) { event.data = &data; event.data_length = sizeof(data); gettimeofday(&event.tv, NULL); - + data.mode = 0; data.id = show->id; strncpy(data.name, show->base_name, sizeof(data.name)); data.name[sizeof(data.name) - 1] = '\0'; - + xine_event_send(this->stream, &event); } else { free(save_base); } } - + this->first_page = 0; this->show_page = 0; this->save_page = -1; @@ -1016,13 +1016,13 @@ static void pvr_event_handler (pvr_input_plugin_t *this) { if( ioctl(this->dev_fd, VIDIOC_S_INPUT, &this->input) == 0 ) { lprintf("Tuner Input set to:%d\n", v4l2_data->input); } else { - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "input_pvr: error setting v4l2 input\n"); } } } - /* change channel */ + /* change channel */ if (v4l2_data->channel != -1 && v4l2_data->channel != this->channel) { lprintf("change channel to:%d\n", v4l2_data->channel); this->channel = v4l2_data->channel; @@ -1057,13 +1057,13 @@ static void pvr_event_handler (pvr_input_plugin_t *this) { } pthread_mutex_unlock(&this->dev_lock); - + /* FIXME: also flush the device */ /* _x_demux_flush_engine(this->stream); */ break; - - + + case XINE_EVENT_PVR_SAVE: if( this->session != -1 ) { switch( save_data->mode ) { @@ -1096,11 +1096,11 @@ static void pvr_event_handler (pvr_input_plugin_t *this) { if( this->save_name ) free( this->save_name ); this->save_name = NULL; - + if( save_data->id < 0 ) { /* no id: set name for current recording */ this->save_name = strdup(save_data->name); - + } else { /* search for the ID of saved shows and rename it * to the given name. */ @@ -1108,17 +1108,17 @@ static void pvr_event_handler (pvr_input_plugin_t *this) { char *dst_filename; saved_show_t *show; xine_list_iterator_t ite; - + pthread_mutex_lock(&this->lock); - + ite = xine_list_front (this->saved_shows); while (ite) { show = xine_list_get_value(this->saved_shows, ite); if( show->id == save_data->id ) { int i; - + for( i = 0; i < show->pages; i++ ) { - + src_filename = make_save_name(this, show->base_name, i+1); dst_filename = make_save_name(this, save_data->name, i+1); @@ -1150,7 +1150,7 @@ static void pvr_event_handler (pvr_input_plugin_t *this) { case XINE_EVENT_SET_MPEG_DATA: { struct ivtv_ioctl_codec codec; - + pthread_mutex_lock(&this->dev_lock); /* how lame. we must close and reopen to change bitrate. */ @@ -1161,9 +1161,9 @@ static void pvr_event_handler (pvr_input_plugin_t *this) { _("input_pvr: error opening device %s\n"), this->class->devname ); return; } - + if (ioctl(this->dev_fd, IVTV_IOC_G_CODEC, &codec) < 0) { - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("input_pvr: IVTV_IOC_G_CODEC failed, maybe API changed?\n")); } else { codec.bitrate = mpeg_data->bitrate_mean; @@ -1178,7 +1178,7 @@ static void pvr_event_handler (pvr_input_plugin_t *this) { pthread_mutex_unlock(&this->dev_lock); } break; - + #if 0 default: printf ("input_pvr: got an event, type 0x%08x\n", event->type); @@ -1204,7 +1204,7 @@ static buf_element_t *pvr_plugin_read_block (input_plugin_t *this_gen, fifo_buff if( !this->pvr_running ) { xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "input_pvr: thread died, aborting\n"); - return NULL; + return NULL; } buf = fifo->buffer_pool_alloc (fifo); @@ -1220,7 +1220,7 @@ static buf_element_t *pvr_plugin_read_block (input_plugin_t *this_gen, fifo_buff if( this->pvr_play_paused ) speed = XINE_SPEED_PAUSE; - + if( this->pvr_playing && _x_stream_info_get(this->stream, XINE_STREAM_INFO_IGNORE_VIDEO) ) { /* video decoding has being disabled. avoid tweaking the clock */ this->pvr_playing = 0; @@ -1232,55 +1232,55 @@ static buf_element_t *pvr_plugin_read_block (input_plugin_t *this_gen, fifo_buff this->pvr_playing = 1; this->play_blk = this->rec_blk; } - + if( this->pvr_playing ) pvr_adjust_realtime_speed(this, fifo, speed); pvr_event_handler(this); - + buf->content = buf->mem; - + pthread_mutex_lock(&this->lock); - + if( this->pvr_playing ) if( !pvr_play_file(this, fifo, buf->content, speed) ) { buf->free_buffer(buf); pthread_mutex_unlock(&this->lock); return NULL; } - + if( todo == PVR_BLOCK_SIZE && speed != XINE_SPEED_PAUSE && this->pvr_playing ) { buf->type = BUF_DEMUX_BLOCK; buf->size = PVR_BLOCK_SIZE; - + if(this->play_fd == -1) { - + /* realtime mode: wait for valid data from pvr thread */ this->want_data = 1; while(!this->valid_data && this->pvr_running) pthread_cond_wait (&this->has_valid_data, &this->lock); - + this->play_blk = this->rec_blk; xine_fast_memcpy(buf->content, this->data, PVR_BLOCK_SIZE); - + this->valid_data = 0; pthread_cond_signal (&this->wake_pvr); } pthread_mutex_unlock(&this->lock); - + } else { pthread_mutex_unlock(&this->lock); - + buf->type = BUF_CONTROL_NOP; - buf->size = 0; - + buf->size = 0; + if(this->preview_buffers) this->preview_buffers--; else xine_usec_sleep (20000); } - + return buf; } @@ -1289,7 +1289,7 @@ static off_t pvr_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin pvr_input_plugin_t *this = (pvr_input_plugin_t *) this_gen; pthread_mutex_lock(&this->lock); - + switch( origin ) { case SEEK_SET: this->play_blk = (offset / PVR_BLOCK_SIZE) + this->page_block[this->first_page]; @@ -1301,18 +1301,18 @@ static off_t pvr_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin this->play_blk = this->rec_blk + (offset / PVR_BLOCK_SIZE); break; } - + /* invalidate the fd if needed */ if( this->play_fd != -1 && block_to_page(this,this->play_blk) != this->play_page ) { if( this->play_fd != this->rec_fd ) - close(this->play_fd); + close(this->play_fd); this->play_fd = -1; if( this->play_blk >= this->rec_blk ) pvr_report_realtime(this,1); } pthread_mutex_unlock(&this->lock); - + return (off_t) (this->play_blk - this->page_block[this->first_page]) * PVR_BLOCK_SIZE; } @@ -1339,9 +1339,9 @@ static const char* pvr_plugin_get_mrl (input_plugin_t *this_gen) { return this->mrl; } -static int pvr_plugin_get_optional_data (input_plugin_t *this_gen, +static int pvr_plugin_get_optional_data (input_plugin_t *this_gen, void *data, int data_type) { - + return INPUT_OPTIONAL_UNSUPPORTED; } @@ -1359,11 +1359,11 @@ static void pvr_plugin_dispose (input_plugin_t *this_gen ) { this->want_data = 0; pthread_cond_signal (&this->wake_pvr); pthread_mutex_unlock(&this->lock); - pthread_join (this->pvr_thread, &p); + pthread_join (this->pvr_thread, &p); lprintf("pvr thread joined\n"); } - + if (this->scr) { this->stream->xine->clock->unregister_scr(this->stream->xine->clock, &this->scr->scr); this->scr->scr.exit(&this->scr->scr); @@ -1376,15 +1376,15 @@ static void pvr_plugin_dispose (input_plugin_t *this_gen ) { close(this->dev_fd); pvr_finish_recording(this); - + free (this->mrl); - + if (this->tmp_prefix) free (this->tmp_prefix); - + if (this->save_prefix) free (this->save_prefix); - + ite = xine_list_front (this->saved_shows); while (ite) { show = xine_list_get_value(this->saved_shows, ite); @@ -1401,7 +1401,7 @@ static int pvr_plugin_open (input_plugin_t *this_gen ) { int64_t time; int err; struct ivtv_ioctl_codec codec; - + this->session = 0; this->rec_fd = -1; this->play_fd = -1; @@ -1417,7 +1417,7 @@ static int pvr_plugin_open (input_plugin_t *this_gen ) { this->dev_fd = open (this->class->devname, O_RDWR); if (this->dev_fd == -1) { - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("input_pvr: error opening device %s\n"), this->class->devname ); return 0; } @@ -1436,42 +1436,42 @@ static int pvr_plugin_open (input_plugin_t *this_gen ) { _("input_pvr: IVTV_IOC_S_CODEC failed, maybe API changed?\n")); } } - - /* register our own scr provider */ + + /* register our own scr provider */ time = this->stream->xine->clock->get_current_time(this->stream->xine->clock); this->scr = pvrscr_init(); this->scr->scr.start(&this->scr->scr, time); this->stream->xine->clock->register_scr(this->stream->xine->clock, &this->scr->scr); this->scr_tunning = 0; - + this->event_queue = xine_event_new_queue (this->stream); - + /* enable resample method */ this->stream->xine->config->update_num(this->stream->xine->config,"audio.synchronization.av_sync_method",1); - + this->pvr_running = 1; - + if ((err = pthread_create (&this->pvr_thread, NULL, pvr_loop, this)) != 0) { xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "input_pvr: can't create new thread (%s)\n", strerror(err)); _x_abort(); } - + return 1; } -static input_plugin_t *pvr_class_get_instance (input_class_t *cls_gen, xine_stream_t *stream, +static input_plugin_t *pvr_class_get_instance (input_class_t *cls_gen, xine_stream_t *stream, const char *data) { pvr_input_class_t *cls = (pvr_input_class_t *) cls_gen; pvr_input_plugin_t *this; char *mrl; char *aux; - - if (strncasecmp (data, "pvr:/", 5)) + + if (strncasecmp (data, "pvr:/", 5)) return NULL; - + mrl = strdup(data); aux = &mrl[5]; @@ -1485,14 +1485,14 @@ static input_plugin_t *pvr_class_get_instance (input_class_t *cls_gen, xine_stre /* decode configuration options from mrl */ if( strlen(aux) ) { this->tmp_prefix = strdup(aux); - + aux = strchr(this->tmp_prefix,'!'); if( aux ) { aux[0] = '\0'; this->save_prefix = strdup(aux+1); aux = strchr(this->save_prefix, '!'); - if( aux ) { + if( aux ) { aux[0] = '\0'; if( atoi(aux+1) ) this->max_page_age = atoi(aux+1); @@ -1504,11 +1504,11 @@ static input_plugin_t *pvr_class_get_instance (input_class_t *cls_gen, xine_stre this->tmp_prefix=strdup("./"); this->save_prefix=strdup("./"); } - + lprintf("tmp_prefix=%s\n", this->tmp_prefix); lprintf("save_prefix=%s\n", this->save_prefix); lprintf("max_page_age=%d\n", this->max_page_age); - + this->input_plugin.open = pvr_plugin_open; this->input_plugin.get_capabilities = pvr_plugin_get_capabilities; this->input_plugin.read = pvr_plugin_read; @@ -1526,12 +1526,12 @@ static input_plugin_t *pvr_class_get_instance (input_class_t *cls_gen, xine_stre this->event_queue = NULL; this->save_name = NULL; this->saved_shows = xine_list_new(); - + pthread_mutex_init (&this->lock, NULL); pthread_mutex_init (&this->dev_lock, NULL); pthread_cond_init (&this->has_valid_data,NULL); pthread_cond_init (&this->wake_pvr,NULL); - + return &this->input_plugin; } @@ -1588,7 +1588,7 @@ static void *init_plugin (xine_t *xine, void *data) { */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_INPUT | PLUGIN_MUST_PRELOAD, 17, "pvr", XINE_VERSION_CODE, NULL, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/input/input_rtp.c b/src/input/input_rtp.c index 90bae6670..e91e43f55 100644 --- a/src/input/input_rtp.c +++ b/src/input/input_rtp.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -114,7 +114,7 @@ typedef struct { input_plugin_t input_plugin; xine_stream_t *stream; - + char *mrl; config_values_t *config; @@ -122,16 +122,16 @@ typedef struct { int port; char *interface; /* For multicast, eth0, eth1 etc */ int is_rtp; - + int fh; - + unsigned char *buffer; /* circular buffer */ unsigned char *buffer_get_ptr; /* get pointer used by reader */ unsigned char *buffer_put_ptr; /* put pointer used by writer */ long buffer_count; /* number of bytes in the buffer */ unsigned char packet_buffer[65536]; - + int last_input_error; int input_eof; @@ -184,7 +184,7 @@ static int host_connect_attempt(struct in_addr ia, int port, return -1; } - saddr.in.sin_family = AF_INET; + saddr.in.sin_family = AF_INET; saddr.in.sin_addr = ia; saddr.in.sin_port = htons(port); @@ -193,8 +193,8 @@ static int host_connect_attempt(struct in_addr ia, int port, LOG_MSG(xine, _("IP address specified is multicast\n")); multicast = 1; /* boolean true */ } - - + + /* Try to increase receive buffer to 1MB to avoid dropping packets */ optval = BUFFER_SIZE; if ((setsockopt(s, SOL_SOCKET, SO_RCVBUF, @@ -217,7 +217,7 @@ static int host_connect_attempt(struct in_addr ia, int port, LOG_MSG(xine, _("bind(): %s.\n"), strerror(errno)); return -1; } - + /* multicast ? */ if (multicast) { @@ -250,14 +250,14 @@ static int host_connect_attempt(struct in_addr ia, int port, &((struct sockaddr_in *) &ifreq.ifr_addr)->sin_addr, sizeof(struct in_addr)); } - + if (setsockopt(s, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof(mreq))) { LOG_MSG(xine, _("setsockopt(IP_ADD_MEMBERSHIP) failed (multicast kernel?): %s.\n"), strerror(errno)); return -1; } } - + return s; } @@ -271,13 +271,13 @@ static int host_connect(const char *host, int port, struct hostent *h; int i; int s; - + h=gethostbyname(host); if(h==NULL) { LOG_MSG(xine, _("unable to resolve '%s'.\n"), host); return -1; } - + for(i=0; h->h_addr_list[i]; i++) { struct in_addr ia; memcpy(&ia, h->h_addr_list[i],4); @@ -299,7 +299,7 @@ static void * input_plugin_read_loop(void *arg) { fd_set read_fds; while (1) { - + /* System calls are not a thread cancellation point in Linux * pthreads. However, the RT signal sent to cancel the thread * will cause recv() to return with EINTR, and we can manually @@ -339,11 +339,11 @@ static void * input_plugin_read_loop(void *arg) { } else { data = this->packet_buffer; - + if (this->is_rtp) { int pad, ext; int csrc; - + /* Do minimal RTP parsing to extract payload. See * http://www.faqs.org/rfcs/rfc1889.html for header format. * @@ -351,7 +351,7 @@ static void * input_plugin_read_loop(void *arg) { */ if (length < 12) continue; - + pad = data[0] & 0x20; ext = data[0] & 0x10; csrc = data[0] & 0x0f; @@ -361,7 +361,7 @@ static void * input_plugin_read_loop(void *arg) { if (ext) { long hlen; - + if (length < 4) continue; hlen = (data[2] << 8) | data[3]; @@ -382,12 +382,12 @@ static void * input_plugin_read_loop(void *arg) { /* insert data into cyclic buffer */ if (length > 0) { - - /* + + /* * if the buffer is full, wait for the reader - * to signal - */ - + * to signal + */ + pthread_mutex_lock(&this->buffer_ring_mut); /* wait for enough space to write the whole of the recv'ed data */ while( (BUFFER_SIZE - this->buffer_count) < length ) @@ -399,23 +399,23 @@ static void * input_plugin_read_loop(void *arg) { timeout.tv_nsec = tv.tv_usec * 1000; timeout.tv_sec = tv.tv_sec + 2; - + if( pthread_cond_timedwait(&this->writer_cond, &this->buffer_ring_mut, &timeout) != 0 ) { fprintf( stdout, "input_rtp: buffer ring not read within 2 seconds!\n" ); } } - + /* Now there's enough space to write some bytes into the buffer * determine how many bytes can be written. If the buffer wraps * around, write in two pieces: from the head pointer to the - * end of the buffer and from the base to the remaining number + * end of the buffer and from the base to the remaining number * of bytes. */ { long buffer_space_remaining = BUFFER_SIZE - (this->buffer_put_ptr - this->buffer); - + if( buffer_space_remaining >= length ) { /* data fits inside the buffer */ @@ -445,14 +445,14 @@ static void * input_plugin_read_loop(void *arg) { /* END OF PRIVATES */ /* ***************************************************************** */ -static off_t rtp_plugin_read (input_plugin_t *this_gen, +static off_t rtp_plugin_read (input_plugin_t *this_gen, char *buf, off_t length) { rtp_input_plugin_t *this = (rtp_input_plugin_t *) this_gen; struct timeval tv; struct timespec timeout; - off_t copied = 0; - + off_t copied = 0; + if (length < 0) return -1; @@ -472,7 +472,7 @@ static off_t rtp_plugin_read (input_plugin_t *this_gen, gettimeofday(&tv, NULL); timeout.tv_nsec = tv.tv_usec * 1000; timeout.tv_sec = tv.tv_sec + 5; - + if(pthread_cond_timedwait(&this->reader_cond, &this->buffer_ring_mut, &timeout) != 0) { /* we timed out, no data available */ @@ -483,9 +483,9 @@ static off_t rtp_plugin_read (input_plugin_t *this_gen, /* Now determine how many bytes can be read. If the buffer * will wrap the buffer is read in two pieces, first read - * to the end of the buffer, wrap the tail pointer and + * to the end of the buffer, wrap the tail pointer and * update the buffer count. Finally read the second piece - * from the base to the remaining count + * from the base to the remaining count */ if(length > this->buffer_count) { n = this->buffer_count; @@ -493,26 +493,26 @@ static off_t rtp_plugin_read (input_plugin_t *this_gen, else { n = length; } - + if(((this->buffer_get_ptr - this->buffer) + n) > BUFFER_SIZE) { n = BUFFER_SIZE - (this->buffer_get_ptr - this->buffer); } - + /* the actual read */ memcpy(buf, this->buffer_get_ptr, n); buf += n; copied += n; length -= n; - + /* update the tail pointer, watch for wrap arounds */ this->buffer_get_ptr += n; if(this->buffer_get_ptr - this->buffer >= BUFFER_SIZE) this->buffer_get_ptr = this->buffer; - + this->buffer_count -= n; - - /* signal the writer that there's space in the buffer again */ + + /* signal the writer that there's space in the buffer again */ pthread_cond_signal(&this->writer_cond); pthread_mutex_unlock(&this->buffer_ring_mut); } @@ -554,7 +554,7 @@ static buf_element_t *rtp_plugin_read_block (input_plugin_t *this_gen, */ static off_t rtp_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin) { - + return -1; } @@ -571,7 +571,7 @@ static off_t rtp_plugin_get_length (input_plugin_t *this_gen) { */ static off_t rtp_plugin_get_current_pos (input_plugin_t *this_gen){ rtp_input_plugin_t *this = (rtp_input_plugin_t *) this_gen; - + return this->curpos; } @@ -579,7 +579,7 @@ static off_t rtp_plugin_get_current_pos (input_plugin_t *this_gen){ * */ static uint32_t rtp_plugin_get_capabilities (input_plugin_t *this_gen) { - + return INPUT_CAP_PREVIEW; } @@ -587,7 +587,7 @@ static uint32_t rtp_plugin_get_capabilities (input_plugin_t *this_gen) { * */ static uint32_t rtp_plugin_get_blocksize (input_plugin_t *this_gen) { - + return 0; } @@ -596,14 +596,14 @@ static uint32_t rtp_plugin_get_blocksize (input_plugin_t *this_gen) { */ static const char* rtp_plugin_get_mrl (input_plugin_t *this_gen) { rtp_input_plugin_t *this = (rtp_input_plugin_t *) this_gen; - + return this->mrl; } /* * */ -static int rtp_plugin_get_optional_data (input_plugin_t *this_gen, +static int rtp_plugin_get_optional_data (input_plugin_t *this_gen, void *data, int data_type) { rtp_input_plugin_t *this = (rtp_input_plugin_t *) this_gen; @@ -635,16 +635,16 @@ static int rtp_plugin_get_optional_data (input_plugin_t *this_gen, static void rtp_plugin_dispose (input_plugin_t *this_gen ) { rtp_input_plugin_t *this = (rtp_input_plugin_t *) this_gen; - + if (this->nbc) nbc_close(this->nbc); - + if (this->rtp_running) { LOG_MSG(this->stream->xine, _("RTP: stopping reading thread...\n")); pthread_cancel(this->reader_thread); pthread_join(this->reader_thread, NULL); LOG_MSG(this->stream->xine, _("RTP: reading thread terminated\n")); } - + if (this->fh != -1) close(this->fh); free(this->buffer); @@ -661,7 +661,7 @@ static int rtp_plugin_open (input_plugin_t *this_gen ) { this->filename, this->port, this->interface); - + this->fh = host_connect(this->filename, this->port, this->interface, this->stream->xine); @@ -672,12 +672,12 @@ static int rtp_plugin_open (input_plugin_t *this_gen ) { this->curpos = 0; this->rtp_running = 1; - if ((err = pthread_create(&this->reader_thread, NULL, + if ((err = pthread_create(&this->reader_thread, NULL, input_plugin_read_loop, (void *)this)) != 0) { LOG_MSG(this->stream->xine, _("input_rtp: can't create new thread (%s)\n"), strerror(err)); _x_abort(); } - + return 1; } @@ -691,7 +691,7 @@ static input_plugin_t *rtp_class_get_instance (input_class_t *cls_gen, char *mrl; int is_rtp = 0; int port = 7658; - + mrl = strdup(data); if (!strncasecmp (mrl, "rtp://", 6)) { @@ -702,12 +702,12 @@ static input_plugin_t *rtp_class_get_instance (input_class_t *cls_gen, filename = &mrl[6]; is_rtp = 0; } - + if (filename == NULL || strlen(filename) == 0) { free(mrl); return NULL; } - + /* Locate the port number */ pptr=strchr(filename, ':'); iptr = NULL; @@ -728,7 +728,7 @@ static input_plugin_t *rtp_class_get_instance (input_class_t *cls_gen, } } } - + this = calloc(1, sizeof(rtp_input_plugin_t)); this->stream = stream; this->mrl = mrl; @@ -765,8 +765,8 @@ static input_plugin_t *rtp_class_get_instance (input_class_t *cls_gen, this->input_plugin.get_optional_data = rtp_plugin_get_optional_data; this->input_plugin.dispose = rtp_plugin_dispose; this->input_plugin.input_class = cls_gen; - - this->nbc = NULL; + + this->nbc = NULL; this->nbc = nbc_init(this->stream); return &this->input_plugin; @@ -776,7 +776,7 @@ static input_plugin_t *rtp_class_get_instance (input_class_t *cls_gen, /* * net plugin class */ - + static const char *rtp_class_get_description (input_class_t *this_gen) { return _("RTP and UDP input plugin as shipped with xine"); } @@ -795,7 +795,7 @@ static void *init_class (xine_t *xine, void *data) { rtp_input_class_t *this; - + this = calloc(1, sizeof(rtp_input_class_t)); this->config = xine->config; this->xine = xine; @@ -816,7 +816,7 @@ static void *init_class (xine_t *xine, void *data) { */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_INPUT, 17, "rtp", XINE_VERSION_CODE, NULL, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/input/input_rtsp.c b/src/input/input_rtsp.c index fad395e0b..fbfad0364 100644 --- a/src/input/input_rtsp.c +++ b/src/input/input_rtsp.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2002-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -69,14 +69,14 @@ typedef struct { off_t curpos; - nbc_t *nbc; + nbc_t *nbc; char scratch[BUFSIZE]; } rtsp_input_plugin_t; -static off_t rtsp_plugin_read (input_plugin_t *this_gen, +static off_t rtsp_plugin_read (input_plugin_t *this_gen, char *buf, off_t len) { rtsp_input_plugin_t *this = (rtsp_input_plugin_t *) this_gen; off_t n; @@ -90,7 +90,7 @@ static off_t rtsp_plugin_read (input_plugin_t *this_gen, return n; } -static buf_element_t *rtsp_plugin_read_block (input_plugin_t *this_gen, +static buf_element_t *rtsp_plugin_read_block (input_plugin_t *this_gen, fifo_buffer_t *fifo, off_t todo) { /*rtsp_input_plugin_t *this = (rtsp_input_plugin_t *) this_gen; */ buf_element_t *buf = fifo->buffer_pool_alloc (fifo); @@ -107,7 +107,7 @@ static buf_element_t *rtsp_plugin_read_block (input_plugin_t *this_gen, buf->content = buf->mem; buf->type = BUF_DEMUX_BLOCK; - + total_bytes = rtsp_plugin_read (this_gen, (char*)buf->content, todo); if (total_bytes != todo) { @@ -151,17 +151,17 @@ static off_t rtsp_plugin_seek_time (input_plugin_t *this_gen, int time_offset, i rtsp_input_plugin_t *this = (rtsp_input_plugin_t *) this_gen; lprintf ("seek_time %d msec, origin %d\n", time_offset, origin); - + if (origin == SEEK_SET) rtsp_session_set_start_time (this->rtsp, time_offset); - + return this->curpos; } static off_t rtsp_plugin_get_length (input_plugin_t *this_gen) { /* - rtsp_input_plugin_t *this = (rtsp_input_plugin_t *) this_gen; + rtsp_input_plugin_t *this = (rtsp_input_plugin_t *) this_gen; off_t length; */ @@ -198,13 +198,13 @@ static void rtsp_plugin_dispose (input_plugin_t *this_gen) { nbc_close (this->nbc); this->nbc = NULL; } - + if(this->mrl) free(this->mrl); - + if(this->public_mrl) free(this->public_mrl); - + free (this); } @@ -214,7 +214,7 @@ static const char* rtsp_plugin_get_mrl (input_plugin_t *this_gen) { return this->public_mrl; } -static int rtsp_plugin_get_optional_data (input_plugin_t *this_gen, +static int rtsp_plugin_get_optional_data (input_plugin_t *this_gen, void *data, int data_type) { rtsp_input_plugin_t *this = (rtsp_input_plugin_t *) this_gen; @@ -245,11 +245,11 @@ static int rtsp_plugin_open (input_plugin_t *this_gen) { } this->rtsp = rtsp; - + return 1; } -static input_plugin_t *rtsp_class_get_instance (input_class_t *cls_gen, xine_stream_t *stream, +static input_plugin_t *rtsp_class_get_instance (input_class_t *cls_gen, xine_stream_t *stream, const char *mrl) { /* rtsp_input_class_t *cls = (rtsp_input_class_t *) cls_gen; */ @@ -267,7 +267,7 @@ static input_plugin_t *rtsp_class_get_instance (input_class_t *cls_gen, xine_str * an .rm extention to force handling by demux_real. */ asprintf(&this->public_mrl, "%s.rm", this->mrl); - + this->nbc = nbc_init (stream); this->input_plugin.open = rtsp_plugin_open; @@ -283,7 +283,7 @@ static input_plugin_t *rtsp_class_get_instance (input_class_t *cls_gen, xine_str this->input_plugin.dispose = rtsp_plugin_dispose; this->input_plugin.get_optional_data = rtsp_plugin_get_optional_data; this->input_plugin.input_class = cls_gen; - + return &this->input_plugin; } @@ -329,7 +329,7 @@ static void *init_class (xine_t *xine, void *data) { */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_INPUT, 17, "rtsp", XINE_VERSION_CODE, NULL, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/input/input_smb.c b/src/input/input_smb.c index e49eaa889..5d97d7518 100644 --- a/src/input/input_smb.c +++ b/src/input/input_smb.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2008 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -41,7 +41,7 @@ typedef struct { input_class_t input_class; xine_t *xine; - + int mrls_allocated_entries; xine_mrl_t **mrls; } smb_input_class_t; @@ -138,7 +138,7 @@ smb_plugin_get_length (input_plugin_t *this_gen) int e; struct stat st; - + if (this->fd>=0) e = smbc_fstat(this->fd,&st); else e = smbc_stat(this->mrl,&st); @@ -218,20 +218,20 @@ static int _strverscmp(const char *s1, const char *s2) { c2 = *p2++; state |= (c1 == '0') + (ISDIGIT(c1) != 0); } - + state = result_type[state << 2 | ((c2 == '0') + (ISDIGIT(c2) != 0))]; - + switch(state) { case CMP: return diff; - + case LEN: while(ISDIGIT(*p1++)) if(!ISDIGIT(*p2++)) return 1; - + return ISDIGIT(*p2) ? -1 : diff; - + default: return state; } @@ -245,9 +245,9 @@ static int _sortfiles_default(const xine_mrl_t *s1, const xine_mrl_t *s2) { } -static xine_mrl_t **smb_class_get_dir (input_class_t *this_gen, +static xine_mrl_t **smb_class_get_dir (input_class_t *this_gen, const char *filename, int *nFiles) { - + smb_input_class_t *this = (smb_input_class_t *) this_gen; int (*func) () = _sortfiles_default; int dir; @@ -263,11 +263,11 @@ static xine_mrl_t **smb_class_get_dir (input_class_t *this_gen, snprintf(current_path, XINE_PATH_MAX, "smb:/"); snprintf(current_path_smb, XINE_PATH_MAX, "smb://"); } - + if ((dir = smbc_opendir(current_path_smb)) >= 0){ xine_mrl_t *dir_files = (xine_mrl_t *) calloc(MAXFILES, sizeof(xine_mrl_t)); xine_mrl_t *norm_files = (xine_mrl_t *) calloc(MAXFILES, sizeof(xine_mrl_t)); - int num_dir_files=0; + int num_dir_files=0; int num_norm_files=0; while ((pdirent = smbc_readdir(dir)) != NULL){ if (pdirent->smbc_type == SMBC_WORKGROUP){ @@ -277,7 +277,7 @@ static xine_mrl_t **smb_class_get_dir (input_class_t *this_gen, asprintf(&(dir_files[num_dir_files].mrl), "%s/%s", current_path, pdirent->name); dir_files[num_dir_files].size = pdirent->dirlen; num_dir_files ++; - }else if (pdirent->smbc_type == SMBC_SERVER){ + }else if (pdirent->smbc_type == SMBC_SERVER){ if (num_dir_files == 0) { dir_files[num_dir_files].link = NULL; dir_files[num_dir_files].type = mrl_file | mrl_file_directory; @@ -309,7 +309,7 @@ static xine_mrl_t **smb_class_get_dir (input_class_t *this_gen, asprintf(&(dir_files[num_dir_files].mrl), "%s/%s", current_path, pdirent->name); dir_files[num_dir_files].size = pdirent->dirlen; num_dir_files ++; - } + } } else if (pdirent->smbc_type == SMBC_DIR){ dir_files[num_dir_files].link = NULL; dir_files[num_dir_files].type = mrl_file | mrl_file_directory; @@ -342,49 +342,49 @@ static xine_mrl_t **smb_class_get_dir (input_class_t *this_gen, */ if(num_dir_files) qsort(dir_files, num_dir_files, sizeof(xine_mrl_t), func); - + if(num_norm_files) qsort(norm_files, num_norm_files, sizeof(xine_mrl_t), func); - + /* * Add directories entries */ for(i = 0; i < num_dir_files; i++) { if (num_files >= this->mrls_allocated_entries) { ++this->mrls_allocated_entries; - this->mrls = realloc(this->mrls, + this->mrls = realloc(this->mrls, (this->mrls_allocated_entries+1) * sizeof(xine_mrl_t*)); this->mrls[num_files] = calloc(1, sizeof(xine_mrl_t)); }else memset(this->mrls[num_files], 0, sizeof(xine_mrl_t)); - - MRL_DUPLICATE(&dir_files[i], this->mrls[num_files]); + + MRL_DUPLICATE(&dir_files[i], this->mrls[num_files]); num_files++; } - - /* + + /* * Add other files entries */ for(i = 0; i < num_norm_files; i++) { if(num_files >= this->mrls_allocated_entries) { ++this->mrls_allocated_entries; - this->mrls = realloc(this->mrls, + this->mrls = realloc(this->mrls, (this->mrls_allocated_entries+1) * sizeof(xine_mrl_t*)); this->mrls[num_files] = calloc(1, sizeof(xine_mrl_t)); }else memset(this->mrls[num_files], 0, sizeof(xine_mrl_t)); - MRL_DUPLICATE(&norm_files[i], this->mrls[num_files]); + MRL_DUPLICATE(&norm_files[i], this->mrls[num_files]); num_files++; } - + /* Some cleanups before leaving */ for(i = num_dir_files; i == 0; i--) MRL_ZERO(&dir_files[i]); free(dir_files); - + for(i = num_norm_files; i == 0; i--) MRL_ZERO(&norm_files[i]); free(norm_files); @@ -394,13 +394,13 @@ static xine_mrl_t **smb_class_get_dir (input_class_t *this_gen, current_path, errno, strerror(errno)); *nFiles = 0; return NULL; - } - + } + /* * Inform caller about files found number. */ *nFiles = num_files; - + /* * Freeing exceeded mrls if exists. */ @@ -408,7 +408,7 @@ static xine_mrl_t **smb_class_get_dir (input_class_t *this_gen, MRL_ZERO(this->mrls[this->mrls_allocated_entries - 1]); free(this->mrls[this->mrls_allocated_entries--]); } - + /* * This is useful to let UI know where it should stops ;-). */ @@ -418,7 +418,7 @@ static xine_mrl_t **smb_class_get_dir (input_class_t *this_gen, } static int -smb_plugin_get_optional_data (input_plugin_t *this_gen, +smb_plugin_get_optional_data (input_plugin_t *this_gen, void *data, int data_type) { return INPUT_OPTIONAL_UNSUPPORTED; @@ -443,8 +443,8 @@ smb_plugin_open (input_plugin_t *this_gen ) smb_input_class_t *class = (smb_input_class_t *) this_gen->input_class; this->fd = smbc_open(this->mrl,O_RDONLY,0); - xprintf(class->xine, XINE_VERBOSITY_DEBUG, - "input_smb: open failed for %s: %s\n", + xprintf(class->xine, XINE_VERBOSITY_DEBUG, + "input_smb: open failed for %s: %s\n", this->mrl, strerror(errno)); if (this->fd<0) return 0; @@ -464,7 +464,7 @@ smb_class_get_instance (input_class_t *class_gen, xine_stream_t *stream, const char *mrl) { smb_input_t *this; - + if (mrl == NULL) return NULL; if (strncmp (mrl, "smb://",6)) @@ -508,7 +508,7 @@ static void if (smbc_init(smb_auth,(xine->verbosity >= XINE_VERBOSITY_DEBUG))) goto _exit_error; - + this = calloc(1, sizeof(smb_input_class_t)); this->xine = xine; @@ -526,7 +526,7 @@ static void setlocale(LC_MESSAGES, lcl); free(lcl); #endif - + return (input_class_t *) this; } diff --git a/src/input/input_stdin_fifo.c b/src/input/input_stdin_fifo.c index 64b8d748c..74f2a1014 100644 --- a/src/input/input_stdin_fifo.c +++ b/src/input/input_stdin_fifo.c @@ -2,17 +2,17 @@ * Copyright (C) 2000-2003 the xine project * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -78,7 +78,7 @@ static off_t stdin_plugin_get_current_pos (input_plugin_t *this_gen); -static off_t stdin_plugin_read (input_plugin_t *this_gen, +static off_t stdin_plugin_read (input_plugin_t *this_gen, char *buf, off_t len) { stdin_input_plugin_t *this = (stdin_input_plugin_t *) this_gen; @@ -104,7 +104,7 @@ static off_t stdin_plugin_read (input_plugin_t *this_gen, n = _x_io_file_read (this->stream, this->fh, &buf[total], len - total); lprintf ("got %"PRId64" bytes (%"PRId64"/%"PRId64" bytes read)\n", n,total,len); - + if (n < 0) { _x_message(this->stream, XINE_MSG_READ_ERROR, NULL); return 0; @@ -116,7 +116,7 @@ static off_t stdin_plugin_read (input_plugin_t *this_gen, return total; } -static buf_element_t *stdin_plugin_read_block (input_plugin_t *this_gen, fifo_buffer_t *fifo, +static buf_element_t *stdin_plugin_read_block (input_plugin_t *this_gen, fifo_buffer_t *fifo, off_t todo) { off_t total_bytes; @@ -166,11 +166,11 @@ static off_t stdin_plugin_seek (input_plugin_t *this_gen, off_t offset, int orig if (offset < this->curpos) { - if( this->curpos <= this->preview_size ) + if( this->curpos <= this->preview_size ) this->curpos = offset; else - xprintf (this->xine, XINE_VERBOSITY_LOG, - _("stdin: cannot seek back! (%" PRIdMAX " > %" PRIdMAX ")\n"), + xprintf (this->xine, XINE_VERBOSITY_LOG, + _("stdin: cannot seek back! (%" PRIdMAX " > %" PRIdMAX ")\n"), (intmax_t)this->curpos, (intmax_t)offset); } else { @@ -194,7 +194,7 @@ static off_t stdin_plugin_get_length(input_plugin_t *this_gen) { } static uint32_t stdin_plugin_get_capabilities(input_plugin_t *this_gen) { - + return INPUT_CAP_PREVIEW; } @@ -218,17 +218,17 @@ static const char* stdin_plugin_get_mrl (input_plugin_t *this_gen) { static void stdin_plugin_dispose (input_plugin_t *this_gen ) { stdin_input_plugin_t *this = (stdin_input_plugin_t *) this_gen; - if (this->nbc) + if (this->nbc) nbc_close (this->nbc); if ((this->fh != STDIN_FILENO) && (this->fh != -1)) close(this->fh); - + free (this->mrl); free (this); } -static int stdin_plugin_get_optional_data (input_plugin_t *this_gen, +static int stdin_plugin_get_optional_data (input_plugin_t *this_gen, void *data, int data_type) { stdin_input_plugin_t *this = (stdin_input_plugin_t *) this_gen; @@ -287,7 +287,7 @@ static int stdin_plugin_open (input_plugin_t *this_gen ) { } -static input_plugin_t *stdin_class_get_instance (input_class_t *class_gen, +static input_plugin_t *stdin_class_get_instance (input_class_t *class_gen, xine_stream_t *stream, const char *data) { stdin_input_class_t *class = (stdin_input_class_t *) class_gen; diff --git a/src/input/input_v4l.c b/src/input/input_v4l.c index 3a020bd69..e3af41f85 100644 --- a/src/input/input_v4l.c +++ b/src/input/input_v4l.c @@ -1,19 +1,19 @@ /* * Copyright (C) 2003-2008 the xine project * Copyright (C) 2003 J.Asselman <j.asselman@itsec-ps.nl> - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -65,7 +65,7 @@ #define LOG_MODULE "input_v4l" #define LOG_VERBOSE /* -#define LOG +#define LOG */ #include "xine_internal.h" @@ -109,7 +109,7 @@ typedef struct { typedef struct { input_plugin_t input_plugin; - + xine_stream_t *stream; char *mrl; @@ -123,7 +123,7 @@ typedef struct { buf_element_t *frames_base; void *audio_content_base; void *video_content_base; - + /* Audio */ buf_element_t *aud_frames; pthread_mutex_t aud_frames_lock; @@ -132,32 +132,32 @@ typedef struct { #ifdef HAVE_ALSA /* Handle for the PCM device */ snd_pcm_t *pcm_handle; - + /* Record stream (via line 1) */ snd_pcm_stream_t pcm_stream; - + /* Information and configuration for the PCM stream */ snd_pcm_hw_params_t *pcm_hwparams; /* Name of the PCM device, plughw:0,0?=>soundcard,device*/ - char *pcm_name; - + char *pcm_name; + /* Use alsa to capture the sound (for a/v sync) */ char audio_capture; - + int exact_rate; /* Actual sample rate sndpcm_hw_params_set_rate_near */ int dir; /* exact rate == rate --> dir = 0 exact rate < rate --> dir = -1 exact rate > rate --> dir = 1 */ - + unsigned char *pcm_data; - + int64_t pts_aud_start; #endif int audio_header_sent; - + int rate; /* Sample rate */ int periods; /* Number of periods */ int periodsize; /* Periodsize in bytes */ @@ -186,9 +186,9 @@ typedef struct { struct video_audio audio; struct video_audio audio_saved; struct video_mbuf gb_buffers; - + int video_header_sent; - + int frame_format; const resolution_t *resolution; int frame_size; @@ -225,13 +225,13 @@ typedef struct { struct pvrscr_s { scr_plugin_t scr; - + struct timeval cur_time; int64_t cur_pts; int xine_speed; double speed_factor; double speed_tuning; - + pthread_mutex_t lock; }; @@ -246,47 +246,47 @@ static void pvrscr_set_pivot(pvrscr_t *this) struct timeval tv; int64_t pts; double pts_calc; - + xine_monotonic_clock(&tv, NULL); pts_calc = (tv.tv_sec - this->cur_time.tv_sec) * this->speed_factor; pts_calc += (tv.tv_usec - this->cur_time.tv_usec) * this->speed_factor / 1e6; pts = this->cur_pts + pts_calc; - + /* This next part introduces a one off inaccuracy * to the scr due to rounding tv to pts. */ this->cur_time.tv_sec = tv.tv_sec; this->cur_time.tv_usec = tv.tv_usec; this->cur_pts = pts; - + return; } static int pvrscr_set_fine_speed (scr_plugin_t *scr, int speed) { pvrscr_t *this = (pvrscr_t*) scr; - + pthread_mutex_lock (&this->lock); - + pvrscr_set_pivot( this ); this->xine_speed = speed; this->speed_factor = (double) speed * 90000.0 / XINE_FINE_SPEED_NORMAL * this->speed_tuning; - + pthread_mutex_unlock (&this->lock); - + return speed; } static void pvrscr_speed_tuning (pvrscr_t *this, double factor) { pthread_mutex_lock (&this->lock); - + pvrscr_set_pivot( this ); this->speed_tuning = factor; this->speed_factor = (double) this->xine_speed * 90000.0 / XINE_FINE_SPEED_NORMAL * this->speed_tuning; - + pthread_mutex_unlock (&this->lock); } @@ -294,28 +294,28 @@ static void pvrscr_adjust (scr_plugin_t *scr, int64_t vpts) { pvrscr_t *this = (pvrscr_t*) scr; struct timeval tv; - + pthread_mutex_lock (&this->lock); - + xine_monotonic_clock(&tv, NULL); this->cur_time.tv_sec = tv.tv_sec; this->cur_time.tv_usec = tv.tv_usec; this->cur_pts = vpts; - + pthread_mutex_unlock (&this->lock); } static void pvrscr_start (scr_plugin_t *scr, int64_t start_vpts) { pvrscr_t *this = (pvrscr_t*) scr; - + pthread_mutex_lock (&this->lock); - + xine_monotonic_clock(&this->cur_time, NULL); this->cur_pts = start_vpts; pthread_mutex_unlock (&this->lock); - + pvrscr_set_fine_speed (&this->scr, XINE_FINE_SPEED_NORMAL); } @@ -325,17 +325,17 @@ static int64_t pvrscr_get_current (scr_plugin_t *scr) struct timeval tv; int64_t pts; double pts_calc; - + pthread_mutex_lock (&this->lock); - + xine_monotonic_clock(&tv, NULL); - + pts_calc = (tv.tv_sec - this->cur_time.tv_sec) * this->speed_factor; pts_calc += (tv.tv_usec - this->cur_time.tv_usec) * this->speed_factor / 1e6; pts = this->cur_pts + pts_calc; - + pthread_mutex_unlock (&this->lock); - + /*printf("returning pts %lld\n", pts);*/ return pts; } @@ -343,7 +343,7 @@ static int64_t pvrscr_get_current (scr_plugin_t *scr) static void pvrscr_exit (scr_plugin_t *scr) { pvrscr_t *this = (pvrscr_t*) scr; - + pthread_mutex_destroy (&this->lock); free(this); } @@ -351,9 +351,9 @@ static void pvrscr_exit (scr_plugin_t *scr) static pvrscr_t *XINE_MALLOC pvrscr_init (void) { pvrscr_t *this; - + this = calloc(1, sizeof(pvrscr_t)); - + this->scr.interface_version = 3; this->scr.get_priority = pvrscr_get_priority; this->scr.set_fine_speed = pvrscr_set_fine_speed; @@ -361,7 +361,7 @@ static pvrscr_t *XINE_MALLOC pvrscr_init (void) this->scr.start = pvrscr_start; this->scr.get_current = pvrscr_get_current; this->scr.exit = pvrscr_exit; - + pthread_mutex_init (&this->lock, NULL); pvrscr_speed_tuning(this, 1.0 ); @@ -369,7 +369,7 @@ static pvrscr_t *XINE_MALLOC pvrscr_init (void) #ifdef SCRLOG printf("input_v4l: scr init complete\n"); #endif - + return this; } @@ -380,7 +380,7 @@ static void report_progress (xine_stream_t *stream, int p) { xine_event_t event; xine_progress_data_t prg; - + if (p == SCR_PAUSED) { prg.description = _("Buffer underrun..."); p = 0; @@ -390,13 +390,13 @@ static void report_progress (xine_stream_t *stream, int p) p = 100; } else prg.description = _("Adjusting..."); - + prg.percent = (p>100)?100:p; - + event.type = XINE_EVENT_PROGRESS; event.data = &prg; event.data_length = sizeof (xine_progress_data_t); - + xine_event_send (stream, &event); } @@ -412,25 +412,25 @@ static void v4l_event_handler(v4l_input_plugin_t *this); inline static buf_element_t *alloc_aud_frame (v4l_input_plugin_t *this) { buf_element_t *frame; - + lprintf("alloc_aud_frame. trying to get lock...\n"); pthread_mutex_lock (&this->aud_frames_lock) ; - + lprintf("got the lock\n"); - + while (!this->aud_frames) { lprintf("no audio frame available...\n"); pthread_cond_wait (&this->aud_frame_freed, &this->aud_frames_lock); } - + frame = this->aud_frames; this->aud_frames = this->aud_frames->next; - + pthread_mutex_unlock (&this->aud_frames_lock); - + lprintf("alloc_aud_frame done\n"); - + return frame; } @@ -444,10 +444,10 @@ static void store_aud_frame (buf_element_t *frame) lprintf("store_aud_frame\n"); pthread_mutex_lock (&this->aud_frames_lock) ; - + frame->next = this->aud_frames; this->aud_frames = frame; - + pthread_cond_signal (&this->aud_frame_freed); pthread_mutex_unlock (&this->aud_frames_lock); } @@ -464,19 +464,19 @@ inline static buf_element_t *alloc_vid_frame (v4l_input_plugin_t *this) pthread_mutex_lock (&this->vid_frames_lock) ; lprintf("got the lock\n"); - + while (!this->vid_frames) { lprintf("no video frame available...\n"); pthread_cond_wait (&this->vid_frame_freed, &this->vid_frames_lock); } - + frame = this->vid_frames; this->vid_frames = this->vid_frames->next; - + pthread_mutex_unlock (&this->vid_frames_lock); - + lprintf("alloc_vid_frame done\n"); - + return frame; } @@ -487,50 +487,50 @@ static void store_vid_frame (buf_element_t *frame) { v4l_input_plugin_t *this = (v4l_input_plugin_t *) frame->source; - + lprintf("store_vid_frame\n"); - + pthread_mutex_lock (&this->vid_frames_lock) ; frame->next = this->vid_frames; this->vid_frames = frame; - + pthread_cond_signal (&this->vid_frame_freed); pthread_mutex_unlock (&this->vid_frames_lock); } -static int extract_mrl(v4l_input_plugin_t *this, char *mrl) +static int extract_mrl(v4l_input_plugin_t *this, char *mrl) { char *tuner_name = NULL; int frequency = 0; char *locator = NULL; char *begin = NULL; - + if (mrl == NULL) { lprintf("Someone passed an empty mrl\n"); return 0; } - + for (locator = mrl; *locator != '\0' && *locator != '/' ; locator++); - + /* Get tuner name */ if (*locator == '/') { begin = ++locator; - + for (; *locator != '\0' && *locator != '/' ; locator++); - + tuner_name = (char *) strndup(begin, locator - begin); - - /* Get frequency, if available */ + + /* Get frequency, if available */ sscanf(locator, "/%d", &frequency); - + /* cannot use xprintf to log in this routine */ lprintf("input_v4l: Tuner name: %s frequency %d\n", tuner_name, frequency ); } - + this->frequency = frequency; this->tuner_name = tuner_name; - + return 1; } @@ -538,12 +538,12 @@ static int set_frequency(v4l_input_plugin_t *this, unsigned long frequency) { int ret = 0; int fd; - + if (this->video_fd > 0) fd = this->video_fd; else fd = this->radio_fd; - + if (frequency != 0) { /* FIXME: Don't assume tuner 0 ? */ this->tuner = 0; @@ -556,18 +556,18 @@ static int set_frequency(v4l_input_plugin_t *this, unsigned long frequency) } else { this->calc_frequency = (frequency * 16) / 1000; } - + ret = ioctl(fd, VIDIOCSFREQ, &this->calc_frequency); lprintf("IOCTL set frequency (%ld) returned: %d\n", frequency, ret); } else { - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "input_v4l: No frequency given. Expected syntax: v4l:/tuner/frequency\n" "input_v4l: Using currently tuned settings\n"); } - + this->frequency = frequency; - + if (ret < 0) return ret; else @@ -577,11 +577,11 @@ static int set_frequency(v4l_input_plugin_t *this, unsigned long frequency) static int set_input_source(v4l_input_plugin_t *this, char *input_source) { int ret = 0; - + if ((ret = search_by_channel(this, input_source)) != 1) { ret = search_by_tuner(this, input_source); } - + return ret; } @@ -590,23 +590,23 @@ static int search_by_tuner(v4l_input_plugin_t *this, char *input_source) int ret = 0; int fd = 0; int cur_tuner = 0; - + if (this->video_fd > 0) fd = this->video_fd; else fd = this->radio_fd; - + this->video_tuner.tuner = cur_tuner; ioctl(fd, VIDIOCGCAP, &this->video_cap); - + lprintf("This device has %d channel(s)\n", this->video_cap.channels); - + for (ret = ioctl(fd, VIDIOCGTUNER, &this->video_tuner); ret == 0 && this->video_cap.channels > cur_tuner && strstr(this->video_tuner.name, input_source) == NULL; cur_tuner++) { - + this->video_tuner.tuner = cur_tuner; - + lprintf("(%d) V4L device currently set to: \n", ret); lprintf("Tuner: %d\n", this->video_tuner.tuner); lprintf("Name: %s\n", this->video_tuner.name); @@ -616,7 +616,7 @@ static int search_by_tuner(v4l_input_plugin_t *this, char *input_source) lprintf("Range: %ld - %ld\n", this->video_tuner.rangelow * 1000 / 16, this->video_tuner.rangehigh * 1000 / 16); } } - + lprintf("(%d) V4L device final: \n", ret); lprintf("Tuner: %d\n", this->video_tuner.tuner); lprintf("Name: %s\n", this->video_tuner.name); @@ -625,10 +625,10 @@ static int search_by_tuner(v4l_input_plugin_t *this, char *input_source) } else { lprintf("Range: %ld - %ld\n", this->video_tuner.rangelow * 1000 / 16, this->video_tuner.rangehigh * 1000 / 16); } - + if (strstr(this->video_tuner.name, input_source) == NULL) return -1; - + return 1; } @@ -639,20 +639,20 @@ static int search_by_channel(v4l_input_plugin_t *this, char *input_source) cfg_entry_t *tv_standard_entry; lprintf("input_source: %s\n", input_source); - + this->input = 0; - + if (this->video_fd > 0) fd = this->video_fd; else fd = this->radio_fd; - + /* Tune into channel */ if (strlen(input_source) > 0) { for( this->video_channel.channel = 0; ioctl(fd, VIDIOCGCHAN, &this->video_channel) == 0; this->video_channel.channel++ ) { - + lprintf("V4L device currently set to:\n"); lprintf("Channel: %d\n", this->video_channel.channel); lprintf("Name: %s\n", this->video_channel.name); @@ -666,33 +666,33 @@ static int search_by_channel(v4l_input_plugin_t *this, char *input_source) break; } } - + if (strstr(this->video_channel.name, input_source) == NULL) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("Tuner name not found\n")); return -1; } - + tv_standard_entry = this->stream->xine->config->lookup_entry(this->stream->xine->config, "media.video4linux.tv_standard"); this->tuner_name = input_source; if (tv_standard_entry->num_value != 0) { this->video_channel.norm = tv_standard_values[ tv_standard_entry->num_value ]; xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - "input_v4l: TV Standard configured as STD %s (%d)\n", + "input_v4l: TV Standard configured as STD %s (%d)\n", tv_standard_names[ tv_standard_entry->num_value ], this->video_channel.norm ); ret = ioctl(fd, VIDIOCSCHAN, &this->video_channel); } else ret = ioctl(fd, VIDIOCSCHAN, &this->input); - + lprintf("(%d) Set channel to %d\n", ret, this->input); } else { - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "input_v4l: Not setting video source. No source given\n"); } ret = ioctl(fd, VIDIOCGTUNER, &this->video_tuner); lprintf("(%d) Flags %d\n", ret, this->video_tuner.flags); - + lprintf("VIDEO_TUNER_PAL %s set\n", this->video_tuner.flags & VIDEO_TUNER_PAL ? "" : "not"); lprintf("VIDEO_TUNER_NTSC %s set\n", this->video_tuner.flags & VIDEO_TUNER_NTSC ? "" : "not"); lprintf("VIDEO_TUNER_SECAM %s set\n", this->video_tuner.flags & VIDEO_TUNER_SECAM ? "" : "not"); @@ -701,7 +701,7 @@ static int search_by_channel(v4l_input_plugin_t *this, char *input_source) lprintf("VIDEO_TUNER_STEREO_ON %s set\n", this->video_tuner.flags & VIDEO_TUNER_STEREO_ON ? "" : "not"); lprintf("VIDEO_TUNER_RDS_ON %s set\n", this->video_tuner.flags & VIDEO_TUNER_RDS_ON ? "" : "not"); lprintf("VIDEO_TUNER_MBS_ON %s set\n", this->video_tuner.flags & VIDEO_TUNER_MBS_ON ? "" : "not"); - + switch (this->video_tuner.mode) { case VIDEO_MODE_PAL: lprintf("The tuner is in PAL mode\n"); @@ -717,7 +717,7 @@ static int search_by_channel(v4l_input_plugin_t *this, char *input_source) break; } - return 1; + return 1; } static void allocate_frames(v4l_input_plugin_t *this, unsigned dovideo) @@ -743,7 +743,7 @@ static void allocate_frames(v4l_input_plugin_t *this, unsigned dovideo) frames[i].source = this; frames[i].free_buffer = store_aud_frame; frames[i].extra_info = &infos[i]; - + audio_content += this->periodsize; store_aud_frame(&frames[i]); } @@ -772,12 +772,12 @@ static void unmute_audio(v4l_input_plugin_t *this) int fd; lprintf("unmute_audio\n"); - + if (this->video_fd > 0) fd = this->video_fd; else fd = this->radio_fd; - + ioctl(fd, VIDIOCGAUDIO, &this->audio); memcpy(&this->audio_saved, &this->audio, sizeof(this->audio)); @@ -786,43 +786,43 @@ static void unmute_audio(v4l_input_plugin_t *this) ioctl(fd, VIDIOCSAUDIO, &this->audio); } - + static int open_radio_capture_device(v4l_input_plugin_t *this) { int tuner_found = 0; cfg_entry_t *entry; - + lprintf("open_radio_capture_device\n"); - + entry = this->stream->xine->config->lookup_entry(this->stream->xine->config, "media.video4linux.radio_device"); - + if((this->radio_fd = open(entry->str_value, O_RDWR)) < 0) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - "input_v4l: error opening v4l device (%s): %s\n", + "input_v4l: error opening v4l device (%s): %s\n", entry->str_value, strerror(errno)); return 0; } - + lprintf("Device opened, radio %d\n", this->radio_fd); - + if (set_input_source(this, this->tuner_name) > 0) tuner_found = 1; - + _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_AUDIO, 1); _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_VIDEO, 0); - + /* Pre-allocate some frames for audio so it doesn't have to be done during * capture */ allocate_frames(this, 0); - + this->audio_only = 1; - + /* Unmute audio off video capture device */ unmute_audio(this); - - set_frequency(this, this->frequency); - + + set_frequency(this, this->frequency); + if (tuner_found) return 1; else @@ -843,22 +843,22 @@ static int open_video_capture_device(v4l_input_plugin_t *this) int ret; unsigned int j; cfg_entry_t *entry; - + lprintf("open_video_capture_device\n"); - - entry = this->stream->xine->config->lookup_entry(this->stream->xine->config, + + entry = this->stream->xine->config->lookup_entry(this->stream->xine->config, "media.video4linux.video_device"); /* Try to open the video device */ if((this->video_fd = open(entry->str_value, O_RDWR)) < 0) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - "input_v4l: error opening v4l device (%s): %s\n", + "input_v4l: error opening v4l device (%s): %s\n", entry->str_value, strerror(errno)); return 0; } - + lprintf("Device opened, tv %d\n", this->video_fd); - + /* figure out the resolution */ for (j = 0; j < NUM_RESOLUTIONS; j++) { @@ -870,7 +870,7 @@ static int open_video_capture_device(v4l_input_plugin_t *this) break; } } - + if (found == 0 || resolutions[j].width < this->video_cap.minwidth || resolutions[j].height < this->video_cap.minheight) { @@ -878,15 +878,15 @@ static int open_video_capture_device(v4l_input_plugin_t *this) lprintf("Grab device does not support any preset resolutions"); return 0; } - + this->resolution = &resolutions[j]; - + _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_AUDIO, 1); _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_VIDEO, 1); - + /* Unmute audio off video capture device */ unmute_audio(this); - + if (strlen(this->tuner_name) > 0) { /* Tune into source and given frequency */ if (set_input_source(this, this->tuner_name) <= 0) @@ -894,20 +894,20 @@ static int open_video_capture_device(v4l_input_plugin_t *this) else tuner_found = 1; } - - set_frequency(this, this->frequency); - + + set_frequency(this, this->frequency); + /* Test for mmap video access */ ret = ioctl(this->video_fd,VIDIOCGMBUF, &this->gb_buffers); - + if (ret < 0) { /* Device driver does not support mmap */ /* try to use read based access */ struct video_picture pict; int val; - + ioctl(this->video_fd, VIDIOCGPICT, &pict); - + /* try to choose a suitable video format */ pict.palette = VIDEO_PALETTE_YUV420P; ret = ioctl(this->video_fd, VIDIOCSPICT, &pict); @@ -925,13 +925,13 @@ static int open_video_capture_device(v4l_input_plugin_t *this) } else lprintf("Grab: format YUV 4:2:0\n"); - + this->frame_format = pict.palette; val = 1; ioctl(this->video_fd, VIDIOCCAPTURE, &val); - + this->use_mmap = 0; - + } else { /* Good, device driver support mmap. Mmap the memory */ lprintf("using mmap, size %d\n", this->gb_buffers.size); @@ -945,23 +945,23 @@ static int open_video_capture_device(v4l_input_plugin_t *this) return 0; } this->gb_frame = 0; - + /* start to grab the first frame */ this->gb_buf.frame = (this->gb_frame + 1) % this->gb_buffers.frames; this->gb_buf.height = resolutions[j].height; this->gb_buf.width = resolutions[j].width; this->gb_buf.format = VIDEO_PALETTE_YUV420P; - + ret = ioctl(this->video_fd, VIDIOCMCAPTURE, &this->gb_buf); if (ret < 0 && errno != EAGAIN) { /* try YUV422 */ this->gb_buf.format = VIDEO_PALETTE_YUV422; - + ret = ioctl(this->video_fd, VIDIOCMCAPTURE, &this->gb_buf); } else lprintf("(%d) YUV420 should work\n", ret); - + if (ret < 0) { if (errno != EAGAIN) { lprintf("grab device does not support suitable format\n"); @@ -974,7 +974,7 @@ static int open_video_capture_device(v4l_input_plugin_t *this) this->frame_format = this->gb_buf.format; this->use_mmap = 1; } - + switch(this->frame_format) { case VIDEO_PALETTE_YUV420P: this->frame_format = BUF_VIDEO_I420; @@ -985,19 +985,19 @@ static int open_video_capture_device(v4l_input_plugin_t *this) this->frame_size = resolutions[j].width * resolutions[j].height * 2; break; } - - /* Strip the vbi / sync signal from the image by zooming in */ + + /* Strip the vbi / sync signal from the image by zooming in */ this->old_zoomx = xine_get_param(this->stream, XINE_PARAM_VO_ZOOM_X); this->old_zoomy = xine_get_param(this->stream, XINE_PARAM_VO_ZOOM_Y); - + xine_set_param(this->stream, XINE_PARAM_VO_ZOOM_X, 103); xine_set_param(this->stream, XINE_PARAM_VO_ZOOM_Y, 103); - /* Pre-allocate some frames for audio and video so it doesn't have to be + /* Pre-allocate some frames for audio and video so it doesn't have to be * done during capture */ allocate_frames(this, 1); - /* If we made it here, everything went ok */ + /* If we made it here, everything went ok */ this->audio_only = 0; if (tuner_found) return 1; @@ -1021,98 +1021,98 @@ static int open_audio_capture_device(v4l_input_plugin_t *this) /* Allocate the snd_pcm_hw_params_t structure on the stack. */ snd_pcm_hw_params_alloca(&this->pcm_hwparams); - + /* If we are not capturing video, open the sound device in blocking mode, * otherwise xine gets too many NULL bufs and doesn't seem to handle them * correctly. If we are capturing video, open the sound device in non- * blocking mode, otherwise we will loose video frames while waiting */ if(!this->audio_only) mode = SND_PCM_NONBLOCK; - + /* Open the PCM device. */ if(snd_pcm_open(&this->pcm_handle, this->pcm_name, this->pcm_stream, mode) < 0) { - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "input_v4l: Error opening PCM device: %s\n", this->pcm_name); this->audio_capture = 0; } - + /* Get parameters */ if (this->audio_capture && (snd_pcm_hw_params_any(this->pcm_handle, this->pcm_hwparams) < 0)) { - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "input_v4l: Broken configuration for PCM device: No configurations available\n"); this->audio_capture = 0; } - + /* Set access type */ if (this->audio_capture && (snd_pcm_hw_params_set_access(this->pcm_handle, this->pcm_hwparams, SND_PCM_ACCESS_RW_INTERLEAVED) < 0)) { - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "input_v4l: Error setting SND_PCM_ACCESS_RW_INTERLEAVED\n"); this->audio_capture = 0; } - + /* Set sample format */ if (this->audio_capture && - (snd_pcm_hw_params_set_format(this->pcm_handle, + (snd_pcm_hw_params_set_format(this->pcm_handle, this->pcm_hwparams, SND_PCM_FORMAT_S16_LE) < 0)) { - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "input_v4l: Error setting SND_PCM_FORMAT_S16_LE\n"); this->audio_capture = 0; } - + /* Set sample rate */ this->exact_rate = this->rate; if (this->audio_capture && - (snd_pcm_hw_params_set_rate_near(this->pcm_handle, this->pcm_hwparams, + (snd_pcm_hw_params_set_rate_near(this->pcm_handle, this->pcm_hwparams, &this->exact_rate, &this->dir) < 0)) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "input_v4l: Error setting samplerate\n"); this->audio_capture = 0; } if (this->audio_capture && this->dir != 0) { - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "input_v4l: Samplerate %d Hz is not supported by your hardware\n", this->rate); - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "input_v4l: Using %d instead\n", this->exact_rate); } - + /* Set number of channels */ if (this->audio_capture && (snd_pcm_hw_params_set_channels(this->pcm_handle, this->pcm_hwparams, 2) < 0)) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "input_v4l: Error setting PCM channels\n"); this->audio_capture = 0; } - + if (this->audio_capture && (snd_pcm_hw_params_set_periods(this->pcm_handle, this->pcm_hwparams, this->periods, 0) < 0)) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "input_v4l: Error setting PCM periods\n"); this->audio_capture = 0; } - + /* Set buffersize */ if (this->audio_capture && - (snd_pcm_hw_params_set_buffer_size_near(this->pcm_handle, + (snd_pcm_hw_params_set_buffer_size_near(this->pcm_handle, this->pcm_hwparams, &buf_size) < 0)) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "input_v4l: Error setting PCM buffer size to %d\n", (int)buf_size ); this->audio_capture = 0; } - + /* Apply HW parameter settings */ if (this->audio_capture && (snd_pcm_hw_params(this->pcm_handle, this->pcm_hwparams) < 0)) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "input_v4l: Error Setting PCM HW params\n"); this->audio_capture = 0; } - + if (this->audio_capture) { lprintf("Allocating memory for PCM capture :%d\n", this->periodsize); this->pcm_data = (unsigned char*) malloc(this->periodsize); } else - this->pcm_data = NULL; - + this->pcm_data = NULL; + lprintf("Audio device succesfully configured\n"); #endif return 0; @@ -1128,30 +1128,30 @@ static int v4l_adjust_realtime_speed(v4l_input_plugin_t *this, fifo_buffer_t *fi { int num_used, num_free; int scr_tuning = this->scr_tuning; - + if (fifo == NULL) return 0; - + num_used = fifo->size(fifo); num_free = NUM_FRAMES - num_used; - + if (!this->audio_only && num_used == 0 && scr_tuning != SCR_PAUSED) { /* Buffer is empty, and we did not pause playback */ report_progress(this->stream, SCR_PAUSED); - - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "input_v4l: Buffer empty, pausing playback (used: %d, num_free: %d)\n", num_used, num_free); - + _x_set_speed(this->stream, XINE_SPEED_PAUSE); this->stream->xine->clock->set_option (this->stream->xine->clock, CLOCK_SCR_ADJUSTABLE, 0); - + this->scr_tuning = SCR_PAUSED; /* pvrscr_speed_tuning(this->scr, 0.0); */ - + } else if (num_free <= 1 && scr_tuning != SCR_SKIP) { this->scr_tuning = SCR_SKIP; - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "input_v4l: Buffer full, skipping (used: %d, free: %d)\n", num_used, num_free); return 0; } else if (scr_tuning == SCR_PAUSED) { @@ -1159,11 +1159,11 @@ static int v4l_adjust_realtime_speed(v4l_input_plugin_t *this, fifo_buffer_t *fi /* Playback was paused, but we have normal buffer usage again */ xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "input_v4l: Resuming from paused (used: %d, free: %d)\n", num_used, num_free); - + this->scr_tuning = 0; - + pvrscr_speed_tuning(this->scr, 1.0); - + _x_set_speed(this->stream, XINE_SPEED_NORMAL); this->stream->xine->clock->set_option (this->stream->xine->clock, CLOCK_SCR_ADJUSTABLE, 1); } @@ -1188,12 +1188,12 @@ static int v4l_adjust_realtime_speed(v4l_input_plugin_t *this, fifo_buffer_t *fi (scr_tuning < 0 && num_used > num_free)) /* Buffer usage is ok again. Set playback speed to normal */ scr_tuning = 0; - - /* Check if speed adjustment should be changed */ + + /* Check if speed adjustment should be changed */ if (scr_tuning != this->scr_tuning) { this->scr_tuning = scr_tuning; - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, - "input_v4l: scr tuning = %d (used: %d, free: %d)\n", + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_v4l: scr tuning = %d (used: %d, free: %d)\n", scr_tuning, num_used, num_free); pvrscr_speed_tuning(this->scr, 1.0 + (0.01 * scr_tuning)); } @@ -1203,13 +1203,13 @@ static int v4l_adjust_realtime_speed(v4l_input_plugin_t *this, fifo_buffer_t *fi * speed */ this->scr_tuning = 0; - + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "input_v4l: scr tuning resetting (used: %d, free: %d\n", num_used, num_free); - + pvrscr_speed_tuning(this->scr, 1.0); } - + return 1; } @@ -1246,15 +1246,15 @@ static buf_element_t *v4l_plugin_read_block (input_plugin_t *this_gen, fifo_buff uint8_t *ptr; static char video = 0; int speed = _x_get_speed(this->stream); - - v4l_event_handler(this); - + + v4l_event_handler(this); + #ifdef HAVE_ALSA if (!this->audio_header_sent) { lprintf("sending audio header\n"); - + buf = alloc_aud_frame (this); - + buf->size = 0; buf->decoder_flags = BUF_FLAG_HEADER|BUF_FLAG_STDHEADER|BUF_FLAG_FRAME_END; @@ -1262,60 +1262,60 @@ static buf_element_t *v4l_plugin_read_block (input_plugin_t *this_gen, fifo_buff buf->decoder_info[1] = this->exact_rate; buf->decoder_info[2] = this->bits; buf->decoder_info[3] = 2; - + this->audio_header_sent = 1; - + return buf; } -#endif - +#endif + if (!this->audio_only && !this->video_header_sent) { xine_bmiheader bih; - + lprintf("sending video header"); - + bih.biSize = sizeof(xine_bmiheader); bih.biWidth = this->resolution->width; bih.biHeight = this->resolution->height; - + buf = alloc_vid_frame (this); - + buf->size = sizeof(xine_bmiheader); buf->decoder_flags = BUF_FLAG_HEADER|BUF_FLAG_STDHEADER|BUF_FLAG_FRAME_END; memcpy(buf->content, &bih, sizeof(xine_bmiheader)); - + this->video_header_sent = 1; - - return buf; + + return buf; } - + if (!this->audio_only) { if (!v4l_adjust_realtime_speed(this, fifo, speed)) { return NULL; } } - - if (!this->audio_only) + + if (!this->audio_only) video = !video; else video = 0; - + lprintf("%lld bytes...\n", todo); - - if (this->start_time == 0) + + if (this->start_time == 0) /* Create a start pts value */ this->start_time = get_time(); /* this->stream->xine->clock->get_current_time(this->stream->xine->clock); */ - + if (video) { /* Capture video */ buf = alloc_vid_frame (this); buf->decoder_flags = BUF_FLAG_FRAME_START|BUF_FLAG_FRAME_END; - + this->gb_buf.frame = this->gb_frame; - + lprintf("VIDIOCMCAPTURE\n"); - + while (ioctl(this->video_fd, VIDIOCMCAPTURE, &this->gb_buf) < 0) { lprintf("Upper while loop\n"); if (errno == EAGAIN) { @@ -1327,92 +1327,92 @@ static buf_element_t *v4l_plugin_read_block (input_plugin_t *this_gen, fifo_buff return NULL; } } - + this->gb_frame = (this->gb_frame + 1) % this->gb_buffers.frames; - + while (ioctl(this->video_fd, VIDIOCSYNC, &this->gb_frame) < 0 && (errno == EAGAIN || errno == EINTR)) { lprintf("Waiting for videosync\n"); } - + /* printf ("grabbing frame #%d\n", frame_num); */ - + ptr = this->video_buf + this->gb_buffers.offsets[this->gb_frame]; buf->pts = get_time(); /* this->stream->xine->clock->get_current_time(this->stream->xine->clock); */ - xine_fast_memcpy (buf->content, ptr, this->frame_size); + xine_fast_memcpy (buf->content, ptr, this->frame_size); } #ifdef HAVE_ALSA else if (this->audio_capture) { /* Record audio */ int pcmreturn; - - if ((pcmreturn = snd_pcm_readi(this->pcm_handle, this->pcm_data, (this->periodsize)>> 2)) < 0) { + + if ((pcmreturn = snd_pcm_readi(this->pcm_handle, this->pcm_data, (this->periodsize)>> 2)) < 0) { switch (pcmreturn) { case -EAGAIN: /* No data available at the moment */ break; case -EBADFD: /* PCM device in wrong state */ - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "input_v4l: PCM is not in the right state\n"); break; case -EPIPE: /* Buffer overrun */ - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "input_v4l: PCM buffer Overrun (lost some samples)\n"); /* On buffer overrun we need to re prepare the capturing pcm device */ snd_pcm_prepare(this->pcm_handle); break; case -ESTRPIPE: /* Suspend event */ - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "input_v4l: PCM suspend event occured\n"); break; default: /* Unknown */ - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "input_v4l: Unknown PCM error code: %d\n", pcmreturn); snd_pcm_prepare(this->pcm_handle); } } else { /* Succesfully read audio data */ - + if (this->pts_aud_start) { buf = alloc_aud_frame (this); buf->decoder_flags = 0; } - + /* We want the pts on the start of the sample. As the soundcard starts * sampling a new sample as soon as the read function returned with a - * success we will save the current pts and assign the current pts to + * success we will save the current pts and assign the current pts to * that sample when we read it */ - + /* Assign start pts to sample */ if (buf) buf->pts = this->pts_aud_start; - + /* Save start pts */ this->pts_aud_start = get_time(); /* this->stream->xine->clock->get_current_time(this->stream->xine->clock); */ - + if (!buf) /* Skip first sample as we don't have a good pts for this one */ return NULL; - + lprintf("Audio: Data read: %d [%d, %d]. Pos: %d\n", pcmreturn, (int) (*this->pcm_data), (int) (*(this->pcm_data + this->periodsize - 3)), (int) this->curpos); - - + + /* Tell decoder the number of bytes we have read */ - buf->size = pcmreturn<<2; - + buf->size = pcmreturn<<2; + this->curpos++; - + xine_fast_memcpy(buf->content, this->pcm_data, buf->size); } } #endif - + lprintf("read block done\n"); - + return buf; } @@ -1422,7 +1422,7 @@ static buf_element_t *v4l_plugin_read_block (input_plugin_t *this_gen, fifo_buff */ static off_t v4l_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin) { v4l_input_plugin_t *this = (v4l_input_plugin_t *) this_gen; - + lprintf("seek %lld bytes, origin %d\n", offset, origin); return this->curpos; } @@ -1433,10 +1433,10 @@ static off_t v4l_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin */ static off_t v4l_plugin_get_length (input_plugin_t *this_gen) { /* - v4l_input_plugin_t *this = (v4l_input_plugin_t *) this_gen; + v4l_input_plugin_t *this = (v4l_input_plugin_t *) this_gen; off_t length; */ - + return -1; } @@ -1446,8 +1446,8 @@ static off_t v4l_plugin_get_length (input_plugin_t *this_gen) { */ static uint32_t v4l_plugin_get_capabilities (input_plugin_t *this_gen) { - v4l_input_plugin_t *this = (v4l_input_plugin_t *) this_gen; - + v4l_input_plugin_t *this = (v4l_input_plugin_t *) this_gen; + if (this->audio_only) return 0x10; else @@ -1469,26 +1469,26 @@ static uint32_t v4l_plugin_get_blocksize (input_plugin_t *this_gen) */ static off_t v4l_plugin_get_current_pos (input_plugin_t *this_gen){ v4l_input_plugin_t *this = (v4l_input_plugin_t *) this_gen; - + /* printf ("current pos is %lld\n", this->curpos); */ - + return this->curpos; } /** * Event handler. - * + * * Processes events from a frontend. This way frequencies can be changed * without closing the v4l plugin. */ static void v4l_event_handler (v4l_input_plugin_t *this) { xine_event_t *event; - + while ((event = xine_event_get (this->event_queue))) { xine_set_v4l2_data_t *v4l2_data = event->data; - + switch (event->type) { case XINE_EVENT_SET_V4L2: if( v4l2_data->input != this->input || @@ -1498,25 +1498,25 @@ static void v4l_event_handler (v4l_input_plugin_t *this) { this->input = v4l2_data->input; this->channel = v4l2_data->channel; this->frequency = v4l2_data->frequency; - + lprintf("Switching to input:%d chan:%d freq:%.2f\n", v4l2_data->input, v4l2_data->channel, (float)v4l2_data->frequency); set_frequency(this, this->frequency); - _x_demux_flush_engine(this->stream); + _x_demux_flush_engine(this->stream); } break; /* default: - + lprintf("Got an event, type 0x%08x\n", event->type); */ } - + xine_event_free (event); } -} +} /** * Dispose plugin. @@ -1526,69 +1526,69 @@ static void v4l_event_handler (v4l_input_plugin_t *this) { */ static void v4l_plugin_dispose (input_plugin_t *this_gen) { v4l_input_plugin_t *this = (v4l_input_plugin_t *) this_gen; - + if(this->mrl) free(this->mrl); - + if (this->scr) { this->stream->xine->clock->unregister_scr(this->stream->xine->clock, &this->scr->scr); this->scr->scr.exit(&this->scr->scr); } - + /* Close and free video device */ if (this->tuner_name) free(this->tuner_name); - + /* Close video device only if device was openend */ if (this->video_fd > 0) { - + /* Restore v4l audio volume */ - lprintf("Restoring v4l audio volume %d\n", + lprintf("Restoring v4l audio volume %d\n", ioctl(this->video_fd, VIDIOCSAUDIO, &this->audio_saved)); ioctl(this->video_fd, VIDIOCSAUDIO, &this->audio_saved); - + /* Unmap memory */ - if (this->video_buf != NULL && + if (this->video_buf != NULL && munmap(this->video_buf, this->gb_buffers.size) != 0) { - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "input_v4l: Could not unmap video memory: %s\n", strerror(errno)); } else lprintf("Succesfully unmapped video memory (size %d)\n", this->gb_buffers.size); - + lprintf("Closing video filehandler %d\n", this->video_fd); - + /* Now close the video device */ if (close(this->video_fd) != 0) - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "input_v4l: Error while closing video file handler: %s\n", strerror(errno)); else lprintf("Video device succesfully closed\n"); - - /* Restore zoom setting */ + + /* Restore zoom setting */ xine_set_param(this->stream, XINE_PARAM_VO_ZOOM_X, this->old_zoomx); xine_set_param(this->stream, XINE_PARAM_VO_ZOOM_Y, this->old_zoomy); } - + if (this->radio_fd > 0) { close(this->radio_fd); } - + #ifdef HAVE_ALSA /* Close audio device */ if (this->pcm_handle) { snd_pcm_drop(this->pcm_handle); snd_pcm_close(this->pcm_handle); } - + if (this->pcm_data) { free(this->pcm_data); } - + if (this->pcm_name) { free(this->pcm_name); } #endif - + if (this->event_queue) xine_event_dispose_queue (this->event_queue); @@ -1607,9 +1607,9 @@ static void v4l_plugin_dispose (input_plugin_t *this_gen) { #ifdef LOG printf("\n"); #endif - + free (this); - + lprintf("plugin Bye bye! \n"); } @@ -1620,11 +1620,11 @@ static void v4l_plugin_dispose (input_plugin_t *this_gen) { */ static const char* v4l_plugin_get_mrl (input_plugin_t *this_gen) { v4l_input_plugin_t *this = (v4l_input_plugin_t *) this_gen; - + return this->mrl; } -static int v4l_plugin_get_optional_data (input_plugin_t *this_gen, +static int v4l_plugin_get_optional_data (input_plugin_t *this_gen, void *data, int data_type) { /* v4l_input_plugin_t *this = (v4l_input_plugin_t *) this_gen; */ @@ -1634,19 +1634,19 @@ static int v4l_plugin_get_optional_data (input_plugin_t *this_gen, static int v4l_plugin_radio_open (input_plugin_t *this_gen) { v4l_input_plugin_t *this = (v4l_input_plugin_t *) this_gen; - + if(open_radio_capture_device(this) != 1) return 0; - + open_audio_capture_device(this); - + #ifdef HAVE_ALSA this->start_time = 0; this->pts_aud_start = 0; this->curpos = 0; this->event_queue = xine_event_new_queue (this->stream); -#endif - +#endif + return 1; } @@ -1655,30 +1655,30 @@ static int v4l_plugin_video_open (input_plugin_t *this_gen) { v4l_input_plugin_t *this = (v4l_input_plugin_t *) this_gen; int64_t time; - + if(!open_video_capture_device(this)) return 0; - + open_audio_capture_device(this); - + #ifdef HAVE_ALSA this->pts_aud_start = 0; #endif this->start_time = 0; this->curpos = 0; - + /* Register our own scr provider */ time = this->stream->xine->clock->get_current_time(this->stream->xine->clock); this->scr = pvrscr_init(); this->scr->scr.start(&this->scr->scr, time); this->stream->xine->clock->register_scr(this->stream->xine->clock, &this->scr->scr); this->scr_tuning = 0; - + /* enable resample method */ this->stream->xine->config->update_num(this->stream->xine->config, "audio.synchronization.av_sync_method", 1); - + this->event_queue = xine_event_new_queue (this->stream); - + return 1; } @@ -1697,19 +1697,19 @@ static input_plugin_t *v4l_class_get_instance (input_class_t *cls_gen, cfg_entry_t *entry; #endif char *mrl = strdup(data); - + /* Example mrl: v4l:/Television/62500 */ if(!mrl || strncasecmp(mrl, "v4l:/", 5)) { free(mrl); return NULL; } - + this = calloc(1, sizeof (v4l_input_plugin_t)); - + extract_mrl(this, mrl); - - this->stream = stream; - this->mrl = mrl; + + this->stream = stream; + this->mrl = mrl; this->video_buf = NULL; this->video_fd = -1; this->radio_fd = -1; @@ -1718,7 +1718,7 @@ static input_plugin_t *v4l_class_get_instance (input_class_t *cls_gen, #ifdef HAVE_ALSA this->pcm_data = NULL; this->pcm_hwparams = NULL; - + /* Audio */ this->pcm_stream = SND_PCM_STREAM_CAPTURE; entry = this->stream->xine->config->lookup_entry(this->stream->xine->config, @@ -1730,13 +1730,13 @@ static input_plugin_t *v4l_class_get_instance (input_class_t *cls_gen, this->periods = 2; this->periodsize = 2 * 8192; this->bits = 16; - + pthread_mutex_init (&this->aud_frames_lock, NULL); pthread_cond_init (&this->aud_frame_freed, NULL); - + pthread_mutex_init (&this->vid_frames_lock, NULL); pthread_cond_init (&this->vid_frame_freed, NULL); - + this->input_plugin.get_capabilities = v4l_plugin_get_capabilities; this->input_plugin.read = v4l_plugin_read; this->input_plugin.read_block = v4l_plugin_read_block; @@ -1748,7 +1748,7 @@ static input_plugin_t *v4l_class_get_instance (input_class_t *cls_gen, this->input_plugin.dispose = v4l_plugin_dispose; this->input_plugin.get_optional_data = v4l_plugin_get_optional_data; this->input_plugin.input_class = cls_gen; - + return &this->input_plugin; } @@ -1758,57 +1758,57 @@ static input_plugin_t *v4l_class_get_video_instance (input_class_t *cls_gen, v4l_input_plugin_t *this = NULL; int is_ok = 1; cfg_entry_t *entry; - + this = (v4l_input_plugin_t *) v4l_class_get_instance (cls_gen, stream, data); - + if (this) this->input_plugin.open = v4l_plugin_video_open; else return NULL; - - entry = this->stream->xine->config->lookup_entry(this->stream->xine->config, + + entry = this->stream->xine->config->lookup_entry(this->stream->xine->config, "media.video4linux.video_device"); - + /* Try to open the video device */ if((this->video_fd = open(entry->str_value, O_RDWR)) < 0) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - "input_v4l: error opening v4l device (%s): %s\n", + "input_v4l: error opening v4l device (%s): %s\n", entry->str_value, strerror(errno)); is_ok = 0; } else lprintf("Device opened, tv %d\n", this->video_fd); - + /* Get capabilities */ if (is_ok && ioctl(this->video_fd, VIDIOCGCAP, &this->video_cap) < 0) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "input_v4l: v4l card doesn't support some features needed by xine\n"); is_ok = 0;; } - + if (is_ok && !(this->video_cap.type & VID_TYPE_CAPTURE)) { /* Capture is not supported by the device. This is a must though! */ xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "input_v4l: v4l card doesn't support frame grabbing\n"); is_ok = 0; } - + if (is_ok && set_input_source(this, this->tuner_name) <= 0) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "input_v4l: unable to locate the tuner name (%s) on your v4l card\n", this->tuner_name); is_ok = 0; } - + if (this->video_fd > 0) { close(this->video_fd); this->video_fd = -1; } - + if (!is_ok) { v4l_plugin_dispose((input_plugin_t *) this); return NULL; } - + return &this->input_plugin; } @@ -1819,45 +1819,45 @@ static input_plugin_t *v4l_class_get_radio_instance (input_class_t *cls_gen, v4l_input_plugin_t *this = NULL; int is_ok = 1; cfg_entry_t *entry; - + if (strstr(data, "Radio") == NULL) return NULL; - + this = (v4l_input_plugin_t *) v4l_class_get_instance (cls_gen, stream, data); - + if (this) this->input_plugin.open = v4l_plugin_radio_open; else return NULL; - - entry = this->stream->xine->config->lookup_entry(this->stream->xine->config, + + entry = this->stream->xine->config->lookup_entry(this->stream->xine->config, "media.video4linux.radio_device"); - + if((this->radio_fd = open(entry->str_value, O_RDWR)) < 0) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - "input_v4l: error opening v4l device (%s): %s\n", + "input_v4l: error opening v4l device (%s): %s\n", entry->str_value, strerror(errno)); is_ok = 0; } else lprintf("Device opened, radio %d\n", this->radio_fd); - + if (is_ok && set_input_source(this, this->tuner_name) <= 0) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "input_v4l: unable to locate the tuner name (%s) on your v4l card\n", this->tuner_name); is_ok = 0; } - + if (this->radio_fd > 0) { close(this->radio_fd); this->radio_fd = -1; } - + if (!is_ok) { v4l_plugin_dispose((input_plugin_t *) this); return NULL; } - + return &this->input_plugin; } @@ -1880,7 +1880,7 @@ static const char *v4l_class_get_identifier (input_class_t *this_gen) { static void v4l_class_dispose (input_class_t *this_gen) { v4l_input_class_t *this = (v4l_input_class_t *) this_gen; - + free (this); } @@ -1888,11 +1888,11 @@ static void *init_video_class (xine_t *xine, void *data) { v4l_input_class_t *this; config_values_t *config = xine->config; - + this = calloc(1, sizeof (v4l_input_class_t)); - + this->xine = xine; - + this->input_class.get_instance = v4l_class_get_video_instance; this->input_class.get_identifier = v4l_class_get_identifier; this->input_class.get_description = v4l_class_get_video_description; @@ -1900,7 +1900,7 @@ static void *init_video_class (xine_t *xine, void *data) this->input_class.get_autoplay_list = NULL; this->input_class.dispose = v4l_class_dispose; this->input_class.eject_media = NULL; - + config->register_filename (config, "media.video4linux.video_device", VIDEO_DEV, XINE_CONFIG_STRING_IS_DEVICE_NAME, _("v4l video device"), @@ -1926,11 +1926,11 @@ static void *init_radio_class (xine_t *xine, void *data) { v4l_input_class_t *this; config_values_t *config = xine->config; - + this = calloc(1, sizeof (v4l_input_class_t)); - + this->xine = xine; - + this->input_class.get_instance = v4l_class_get_radio_instance; this->input_class.get_identifier = v4l_class_get_identifier; this->input_class.get_description = v4l_class_get_radio_description; @@ -1938,13 +1938,13 @@ static void *init_radio_class (xine_t *xine, void *data) this->input_class.get_autoplay_list = NULL; this->input_class.dispose = v4l_class_dispose; this->input_class.eject_media = NULL; - + config->register_filename (config, "media.video4linux.radio_device", RADIO_DEV, XINE_CONFIG_STRING_IS_DEVICE_NAME, _("v4l radio device"), _("The path to your Video4Linux radio device."), 10, NULL, NULL); - + return this; } @@ -1953,12 +1953,12 @@ static void *init_radio_class (xine_t *xine, void *data) */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_INPUT | PLUGIN_MUST_PRELOAD, 17, "v4l_radio", XINE_VERSION_CODE, NULL, init_radio_class }, { PLUGIN_INPUT | PLUGIN_MUST_PRELOAD, 17, "v4l_tv", XINE_VERSION_CODE, NULL, init_video_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; /* - * vim:sw=3:sts=3: + * vim:sw=3:sts=3: */ diff --git a/src/input/input_vcd.c b/src/input/input_vcd.c index c99f57f09..43980bd52 100644 --- a/src/input/input_vcd.c +++ b/src/input/input_vcd.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2008 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -105,11 +105,11 @@ typedef struct { typedef struct { input_plugin_t input_plugin; - + vcd_input_class_t *cls; - + xine_stream_t *stream; - + char *mrl; config_values_t *config; @@ -136,7 +136,7 @@ typedef struct { */ static void device_change_cb (void *data, xine_cfg_entry_t *cfg) { vcd_input_class_t *this = (vcd_input_class_t *) data; - + this->device = cfg->str_value; } @@ -146,7 +146,7 @@ static int input_vcd_read_toc (vcd_input_class_t *this, int fd) { /* read TOC header */ if ( ioctl(fd, CDROMREADTOCHDR, &this->tochdr) == -1 ) { - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "input_vcd : error in ioctl CDROMREADTOCHDR\n"); return -1; } @@ -156,7 +156,7 @@ static int input_vcd_read_toc (vcd_input_class_t *this, int fd) { this->tocent[i-1].cdte_track = i; this->tocent[i-1].cdte_format = CDROM_MSF; if ( ioctl(fd, CDROMREADTOCENTRY, &this->tocent[i-1]) == -1 ) { - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "input_vcd: error in ioctl CDROMREADTOCENTRY for track %d\n", i); return -1; } @@ -166,9 +166,9 @@ static int input_vcd_read_toc (vcd_input_class_t *this, int fd) { this->tocent[this->tochdr.cdth_trk1].cdte_track = CDROM_LEADOUT; this->tocent[this->tochdr.cdth_trk1].cdte_format = CDROM_MSF; - if (ioctl(fd, CDROMREADTOCENTRY, + if (ioctl(fd, CDROMREADTOCENTRY, &this->tocent[this->tochdr.cdth_trk1]) == -1 ) { - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "input_vcd: error in ioctl CDROMREADTOCENTRY for lead-out\n"); return -1; } @@ -185,23 +185,23 @@ static int input_vcd_read_toc (vcd_input_class_t *this, int fd) { /* read TOC header */ if ( ioctl(fd, CDIOREADTOCHEADER, &this->tochdr) == -1 ) { - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "input_vcd : error in ioctl CDROMREADTOCHDR\n"); return -1; } - ntracks = this->tochdr.ending_track + ntracks = this->tochdr.ending_track - this->tochdr.starting_track + 2; this->tocent = (struct cd_toc_entry *) xine_xmalloc(sizeof(*this->tocent) * ntracks); - + te.address_format = CD_LBA_FORMAT; te.starting_track = 0; te.data_len = ntracks * sizeof(struct cd_toc_entry); te.data = this->tocent; - + if ( ioctl(fd, CDIOREADTOCENTRYS, &te) == -1 ){ - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "input_vcd: error in ioctl CDROMREADTOCENTRY\n"); return -1; } @@ -232,11 +232,11 @@ static int sun_vcd_read(vcd_input_plugin_t *this, long lba, cdsector_t *data) */ if (this->controller_type == 0) { if ( ioctl(this->fd, DKIOCINFO, &cinfo) == 0 - && ((strcmp(cinfo.dki_cname, "ide") == 0) + && ((strcmp(cinfo.dki_cname, "ide") == 0) || (strncmp(cinfo.dki_cname, "pci", 3) == 0)) ) this->controller_type = SUN_CTRL_ATAPI; else - this->controller_type = SUN_CTRL_SCSI; + this->controller_type = SUN_CTRL_SCSI; } switch (this->controller_type) { case SUN_CTRL_SCSI: @@ -247,7 +247,7 @@ static int sun_vcd_read(vcd_input_plugin_t *this, long lba, cdsector_t *data) cdxa.cdxa_length = 1; cdxa.cdxa_data = data->subheader; cdxa.cdxa_format = CDROM_XA_SECTOR_DATA; - + if(ioctl(this->fd,CDROMCDXA,&cdxa)==-1) { xprintf(this->cls->xine, XINE_VERBOSITY_DEBUG, "CDROMCDXA: %s\n", strerror(errno)); return -1; @@ -304,12 +304,12 @@ static int sun_vcd_read(vcd_input_plugin_t *this, long lba, cdsector_t *data) cdb.cdb_opaque[7] = (blocks >> 8) & 0xff; cdb.cdb_opaque[8] = blocks & 0xff; cdb.cdb_opaque[9] = (sync << 7) | - (header_code << 5) | - (user_data << 4) | - (edc_ecc << 3) | - (error_field << 1); + (header_code << 5) | + (user_data << 4) | + (edc_ecc << 3) | + (error_field << 1); cdb.cdb_opaque[10] = sub_channel; - + sc.uscsi_cdb = (caddr_t)&cdb; sc.uscsi_cdblen = 12; sc.uscsi_bufaddr = (caddr_t)data->subheader; @@ -321,7 +321,7 @@ static int sun_vcd_read(vcd_input_plugin_t *this, long lba, cdsector_t *data) return -1; } if (sc.uscsi_status) { - xprintf (this->cls->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->cls->xine, XINE_VERBOSITY_DEBUG, "scsi command failed with status %d\n", sc.uscsi_status); return -1; } @@ -336,9 +336,9 @@ static int sun_vcd_read(vcd_input_plugin_t *this, long lba, cdsector_t *data) /* ***************************************************************** */ #if defined (__linux__) -static off_t vcd_plugin_read (input_plugin_t *this_gen, +static off_t vcd_plugin_read (input_plugin_t *this_gen, char *buf, off_t nlen) { - + vcd_input_plugin_t *this = (vcd_input_plugin_t *) this_gen; static struct cdrom_msf msf ; static cdsector_t data; @@ -348,14 +348,14 @@ static off_t vcd_plugin_read (input_plugin_t *this_gen, return 0; do - { + { end_msf = (struct cdrom_msf0 *) &this->cls->tocent[this->cur_track+1].cdte_addr.msf; /* printf ("cur: %02d:%02d:%02d end: %02d:%02d:%02d\n", - this->cur_min, this->cur_sec, this->cur_frame, - end_msf->minute, end_msf->second, end_msf->frame); + this->cur_min, this->cur_sec, this->cur_frame, + end_msf->minute, end_msf->second, end_msf->frame); */ if ( (this->cur_min>=end_msf->minute) && (this->cur_sec>=end_msf->second) @@ -369,7 +369,7 @@ static off_t vcd_plugin_read (input_plugin_t *this_gen, memcpy (&data, &msf, sizeof (msf)); if (ioctl (this->fd, CDROMREADRAW, &data) == -1) { - xprintf (this->cls->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->cls->xine, XINE_VERBOSITY_DEBUG, "input_vcd: error in CDROMREADRAW\n"); return 0; } @@ -384,17 +384,17 @@ static off_t vcd_plugin_read (input_plugin_t *this_gen, this->cur_min++; } } - + /* Header ID check for padding sector. VCD uses this to keep constant bitrate so the CD doesn't stop/start */ } while((data.subheader[2]&~0x01)==0x60); - + memcpy (buf, data.data, VCDSECTORSIZE); /* FIXME */ return VCDSECTORSIZE; } #elif defined (__FreeBSD_kernel__) || defined (__OpenBSD__) -static off_t vcd_plugin_read (input_plugin_t *this_gen, +static off_t vcd_plugin_read (input_plugin_t *this_gen, char *buf, off_t nlen) { vcd_input_plugin_t *this = (vcd_input_plugin_t *) this_gen; static cdsector_t data; @@ -418,9 +418,9 @@ static off_t vcd_plugin_read (input_plugin_t *this_gen, return VCDSECTORSIZE; } #elif defined (__sun) -static off_t vcd_plugin_read (input_plugin_t *this_gen, +static off_t vcd_plugin_read (input_plugin_t *this_gen, char *buf, off_t nlen) { - + vcd_input_plugin_t *this = (vcd_input_plugin_t *) this_gen; static cdsector_t data; struct cdrom_msf0 *end_msf; @@ -430,14 +430,14 @@ static off_t vcd_plugin_read (input_plugin_t *this_gen, return 0; do - { - end_msf = (struct cdrom_msf0 *) + { + end_msf = (struct cdrom_msf0 *) &this->cls->tocent[this->cur_track+1].cdte_addr.msf; /* printf ("cur: %02d:%02d:%02d end: %02d:%02d:%02d\n", - this->cur_min, this->cur_sec, this->cur_frame, - end_msf->minute, end_msf->second, end_msf->frame); + this->cur_min, this->cur_sec, this->cur_frame, + end_msf->minute, end_msf->second, end_msf->frame); */ if ( (this->cur_min>=end_msf->minute) && (this->cur_sec>=end_msf->second) @@ -460,21 +460,21 @@ static off_t vcd_plugin_read (input_plugin_t *this_gen, this->cur_min++; } } - + /* Header ID check for padding sector. VCD uses this to keep constant bitrate so the CD doesn't stop/start */ } while((data.subheader[2]&~0x01)==0x60); - + memcpy (buf, data.data, VCDSECTORSIZE); /* FIXME */ return VCDSECTORSIZE; } #endif #if defined (__linux__) -static buf_element_t *vcd_plugin_read_block (input_plugin_t *this_gen, +static buf_element_t *vcd_plugin_read_block (input_plugin_t *this_gen, fifo_buffer_t *fifo, off_t nlen) { - + vcd_input_plugin_t *this = (vcd_input_plugin_t *) this_gen; buf_element_t *buf; static struct cdrom_msf msf ; @@ -485,13 +485,13 @@ static buf_element_t *vcd_plugin_read_block (input_plugin_t *this_gen, return NULL; do - { + { end_msf = &this->cls->tocent[this->cur_track+1].cdte_addr.msf; /* printf ("cur: %02d:%02d:%02d end: %02d:%02d:%02d\n", - this->cur_min, this->cur_sec, this->cur_frame, - end_msf->minute, end_msf->second, end_msf->frame); + this->cur_min, this->cur_sec, this->cur_frame, + end_msf->minute, end_msf->second, end_msf->frame); */ if ( (this->cur_min>=end_msf->minute) && (this->cur_sec>=end_msf->second) @@ -519,12 +519,12 @@ static buf_element_t *vcd_plugin_read_block (input_plugin_t *this_gen, this->cur_min++; } } - + /* Header ID check for padding sector. VCD uses this to keep constant bitrate so the CD doesn't stop/start */ } while((data.subheader[2]&~0x01)==0x60); - + buf = fifo->buffer_pool_alloc (fifo); buf->content = buf->mem; buf->type = BUF_DEMUX_BLOCK; @@ -532,9 +532,9 @@ static buf_element_t *vcd_plugin_read_block (input_plugin_t *this_gen, return buf; } #elif defined (__FreeBSD_kernel__) || defined (__OpenBSD__) -static buf_element_t *vcd_plugin_read_block (input_plugin_t *this_gen, +static buf_element_t *vcd_plugin_read_block (input_plugin_t *this_gen, fifo_buffer_t *fifo, off_t nlen) { - + vcd_input_plugin_t *this = (vcd_input_plugin_t *) this_gen; buf_element_t *buf; static cdsector_t data; @@ -562,9 +562,9 @@ static buf_element_t *vcd_plugin_read_block (input_plugin_t *this_gen, return buf; } #elif defined(__sun) -static buf_element_t *vcd_plugin_read_block (input_plugin_t *this_gen, +static buf_element_t *vcd_plugin_read_block (input_plugin_t *this_gen, fifo_buffer_t *fifo, off_t nlen) { - + vcd_input_plugin_t *this = (vcd_input_plugin_t *) this_gen; buf_element_t *buf; static cdsector_t data; @@ -575,14 +575,14 @@ static buf_element_t *vcd_plugin_read_block (input_plugin_t *this_gen, return NULL; do - { - end_msf = (struct cdrom_msf0 *) + { + end_msf = (struct cdrom_msf0 *) &this->cls->tocent[this->cur_track+1].cdte_addr.msf; /* printf ("cur: %02d:%02d:%02d end: %02d:%02d:%02d\n", - this->cur_min, this->cur_sec, this->cur_frame, - end_msf->minute, end_msf->second, end_msf->frame); + this->cur_min, this->cur_sec, this->cur_frame, + end_msf->minute, end_msf->second, end_msf->frame); */ if ( (this->cur_min>=end_msf->minute) && (this->cur_sec>=end_msf->second) @@ -606,12 +606,12 @@ static buf_element_t *vcd_plugin_read_block (input_plugin_t *this_gen, this->cur_min++; } } - + /* Header ID check for padding sector. VCD uses this to keep constant bitrate so the CD doesn't stop/start */ } while((data.subheader[2]&~0x01)==0x60); - + buf = fifo->buffer_pool_alloc (fifo); buf->content = buf->mem; buf->type = BUF_DEMUX_BLOCK; @@ -625,17 +625,17 @@ static off_t vcd_time_to_offset (int min, int sec, int frame) { return min * 60 * 75 + sec * 75 + frame; } -static void vcd_offset_to_time (off_t offset, uint8_t *min, uint8_t *sec, +static void vcd_offset_to_time (off_t offset, uint8_t *min, uint8_t *sec, uint8_t *frame) { *min = offset / (60*75); offset %= (60*75); - *sec = offset / 75; - *frame = offset % 75; + *sec = offset / 75; + *frame = offset % 75; } -static off_t vcd_plugin_seek (input_plugin_t *this_gen, +static off_t vcd_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin) { vcd_input_plugin_t *this = (vcd_input_plugin_t *) this_gen; @@ -647,11 +647,11 @@ static off_t vcd_plugin_seek (input_plugin_t *this_gen, switch (origin) { case SEEK_SET: - sector_pos = (offset / VCDSECTORSIZE) + sector_pos = (offset / VCDSECTORSIZE) + vcd_time_to_offset (start_msf->minute, start_msf->second, start_msf->frame); - + vcd_offset_to_time (sector_pos, &this->cur_min, &this->cur_sec, &this->cur_frame); @@ -663,8 +663,8 @@ static off_t vcd_plugin_seek (input_plugin_t *this_gen, break; case SEEK_CUR: - if (offset) - xprintf (this->cls->xine, XINE_VERBOSITY_DEBUG, + if (offset) + xprintf (this->cls->xine, XINE_VERBOSITY_DEBUG, "input_vcd: SEEK_CUR not implemented for offset != 0\n"); /* @@ -683,7 +683,7 @@ static off_t vcd_plugin_seek (input_plugin_t *this_gen, break; default: - xprintf (this->cls->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->cls->xine, XINE_VERBOSITY_DEBUG, "input_vcd: error seek to origin %d not implemented!\n", origin); return 0; } @@ -691,7 +691,7 @@ static off_t vcd_plugin_seek (input_plugin_t *this_gen, return offset ; /* FIXME */ } #elif defined (__FreeBSD_kernel__) || defined (__OpenBSD__) -static off_t vcd_plugin_seek (input_plugin_t *this_gen, +static off_t vcd_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin) { @@ -700,11 +700,11 @@ static off_t vcd_plugin_seek (input_plugin_t *this_gen, uint32_t dist ; off_t sector_pos; - start = + start = ntohl(this->cls->tocent [this->cur_track+1 - this->cls->tochdr.starting_track].addr.lba); - /* printf("seek: start sector:%lu, origin: %d, offset:%qu\n", + /* printf("seek: start sector:%lu, origin: %d, offset:%qu\n", start, origin, offset); */ @@ -715,7 +715,7 @@ static off_t vcd_plugin_seek (input_plugin_t *this_gen, break; case SEEK_CUR: - if (offset) + if (offset) xprintf (this->cls->xine, XINE_VERBOSITY_DEBUG, "input_vcd: SEEK_CUR not implemented for offset != 0\n"); sector_pos = this->cur_sec; @@ -724,7 +724,7 @@ static off_t vcd_plugin_seek (input_plugin_t *this_gen, break; default: - xprintf (this->cls->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->cls->xine, XINE_VERBOSITY_DEBUG, "input_vcd: error seek to origin %d not implemented!\n", origin); return 0; } @@ -738,27 +738,27 @@ static off_t vcd_plugin_get_length (input_plugin_t *this_gen) { vcd_input_plugin_t *this = (vcd_input_plugin_t *) this_gen; struct cdrom_msf0 *end_msf, *start_msf; off_t len ; - + if(this->cls->total_tracks) { - + start_msf = (struct cdrom_msf0 *) &this->cls->tocent[this->cur_track].cdte_addr.msf; end_msf = (struct cdrom_msf0 *) &this->cls->tocent[this->cur_track+1].cdte_addr.msf; - + len = 75 - start_msf->frame; - + if (start_msf->second<60) len += (59 - start_msf->second) * 75; - + if (end_msf->minute > start_msf->minute) { len += (end_msf->minute - start_msf->minute-1) * 60 * 75; - + len += end_msf->second * 60; - + len += end_msf->frame ; } - + return len * VCDSECTORSIZE; } @@ -770,14 +770,14 @@ static off_t vcd_plugin_get_length (input_plugin_t *this_gen) { off_t len ; - len = + len = ntohl(this->cls->tocent - [this->cur_track+2 + [this->cur_track+2 - this->cls->tochdr.starting_track].addr.lba) - ntohl(this->cls->tocent - [this->cur_track+1 + [this->cur_track+1 - this->cls->tochdr.starting_track].addr.lba); - + return len * 2352; /*VCDSECTORSIZE;*/ } @@ -790,7 +790,7 @@ static off_t vcd_plugin_get_current_pos (input_plugin_t *this_gen){ } static uint32_t vcd_plugin_get_capabilities (input_plugin_t *this_gen) { - + return INPUT_CAP_SEEKABLE | INPUT_CAP_BLOCK ; } @@ -816,7 +816,7 @@ static const char* vcd_plugin_get_mrl (input_plugin_t *this_gen) { return this->mrl; } -static int vcd_plugin_get_optional_data (input_plugin_t *this_gen, +static int vcd_plugin_get_optional_data (input_plugin_t *this_gen, void *data, int data_type) { return INPUT_OPTIONAL_UNSUPPORTED; @@ -843,13 +843,13 @@ static int vcd_plugin_open (input_plugin_t *this_gen) { while (*filename == '/') filename++; if (sscanf (filename, "%d", &this->cur_track) != 1) { - xprintf (cls->xine, XINE_VERBOSITY_LOG, + xprintf (cls->xine, XINE_VERBOSITY_LOG, _("input_vcd: malformed MRL. Use vcdo:/<track #>\n")); return 0; } if (this->cur_track>=this->cls->total_tracks) { - xprintf (cls->xine, XINE_VERBOSITY_LOG, + xprintf (cls->xine, XINE_VERBOSITY_LOG, _("input_vcd: invalid track %d (valid range: 0 .. %d)\n"), this->cur_track, this->cls->total_tracks-1); return 0; @@ -870,21 +870,21 @@ static int vcd_plugin_open (input_plugin_t *this_gen) { xprintf (cls->xine, XINE_VERBOSITY_DEBUG, "input_vcd: error in CDRIOCSETBLOCKSIZE %d\n", errno); return 0; } - - this->cur_sec = + + this->cur_sec = ntohl(this->cls->tocent [this->cur_track+1 - this->cls->tochdr.starting_track].addr.lba); - + } #endif - + return 1; } -static input_plugin_t *vcd_class_get_instance (input_class_t *cls_gen, xine_stream_t *stream, +static input_plugin_t *vcd_class_get_instance (input_class_t *cls_gen, xine_stream_t *stream, const char *data) { - vcd_input_class_t *cls = (vcd_input_class_t *) cls_gen; + vcd_input_class_t *cls = (vcd_input_class_t *) cls_gen; vcd_input_plugin_t *this; char *mrl = strdup(data); @@ -892,7 +892,7 @@ static input_plugin_t *vcd_class_get_instance (input_class_t *cls_gen, xine_stre free (mrl); return 0; } - + this = calloc(1, sizeof(vcd_input_plugin_t)); this->stream = stream; @@ -959,7 +959,7 @@ static int vcd_class_eject_media (input_class_t *this_gen) { return media_eject_media (this->xine, this->device); } -static xine_mrl_t **vcd_class_get_dir (input_class_t *this_gen, const char *filename, +static xine_mrl_t **vcd_class_get_dir (input_class_t *this_gen, const char *filename, int *num_files) { vcd_input_class_t *this = (vcd_input_class_t *) this_gen; @@ -970,7 +970,7 @@ static xine_mrl_t **vcd_class_get_dir (input_class_t *this_gen, const char *file if (filename) return NULL; - + fd = open (this->device, O_RDONLY|O_EXCL); if (fd == -1) { @@ -1004,9 +1004,9 @@ static xine_mrl_t **vcd_class_get_dir (input_class_t *this_gen, const char *file else { memset(this->mrls[(i-1)], 0, sizeof(xine_mrl_t)); } - + asprintf(&(this->mrls[i-1]->mrl), "vcdo:/%d", i); - + this->mrls[i-1]->type = mrl_vcd; /* hack */ @@ -1023,13 +1023,13 @@ static xine_mrl_t **vcd_class_get_dir (input_class_t *this_gen, const char *file } this->mrls[*num_files] = NULL; - + return this->mrls; } static char ** vcd_class_get_autoplay_list (input_class_t *this_gen, int *num_files) { - vcd_input_class_t *this = (vcd_input_class_t *) this_gen; + vcd_input_class_t *this = (vcd_input_class_t *) this_gen; int i, fd; @@ -1101,7 +1101,7 @@ static void *init_class (xine_t *xine, void *data) { */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_INPUT | PLUGIN_MUST_PRELOAD, 17, "VCDO", XINE_VERSION_CODE, NULL, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/input/libdvdnav/Makefile.am b/src/input/libdvdnav/Makefile.am index 412828261..1cf60a0e2 100644 --- a/src/input/libdvdnav/Makefile.am +++ b/src/input/libdvdnav/Makefile.am @@ -46,4 +46,4 @@ noinst_HEADERS = \ dvd_reader.h \ dvd_input.h \ dvd_udf.h \ - bswap.h + bswap.h diff --git a/src/input/libreal/asmrp.c b/src/input/libreal/asmrp.c index 902c59d42..2c02c2f13 100644 --- a/src/input/libreal/asmrp.c +++ b/src/input/libreal/asmrp.c @@ -2,7 +2,7 @@ * Copyright (C) 2002-2004 the xine project * * This file is part of xine, a free video player. - * + * * xine 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 @@ -85,7 +85,7 @@ typedef struct { int sym; int num; - + char str[ASMRP_MAX_ID]; /* private part */ @@ -115,7 +115,7 @@ static void asmrp_dispose (asmrp_t *p) { int i; - for (i=0; i<p->sym_tab_num; i++) + for (i=0; i<p->sym_tab_num; i++) free (p->sym_tab[i].id); free (p); @@ -133,7 +133,7 @@ static void asmrp_init (asmrp_t *p, const char *str) { p->buf = strdup (str); p->pos = 0; - + asmrp_getch (p); } @@ -167,10 +167,10 @@ static void asmrp_string (asmrp_t *p) { asmrp_getch (p); } p->str[l]=0; - + if (p->ch=='"') asmrp_getch (p); - + p->sym = ASMRP_SYM_STRING; } @@ -189,7 +189,7 @@ static void asmrp_identifier (asmrp_t *p) { asmrp_getch (p); } p->str[l]=0; - + p->sym = ASMRP_SYM_ID; } @@ -387,10 +387,10 @@ static int asmrp_set_id (asmrp_t *p, char *s, int v) { lprintf ("new symbol '%s'\n", s); - } + } p->sym_tab[i].v = v; - + lprintf ("symbol '%s' assigned %d\n", s, v); return i; @@ -401,7 +401,7 @@ static int asmrp_condition (asmrp_t *p) ; static int asmrp_operand (asmrp_t *p) { int i, ret; - + lprintf ("operand\n"); ret = 0; @@ -411,7 +411,7 @@ static int asmrp_operand (asmrp_t *p) { case ASMRP_SYM_DOLLAR: asmrp_get_sym (p); - + if (p->sym != ASMRP_SYM_ID) { printf ("error: identifier expected.\n"); _x_abort(); @@ -453,7 +453,7 @@ static int asmrp_operand (asmrp_t *p) { } lprintf ("operand done, =%d\n", ret); - + return ret; } @@ -503,7 +503,7 @@ static int asmrp_comp_expression (asmrp_t *p) { } static int asmrp_condition (asmrp_t *p) { - + int a; lprintf ("condition\n"); @@ -542,7 +542,7 @@ static void asmrp_assignment (asmrp_t *p) { lprintf ("empty assignment\n"); return; } - + if (p->sym != ASMRP_SYM_ID) { printf ("error: identifier expected\n"); _x_abort (); @@ -555,7 +555,7 @@ static void asmrp_assignment (asmrp_t *p) { } asmrp_get_sym (p); - if ( (p->sym != ASMRP_SYM_NUM) && (p->sym != ASMRP_SYM_STRING) + if ( (p->sym != ASMRP_SYM_NUM) && (p->sym != ASMRP_SYM_STRING) && (p->sym != ASMRP_SYM_ID)) { printf ("error: number or string expected\n"); _x_abort (); @@ -566,22 +566,22 @@ static void asmrp_assignment (asmrp_t *p) { } static int asmrp_rule (asmrp_t *p) { - + int ret; lprintf ("rule\n"); ret = 1; - + if (p->sym == ASMRP_SYM_HASH) { asmrp_get_sym (p); ret = asmrp_condition (p); while (p->sym == ASMRP_SYM_COMMA) { - + asmrp_get_sym (p); - + asmrp_assignment (p); } diff --git a/src/input/libreal/real.c b/src/input/libreal/real.c index dcb90bcd0..9b72c7e57 100644 --- a/src/input/libreal/real.c +++ b/src/input/libreal/real.c @@ -55,20 +55,20 @@ static const unsigned char xor_table[] = { static void hash(char *field, char *param) { uint32_t a, b, c, d; - + /* fill variables */ a = _X_LE_32(field); b = _X_LE_32(field+4); c = _X_LE_32(field+8); d = _X_LE_32(field+12); - + lprintf("hash input: %x %x %x %x\n", a, b, c, d); lprintf("hash parameter:\n"); #ifdef LOG xine_hexdump(param, 64); #endif - + a = ((b & c) | (~b & d)) + _X_LE_32((param+0x00)) + a - 0x28955B88; a = ((a << 0x07) | (a >> 0x19)) + b; d = ((a & b) | (~a & c)) + _X_LE_32((param+0x04)) + d - 0x173848AA; @@ -101,7 +101,7 @@ static void hash(char *field, char *param) { c = ((c << 0x11) | (c >> 0x0f)) + d; b = ((c & d) | (~c & a)) + _X_LE_32((param+0x3c)) + b + 0x49B40821; b = ((b << 0x16) | (b >> 0x0a)) + c; - + a = ((b & d) | (~d & c)) + _X_LE_32((param+0x04)) + a - 0x09E1DA9E; a = ((a << 0x05) | (a >> 0x1b)) + b; d = ((a & c) | (~c & b)) + _X_LE_32((param+0x18)) + d - 0x3FBF4CC0; @@ -134,7 +134,7 @@ static void hash(char *field, char *param) { c = ((c << 0x0e) | (c >> 0x12)) + d; b = ((c & a) | (~a & d)) + _X_LE_32((param+0x30)) + b - 0x72D5B376; b = ((b << 0x14) | (b >> 0x0c)) + c; - + a = (b ^ c ^ d) + _X_LE_32((param+0x14)) + a - 0x0005C6BE; a = ((a << 0x04) | (a >> 0x1c)) + b; d = (a ^ b ^ c) + _X_LE_32((param+0x20)) + d - 0x788E097F; @@ -167,42 +167,42 @@ static void hash(char *field, char *param) { c = ((c << 0x10) | (c >> 0x10)) + d; b = (c ^ d ^ a) + _X_LE_32((param+0x08)) + b - 0x3B53A99B; b = ((b << 0x17) | (b >> 0x09)) + c; - + a = ((~d | b) ^ c) + _X_LE_32((param+0x00)) + a - 0x0BD6DDBC; - a = ((a << 0x06) | (a >> 0x1a)) + b; + a = ((a << 0x06) | (a >> 0x1a)) + b; d = ((~c | a) ^ b) + _X_LE_32((param+0x1c)) + d + 0x432AFF97; - d = ((d << 0x0a) | (d >> 0x16)) + a; + d = ((d << 0x0a) | (d >> 0x16)) + a; c = ((~b | d) ^ a) + _X_LE_32((param+0x38)) + c - 0x546BDC59; - c = ((c << 0x0f) | (c >> 0x11)) + d; + c = ((c << 0x0f) | (c >> 0x11)) + d; b = ((~a | c) ^ d) + _X_LE_32((param+0x14)) + b - 0x036C5FC7; - b = ((b << 0x15) | (b >> 0x0b)) + c; + b = ((b << 0x15) | (b >> 0x0b)) + c; a = ((~d | b) ^ c) + _X_LE_32((param+0x30)) + a + 0x655B59C3; - a = ((a << 0x06) | (a >> 0x1a)) + b; + a = ((a << 0x06) | (a >> 0x1a)) + b; d = ((~c | a) ^ b) + _X_LE_32((param+0x0C)) + d - 0x70F3336E; - d = ((d << 0x0a) | (d >> 0x16)) + a; + d = ((d << 0x0a) | (d >> 0x16)) + a; c = ((~b | d) ^ a) + _X_LE_32((param+0x28)) + c - 0x00100B83; - c = ((c << 0x0f) | (c >> 0x11)) + d; + c = ((c << 0x0f) | (c >> 0x11)) + d; b = ((~a | c) ^ d) + _X_LE_32((param+0x04)) + b - 0x7A7BA22F; - b = ((b << 0x15) | (b >> 0x0b)) + c; + b = ((b << 0x15) | (b >> 0x0b)) + c; a = ((~d | b) ^ c) + _X_LE_32((param+0x20)) + a + 0x6FA87E4F; - a = ((a << 0x06) | (a >> 0x1a)) + b; + a = ((a << 0x06) | (a >> 0x1a)) + b; d = ((~c | a) ^ b) + _X_LE_32((param+0x3c)) + d - 0x01D31920; - d = ((d << 0x0a) | (d >> 0x16)) + a; + d = ((d << 0x0a) | (d >> 0x16)) + a; c = ((~b | d) ^ a) + _X_LE_32((param+0x18)) + c - 0x5CFEBCEC; - c = ((c << 0x0f) | (c >> 0x11)) + d; + c = ((c << 0x0f) | (c >> 0x11)) + d; b = ((~a | c) ^ d) + _X_LE_32((param+0x34)) + b + 0x4E0811A1; - b = ((b << 0x15) | (b >> 0x0b)) + c; + b = ((b << 0x15) | (b >> 0x0b)) + c; a = ((~d | b) ^ c) + _X_LE_32((param+0x10)) + a - 0x08AC817E; - a = ((a << 0x06) | (a >> 0x1a)) + b; + a = ((a << 0x06) | (a >> 0x1a)) + b; d = ((~c | a) ^ b) + _X_LE_32((param+0x2c)) + d - 0x42C50DCB; - d = ((d << 0x0a) | (d >> 0x16)) + a; + d = ((d << 0x0a) | (d >> 0x16)) + a; c = ((~b | d) ^ a) + _X_LE_32((param+0x08)) + c + 0x2AD7D2BB; - c = ((c << 0x0f) | (c >> 0x11)) + d; + c = ((c << 0x0f) | (c >> 0x11)) + d; b = ((~a | c) ^ d) + _X_LE_32((param+0x24)) + b - 0x14792C6F; - b = ((b << 0x15) | (b >> 0x0b)) + c; + b = ((b << 0x15) | (b >> 0x0b)) + c; lprintf("hash output: %x %x %x %x\n", a, b, c, d); - + a += _X_LE_32(field); b += _X_LE_32(field+4); c += _X_LE_32(field+8); @@ -218,15 +218,15 @@ static void call_hash (char *key, char *challenge, unsigned int len) { char *ptr1, *ptr2; uint32_t a, b, c, d, tmp; - + ptr1=(key+16); ptr2=(key+20); - + a = _X_LE_32(ptr1); b = (a >> 3) & 0x3f; a += len * 8; _X_LE_32C(ptr1, a); - + if (a < (len << 3)) { lprintf("not verified: (len << 3) > a true\n"); @@ -236,7 +236,7 @@ static void call_hash (char *key, char *challenge, unsigned int len) { tmp = _X_LE_32(ptr2) + (len >> 0x1d); _X_LE_32C(ptr2, tmp); a = 64 - b; - c = 0; + c = 0; if (a <= len) { @@ -244,7 +244,7 @@ static void call_hash (char *key, char *challenge, unsigned int len) { hash(key, key+24); c = a; d = c + 0x3f; - + while ( d < len ) { lprintf("not verified: while ( d < len )\n"); hash(key, challenge+d-0x3f); @@ -253,7 +253,7 @@ static void call_hash (char *key, char *challenge, unsigned int len) { } b = 0; } - + memcpy(key+b+24, challenge+c, len-c); } @@ -265,11 +265,11 @@ static void calc_response (char *result, char *field) { memset (buf1, 0, 64); *buf1 = 128; - + memcpy (buf2, field+16, 8); - + i = ( _X_LE_32((buf2)) >> 3 ) & 0x3f; - + if (i < 56) { i = 56 - i; } else { @@ -286,7 +286,7 @@ static void calc_response (char *result, char *field) { static void calc_response_string (char *result, char *challenge) { - + char field[128] = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, 0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10, @@ -295,15 +295,15 @@ static void calc_response_string (char *result, char *challenge) { }; char zres[20]; int i; - + /* calculate response */ call_hash(field, challenge, 64); calc_response(zres,field); - + /* convert zres to ascii string */ for (i=0; i<16; i++ ) { char a, b; - + a = (zres[i] >> 4) & 15; b = zres[i] & 15; @@ -342,11 +342,11 @@ void real_calc_response_and_checksum (char *response, char *chksum, char *challe ch_len=32; } if ( ch_len > 56 ) ch_len=56; - + /* copy challenge to buf */ memcpy(ptr, challenge, ch_len); } - + /* xor challenge bytewise with xor_table */ for (i=0; i<XOR_TABLE_LEN; i++) ptr[i] = ptr[i] ^ xor_table[i]; @@ -372,7 +372,7 @@ static int select_mlti_data(const char *mlti_chunk, int mlti_size, int selection int numrules, codec, size; int i; - + /* MLTI chunk should begin with MLTI */ if ((mlti_chunk[0] != 'M') @@ -410,13 +410,13 @@ static int select_mlti_data(const char *mlti_chunk, int mlti_size, int selection } mlti_chunk+=2; - + /* now seek to selected codec */ for (i=0; i<codec; i++) { size=_X_BE_32(mlti_chunk); mlti_chunk+=size+4; } - + size=_X_BE_32(mlti_chunk); #ifdef LOG @@ -441,14 +441,14 @@ rmff_header_t *real_parse_sdp(char *data, char **stream_rules, uint32_t bandwidt int max_packet_size=0; int avg_packet_size=0; int duration=0; - + if (!data) return NULL; desc=sdpplin_parse(data); if (!desc) return NULL; - + buf=xine_buffer_init(2048); header = calloc(1, sizeof(rmff_header_t)); @@ -484,7 +484,7 @@ rmff_header_t *real_parse_sdp(char *data, char **stream_rules, uint32_t bandwidt } else len=select_mlti_data(desc->stream[i]->mlti_data, desc->stream[i]->mlti_data_size, rulematches[0], &buf); - + header->streams[i]=rmff_new_mdpr( desc->stream[i]->stream_id, desc->stream[i]->max_bit_rate, @@ -508,7 +508,7 @@ rmff_header_t *real_parse_sdp(char *data, char **stream_rules, uint32_t bandwidt else avg_packet_size=desc->stream[i]->avg_packet_size; } - + if (*stream_rules && strlen(*stream_rules) && (*stream_rules)[strlen(*stream_rules)-1] == ',') (*stream_rules)[strlen(*stream_rules)-1]=0; /* delete last ',' in stream_rules */ @@ -577,12 +577,12 @@ int real_get_rdt_chunk(rtsp_t *rtsp_session, unsigned char **buffer) { n=rtsp_read_data(rtsp_session, header, 6); if (n<6) return 0; ts=_X_BE_32(header); - - lprintf("ts: %u size: %u, flags: 0x%02x, unknown values: %u 0x%02x 0x%02x\n", + + lprintf("ts: %u size: %u, flags: 0x%02x, unknown values: %u 0x%02x 0x%02x\n", ts, size, flags1, unknown1, header[4], header[5]); size+=2; - + ph.object_version=0; ph.length=size; ph.stream_number=(flags1>>1)&1; @@ -593,7 +593,7 @@ int real_get_rdt_chunk(rtsp_t *rtsp_session, unsigned char **buffer) { rmff_dump_pheader(&ph, *buffer); size-=12; n=rtsp_read_data(rtsp_session, (*buffer)+12, size); - + return (n <= 0) ? 0 : n+12; } @@ -612,11 +612,11 @@ rmff_header_t *real_setup_and_get_header(rtsp_t *rtsp_session, uint32_t bandwid char *mrl=rtsp_get_mrl(rtsp_session); unsigned int size; int status; - + /* get challenge */ challenge1=strdup(rtsp_search_answers(rtsp_session,"RealChallenge1")); lprintf("Challenge1: %s\n", challenge1); - + /* request stream description */ rtsp_schedule_field(rtsp_session, "Accept: application/sdp"); sprintf(buf, "Bandwidth: %u", bandwidth); @@ -658,7 +658,7 @@ rmff_header_t *real_setup_and_get_header(rtsp_t *rtsp_session, uint32_t bandwid lprintf("real: got no ETag!\n"); else session_id=strdup(rtsp_search_answers(rtsp_session,"ETag")); - + lprintf("Stream description size: %i\n", size); description = malloc(size+1); @@ -682,7 +682,7 @@ rmff_header_t *real_setup_and_get_header(rtsp_t *rtsp_session, uint32_t bandwid lprintf("Title: %s\nCopyright: %s\nAuthor: %s\nStreams: %i\n", h->cont->title, h->cont->copyright, h->cont->author, h->prop->num_streams); - + /* setup our streams */ real_calc_response_and_checksum (challenge2, checksum, challenge1); xine_buffer_ensure_size(buf, strlen(challenge2) + strlen(checksum) + 32); diff --git a/src/input/libreal/real.h b/src/input/libreal/real.h index edcd170f8..f299b909b 100644 --- a/src/input/libreal/real.h +++ b/src/input/libreal/real.h @@ -20,7 +20,7 @@ * special functions for real streams. * adopted from joschkas real tools. */ - + #ifndef HAVE_REAL_H #define HAVE_REAL_H diff --git a/src/input/libreal/rmff.c b/src/input/libreal/rmff.c index 2d3fcc613..6a2b761e1 100644 --- a/src/input/libreal/rmff.c +++ b/src/input/libreal/rmff.c @@ -51,7 +51,7 @@ static int rmff_dump_fileheader(rmff_fileheader_t *fileheader, uint8_t *buffer, fileheader->object_version=_X_BE_16(&fileheader->object_version); fileheader->file_version=_X_BE_32(&fileheader->file_version); fileheader->num_headers=_X_BE_32(&fileheader->num_headers); - + memcpy(buffer, fileheader, 8); memcpy(&buffer[8], &fileheader->object_version, 2); memcpy(&buffer[10], &fileheader->file_version, 8); @@ -92,7 +92,7 @@ static int rmff_dump_prop(rmff_prop_t *prop, uint8_t *buffer, int bufsize) { memcpy(&buffer[10], &prop->max_bit_rate, 36); memcpy(&buffer[46], &prop->num_streams, 2); memcpy(&buffer[48], &prop->flags, 2); - + prop->size=_X_BE_32(&prop->size); prop->object_version=_X_BE_16(&prop->object_version); prop->max_bit_rate=_X_BE_32(&prop->max_bit_rate); @@ -143,7 +143,7 @@ static int rmff_dump_mdpr(rmff_mdpr_t *mdpr, uint8_t *buffer, int bufsize) { memcpy(&buffer[41+s1], &mdpr->mime_type_size, 1); s2=mdpr->mime_type_size; memcpy(&buffer[42+s1], mdpr->mime_type, s2); - + mdpr->type_specific_len=_X_BE_32(&mdpr->type_specific_len); memcpy(&buffer[42+s1+s2], &mdpr->type_specific_len, 4); mdpr->type_specific_len=_X_BE_32(&mdpr->type_specific_len); @@ -180,7 +180,7 @@ static int rmff_dump_cont(rmff_cont_t *cont, uint8_t *buffer, int bufsize) { memcpy(buffer, cont, 8); memcpy(&buffer[8], &cont->object_version, 2); - + cont->title_len=_X_BE_16(&cont->title_len); memcpy(&buffer[10], &cont->title_len, 2); cont->title_len=_X_BE_16(&cont->title_len); @@ -228,7 +228,7 @@ static int rmff_dump_dataheader(rmff_data_t *data, uint8_t *buffer, int bufsize) memcpy(buffer, data, 8); memcpy(&buffer[8], &data->object_version, 2); memcpy(&buffer[10], &data->num_packets, 8); - + data->num_packets=_X_BE_32(&data->num_packets); data->next_data_header=_X_BE_32(&data->next_data_header); data->size=_X_BE_32(&data->size); @@ -267,7 +267,7 @@ int rmff_dump_header(rmff_header_t *h, void *buf_gen, int max) { stream++; } } - + if ((size=rmff_dump_dataheader(h->data, &buffer[written], max)) < 0) return -1; written+=size; @@ -355,7 +355,7 @@ static rmff_mdpr_t *rmff_scan_mdpr(const char *data) mdpr->start_time=_X_BE_32(&data[28]); mdpr->preroll=_X_BE_32(&data[32]); mdpr->duration=_X_BE_32(&data[36]); - + mdpr->stream_name_size=data[40]; if (mdpr->size < 46 + mdpr->stream_name_size) goto fail; @@ -364,7 +364,7 @@ static rmff_mdpr_t *rmff_scan_mdpr(const char *data) goto fail; memcpy(mdpr->stream_name, &data[41], mdpr->stream_name_size); mdpr->stream_name[mdpr->stream_name_size]=0; - + mdpr->mime_type_size=data[41+mdpr->stream_name_size]; if (mdpr->size < 46 + mdpr->stream_name_size + mdpr->mime_type_size) goto fail; @@ -373,16 +373,16 @@ static rmff_mdpr_t *rmff_scan_mdpr(const char *data) goto fail; memcpy(mdpr->mime_type, &data[42+mdpr->stream_name_size], mdpr->mime_type_size); mdpr->mime_type[mdpr->mime_type_size]=0; - + mdpr->type_specific_len=_X_BE_32(&data[42+mdpr->stream_name_size+mdpr->mime_type_size]); if (mdpr->size < 46 + mdpr->stream_name_size + mdpr->mime_type_size + mdpr->type_specific_data) goto fail; mdpr->type_specific_data = malloc(mdpr->type_specific_len); if (!mdpr->type_specific_data) goto fail; - memcpy(mdpr->type_specific_data, + memcpy(mdpr->type_specific_data, &data[46+mdpr->stream_name_size+mdpr->mime_type_size], mdpr->type_specific_len); - + return mdpr; fail: @@ -444,7 +444,7 @@ static rmff_data_t *rmff_scan_dataheader(const char *data) { return dh; } - + rmff_header_t *rmff_scan_header(const char *data) { rmff_header_t *header = malloc(sizeof(rmff_header_t)); @@ -468,18 +468,18 @@ rmff_header_t *rmff_scan_header(const char *data) { } header->fileheader=rmff_scan_fileheader(ptr); ptr += header->fileheader->size; - + header->streams = calloc(header->fileheader->num_headers, sizeof(rmff_mdpr_t*)); - + for (i=1; i<header->fileheader->num_headers; i++) { chunk_type = _X_BE_32(ptr); - + if (ptr[0] == 0) { lprintf("rmff: warning: only %d of %d header found.\n", i, header->fileheader->num_headers); break; } - + chunk_size=1; switch (chunk_type) { case PROP_TAG: @@ -610,7 +610,7 @@ rmff_prop_t *rmff_new_prop ( prop->data_offset=data_offset; prop->num_streams=num_streams; prop->flags=flags; - + return prop; } @@ -629,7 +629,7 @@ rmff_mdpr_t *rmff_new_mdpr( const char *type_specific_data ) { rmff_mdpr_t *mdpr = malloc(sizeof(rmff_mdpr_t)); - + mdpr->object_id=MDPR_TAG; mdpr->object_version=0; @@ -655,7 +655,7 @@ rmff_mdpr_t *rmff_new_mdpr( mdpr->type_specific_data = malloc(type_specific_len); memcpy(mdpr->type_specific_data,type_specific_data,type_specific_len); mdpr->mlti_data=NULL; - + mdpr->size=mdpr->stream_name_size+mdpr->mime_type_size+mdpr->type_specific_len+46; return mdpr; @@ -672,7 +672,7 @@ rmff_cont_t *rmff_new_cont(const char *title, const char *author, const char *co cont->author=NULL; cont->copyright=NULL; cont->comment=NULL; - + cont->title_len=0; cont->author_len=0; cont->copyright_len=0; @@ -711,11 +711,11 @@ rmff_data_t *rmff_new_dataheader(uint32_t num_packets, uint32_t next_data_header return data; } - + void rmff_print_header(rmff_header_t *h) { rmff_mdpr_t **stream; - + if(!h) { printf("rmff_print_header: NULL given\n"); return; @@ -776,7 +776,7 @@ void rmff_print_header(rmff_header_t *h) { printf("size : %i\n", h->data->size); printf("packets : %i\n", h->data->num_packets); printf("next DATA : 0x%08x\n", h->data->next_data_header); - } + } } void rmff_fix_header(rmff_header_t *h) { @@ -804,7 +804,7 @@ void rmff_fix_header(rmff_header_t *h) { streams++; } } - + if (h->prop) { if (h->prop->size != 50) { @@ -841,7 +841,7 @@ void rmff_fix_header(rmff_header_t *h) { } num_headers++; - + if (!h->fileheader) { lprintf("rmff_fix_header: no fileheader, creating one"); @@ -856,31 +856,31 @@ void rmff_fix_header(rmff_header_t *h) { num_headers++; if(h->fileheader->num_headers != num_headers) { - lprintf("rmff_fix_header: setting num_headers from %i to %i\n", h->fileheader->num_headers, num_headers); + lprintf("rmff_fix_header: setting num_headers from %i to %i\n", h->fileheader->num_headers, num_headers); h->fileheader->num_headers=num_headers; } if(h->prop) { if (h->prop->data_offset != header_size) { - lprintf("rmff_fix_header: setting prop.data_offset from %i to %i\n", h->prop->data_offset, header_size); + lprintf("rmff_fix_header: setting prop.data_offset from %i to %i\n", h->prop->data_offset, header_size); h->prop->data_offset=header_size; } if (h->prop->num_packets == 0) { int p=(int)(h->prop->avg_bit_rate/8.0*(h->prop->duration/1000.0)/h->prop->avg_packet_size); - lprintf("rmff_fix_header: assuming prop.num_packets=%i\n", p); + lprintf("rmff_fix_header: assuming prop.num_packets=%i\n", p); h->prop->num_packets=p; } if (h->data->num_packets == 0) { - lprintf("rmff_fix_header: assuming data.num_packets=%i\n", h->prop->num_packets); + lprintf("rmff_fix_header: assuming data.num_packets=%i\n", h->prop->num_packets); h->data->num_packets=h->prop->num_packets; } - - lprintf("rmff_fix_header: assuming data.size=%i\n", h->prop->num_packets*h->prop->avg_packet_size); + + lprintf("rmff_fix_header: assuming data.size=%i\n", h->prop->num_packets*h->prop->avg_packet_size); h->data->size=h->prop->num_packets*h->prop->avg_packet_size; } @@ -892,7 +892,7 @@ int rmff_get_header_size(rmff_header_t *h) { if (!h->prop) return -1; return h->prop->data_offset+18; - + } void rmff_free_header(rmff_header_t *h) { diff --git a/src/input/libreal/rmff.h b/src/input/libreal/rmff.h index 50656349d..20b8b8960 100644 --- a/src/input/libreal/rmff.h +++ b/src/input/libreal/rmff.h @@ -98,7 +98,7 @@ typedef struct { uint32_t data_offset; uint16_t num_streams; uint16_t flags; - + } rmff_prop_t; typedef struct { @@ -141,11 +141,11 @@ typedef struct { char *copyright; uint16_t comment_len; char *comment; - + } rmff_cont_t; typedef struct { - + uint32_t object_id; uint32_t size; uint16_t object_version; @@ -178,7 +178,7 @@ typedef struct { /* * constructors for header structs */ - + rmff_fileheader_t *rmff_new_fileheader(uint32_t num_headers); rmff_prop_t *rmff_new_prop ( @@ -247,7 +247,7 @@ void rmff_fix_header(rmff_header_t *h); * returns the size of the header (incl. first data-header) */ int rmff_get_header_size(rmff_header_t *h); - + /* * dumps the header <h> to <buffer>. <max> is the size of <buffer> */ diff --git a/src/input/libreal/sdpplin.c b/src/input/libreal/sdpplin.c index a07cb3360..b7e5218cb 100644 --- a/src/input/libreal/sdpplin.c +++ b/src/input/libreal/sdpplin.c @@ -23,7 +23,7 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif - + #define LOG_MODULE "sdpplin" #define LOG_VERBOSE /* @@ -62,7 +62,7 @@ static char *b64_decode(const char *in, char *out, int *size) dtable['='] = 0; k=0; - + /*CONSTANTCONDITION*/ const size_t in_len = strlen(in); for (j=0; j<in_len; j+=4) @@ -106,10 +106,10 @@ static int filter(const char *in, const char *filter, char **out) { size_t flen=strlen(filter); size_t len; - + if (!in) return 0; - + len = (strchr(in,'\n')) ? (size_t)(strchr(in,'\n')-in) : strlen(in); if (!strncmp(in,filter,flen)) @@ -122,7 +122,7 @@ static int filter(const char *in, const char *filter, char **out) { return len-flen; } - + return 0; } static sdpplin_stream_t *XINE_MALLOC sdpplin_parse_stream(char **data) { @@ -131,7 +131,7 @@ static sdpplin_stream_t *XINE_MALLOC sdpplin_parse_stream(char **data) { char *buf=xine_buffer_init(32); char *decoded=xine_buffer_init(32); int handled; - + if (filter(*data, "m=", &buf)) { desc->id = strdup(buf); } else @@ -146,7 +146,7 @@ static sdpplin_stream_t *XINE_MALLOC sdpplin_parse_stream(char **data) { while (*data && **data && *data[0]!='m') { handled=0; - + if(filter(*data,"a=control:streamid=",&buf)) { /* This way negative values are mapped to unfeasibly high * values, and will be discarded afterward @@ -175,7 +175,7 @@ static sdpplin_stream_t *XINE_MALLOC sdpplin_parse_stream(char **data) { handled=1; *data=nl(*data); } - + if(filter(*data,"a=StartTime:integer;",&buf)) { desc->start_time=atoi(buf); handled=1; @@ -218,7 +218,7 @@ static sdpplin_stream_t *XINE_MALLOC sdpplin_parse_stream(char **data) { lprintf("mlti_data_size: %i\n", desc->mlti_data_size); } } - + if(filter(*data,"a=ASMRuleBook:string;",&buf)) { desc->asm_rule_book=strdup(buf); handled=1; @@ -238,7 +238,7 @@ static sdpplin_stream_t *XINE_MALLOC sdpplin_parse_stream(char **data) { xine_buffer_free(buf); xine_buffer_free(decoded); - + return desc; } @@ -256,7 +256,7 @@ sdpplin_t *sdpplin_parse(char *data) { while (data && *data) { handled=0; - + if (filter(data, "m=", &buf)) { if ( ! desc->stream ) { fprintf(stderr, "sdpplin.c: stream identifier found before stream count, skipping."); @@ -279,7 +279,7 @@ sdpplin_t *sdpplin_parse(char *data) { data=nl(data); } } - + if(filter(data,"a=Author:buffer;",&buf)) { decoded=b64_decode(buf, decoded, &len); if ( decoded != NULL ) { @@ -288,7 +288,7 @@ sdpplin_t *sdpplin_parse(char *data) { data=nl(data); } } - + if(filter(data,"a=Copyright:buffer;",&buf)) { decoded=b64_decode(buf, decoded, &len); if ( decoded != NULL ) { @@ -297,7 +297,7 @@ sdpplin_t *sdpplin_parse(char *data) { data=nl(data); } } - + if(filter(data,"a=Abstract:buffer;",&buf)) { decoded=b64_decode(buf, decoded, &len); if ( decoded != NULL ) { @@ -306,7 +306,7 @@ sdpplin_t *sdpplin_parse(char *data) { data=nl(data); } } - + if(filter(data,"a=StreamCount:integer;",&buf)) { /* This way negative values are mapped to unfeasibly high * values, and will be discarded afterward @@ -340,7 +340,7 @@ sdpplin_t *sdpplin_parse(char *data) { xine_buffer_free(buf); xine_buffer_free(decoded); - + return desc; } diff --git a/src/input/libreal/sdpplin.h b/src/input/libreal/sdpplin.h index 1604ee38c..2296c31e7 100644 --- a/src/input/libreal/sdpplin.h +++ b/src/input/libreal/sdpplin.h @@ -19,7 +19,7 @@ * * sdp/sdpplin parser. */ - + #ifndef HAVE_SDPPLIN_H #define HAVE_SDPPLIN_H @@ -98,7 +98,7 @@ typedef struct { int duration; sdpplin_stream_t **stream; - + } sdpplin_t; sdpplin_t *sdpplin_parse(char *data) XINE_MALLOC; diff --git a/src/input/librtsp/rtsp.c b/src/input/librtsp/rtsp.c index 8d0d45ec5..ebac49079 100644 --- a/src/input/librtsp/rtsp.c +++ b/src/input/librtsp/rtsp.c @@ -44,7 +44,7 @@ #define LOG_VERBOSE /* #define LOG -*/ +*/ #include "rtsp.h" #include "io_helper.h" @@ -69,7 +69,7 @@ struct rtsp_s { char *server; unsigned int server_state; uint32_t server_caps; - + unsigned int cseq; char *session; @@ -105,17 +105,17 @@ const char rtsp_protocol_version[]="RTSP/1.0"; * rtsp_get gets a line from stream * and returns a null terminated string (must be freed). */ - + static char *rtsp_get(rtsp_t *s) { char *buffer = malloc(BUF_SIZE); char *string = NULL; - + if ( _x_io_tcp_read_line(s->stream, s->s, buffer, BUF_SIZE) >= 0 ) { lprintf("<< '%s'\n", buffer); string = strdup( buffer ); } - + free(buffer); return string; } @@ -124,7 +124,7 @@ static char *rtsp_get(rtsp_t *s) { /* * rtsp_put puts a line on stream */ - + static void rtsp_put(rtsp_t *s, const char *string) { size_t len=strlen(string); @@ -137,7 +137,7 @@ static void rtsp_put(rtsp_t *s, const char *string) { buf[len+1]=0x0a; _x_io_tcp_write(s->stream, s->s, buf, len+2); - + lprintf("done.\n"); free(buf); @@ -151,7 +151,7 @@ static int rtsp_get_code(rtsp_t *s, const char *string) { char buf[4]; int code=0; - + if (!strncmp(string, rtsp_protocol_version, strlen(rtsp_protocol_version))) { memcpy(buf, string+strlen(rtsp_protocol_version)+1, 3); @@ -162,7 +162,7 @@ static int rtsp_get_code(rtsp_t *s, const char *string) { return RTSP_STATUS_SET_PARAMETER; } - if(code != 200) + if(code != 200) xprintf(s->stream->xine, XINE_VERBOSITY_DEBUG, "librtsp: server responds: '%s'\n", string); return code; @@ -176,7 +176,7 @@ static void rtsp_send_request(rtsp_t *s, const char *type, const char *what) { char **payload=s->scheduled; char *buf; - + asprintf(&buf,"%s %s %s",type, what, rtsp_protocol_version); rtsp_put(s,buf); free(buf); @@ -196,10 +196,10 @@ static void rtsp_send_request(rtsp_t *s, const char *type, const char *what) { static void rtsp_schedule_standard(rtsp_t *s) { char tmp[17]; - + sprintf(tmp, "Cseq: %u", s->cseq); rtsp_schedule_field(s, tmp); - + if (s->session) { char *buf; asprintf(&buf, "Session: %s", s->session); @@ -210,7 +210,7 @@ static void rtsp_schedule_standard(rtsp_t *s) { /* * get the answers, if server responses with something != 200, return NULL */ - + static int rtsp_get_answers(rtsp_t *s) { char *answer=NULL; @@ -218,7 +218,7 @@ static int rtsp_get_answers(rtsp_t *s) { char **answer_ptr=s->answers; int code; int ans_count = 0; - + answer=rtsp_get(s); if (!answer) return 0; @@ -226,13 +226,13 @@ static int rtsp_get_answers(rtsp_t *s) { free(answer); rtsp_free_answers(s); - + do { /* while we get answer lines */ - + answer=rtsp_get(s); if (!answer) return 0; - + if (!strncasecmp(answer,"Cseq: ",6)) { sscanf(answer+6,"%u",&answer_seq); if (s->cseq != answer_seq) { @@ -249,7 +249,7 @@ static int rtsp_get_answers(rtsp_t *s) { char *tmp = answer + 9; if (s->session) { if (strcmp(tmp, s->session)) { - xprintf(s->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(s->stream->xine, XINE_VERBOSITY_DEBUG, "rtsp: warning: setting NEW session: %s\n", tmp); s->session=strdup(tmp); } @@ -263,12 +263,12 @@ static int rtsp_get_answers(rtsp_t *s) { *answer_ptr=answer; answer_ptr++; } while ((strlen(answer)!=0) && (++ans_count < MAX_FIELDS)); - + s->cseq++; - + *answer_ptr=NULL; rtsp_schedule_standard(s); - + return code; } @@ -278,7 +278,7 @@ static int rtsp_get_answers(rtsp_t *s) { int rtsp_send_ok(rtsp_t *s) { char cseq[16]; - + rtsp_put(s, "RTSP/1.0 200 OK"); sprintf(cseq,"CSeq: %u", s->cseq); rtsp_put(s, cseq); @@ -319,14 +319,14 @@ int rtsp_request_describe(rtsp_t *s, const char *what) { } rtsp_send_request(s,"DESCRIBE",buf); free(buf); - + return rtsp_get_answers(s); } int rtsp_request_setup(rtsp_t *s, const char *what) { rtsp_send_request(s,"SETUP",what); - + return rtsp_get_answers(s); } @@ -342,7 +342,7 @@ int rtsp_request_setparameter(rtsp_t *s, const char *what) { } rtsp_send_request(s,"SET_PARAMETER",buf); free(buf); - + return rtsp_get_answers(s); } @@ -358,14 +358,14 @@ int rtsp_request_play(rtsp_t *s, const char *what) { } rtsp_send_request(s,"PLAY",buf); free(buf); - + return rtsp_get_answers(s); } int rtsp_request_tearoff(rtsp_t *s, const char *what) { rtsp_send_request(s,"TEAROFF",what); - + return rtsp_get_answers(s); } @@ -385,7 +385,7 @@ int rtsp_read_data(rtsp_t *s, char *buffer, unsigned int size) { char *rest=rtsp_get(s); if (!rest) return -1; - + seq=-1; do { free(rest); @@ -432,14 +432,14 @@ rtsp_t *rtsp_connect(xine_stream_t *stream, const char *mrl, const char *user_ag char *slash, *colon; int hostend, i; size_t pathbegin; - + if (strncmp(mrl,"rtsp://",7)) { xprintf(stream->xine, XINE_VERBOSITY_LOG, _("rtsp: bad mrl: %s\n"), mrl); free(s); return NULL; } - + mrl_ptr+=7; for (i=0; i<MAX_FIELDS; i++) { @@ -453,14 +453,14 @@ rtsp_t *rtsp_connect(xine_stream_t *stream, const char *mrl, const char *user_ag s->path=NULL; s->mrl=NULL; s->mrl=strdup(mrl); - + s->server=NULL; s->server_state=0; s->server_caps=0; - + s->cseq=0; s->session=NULL; - + if (user_agent) s->user_agent=strdup(user_agent); else @@ -470,7 +470,7 @@ rtsp_t *rtsp_connect(xine_stream_t *stream, const char *mrl, const char *user_ag colon=strchr(mrl_ptr,':'); if(!slash) slash=mrl_ptr+strlen(mrl_ptr)+1; - if(!colon) colon=slash; + if(!colon) colon=slash; if(colon > slash) colon=slash; pathbegin=slash-mrl_ptr; @@ -481,7 +481,7 @@ rtsp_t *rtsp_connect(xine_stream_t *stream, const char *mrl, const char *user_ag if (pathbegin < strlen(mrl_ptr)) s->path=strdup(mrl_ptr+pathbegin+1); if (colon != slash) { char buffer[pathbegin-hostend]; - + strncpy(buffer,mrl_ptr+hostend+1, pathbegin-hostend-1); buffer[pathbegin-hostend-1]=0; s->port=atoi(buffer); @@ -517,7 +517,7 @@ rtsp_t *rtsp_connect(xine_stream_t *stream, const char *mrl, const char *user_ag /* - * closes an rtsp connection + * closes an rtsp connection */ void rtsp_close(rtsp_t *s) { @@ -530,7 +530,7 @@ void rtsp_close(rtsp_t *s) { if (s->user_agent) free(s->user_agent); rtsp_free_answers(s); rtsp_unschedule_all(s); - free(s); + free(s); } /* @@ -542,7 +542,7 @@ char *rtsp_search_answers(rtsp_t *s, const char *tag) { char **answer; char *ptr; - + if (!s->answers) return NULL; answer=s->answers; @@ -591,7 +591,7 @@ char *rtsp_get_mrl(rtsp_t *s) { void rtsp_schedule_field(rtsp_t *s, const char *string) { int i=0; - + if (!string) return; while(s->scheduled[i]) { @@ -601,13 +601,13 @@ void rtsp_schedule_field(rtsp_t *s, const char *string) { } /* - * removes the first scheduled field which prefix matches string. + * removes the first scheduled field which prefix matches string. */ void rtsp_unschedule_field(rtsp_t *s, const char *string) { char **ptr=s->scheduled; - + if (!string) return; while(*ptr) { @@ -628,7 +628,7 @@ void rtsp_unschedule_field(rtsp_t *s, const char *string) { void rtsp_unschedule_all(rtsp_t *s) { char **ptr; - + if (!s->scheduled) return; ptr=s->scheduled; @@ -645,7 +645,7 @@ void rtsp_unschedule_all(rtsp_t *s) { void rtsp_free_answers(rtsp_t *s) { char **answer; - + if (!s->answers) return; answer=s->answers; diff --git a/src/input/librtsp/rtsp.h b/src/input/librtsp/rtsp.h index 2e1fd6aa0..a00035aef 100644 --- a/src/input/librtsp/rtsp.h +++ b/src/input/librtsp/rtsp.h @@ -20,7 +20,7 @@ * a minimalistic implementation of rtsp protocol, * *not* RFC 2326 compilant yet. */ - + #ifndef HAVE_RTSP_H #define HAVE_RTSP_H diff --git a/src/input/librtsp/rtsp_session.c b/src/input/librtsp/rtsp_session.c index 88103aa7d..2ae002662 100644 --- a/src/input/librtsp/rtsp_session.c +++ b/src/input/librtsp/rtsp_session.c @@ -89,7 +89,7 @@ rtsp_session_t *rtsp_session_start(xine_stream_t *stream, char *mrl) { rmff_header_t *h; int bandwidth_id; uint32_t bandwidth; - + bandwidth_id = xine->config->register_enum(xine->config, "media.network.bandwidth", 10, (char **)rtsp_bandwidth_strs, _("network bandwidth"), @@ -100,7 +100,7 @@ rtsp_session_t *rtsp_session_start(xine_stream_t *stream, char *mrl) { bandwidth = rtsp_bandwidths[bandwidth_id]; rtsp_session->recv = xine_buffer_init(BUF_SIZE); - + connect: /* connect to server */ @@ -149,8 +149,8 @@ connect: return NULL; } } - - rtsp_session->header_left = + + rtsp_session->header_left = rtsp_session->header_len = rmff_dump_header(h,rtsp_session->header,HEADER_SIZE); if (rtsp_session->header_len < 0) { xprintf (stream->xine, XINE_VERBOSITY_LOG, @@ -161,7 +161,7 @@ connect: xine_buffer_copyin(rtsp_session->recv, 0, rtsp_session->header, rtsp_session->header_len); rtsp_session->recv_size = rtsp_session->header_len; rtsp_session->recv_read = 0; - + } else { xprintf(stream->xine, XINE_VERBOSITY_LOG, @@ -174,29 +174,29 @@ connect: return NULL; } free(server); - + return rtsp_session; } void rtsp_session_set_start_time (rtsp_session_t *this, int start_time) { - + if (start_time >= 0) this->start_time = start_time; } static void rtsp_session_play (rtsp_session_t *this) { - + char buf[256]; - - snprintf (buf, sizeof(buf), "Range: npt=%d.%03d-", + + snprintf (buf, sizeof(buf), "Range: npt=%d.%03d-", this->start_time/1000, this->start_time%1000); - + rtsp_schedule_field (this->s, buf); rtsp_request_play (this->s,NULL); } int rtsp_session_read (rtsp_session_t *this, char *data, int len) { - + int to_copy; char *dest=data; char *source=this->recv + this->recv_read; @@ -204,22 +204,22 @@ int rtsp_session_read (rtsp_session_t *this, char *data, int len) { if (len < 0) return 0; - + if (this->header_left) { if (len > this->header_left) len = this->header_left; - + this->header_left -= len; } - + to_copy = len; while (to_copy > fill) { - + if (!this->playing) { rtsp_session_play (this); this->playing = 1; } - + memcpy(dest, source, fill); to_copy -= fill; dest += fill; @@ -234,7 +234,7 @@ int rtsp_session_read (rtsp_session_t *this, char *data, int len) { return len-to_copy; } } - + memcpy(dest, source, to_copy); this->recv_read += to_copy; diff --git a/src/input/media_helper.c b/src/input/media_helper.c index 288ed4205..e19ca63e6 100644 --- a/src/input/media_helper.c +++ b/src/input/media_helper.c @@ -1,18 +1,18 @@ -/* - * Copyright (C) 2000-2003 the xine project, - * +/* + * Copyright (C) 2000-2003 the xine project, + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -66,14 +66,14 @@ static int media_umount_media(const char *device) if(waitpid(pid, &status, 0) == -1) { if (errno != EINTR) return -1; - } + } else { return WEXITSTATUS(status); } } while(1); - + return -1; -} +} #endif int media_eject_media (xine_t *xine, const char *device) @@ -91,7 +91,7 @@ int media_eject_media (xine_t *xine, const char *device) return 0; -#else +#else int fd; @@ -109,14 +109,14 @@ int media_eject_media (xine_t *xine, const char *device) case CDS_TRAY_OPEN: if((ret = ioctl(fd, CDROMCLOSETRAY)) != 0) { #ifdef LOG_MEDIA_EJECT - printf("input_dvd: CDROMCLOSETRAY failed: %s\n", strerror(errno)); + printf("input_dvd: CDROMCLOSETRAY failed: %s\n", strerror(errno)); #endif } break; case CDS_DISC_OK: if((ret = ioctl(fd, CDROMEJECT)) != 0) { #ifdef LOG_MEDIA_EJECT - printf("input_dvd: CDROMEJECT failed: %s\n", strerror(errno)); + printf("input_dvd: CDROMEJECT failed: %s\n", strerror(errno)); #endif } break; diff --git a/src/input/mms.c b/src/input/mms.c index 8ba33e704..c84ce7beb 100644 --- a/src/input/mms.c +++ b/src/input/mms.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2002-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -54,7 +54,7 @@ #define LOG_MODULE "mms" #define LOG_VERBOSE /* -#define LOG +#define LOG */ #include "xine_internal.h" #include "xineutils.h" @@ -65,8 +65,8 @@ #include "../demuxers/asfheader.h" -/* - * mms specific types +/* + * mms specific types */ #define MMST_PORT 1755 @@ -107,9 +107,9 @@ struct mms_packet_header_s { struct mms_s { xine_stream_t *stream; - + int s; - + /* url parsing */ char *url; char *proto; @@ -123,12 +123,12 @@ struct mms_s { char scmd[CMD_HEADER_LEN + CMD_BODY_LEN]; char *scmd_body; /* pointer to &scmd[CMD_HEADER_LEN] */ int scmd_len; /* num bytes written in header */ - + /* receive buffer */ uint8_t buf[BUF_SIZE]; int buf_size; int buf_read; - + asf_header_t *asf_header; uint8_t asf_header_buffer[ASF_HEADER_LEN]; uint32_t asf_header_len; @@ -137,13 +137,13 @@ struct mms_s { int seq_num; char guid[37]; int bandwidth; - + off_t current_pos; int eos; uint8_t live_flag; - - uint8_t playing; + + uint8_t playing; double start_time; }; @@ -230,12 +230,12 @@ static void print_command (char *data, int len) { for (i = (CMD_HEADER_LEN + CMD_PREFIX_LEN); i < (CMD_HEADER_LEN + CMD_PREFIX_LEN + len); i += 1) { unsigned char c = data[i]; - + if ((c >= 32) && (c < 128)) printf ("%c", c); else printf (" %02x ", c); - + } if (len > CMD_HEADER_LEN) printf ("\n"); @@ -271,7 +271,7 @@ static int send_command (mms_t *this, int command, mms_buffer_put_32 (&command_buffer, len8 + 2); mms_buffer_put_32 (&command_buffer, 0x00030000 | command); /* dir | command */ /* end of the 40 byte command header */ - + mms_buffer_put_32 (&command_buffer, prefix1); mms_buffer_put_32 (&command_buffer, prefix2); @@ -354,14 +354,14 @@ static int get_packet_header (mms_t *this, mms_packet_header_t *header) { len = _x_io_tcp_read (this->stream, this->s, (char*)this->buf, 8); if (len != 8) goto error; - + if (_X_LE_32(this->buf + 4) == 0xb00bface) { /* command packet */ header->flags = this->buf[3]; len = _x_io_tcp_read (this->stream, this->s, (char*)(this->buf + 8), 4); if (len != 4) goto error; - + header->packet_len = _X_LE_32(this->buf + 8) + 4; if (header->packet_len > BUF_SIZE - 12) { header->packet_len = 0; @@ -383,7 +383,7 @@ static int get_packet_header (mms_t *this, mms_packet_header_t *header) { } } return packet_type; - + error: lprintf("read error, len=%zd\n", len); return MMS_PACKET_ERR; @@ -395,7 +395,7 @@ static int get_packet_command (mms_t *this, uint32_t packet_len) { int command = 0; size_t len; - + /* always enter this loop */ lprintf("packet_len: %d bytes\n", packet_len); @@ -405,18 +405,18 @@ static int get_packet_command (mms_t *this, uint32_t packet_len) { } print_command ((char*)this->buf, len); - + /* check protocol type ("MMS ") */ if (_X_LE_32(this->buf + 12) != 0x20534D4D) { lprintf("unknown protocol type: %c%c%c%c (0x%08X)\n", this->buf[12], this->buf[13], this->buf[14], this->buf[15], - _X_LE_32(this->buf + 12)); + _X_LE_32(this->buf + 12)); return 0; } command = _X_LE_32 (this->buf + 36) & 0xFFFF; lprintf("command = 0x%2x\n", command); - + return command; } @@ -431,9 +431,9 @@ static int get_answer (mms_t *this) { break; case MMS_PACKET_COMMAND: command = get_packet_command (this, header.packet_len); - + if (command == 0x1b) { - + if (!send_command (this, 0x1b, 0, 0, 0)) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "libmms: failed to send command\n"); @@ -452,7 +452,7 @@ static int get_answer (mms_t *this) { "libmms: unexpected asf packet\n"); break; } - + return command; } @@ -461,7 +461,7 @@ static int get_asf_header (mms_t *this) { off_t len; int stop = 0; - + this->asf_header_read = 0; this->asf_header_len = 0; @@ -477,9 +477,9 @@ static int get_asf_header (mms_t *this) { break; case MMS_PACKET_COMMAND: command = get_packet_command (this, header.packet_len); - + if (command == 0x1b) { - + if (!send_command (this, 0x1b, 0, 0, 0)) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "libmms: failed to send command\n"); @@ -560,11 +560,11 @@ static void report_progress (xine_stream_t *stream, int p) { prg.description = _("Connecting MMS server (over tcp)..."); prg.percent = p; - + event.type = XINE_EVENT_PROGRESS; event.data = &prg; event.data_length = sizeof (xine_progress_data_t); - + xine_event_send (stream, &event); } @@ -574,11 +574,11 @@ static void report_progress (xine_stream_t *stream, int p) { */ static int mms_tcp_connect(mms_t *this) { int progress, res; - + if (!this->port) this->port = MMST_PORT; - /* - * try to connect + /* + * try to connect */ lprintf("try to connect to %s on port %d \n", this->host, this->port); this->s = _x_io_tcp_connect (this->stream, this->host, this->port); @@ -626,7 +626,7 @@ static int mms_choose_best_streams(mms_t *this) { /* choose the best quality for the audio stream */ asf_header_choose_streams (this->asf_header, this->bandwidth, &video_stream, &audio_stream); - + lprintf("selected streams: audio %d, video %d\n", audio_stream, video_stream); lprintf("disabling other streams\n"); memset (this->scmd_body, 0, 40); @@ -647,8 +647,8 @@ static int mms_choose_best_streams(mms_t *this) { } /* command 0x33 */ - if (!send_command (this, 0x33, this->asf_header->stream_count, - 0xFFFF | this->asf_header->streams[0]->stream_number << 16, + if (!send_command (this, 0x33, this->asf_header->stream_count, + 0xFFFF | this->asf_header->streams[0]->stream_number << 16, this->asf_header->stream_count * 6 + 2)) { xprintf (this->stream->xine, XINE_VERBOSITY_LOG, "libmms: mms_choose_best_streams failed\n"); @@ -676,7 +676,7 @@ mms_t *mms_connect (xine_stream_t *stream, const char *url, int bandwidth) { mms_t *this; char str[1024]; int res; - + if (!url) return NULL; @@ -696,23 +696,23 @@ mms_t *mms_connect (xine_stream_t *stream, const char *url, int bandwidth) { this->eos = 0; report_progress (stream, 0); - + if (!_x_parse_url (this->url, &this->proto, &this->host, &this->port, &this->user, &this->password, &this->uri, NULL)) { lprintf ("invalid url\n"); goto fail; } - + if (!mmst_valid_proto(this->proto)) { lprintf ("unsupported protocol\n"); goto fail; } - + if (mms_tcp_connect(this)) { goto fail; } report_progress (stream, 30); - + #ifdef USE_ICONV url_conv = string_utf16_open(); #endif @@ -732,13 +732,13 @@ mms_t *mms_connect (xine_stream_t *stream, const char *url, int bandwidth) { "libmms: failed to send command 0x01\n"); goto fail; } - + if ((res = get_answer (this)) != 0x01) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "libmms: unexpected response: %02x (0x01)\n", res); goto fail; } - + report_progress (stream, 40); /* TODO: insert network timing request here */ @@ -786,7 +786,7 @@ mms_t *mms_connect (xine_stream_t *stream, const char *url, int bandwidth) { path++; pathlen--; } - + lprintf("send command 0x05\n"); mms_buffer_init(&command_buffer, this->scmd_body); mms_buffer_put_32 (&command_buffer, 0x00000000); /* ?? */ @@ -796,13 +796,13 @@ mms_t *mms_connect (xine_stream_t *stream, const char *url, int bandwidth) { if (!send_command (this, 5, 1, 0xffffffff, pathlen * 2 + 12)) goto fail; } - + switch (res = get_answer (this)) { case 0x06: { int xx, yy; /* no authentication required */ - + /* Warning: sdp is not right here */ xx = this->buf[62]; yy = this->buf[63]; @@ -845,7 +845,7 @@ mms_t *mms_connect (xine_stream_t *stream, const char *url, int bandwidth) { goto fail; } } - + if ((res = get_answer (this)) != 0x11) { xprintf (this->stream->xine, XINE_VERBOSITY_LOG, "libmms: unexpected response: %02x (0x11)\n", res); @@ -898,7 +898,7 @@ mms_t *mms_connect (xine_stream_t *stream, const char *url, int bandwidth) { #endif lprintf("mms_connect: passed\n" ); - + return this; fail: @@ -924,19 +924,19 @@ fail: static int get_media_packet (mms_t *this) { mms_packet_header_t header; off_t len; - + switch (get_packet_header (this, &header)) { case MMS_PACKET_ERR: xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "libmms: failed to read mms packet header\n"); return 0; break; - + case MMS_PACKET_COMMAND: { int command; command = get_packet_command (this, header.packet_len); - + switch (command) { case 0x1e: { @@ -950,10 +950,10 @@ static int get_media_packet (mms_t *this) { this->eos = 1; return 0; } - + } break; - + case 0x20: { lprintf ("new stream.\n"); @@ -976,7 +976,7 @@ static int get_media_packet (mms_t *this) { mms_buffer_t command_buffer; mms_buffer_init(&command_buffer, this->scmd_body); mms_buffer_put_32 (&command_buffer, 0x00000000); /* 64 byte float timestamp */ - mms_buffer_put_32 (&command_buffer, 0x00000000); + mms_buffer_put_32 (&command_buffer, 0x00000000); mms_buffer_put_32 (&command_buffer, 0xFFFFFFFF); /* ?? */ mms_buffer_put_32 (&command_buffer, 0xFFFFFFFF); /* first packet sequence */ mms_buffer_put_8 (&command_buffer, 0xFF); /* max stream time limit (3 bytes) */ @@ -1003,10 +1003,10 @@ static int get_media_packet (mms_t *this) { } } break; - + case 0x05: break; - + default: xprintf (this->stream->xine, XINE_VERBOSITY_LOG, "unexpected mms command %02x\n", command); @@ -1047,7 +1047,7 @@ static int get_media_packet (mms_t *this) { } break; } - + lprintf ("get media packet succ\n"); return 1; @@ -1085,13 +1085,13 @@ int mms_read (mms_t *this, char *data, int len) { this->asf_header_read += n; total += n; this->current_pos += n; - + if (this->asf_header_read == this->asf_header_len) break; } else { int n, bytes_left ; - + if (!this->playing) { /* send command 0x07 with initial timestamp */ mms_buffer_t command_buffer; diff --git a/src/input/mms.h b/src/input/mms.h index a483fa0c6..eaf9a46f4 100644 --- a/src/input/mms.h +++ b/src/input/mms.h @@ -1,18 +1,18 @@ /* * Copyright (C) 2002-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA diff --git a/src/input/mmsh.c b/src/input/mmsh.c index 2cc27c3b1..de2d6ebab 100644 --- a/src/input/mmsh.c +++ b/src/input/mmsh.c @@ -138,8 +138,8 @@ #endif -/* - * mmsh specific types +/* + * mmsh specific types */ @@ -161,10 +161,10 @@ struct mmsh_s { char str[SCRATCH_SIZE]; /* scratch buffer to built strings */ asf_header_t *asf_header; - int stream_type; + int stream_type; /* receive buffer */ - + /* chunk */ uint16_t chunk_type; uint16_t chunk_length; @@ -178,13 +178,13 @@ struct mmsh_s { uint32_t asf_header_len; uint32_t asf_header_read; int seq_num; - + int video_stream; int audio_stream; off_t current_pos; int user_bandwidth; - + int playing; unsigned int start_time; }; @@ -201,7 +201,7 @@ static int send_command (mmsh_t *this, char *cmd) { } static int get_answer (mmsh_t *this) { - + int done, len, linenum; char *features; @@ -222,14 +222,14 @@ static int get_answer (mmsh_t *this) { this->buf[len] = '\0'; len--; - + if ((len >= 0) && (this->buf[len] == '\015')) { this->buf[len] = '\0'; len--; } linenum++; - + lprintf ("answer: >%s<\n", this->buf); if (linenum == 1) { @@ -263,7 +263,7 @@ static int get_answer (mmsh_t *this) { _("libmmsh: Location redirection not implemented\n")); return 0; } - + if (!strncasecmp((char*)this->buf, "Pragma:", 7)) { features = strstr((char*)(this->buf + 7), "features="); if (features) { @@ -279,7 +279,7 @@ static int get_answer (mmsh_t *this) { } } } - + if (len == -1) { done = 1; } else { @@ -314,7 +314,7 @@ static int get_chunk_header (mmsh_t *this) { } this->chunk_type = _X_LE_16 (&chunk_header[0]); this->chunk_length = _X_LE_16 (&chunk_header[2]); - + switch (this->chunk_type) { case CHUNK_TYPE_DATA: ext_header_len = 8; @@ -340,7 +340,7 @@ static int get_chunk_header (mmsh_t *this) { return 0; } } - + switch (this->chunk_type) { case CHUNK_TYPE_DATA: this->chunk_seq_number = _X_LE_32 (&ext_header[0]); @@ -384,7 +384,7 @@ static int get_header (mmsh_t *this) { lprintf("get_header\n"); this->asf_header_len = 0; - + /* read chunk */ while (1) { if (get_chunk_header(this)) { @@ -484,11 +484,11 @@ static void report_progress (xine_stream_t *stream, int p) { */ static int mmsh_tcp_connect(mmsh_t *this) { int progress, res; - + if (!this->port) this->port = MMSH_PORT; - - /* - * try to connect + + /* + * try to connect */ lprintf("try to connect to %s on port %d \n", this->host, this->port); @@ -522,24 +522,24 @@ static int mmsh_connect_int(mmsh_t *this, int bandwidth) { /* * let the negotiations begin... */ - + /* first request */ lprintf("first http request\n"); - + snprintf (this->str, SCRATCH_SIZE, mmsh_FirstRequest, this->uri, this->host, this->port, 1); if (!send_command (this, this->str)) return 0; - if (!get_answer (this)) + if (!get_answer (this)) return 0; get_header (this); /* FIXME: it returns 0 */ if (!interp_header (this)) return 0; - + close (this->s); report_progress (this->stream, 20); @@ -548,13 +548,13 @@ static int mmsh_connect_int(mmsh_t *this, int bandwidth) { lprintf("audio stream %d, video stream %d\n", this->audio_stream, this->video_stream); - + asf_header_disable_streams (this->asf_header, this->video_stream, this->audio_stream); - + if (mmsh_tcp_connect(this)) return 0; - + return 1; } @@ -565,7 +565,7 @@ static int mmsh_connect_int2(mmsh_t *this, int bandwidth) { int i; char stream_selection[10 * ASF_MAX_NUM_STREAMS]; /* 10 chars per stream */ int offset; - + /* second request */ lprintf("second http request\n"); @@ -606,7 +606,7 @@ static int mmsh_connect_int2(mmsh_t *this, int bandwidth) { if (!send_command (this, this->str)) return 0; - + lprintf("before read \n"); if (!get_answer (this)) @@ -614,11 +614,11 @@ static int mmsh_connect_int2(mmsh_t *this, int bandwidth) { if (!get_header (this)) return 0; - + #if 0 if (!interp_header (this)) return 0; - + asf_header_disable_streams (this->asf_header, this->video_stream, this->audio_stream); #endif @@ -628,7 +628,7 @@ static int mmsh_connect_int2(mmsh_t *this, int bandwidth) { mmsh_t *mmsh_connect (xine_stream_t *stream, const char *url, int bandwidth) { mmsh_t *this; - + if (!url) return NULL; @@ -647,28 +647,28 @@ mmsh_t *mmsh_connect (xine_stream_t *stream, const char *url, int bandwidth) { this->user_bandwidth = bandwidth; report_progress (stream, 0); - + if (!_x_parse_url (this->url, &this->proto, &this->host, &this->port, &this->user, &this->password, &this->uri, NULL)) { xine_log (this->stream->xine, XINE_LOG_MSG, _("invalid url\n")); goto fail; } - + if (!mmsh_valid_proto(this->proto)) { xine_log (this->stream->xine, XINE_LOG_MSG, _("unsupported protocol\n")); goto fail; } - + if (mmsh_tcp_connect(this)) goto fail; - + report_progress (stream, 30); if (!mmsh_connect_int(this, this->user_bandwidth)) goto fail; report_progress (stream, 100); - + lprintf("mmsh_connect: passed\n" ); return this; @@ -717,7 +717,7 @@ static int get_media_packet (mmsh_t *this) { */ if (this->chunk_seq_number == 0) return 0; - + close(this->s); if (mmsh_tcp_connect(this)) @@ -725,20 +725,20 @@ static int get_media_packet (mmsh_t *this) { if (!mmsh_connect_int(this, this->user_bandwidth)) return 0; - + this->playing = 0; /* mmsh_connect_int reads the first data packet */ - /* this->buf_size is set by mmsh_connect_int */ + /* this->buf_size is set by mmsh_connect_int */ return 2; case CHUNK_TYPE_DATA: /* nothing to do */ break; - + case CHUNK_TYPE_RESET: /* next chunk is an ASF header */ - + if (this->chunk_length != 0) { /* that's strange, don't know what to do */ return 0; @@ -747,7 +747,7 @@ static int get_media_packet (mmsh_t *this) { return 0; interp_header(this); return 2; - + default: xprintf (this->stream->xine, XINE_VERBOSITY_LOG, "libmmsh: unexpected chunk type\n"); @@ -755,7 +755,7 @@ static int get_media_packet (mmsh_t *this) { } len = _x_io_tcp_read (this->stream, this->s, (char*)this->buf, this->chunk_length); - + if (len == this->chunk_length) { /* explicit padding with 0 */ if (this->chunk_length > this->asf_header->file->packet_size) { @@ -812,13 +812,13 @@ int mmsh_read (mmsh_t *this, char *data, int len) { this->asf_header_read += n; total += n; this->current_pos += n; - + if (this->asf_header_read == this->asf_header_len) - break; + break; } else { int n, bytes_left ; - + if (!this->playing) { if (!mmsh_connect_int2 (this, this->user_bandwidth)) break; diff --git a/src/input/mmsh.h b/src/input/mmsh.h index 633d3b5f6..09b305adb 100644 --- a/src/input/mmsh.h +++ b/src/input/mmsh.h @@ -1,18 +1,18 @@ /* * Copyright (C) 2002-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA diff --git a/src/input/net_buf_ctrl.c b/src/input/net_buf_ctrl.c index e27ed99f3..bd0e5ce13 100644 --- a/src/input/net_buf_ctrl.c +++ b/src/input/net_buf_ctrl.c @@ -120,7 +120,7 @@ void nbc_check_buffers (nbc_t *this) { static void display_stats (nbc_t *this) { const char buffering[2][4] = {" ", "buf"}; const char enabled[2][4] = {"off", "on "}; - + printf("bufing: %d, enb: %d\n", this->buffering, this->enabled); printf("net_buf_ctrl: vid %3d%% %4.1fs %4" PRId64 "kbps %1d, "\ "aud %3d%% %4.1fs %4" PRId64 "kbps %1d, %s %s\r", @@ -168,7 +168,7 @@ static void nbc_compute_fifo_length(nbc_t *this, this->video_fifo_free = fifo_free; this->video_fifo_fill = (100 * fifo_fill) / fifo_div; this->video_fifo_size = fifo->fifo_data_size; - + if (buf->pts && (this->video_in_disc == 0)) { if (action == FIFO_PUT) { this->video_last_pts = buf->pts; @@ -180,7 +180,7 @@ static void nbc_compute_fifo_length(nbc_t *this, this->video_first_pts = buf->pts; } } - + if (video_br) { this->video_br = video_br; this->video_fifo_length_int = (8000 * this->video_fifo_size) / this->video_br; @@ -201,7 +201,7 @@ static void nbc_compute_fifo_length(nbc_t *this, this->audio_fifo_free = fifo_free; this->audio_fifo_fill = (100 * fifo_fill) / fifo_div; this->audio_fifo_size = fifo->fifo_data_size; - + if (buf->pts && (this->audio_in_disc == 0)) { if (action == FIFO_PUT) { this->audio_last_pts = buf->pts; @@ -213,7 +213,7 @@ static void nbc_compute_fifo_length(nbc_t *this, this->audio_first_pts = buf->pts; } } - + if (audio_br) { this->audio_br = audio_br; this->audio_fifo_length_int = (8000 * this->audio_fifo_size) / this->audio_br; @@ -230,7 +230,7 @@ static void nbc_compute_fifo_length(nbc_t *this, } } } - + /* decoder buffer compensation */ if (has_audio && has_video) { diff = this->video_first_pts - this->audio_first_pts; @@ -271,7 +271,7 @@ static void nbc_alloc_cb (fifo_buffer_t *fifo, void *this_gen) { /* Put callback * the fifo mutex is locked */ -static void nbc_put_cb (fifo_buffer_t *fifo, +static void nbc_put_cb (fifo_buffer_t *fifo, buf_element_t *buf, void *this_gen) { nbc_t *this = (nbc_t*)this_gen; int64_t progress = 0; @@ -285,7 +285,7 @@ static void nbc_put_cb (fifo_buffer_t *fifo, if ((buf->type & BUF_MAJOR_MASK) != BUF_CONTROL_BASE) { if (this->enabled) { - + nbc_compute_fifo_length(this, fifo, buf, FIFO_PUT); if (this->buffering) { @@ -311,8 +311,8 @@ static void nbc_put_cb (fifo_buffer_t *fifo, xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "\nnet_buf_ctrl: nbc_put_cb: stops buffering\n"); nbc_set_speed_normal(this); - - this->high_water_mark += this->high_water_mark / 2; + + this->high_water_mark += this->high_water_mark / 2; } else { /* compute the buffering progress @@ -439,7 +439,7 @@ static void nbc_get_cb (fifo_buffer_t *fifo, if (this->enabled) { nbc_compute_fifo_length(this, fifo, buf, FIFO_GET); - + if (!this->buffering) { /* start buffering if one fifo is empty */ @@ -454,7 +454,7 @@ static void nbc_get_cb (fifo_buffer_t *fifo, this->progress = 0; report_progress (this->stream, 0); - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "\nnet_buf_ctrl: nbc_get_cb: starts buffering, vid: %d, aud: %d\n", this->video_fifo_fill, this->audio_fifo_fill); nbc_set_speed_pause(this); @@ -495,7 +495,7 @@ static void nbc_get_cb (fifo_buffer_t *fifo, } nbc_t *nbc_init (xine_stream_t *stream) { - + nbc_t *this = calloc(1, sizeof (nbc_t)); fifo_buffer_t *video_fifo = stream->video_fifo; fifo_buffer_t *audio_fifo = stream->audio_fifo; @@ -508,7 +508,7 @@ nbc_t *nbc_init (xine_stream_t *stream) { this->stream = stream; this->video_fifo = video_fifo; this->audio_fifo = audio_fifo; - + /* when the FIFO sizes are increased compared to the default configuration, * apply a factor to the high water mark */ entry = stream->xine->config->lookup_entry(stream->xine->config, "engine.buffers.video_num_buffers"); diff --git a/src/input/net_buf_ctrl.h b/src/input/net_buf_ctrl.h index 7dfb7b0d1..6eac63e52 100644 --- a/src/input/net_buf_ctrl.h +++ b/src/input/net_buf_ctrl.h @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA diff --git a/src/input/pnm.c b/src/input/pnm.c index aabdbde96..bf24e5f8f 100644 --- a/src/input/pnm.c +++ b/src/input/pnm.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * - * pnm protocol implementation + * pnm protocol implementation * based upon code from joschka */ @@ -144,26 +144,26 @@ static const unsigned char pnm_header[] = { #define PNM_CLIENT_CAPS_SIZE 126 static const unsigned char pnm_client_caps[] = { - 0x07, 0x8a, 'p','n','r','v', - 0, 0x90, 'p','n','r','v', - 0, 0x64, 'd','n','e','t', - 0, 0x46, 'p','n','r','v', - 0, 0x32, 'd','n','e','t', - 0, 0x2b, 'p','n','r','v', - 0, 0x28, 'd','n','e','t', - 0, 0x24, 'p','n','r','v', - 0, 0x19, 'd','n','e','t', - 0, 0x18, 'p','n','r','v', - 0, 0x14, 's','i','p','r', - 0, 0x14, 'd','n','e','t', - 0, 0x24, '2','8','_','8', - 0, 0x12, 'p','n','r','v', - 0, 0x0f, 'd','n','e','t', - 0, 0x0a, 's','i','p','r', - 0, 0x0a, 'd','n','e','t', - 0, 0x08, 's','i','p','r', - 0, 0x06, 's','i','p','r', - 0, 0x12, 'l','p','c','J', + 0x07, 0x8a, 'p','n','r','v', + 0, 0x90, 'p','n','r','v', + 0, 0x64, 'd','n','e','t', + 0, 0x46, 'p','n','r','v', + 0, 0x32, 'd','n','e','t', + 0, 0x2b, 'p','n','r','v', + 0, 0x28, 'd','n','e','t', + 0, 0x24, 'p','n','r','v', + 0, 0x19, 'd','n','e','t', + 0, 0x18, 'p','n','r','v', + 0, 0x14, 's','i','p','r', + 0, 0x14, 'd','n','e','t', + 0, 0x24, '2','8','_','8', + 0, 0x12, 'p','n','r','v', + 0, 0x0f, 'd','n','e','t', + 0, 0x0a, 's','i','p','r', + 0, 0x0a, 'd','n','e','t', + 0, 0x08, 's','i','p','r', + 0, 0x06, 's','i','p','r', + 0, 0x12, 'l','p','c','J', 0, 0x07, '0','5','_','6' }; static const uint32_t pnm_default_bandwidth=10485800; @@ -179,7 +179,7 @@ static const unsigned char pnm_twentyfour[]={ static const int after_chunks_length=6; static const unsigned char after_chunks[]={ 0x00, 0x00, /* mark */ - + 0x50, 0x84, /* seems to be fixated */ 0x1f, 0x3a /* varies on each request (checksum ?)*/ }; @@ -201,7 +201,7 @@ static const unsigned char after_chunks[]={ * if we have an PNA_TAG, we need a different parsing; see below. */ -static unsigned int pnm_get_chunk(pnm_t *p, +static unsigned int pnm_get_chunk(pnm_t *p, unsigned int max, unsigned int *chunk_type, char *data, int *need_response) { @@ -212,7 +212,7 @@ static unsigned int pnm_get_chunk(pnm_t *p, if( max < PREAMBLE_SIZE ) return -1; - + /* get first PREAMBLE_SIZE bytes and ignore checksum */ _x_io_tcp_read (p->stream, p->s, data, CHECKSUM_SIZE); if (data[0] == 0x72) @@ -221,7 +221,7 @@ static unsigned int pnm_get_chunk(pnm_t *p, _x_io_tcp_read (p->stream, p->s, data+CHECKSUM_SIZE, PREAMBLE_SIZE-CHECKSUM_SIZE); max -= PREAMBLE_SIZE; - + *chunk_type = be2me_32(*((uint32_t *)data)); chunk_size = be2me_32(*((uint32_t *)(data+4))); @@ -237,10 +237,10 @@ static unsigned int pnm_get_chunk(pnm_t *p, while(1) { /* The pna chunk is devided into subchunks. - * expecting following chunk format (in big endian): - * 0x4f - * uint8_t chunk_size - * uint8_t data[chunk_size] + * expecting following chunk format (in big endian): + * 0x4f + * uint8_t chunk_size + * uint8_t data[chunk_size] * * if first byte is 'X', we got a message from server * if first byte is 'F', we got an error @@ -250,7 +250,7 @@ static unsigned int pnm_get_chunk(pnm_t *p, return -1; _x_io_tcp_read (p->stream, p->s, ptr, 2); max -= 2; - + if (*ptr == 'X') /* checking for server message */ { xprintf(p->stream->xine, XINE_VERBOSITY_DEBUG, "input_pnm: got a message from server:\n"); @@ -273,7 +273,7 @@ static unsigned int pnm_get_chunk(pnm_t *p, xprintf(p->stream->xine, XINE_VERBOSITY_DEBUG, "%s\n", ptr+3); return -1; } - + if (*ptr == 'F') /* checking for server error */ { /* some error codes after 'F' were ignored */ @@ -319,7 +319,7 @@ static unsigned int pnm_get_chunk(pnm_t *p, break; default: *chunk_type = 0; - chunk_size = PREAMBLE_SIZE; + chunk_size = PREAMBLE_SIZE; break; } @@ -334,7 +334,7 @@ static unsigned int pnm_get_chunk(pnm_t *p, * uint8_t data[length] */ -static int pnm_write_chunk(uint16_t chunk_id, uint16_t length, +static int pnm_write_chunk(uint16_t chunk_id, uint16_t length, const char *chunk, char *data) { uint16_t be_id, be_len; @@ -345,7 +345,7 @@ static int pnm_write_chunk(uint16_t chunk_id, uint16_t length, memcpy(data , &be_id , 2); memcpy(data+2, &be_len, 2); memcpy(data+4, chunk , length); - + return length+4; } @@ -383,7 +383,7 @@ static void pnm_send_request(pnm_t *p, uint32_t bandwidth) { pnm_guid,&p->buffer[c]); c+=pnm_write_chunk(PNA_TWENTYFOUR,PNM_TWENTYFOUR_SIZE, (char*)pnm_twentyfour,&p->buffer[c]); - + /* data after chunks */ memcpy(&p->buffer[c],after_chunks,after_chunks_length); c+=after_chunks_length; @@ -406,7 +406,7 @@ static void pnm_send_request(pnm_t *p, uint32_t bandwidth) { /* some trailing bytes */ p->buffer[c]='y'; p->buffer[c+1]='B'; - + _x_io_tcp_write(p->stream,p->s,p->buffer,c+2); } @@ -476,7 +476,7 @@ static int pnm_get_headers(pnm_t *p, int *need_response) { xprintf(p->stream->xine, XINE_VERBOSITY_DEBUG, "input_pnm: error while parsing headers.\n"); return 0; } - + /* set data offset */ { uint32_t be_size; @@ -484,7 +484,7 @@ static int pnm_get_headers(pnm_t *p, int *need_response) { be_size = be2me_32(size-1); memcpy(prop_hdr+42, &be_size, 4); } - + /* read challenge */ memcpy (p->buffer, ptr, PREAMBLE_SIZE); _x_io_tcp_read (p->stream, p->s, &p->buffer[PREAMBLE_SIZE], 64); @@ -492,18 +492,18 @@ static int pnm_get_headers(pnm_t *p, int *need_response) { /* now write a data header */ memcpy(ptr, pnm_data_header, PNM_DATA_HEADER_SIZE); size+=PNM_DATA_HEADER_SIZE; -/* +/* h=rmff_scan_header(p->header); rmff_fix_header(h); p->header_len=rmff_get_header_size(h); rmff_dump_header(h, p->header, HEADER_SIZE); */ p->header_len=size; - + return 1; } -/* +/* * determine correct stream number by looking at indices * FIXME: this doesn't work with all streams! There must be * another way to determine correct stream numbers! @@ -569,7 +569,7 @@ static int pnm_calc_stream(pnm_t *p) { return 0; break; } - xprintf(p->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(p->stream->xine, XINE_VERBOSITY_DEBUG, "input_pnm: wow, something very nasty happened in pnm_calc_stream\n"); return 2; } @@ -586,7 +586,7 @@ static int pnm_get_stream_chunk(pnm_t *p) { /* send a keepalive */ /* realplayer seems to do that every 43th package */ - if ((p->packet%43) == 42) + if ((p->packet%43) == 42) { _x_io_tcp_write(p->stream,p->s,&keepalive,1); } @@ -596,10 +596,10 @@ static int pnm_get_stream_chunk(pnm_t *p) { * <i1> is a 16 bit index (big endian) * <i2> is a 8 bit index which counts from 0x10 to somewhere */ - + n = _x_io_tcp_read (p->stream, p->s, p->buffer, 8); if (n<8) return 0; - + /* skip 8 bytes if 0x62 is read */ if (p->buffer[0] == 0x62) { @@ -607,7 +607,7 @@ static int pnm_get_stream_chunk(pnm_t *p) { if (n<8) return 0; lprintf("had to seek 8 bytes on 0x62\n"); } - + /* a server message */ if (p->buffer[0] == 'X') { @@ -615,7 +615,7 @@ static int pnm_get_stream_chunk(pnm_t *p) { _x_io_tcp_read (p->stream, p->s, &p->buffer[8], size-5); p->buffer[size+3]=0; - xprintf(p->stream->xine, XINE_VERBOSITY_LOG, + xprintf(p->stream->xine, XINE_VERBOSITY_LOG, _("input_pnm: got message from server while reading stream:\n%s\n"), &p->buffer[3]); return 0; } @@ -655,14 +655,14 @@ static int pnm_get_stream_chunk(pnm_t *p) { fof2=be2me_16(*(uint16_t*)(&p->buffer[3])); if (fof1 != fof2) { - xprintf(p->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(p->stream->xine, XINE_VERBOSITY_DEBUG, "input_pnm: frame offsets are different: 0x%04x 0x%04x\n", fof1, fof2); return 0; } /* get first index */ p->seq_current[0]=be2me_16(*(uint16_t*)(&p->buffer[5])); - + /* now read the rest of stream chunk */ n = _x_io_tcp_read (p->stream, p->s, (char*)&p->recv[5], fof1-5); if (n<(fof1-5)) return 0; @@ -672,15 +672,15 @@ static int pnm_get_stream_chunk(pnm_t *p) { /* get timestamp */ p->ts_current=be2me_32(*(uint32_t*)(&p->recv[6])); - + /* get stream number */ stream=pnm_calc_stream(p); /* saving timestamp */ p->ts_last[stream]=p->ts_current; - + /* constructing a data packet header */ - + p->recv[0]=0; /* object version */ p->recv[1]=0; @@ -691,7 +691,7 @@ static int pnm_get_stream_chunk(pnm_t *p) { p->recv[4]=0; /* stream number */ p->recv[5]=stream; - + p->recv[10]=p->recv[10] & 0xfe; /* streambox seems to do that... */ p->packet++; @@ -702,19 +702,19 @@ static int pnm_get_stream_chunk(pnm_t *p) { } pnm_t *pnm_connect(xine_stream_t *stream, const char *mrl) { - + char *mrl_ptr=strdup(mrl); char *slash, *colon; size_t pathbegin, hostend; pnm_t *p; int fd; int need_response=0; - + if (strncmp(mrl,"pnm://",6)) { return NULL; } - + mrl_ptr+=6; p = calloc(1, sizeof(pnm_t)); @@ -727,7 +727,7 @@ pnm_t *pnm_connect(xine_stream_t *stream, const char *mrl) { colon=strchr(mrl_ptr,':'); if(!slash) slash=mrl_ptr+strlen(mrl_ptr)+1; - if(!colon) colon=slash; + if(!colon) colon=slash; if(colon > slash) colon=slash; pathbegin=slash-mrl_ptr; @@ -745,7 +745,7 @@ pnm_t *pnm_connect(xine_stream_t *stream, const char *mrl) { free(mrl_ptr-6); lprintf("got mrl: %s %i %s\n",p->host,p->port,p->path); - + fd = _x_io_tcp_connect (stream, p->host, p->port); if (fd == -1) { @@ -771,7 +771,7 @@ pnm_t *pnm_connect(xine_stream_t *stream, const char *mrl) { pnm_send_response(p, pnm_response); p->ts_last[0]=0; p->ts_last[1]=0; - + /* copy header to recv */ memcpy(p->recv, p->header, p->header_len); @@ -782,15 +782,15 @@ pnm_t *pnm_connect(xine_stream_t *stream, const char *mrl) { } int pnm_read (pnm_t *this, char *data, int len) { - + int to_copy=len; char *dest=data; char *source=(char*)(this->recv + this->recv_read); int fill=this->recv_size - this->recv_read; - + if (len < 0) return 0; while (to_copy > fill) { - + memcpy(dest, source, fill); to_copy -= fill; dest += fill; diff --git a/src/input/pnm.h b/src/input/pnm.h index 838fbadcc..df1f47290 100644 --- a/src/input/pnm.h +++ b/src/input/pnm.h @@ -19,7 +19,7 @@ * * pnm util functions header by joschka */ - + #ifndef HAVE_PNM_H #define HAVE_PNM_H diff --git a/src/input/sha1.c b/src/input/sha1.c index b70e50d5f..c30825a19 100644 --- a/src/input/sha1.c +++ b/src/input/sha1.c @@ -1,14 +1,14 @@ /* (PD) 2001 The Bitzi Corporation - * Please see file COPYING or http://bitzi.com/publicdomain + * Please see file COPYING or http://bitzi.com/publicdomain * for more info. * - * NIST Secure Hash Algorithm - * heavily modified by Uwe Hollerbach <uh@alumni.caltech edu> - * from Peter C. Gutmann's implementation as found in - * Applied Cryptography by Bruce Schneier - * Further modifications to include the "UNRAVEL" stuff, below + * NIST Secure Hash Algorithm + * heavily modified by Uwe Hollerbach <uh@alumni.caltech edu> + * from Peter C. Gutmann's implementation as found in + * Applied Cryptography by Bruce Schneier + * Further modifications to include the "UNRAVEL" stuff, below * - * This code is in the public domain + * This code is in the public domain */ #include <string.h> diff --git a/src/input/sha1.h b/src/input/sha1.h index 9f2659d60..a81af673b 100644 --- a/src/input/sha1.h +++ b/src/input/sha1.h @@ -34,7 +34,7 @@ char *sha_version(void); #define SHA_VERSION 1 -#ifdef HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H #include "config.h" #ifdef WORDS_BIGENDIAN diff --git a/src/input/vcd/libcdio/cdio/Makefile.am b/src/input/vcd/libcdio/cdio/Makefile.am index 0910d60e5..4f0d53cc8 100644 --- a/src/input/vcd/libcdio/cdio/Makefile.am +++ b/src/input/vcd/libcdio/cdio/Makefile.am @@ -16,4 +16,4 @@ noinst_HEADERS = \ types.h \ util.h \ version.h \ - xa.h + xa.h diff --git a/src/input/vcd/libvcd/Makefile.am b/src/input/vcd/libvcd/Makefile.am index 01b100aa4..fddbb390f 100644 --- a/src/input/vcd/libvcd/Makefile.am +++ b/src/input/vcd/libvcd/Makefile.am @@ -21,7 +21,7 @@ libvcd_SRCS = \ sector.c \ stream.c \ stream_stdio.c \ - util.c + util.c libvcdinfo_SRCS = \ info.c \ diff --git a/src/input/vcd/xine-extra.c b/src/input/vcd/xine-extra.c index e3b6da912..d211f46a4 100644 --- a/src/input/vcd/xine-extra.c +++ b/src/input/vcd/xine-extra.c @@ -1,23 +1,23 @@ -/* - +/* + Copyright (C) 2002 Rocky Bernstein <rocky@panix.com> - + Program 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. - + This program 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 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - + These are routines that probably should be in xine, but for whatever - reason aren't - yet. + reason aren't - yet. */ #ifdef HAVE_CONFIG_H @@ -42,7 +42,7 @@ static xine_t *my_xine = NULL; In short this writes a message to buffer 'buf' and to stdout. */ -void +void xine_vlog_msg(xine_t *this, int buf, const char *format, va_list args) { va_list copy; @@ -58,7 +58,7 @@ xine_vlog_msg(xine_t *this, int buf, const char *format, va_list args) In short this writes a message to buffer 'buf' and to stderr. */ -void +void xine_vlog_err(xine_t *this, int buf, const char *format, va_list args) { va_list copy; @@ -69,7 +69,7 @@ xine_vlog_err(xine_t *this, int buf, const char *format, va_list args) /*! Call this before calling any of the xine_log_msg or xine_log_err routines. It sets up the xine buffer that will be used in error - logging. + logging. \return true if everything went okay; false is returned if logging was already initialized, in which case nothing is done. @@ -85,12 +85,12 @@ xine_log_init(xine_t *this) /*! This routine is like xine_log without any xine-specific paramenters. Before calling this routine you should have set up a xine log buffer via - xine_log_init(). + xine_log_init(). In short this writes a message to buffer 'buf' and to stdout. - \return true if everything went okay; false is there was - an error, such as logging wasn't initialized. On error, nothing is + \return true if everything went okay; false is there was + an error, such as logging wasn't initialized. On error, nothing is logged. */ bool @@ -107,12 +107,12 @@ xine_log_msg(const char *format, ...) /*! This routine is like xine_log without any xine-specific paramenters. Before calling this routine you should have set up a xine log buffer via - xine_log_init(). + xine_log_init(). In short this writes a message to buffer 'buf' and to stdout. - \return true if everything went okay; false is there was - an error, such as logging wasn't initialized. On error, nothing is + \return true if everything went okay; false is there was + an error, such as logging wasn't initialized. On error, nothing is logged. */ bool @@ -128,7 +128,7 @@ xine_log_err(const char *format, ...) } void -xine_free_mrls(int *num_mrls, xine_mrl_t **mrls) +xine_free_mrls(int *num_mrls, xine_mrl_t **mrls) { (*num_mrls)--; for ( ; *num_mrls >= 0; (*num_mrls)-- ) { diff --git a/src/input/vcd/xine-extra.h b/src/input/vcd/xine-extra.h index 0650f863d..8acf1f291 100644 --- a/src/input/vcd/xine-extra.h +++ b/src/input/vcd/xine-extra.h @@ -1,23 +1,23 @@ -/* - +/* + Copyright (C) 2002 Rocky Bernstein <rocky@panix.com> - + Program 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. - + This program 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 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - + These are routines that probably should be in xine, but for whatever - reason aren't - yet. + reason aren't - yet. */ #ifndef XINE_EXTRA_H @@ -47,7 +47,7 @@ In short this writes a message to buffer 'buf' and to stdout. */ -void +void xine_vlog_msg(xine_t *this, int buf, const char *format, va_list args) XINE_FORMAT_PRINTF(3, 0); /*! This routine is like xine_log, except it takes a va_list instead @@ -61,7 +61,7 @@ void xine_vlog_err(xine_t *this, int buf, const char *format, va_list args) XINE /*! Call this before calling any of the xine_log_msg or xine_log_err routines. It sets up the xine buffer that will be used in error - logging. + logging. \return true if everything went okay; false is returned if logging was already initialized, in which case nothing is done. @@ -71,24 +71,24 @@ bool xine_log_init(xine_t *this); /*! This routine is like xine_log without any xine-specific paramenters. Before calling this routine you should have set up a xine log buffer via - xine_log_init(). + xine_log_init(). In short this writes a message to buffer 'buf' and to stdout. - \return true if everything went okay; false is there was - an error, such as logging wasn't initialized. On error, nothing is + \return true if everything went okay; false is there was + an error, such as logging wasn't initialized. On error, nothing is logged. */ bool xine_log_msg(const char *format, ...) XINE_FORMAT_PRINTF(1, 2); /*! This routine is like xine_log without any xine-specific paramenters. Before calling this routine you should have set up a xine log buffer via - xine_log_init(). + xine_log_init(). In short this writes a message to buffer 'buf' and to stdout. - \return true if everything went okay; false is there was - an error, such as logging wasn't initialized. On error, nothing is + \return true if everything went okay; false is there was + an error, such as logging wasn't initialized. On error, nothing is logged. */ bool xine_log_err(const char *format, ...) XINE_FORMAT_PRINTF(1, 2); diff --git a/src/input/vcd/xineplug_inp_vcd.c b/src/input/vcd/xineplug_inp_vcd.c index 50382ee7e..e238460db 100644 --- a/src/input/vcd/xineplug_inp_vcd.c +++ b/src/input/vcd/xineplug_inp_vcd.c @@ -1,23 +1,23 @@ /* - + Copyright (C) 2002, 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com> - + This program 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. - + This program 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 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA */ -/* +/* These are plugin routines called by the xine engine. See Chapter 4. Extending xine's input http://www.xine-project.org/hackersguide#INPUT @@ -83,8 +83,8 @@ #define BUF_DEMUX_BLOCK 0x05000000 #endif -/* - Convert an autoplay enumeration into an vcdinfo itemtype enumeration. +/* + Convert an autoplay enumeration into an vcdinfo itemtype enumeration. See definitions in vcdplayer.h and vcdinfo.h to get the below correct. */ static const vcdinfo_item_enum_t autoplay2itemtype[]={ @@ -94,7 +94,7 @@ static const vcdinfo_item_enum_t autoplay2itemtype[]={ VCDINFO_ITEM_TYPE_LID /* VCDPLAYER_AUTOPLAY_PBC */ }; -typedef struct vcd_config_s +typedef struct vcd_config_s { char *title_format; /* Format string of GUI display title */ char *comment_format; /* Format string of stream comment meta */ @@ -106,7 +106,7 @@ typedef struct vcd_input_class_s { input_class_t input_class; xine_t *xine; config_values_t *config; /* Pointer to XineRC config file. */ - vcd_input_plugin_t *ip; + vcd_input_plugin_t *ip; vcd_config_t v_config; /* config stuff passed to child */ xine_mrl_t **mrls; /* list of mrl entries for medium */ @@ -114,10 +114,10 @@ typedef struct vcd_input_class_s { char *vcd_device;/* Device name to use when none specified in MRL */ /*-------------------------------------------------------------- - Media resource locator (MRL) info. + Media resource locator (MRL) info. For the below offsets, use play_item + mrl_xxx_offset to get index - into "mrls" array + into "mrls" array ---------------------------------------------------------------*/ int mrl_track_offset; /* perhaps -1 for tracks staring with 1*/ int mrl_entry_offset; /* i_tracks for entries starting with 0 */ @@ -130,10 +130,10 @@ typedef struct vcd_input_class_s { vcd_input_class_t *vcd_class; struct vcd_input_plugin_tag { - input_plugin_t input_plugin; /* input plugin interface as defined by - by player. For xine it contains a + input_plugin_t input_plugin; /* input plugin interface as defined by + by player. For xine it contains a structure of functions that need - to be implemented. + to be implemented. */ xine_stream_t *stream; xine_event_queue_t *event_queue; @@ -155,7 +155,7 @@ struct vcd_input_plugin_tag { the mouse is not in any "button" region then this has value -1. */ - bool b_mouse_in; /* True if mouse is inside a "button" + bool b_mouse_in; /* True if mouse is inside a "button" region; false otherwise */ vcdplayer_t player ; @@ -168,13 +168,13 @@ vcd_input_plugin_t my_vcd; static bool vcd_handle_events (void); static void vcd_close(vcd_input_class_t *class); #if LIBVCD_VERSION_NUM >= 23 -static void send_mouse_enter_leave_event(vcd_input_plugin_t *p_this, +static void send_mouse_enter_leave_event(vcd_input_plugin_t *p_this, bool b_mouse_in); #endif -/* - If class->vcd_device is NULL or the empty string, - Use libcdio to find a CD drive with a VCD in it. +/* + If class->vcd_device is NULL or the empty string, + Use libcdio to find a CD drive with a VCD in it. */ static bool vcd_get_default_device(vcd_input_class_t *class, bool log_msg_if_fail) @@ -184,7 +184,7 @@ vcd_get_default_device(vcd_input_class_t *class, bool log_msg_if_fail) if (NULL == class->vcd_device || strlen(class->vcd_device)==0) { char **cd_drives=NULL; - cd_drives = cdio_get_devices_with_cap(NULL, + cd_drives = cdio_get_devices_with_cap(NULL, (CDIO_FS_ANAL_SVCD|CDIO_FS_ANAL_CVD|CDIO_FS_ANAL_VIDEOCD|CDIO_FS_UNKNOWN), true); if (NULL == cd_drives || NULL == cd_drives[0]) { @@ -201,8 +201,8 @@ vcd_get_default_device(vcd_input_class_t *class, bool log_msg_if_fail) } -static void -meta_info_assign(int field, xine_stream_t *stream, const char * info) +static void +meta_info_assign(int field, xine_stream_t *stream, const char * info) { if (NULL != info) { dbg_print(INPUT_DBG_META, "meta[%d]: %s\n", field, info); @@ -215,10 +215,10 @@ meta_info_assign(int field, xine_stream_t *stream, const char * info) /* Set stream information. */ static void -vcd_set_meta_info (vcd_input_plugin_t *xine_vcd) +vcd_set_meta_info (vcd_input_plugin_t *xine_vcd) { vcdinfo_obj_t *p_vcdinfo= xine_vcd->player.vcd; - meta_info_assign(XINE_META_INFO_ALBUM, xine_vcd->stream, + meta_info_assign(XINE_META_INFO_ALBUM, xine_vcd->stream, vcdinfo_get_album_id(p_vcdinfo)); meta_info_assign(XINE_META_INFO_ARTIST, xine_vcd->stream, vcdinfo_get_preparer_id(p_vcdinfo)); @@ -230,40 +230,40 @@ vcd_set_meta_info (vcd_input_plugin_t *xine_vcd) } static void -vcd_force_redisplay (void) +vcd_force_redisplay (void) { #if 1 my_vcd.stream->xine->clock->adjust_clock(my_vcd.stream->xine->clock, - my_vcd.stream->xine->clock->get_current_time(my_vcd.stream->xine->clock) + my_vcd.stream->xine->clock->get_current_time(my_vcd.stream->xine->clock) + 30 * 90000 ); #else /* Alternate method that causes too much disruption... */ - xine_set_param(my_vcd.stream, XINE_PARAM_VO_ASPECT_RATIO, + xine_set_param(my_vcd.stream, XINE_PARAM_VO_ASPECT_RATIO, (xine_get_param(my_vcd.stream, XINE_PARAM_VO_ASPECT_RATIO))); #endif } static void -vcd_set_aspect_ratio (int i_aspect_ratio) +vcd_set_aspect_ratio (int i_aspect_ratio) { /* Alternate method that causes too much disruption... */ xine_set_param(my_vcd.stream, XINE_PARAM_VO_ASPECT_RATIO, i_aspect_ratio); } -/*! Add another MRL to the MRL list inside "this" to be displayed. - mrl is the string name to add; size is the size of the entry in bytes. - The number of mrls in "this" is incremented. +/*! Add another MRL to the MRL list inside "this" to be displayed. + mrl is the string name to add; size is the size of the entry in bytes. + The number of mrls in "this" is incremented. */ static void -vcd_add_mrl_slot(vcd_input_class_t *this, const char *mrl, off_t size, +vcd_add_mrl_slot(vcd_input_class_t *this, const char *mrl, off_t size, unsigned int *i) { - dbg_print(INPUT_DBG_MRL, "called to add slot %d: %s, size %u\n", + dbg_print(INPUT_DBG_MRL, "called to add slot %d: %s, size %u\n", *i, mrl, (unsigned int) size); - + this->mrls[*i] = malloc(sizeof(xine_mrl_t)); if (NULL==this->mrls[*i]) { - LOG_ERR("Can't malloc %zu bytes for MRL slot %u (%s)", + LOG_ERR("Can't malloc %zu bytes for MRL slot %u (%s)", sizeof(xine_mrl_t), *i, mrl); return; } @@ -271,7 +271,7 @@ vcd_add_mrl_slot(vcd_input_class_t *this, const char *mrl, off_t size, this->mrls[*i]->origin = NULL; this->mrls[*i]->type = mrl_vcd; this->mrls[*i]->size = size * M2F2_SECTOR_SIZE; - + this->mrls[*i]->mrl = strdup(mrl); if (NULL==this->mrls[*i]->mrl) { LOG_ERR("Can't malloc %zu bytes for MRL name %s", sizeof(xine_mrl_t), mrl); @@ -282,9 +282,9 @@ vcd_add_mrl_slot(vcd_input_class_t *this, const char *mrl, off_t size, /*! Return the associated mrl_offset for the given type. */ -static int -vcd_get_mrl_type_offset(vcd_input_plugin_t *inp, - vcdinfo_item_enum_t type, int *size) +static int +vcd_get_mrl_type_offset(vcd_input_plugin_t *inp, + vcdinfo_item_enum_t type, int *size) { switch (type) { case VCDINFO_ITEM_TYPE_ENTRY: @@ -297,7 +297,7 @@ vcd_get_mrl_type_offset(vcd_input_plugin_t *inp, case VCDINFO_ITEM_TYPE_TRACK: *size = inp->class->mrl_entry_offset; return inp->class->mrl_track_offset; - case VCDINFO_ITEM_TYPE_LID: + case VCDINFO_ITEM_TYPE_LID: /* Play list number (LID) */ *size = (inp->player.i_lids > 0) ? 1 : 0; return inp->class->mrl_play_offset; @@ -338,10 +338,10 @@ vcd_build_mrl_list(vcd_input_class_t *class, char *vcd_device) if (!vcd_get_default_device(class, true)) return false; vcd_device = class->vcd_device; } - + if (!vcdio_open(vcdplayer, vcd_device)) { /* Error should have been logged in vcdio_open. If not do the below: - LOG_ERR(vcdplayer, "%s: %s.\n", _("unable to open"), + LOG_ERR(vcdplayer, "%s: %s.\n", _("unable to open"), class->vcd_device, strerror(errno)); */ return false; @@ -359,13 +359,13 @@ vcd_build_mrl_list(vcd_input_class_t *class, char *vcd_device) didn't have to possibly remove rejected LIDs from list done in the loop below. */ - class->num_mrls = vcdplayer->i_tracks + vcdplayer->i_entries + class->num_mrls = vcdplayer->i_tracks + vcdplayer->i_entries + vcdplayer->i_segments + vcdplayer->i_lids; if (!vcdplayer->show_rejected && vcdinfo_get_lot(vcdplayer->vcd)) { /* Remove rejected LIDs from count. */ for (n=0; n<vcdplayer->i_lids; n++) { - if ( vcdinf_get_lot_offset(vcdinfo_get_lot(vcdplayer->vcd), n) + if ( vcdinf_get_lot_offset(vcdinfo_get_lot(vcdplayer->vcd), n) == PSD_OFS_DISABLED ) class->num_mrls--; } @@ -381,24 +381,24 @@ vcd_build_mrl_list(vcd_input_class_t *class, char *vcd_device) } /* Record MRL's for tracks */ - for (n=1; n<=vcdplayer->i_tracks; n++) { + for (n=1; n<=vcdplayer->i_tracks; n++) { memset(&mrl, 0, sizeof (mrl)); snprintf(mrl, sizeof(mrl), "%s%s@T%u", MRL_PREFIX, vcd_device, n); vcd_add_mrl_slot(class, mrl, vcdplayer->track[n-1].size, &i); } - + class->mrl_entry_offset = vcdplayer->i_tracks; class->mrl_play_offset = class->mrl_entry_offset + i_entries - 1; /* Record MRL's for entries */ if (i_entries > 0) { - for (n=0; n<i_entries; n++) { + for (n=0; n<i_entries; n++) { memset(&mrl, 0, sizeof (mrl)); snprintf(mrl, sizeof(mrl), "%s%s@E%u", MRL_PREFIX, vcd_device, n); vcd_add_mrl_slot(class, mrl, vcdplayer->entry[n].size, &i); } } - + /* Record MRL's for LID entries or selection entries*/ class->mrl_segment_offset = class->mrl_play_offset; if (vcdinfo_get_lot(vcdplayer->vcd)) { @@ -406,7 +406,7 @@ vcd_build_mrl_list(vcd_input_class_t *class, char *vcd_device) uint16_t ofs = vcdinf_get_lot_offset(vcdinfo_get_lot(vcdplayer->vcd), n); if (ofs != PSD_OFS_DISABLED || vcdplayer->show_rejected) { memset(&mrl, 0, sizeof (mrl)); - snprintf(mrl, sizeof(mrl), "%s%s@P%u%s", MRL_PREFIX, vcd_device, n+1, + snprintf(mrl, sizeof(mrl), "%s%s@P%u%s", MRL_PREFIX, vcd_device, n+1, ofs == PSD_OFS_DISABLED ? "*" : ""); vcd_add_mrl_slot(class, mrl, 0, &i); class->mrl_segment_offset++; @@ -418,7 +418,7 @@ vcd_build_mrl_list(vcd_input_class_t *class, char *vcd_device) { segnum_t i_segments = vcdplayer->i_segments; for (n=0; n<i_segments; n++) { - vcdinfo_video_segment_type_t segtype + vcdinfo_video_segment_type_t segtype = vcdinfo_get_video_type(p_vcdinfo, n); char c='S'; switch (segtype) { @@ -442,10 +442,10 @@ vcd_build_mrl_list(vcd_input_class_t *class, char *vcd_device) vcd_add_mrl_slot(class, mrl, vcdplayer->segment[n].size, &i); } } - - dbg_print(INPUT_DBG_MRL, - "offsets are track: %d, entry: %d, play: %d seg: %d\n", - class->mrl_track_offset, class->mrl_entry_offset, + + dbg_print(INPUT_DBG_MRL, + "offsets are track: %d, entry: %d, play: %d seg: %d\n", + class->mrl_track_offset, class->mrl_entry_offset, class->mrl_play_offset, class->mrl_segment_offset); return true; @@ -453,9 +453,9 @@ vcd_build_mrl_list(vcd_input_class_t *class, char *vcd_device) /*! parses a MRL which has the format - + vcd://[vcd_path][@[EPTS]?number]\*? - + Examples vcd:// - Play (navigate) default device: /dev/cdrom vcd://@ - same as above @@ -467,7 +467,7 @@ vcd_build_mrl_list(vcd_input_class_t *class, char *vcd_device) vcd://dev/cdrom@E0 - Play Entry id 0 from default device vcd://@P1 - probably same as above. If there is no playback control, MRL will - get converted into vcd://@E0 + get converted into vcd://@E0 vcd://@P1* - probably same as above. vcd://@S0 - Play segment 0 from default device vcd://@3 - Play track 3 from default device @@ -475,7 +475,7 @@ vcd_build_mrl_list(vcd_input_class_t *class, char *vcd_device) vcd:///tmp/ntsc.bin@ - Play default item from /tmp/ntsc.bin vcd:///tmp/ntsc.bin/@E0 - Play entry 0 of /tmp/ntsc.bin -parameters: +parameters: mrl : mrl to parse default_vcd_device: name of device to use when none given auto_type : type of selection (entry, track, LID) when none given @@ -483,10 +483,10 @@ parameters: */ static bool -vcd_parse_mrl(/*in*/ const char *default_vcd_device, /*in*/ char *mrl, +vcd_parse_mrl(/*in*/ const char *default_vcd_device, /*in*/ char *mrl, /*out*/ char *device_str, /*out*/ vcdinfo_itemid_t *itemid, - /*in */ vcdplayer_autoplay_t auto_type, - /*out*/ bool *used_default) + /*in */ vcdplayer_autoplay_t auto_type, + /*out*/ bool *used_default) { char type_str[2]; int count; @@ -507,15 +507,15 @@ vcd_parse_mrl(/*in*/ const char *default_vcd_device, /*in*/ char *mrl, device_str[0] = '/'; device_str[1] = 0; - count = sscanf (p, "%1023[^@]@%1[EePpSsTt]%u", + count = sscanf (p, "%1023[^@]@%1[EePpSsTt]%u", device_str + 1, type_str, &num); itemid->num = num; - + switch (count) { case 1: /* Matched device, but nothing beyond that */ if (strlen(device_str)!=0 && device_str[0] != ':') { - /* See if we have old-style MRL with no type specifier. + /* See if we have old-style MRL with no type specifier. If so, we assume "track". */ count = sscanf (p, "%u", &num); itemid->num = num; @@ -534,7 +534,7 @@ vcd_parse_mrl(/*in*/ const char *default_vcd_device, /*in*/ char *mrl, _x_mrl_unescape (device_str); case 0: - case EOF: + case EOF: { /* No device/file given, so use the default device and try again. */ if (NULL == default_vcd_device) return false; @@ -543,16 +543,16 @@ vcd_parse_mrl(/*in*/ const char *default_vcd_device, /*in*/ char *mrl, count = sscanf (p, "%1[EePpSsTt]%u", type_str, &num); type_str[0] = toupper(type_str[0]); itemid->num = num; - + switch (count) { case EOF: /* Default PBC navigation. */ return true; case 0: - /* See if we have old-style MRL with no type specifier. + /* See if we have old-style MRL with no type specifier. If so, we assume "track". */ count = sscanf (p, "%u", &num); - if (1==count) { + if (1==count) { type_str[0] = 'T'; break; } @@ -568,45 +568,45 @@ vcd_parse_mrl(/*in*/ const char *default_vcd_device, /*in*/ char *mrl, /* We have some sort of track/selection/entry number */ switch (type_str[0]) { - case 'E': + case 'E': itemid->type = VCDINFO_ITEM_TYPE_ENTRY; break; - case '\0': + case '\0': /* None specified, use config value. */ itemid->type = (vcdinfo_item_enum_t) auto_type; *used_default = true; break; - case 'P': + case 'P': itemid->type = VCDINFO_ITEM_TYPE_LID; break; - case 'S': + case 'S': itemid->type = VCDINFO_ITEM_TYPE_SEGMENT; break; - case 'T': + case 'T': itemid->type = VCDINFO_ITEM_TYPE_TRACK; break; default: ; } - - if ( 0==itemid->num - && ( (VCDINFO_ITEM_TYPE_LID == itemid->type) + + if ( 0==itemid->num + && ( (VCDINFO_ITEM_TYPE_LID == itemid->type) || (VCDINFO_ITEM_TYPE_TRACK == itemid->type) ) ) itemid->num = 1; return true; } -/*! +/*! From xine plugin spec: return capabilities of input source */ -static uint32_t +static uint32_t vcd_plugin_get_capabilities (input_plugin_t *this_gen) { - uint32_t ret = - INPUT_CAP_AUDIOLANG | INPUT_CAP_BLOCK | + uint32_t ret = + INPUT_CAP_AUDIOLANG | INPUT_CAP_BLOCK | INPUT_CAP_CHAPTERS | INPUT_CAP_PREVIEW | (my_vcd.player.i_still ? 0: INPUT_CAP_SEEKABLE) | INPUT_CAP_SPULANG; @@ -618,14 +618,14 @@ vcd_plugin_get_capabilities (input_plugin_t *this_gen) # if FINISHED /* If needed, will fill out later... */ -static void +static void vcd_read_ahead_cb(void *this_gen, xine_cfg_entry_t *entry) { return; } #endif -static void +static void vcd_flush_buffers(void) { _x_demux_flush_engine(my_vcd.stream); @@ -636,11 +636,11 @@ vcd_flush_buffers(void) read nlen bytes, return number of bytes read. */ -static off_t +static off_t vcd_plugin_read (input_plugin_t *this_gen, char *buf, const off_t nlen) { - dbg_print((INPUT_DBG_CALL|INPUT_DBG_EXT), + dbg_print((INPUT_DBG_CALL|INPUT_DBG_EXT), "Called with nlen %u\n", (unsigned int) nlen); /* FIXME: Tricking the demux_mpeg_block plugin */ @@ -652,7 +652,7 @@ vcd_plugin_read (input_plugin_t *this_gen, char *buf, const off_t nlen) } /* Allocate and return a no-op buffer. This signals the outside - to do nothing, but in contrast to returning NULL, it doesn't + to do nothing, but in contrast to returning NULL, it doesn't mean the stream has ended. We use this say for still frames. */ #define RETURN_NOOP_BUF \ @@ -677,8 +677,8 @@ vcd_plugin_read (input_plugin_t *this_gen, char *buf, const off_t nlen) function */ static buf_element_t * -vcd_plugin_read_block (input_plugin_t *this_gen, fifo_buffer_t *fifo, - const off_t i_len) +vcd_plugin_read_block (input_plugin_t *this_gen, fifo_buffer_t *fifo, + const off_t i_len) { vcd_input_plugin_t *vcd_input_plugin= (vcd_input_plugin_t *) this_gen; vcdplayer_t *p_vcdplayer = &my_vcd.player; @@ -718,7 +718,7 @@ vcd_plugin_read_block (input_plugin_t *this_gen, fifo_buffer_t *fifo, SLEEP_AND_HANDLE_EVENTS; } } - + read_block: switch (vcdplayer_read(p_vcdplayer, data, i_len)) { @@ -728,37 +728,37 @@ vcd_plugin_read_block (input_plugin_t *this_gen, fifo_buffer_t *fifo, case READ_ERROR: /* Some sort of error. */ return NULL; - case READ_STILL_FRAME: + case READ_STILL_FRAME: { dbg_print(INPUT_DBG_STILL, "Handled still event wait time %u\n", p_vcdplayer->i_still); vcd_input_plugin->pause_end_time = time(NULL) + p_vcdplayer->i_still; RETURN_NOOP_BUF; } - + default: case READ_BLOCK: /* Read buffer */ p_buf = fifo->buffer_pool_alloc (fifo); p_buf->type = BUF_DEMUX_BLOCK; } - + p_buf->content = p_buf->mem; if (STILL_READING == p_vcdplayer->i_still && 0 == my_vcd.i_old_still) { - my_vcd.i_old_deinterlace = xine_get_param(my_vcd.stream, + my_vcd.i_old_deinterlace = xine_get_param(my_vcd.stream, XINE_PARAM_VO_DEINTERLACE); xine_set_param(my_vcd.stream, XINE_PARAM_VO_DEINTERLACE, 0); - dbg_print(INPUT_DBG_STILL, "going into still, saving deinterlace %d\n", + dbg_print(INPUT_DBG_STILL, "going into still, saving deinterlace %d\n", my_vcd.i_old_deinterlace); } else if (0 == p_vcdplayer->i_still && 0 != my_vcd.i_old_still) { - dbg_print(INPUT_DBG_STILL, + dbg_print(INPUT_DBG_STILL, "going out of still, restoring deinterlace\n"); xine_set_param(my_vcd.stream, XINE_PARAM_VO_DEINTERLACE, my_vcd.i_old_deinterlace); } my_vcd.i_old_still = p_vcdplayer->i_still; - + /* Ideally this should probably be i_len. */ memcpy (p_buf->mem, data, M2F2_SECTOR_SIZE); @@ -768,12 +768,12 @@ vcd_plugin_read_block (input_plugin_t *this_gen, fifo_buffer_t *fifo, /*! From xine plugin spec: - seek position, return new position + seek position, return new position if seeking failed, -1 is returned */ -static off_t -vcd_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin) +static off_t +vcd_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin) { return vcdio_seek (&my_vcd.player, offset, origin); } @@ -792,7 +792,7 @@ static off_t old_get_length = 0; static vcdplayer_slider_length_t old_slider_length; /* This routine is called a bit. Make reasonably fast. */ -static off_t +static off_t vcd_plugin_get_length (input_plugin_t *this_gen) { vcd_input_plugin_t *ip= (vcd_input_plugin_t *) this_gen; @@ -801,7 +801,7 @@ vcd_plugin_get_length (input_plugin_t *this_gen) { int n = vcdplayer->play_item.num; if (vcdplayer->play_item.num == old_play_item.num - && vcdplayer->play_item.type == old_play_item.type + && vcdplayer->play_item.type == old_play_item.type && vcdplayer->slider_length == old_slider_length) return old_get_length; @@ -833,7 +833,7 @@ vcd_plugin_get_length (input_plugin_t *this_gen) { /* This is the only situation where the size of the current play item is not static. It depends what the current play-item is. */ - old_get_length = (vcdplayer->end_lsn - vcdplayer->origin_lsn) * + old_get_length = (vcdplayer->end_lsn - vcdplayer->origin_lsn) * M2F2_SECTOR_SIZE; return old_get_length; break; @@ -843,11 +843,11 @@ vcd_plugin_get_length (input_plugin_t *this_gen) { /* FIXME? */ return -1; } - + if (n >= 0 && n < ip->class->num_mrls) { old_get_length = ip->class->mrls[n]->size; - dbg_print(INPUT_DBG_MRL, "item: %u, slot %u, size %ld\n", - vcdplayer->play_item.num, + dbg_print(INPUT_DBG_MRL, "item: %u, slot %u, size %ld\n", + vcdplayer->play_item.num, (unsigned int) n, (long int) old_get_length); } return old_get_length; @@ -858,7 +858,7 @@ vcd_plugin_get_length (input_plugin_t *this_gen) { * get current position in stream. * */ -static off_t +static off_t vcd_plugin_get_current_pos (input_plugin_t *this_gen){ // trace_print("Called\n"); return (vcd_plugin_seek (this_gen, 0, SEEK_CUR)); @@ -869,7 +869,7 @@ vcd_plugin_get_current_pos (input_plugin_t *this_gen){ * From xine plugin spec: * return block size of input source (if supported, 0 otherwise) */ -static uint32_t +static uint32_t vcd_plugin_get_blocksize (input_plugin_t *this_gen) { dbg_print((INPUT_DBG_CALL|INPUT_DBG_EXT), "called\n"); @@ -885,7 +885,7 @@ vcd_plugin_get_blocksize (input_plugin_t *this_gen) { */ static xine_mrl_t ** -vcd_class_get_dir (input_class_t *this_gen, const char *filename, +vcd_class_get_dir (input_class_t *this_gen, const char *filename, int *num_files) { char intended_vcd_device[MAX_DEVICE_LEN+1]= { '\0', }; @@ -897,7 +897,7 @@ vcd_class_get_dir (input_class_t *this_gen, const char *filename, bool used_default; if (filename == NULL) { - dbg_print((INPUT_DBG_CALL|INPUT_DBG_EXT), + dbg_print((INPUT_DBG_CALL|INPUT_DBG_EXT), "called with NULL\n"); if ( class->mrls != NULL && NULL != class->mrls[0] ) goto have_mrls; @@ -906,12 +906,12 @@ vcd_class_get_dir (input_class_t *this_gen, const char *filename, } } else { char *mrl = strdup(filename); - dbg_print((INPUT_DBG_CALL|INPUT_DBG_EXT), + dbg_print((INPUT_DBG_CALL|INPUT_DBG_EXT), "called with %s\n", filename); if (!vcd_get_default_device(class, true)) goto no_mrls; - if (!vcd_parse_mrl(class->vcd_device, mrl, - intended_vcd_device, &itemid, - vcdplayer->default_autoplay, &used_default)) { + if (!vcd_parse_mrl(class->vcd_device, mrl, + intended_vcd_device, &itemid, + vcdplayer->default_autoplay, &used_default)) { free (mrl); goto no_mrls; } @@ -923,17 +923,17 @@ vcd_class_get_dir (input_class_t *this_gen, const char *filename, return class->mrls; no_mrls: - *num_files = 0; - return NULL; + *num_files = 0; + return NULL; } #define FREE_AND_NULL(ptr) if (NULL != ptr) free(ptr); ptr = NULL; static void -vcd_close(vcd_input_class_t *class) +vcd_close(vcd_input_class_t *class) { xine_free_mrls(&(class->num_mrls), class->mrls); - FREE_AND_NULL(my_vcd.mrl); + FREE_AND_NULL(my_vcd.mrl); if (my_vcd.player.b_opened) vcdio_close(&my_vcd.player); } @@ -945,15 +945,15 @@ vcd_close(vcd_input_class_t *class) * * returns 0 for temporary failures */ -static int -vcd_class_eject_media (input_class_t *this_gen) +static int +vcd_class_eject_media (input_class_t *this_gen) { int ret; CdIo_t *cdio=vcdinfo_get_cd_image(my_vcd.player.vcd); - + dbg_print((INPUT_DBG_CALL|INPUT_DBG_EXT), "called\n"); if (NULL == cdio) return 0; - + ret = cdio_eject_media(&cdio); if ((ret == 0) || (ret == 2)) { if (my_vcd.player.b_opened) @@ -966,8 +966,8 @@ vcd_class_eject_media (input_class_t *this_gen) * From spec: * return current MRL */ -static const char * -vcd_plugin_get_mrl (input_plugin_t *this_gen) +static const char * +vcd_plugin_get_mrl (input_plugin_t *this_gen) { vcd_input_plugin_t *t = (vcd_input_plugin_t *) this_gen; vcdplayer_t *vcdplayer = &my_vcd.player; @@ -985,13 +985,13 @@ vcd_plugin_get_mrl (input_plugin_t *this_gen) if (-2 == offset) { /* Bad type. */ - LOG_ERR("%s %d", _("Invalid current entry type"), + LOG_ERR("%s %d", _("Invalid current entry type"), vcdplayer->play_item.type); return ""; } else { n += offset; if (n < t->class->num_mrls) { - dbg_print(INPUT_DBG_CALL, "Called, returning %s\n", + dbg_print(INPUT_DBG_CALL, "Called, returning %s\n", t->class->mrls[n]->mrl); return t->class->mrls[n]->mrl; } else { @@ -1002,11 +1002,11 @@ vcd_plugin_get_mrl (input_plugin_t *this_gen) /*! From xine plugin spec: - + return human readable (verbose = 1 line) description for this plugin */ static const char * -vcd_class_get_description (input_class_t *this_gen) +vcd_class_get_description (input_class_t *this_gen) { dbg_print((INPUT_DBG_CALL|INPUT_DBG_EXT), "called\n"); return _("Video CD plugin with PBC and support for: (X)VCD, (X)SVCD, HQVCD, CVD ... "); @@ -1025,12 +1025,12 @@ vcd_class_get_identifier (input_class_t *this_gen) { return SHORT_PLUGIN_NAME; } -/* +/* Handle all queued keyboard/mouse events. Return TRUE if this causes a change in the play item. */ static bool -vcd_handle_events (void) +vcd_handle_events (void) { vcdplayer_t *p_vcdplayer = &my_vcd.player; xine_event_t *p_event; @@ -1038,7 +1038,7 @@ vcd_handle_events (void) /* What you add to the last input number entry. It accumulates all of the 10_ADD keypresses */ - static unsigned int number_addend = 0; + static unsigned int number_addend = 0; while ((p_event = xine_event_get(my_vcd.event_queue))) { @@ -1048,14 +1048,14 @@ vcd_handle_events (void) switch(p_event->type) { case XINE_EVENT_INPUT_NUMBER_10_ADD: - number_addend += 10; - dbg_print(INPUT_DBG_EVENT, "10 added to number. Is now: %d\n", + number_addend += 10; + dbg_print(INPUT_DBG_EVENT, "10 added to number. Is now: %d\n", number_addend); break; /* The method used below is oblivious to XINE_EVENT_INPUT encodings - In particular, it does not assume XINE_EVENT_INPUT_NUMBE_9 = - XINE_EVENT_INPUT_NUMBER_0 + 9. + In particular, it does not assume XINE_EVENT_INPUT_NUMBE_9 = + XINE_EVENT_INPUT_NUMBER_0 + 9. */ case XINE_EVENT_INPUT_NUMBER_9: digit_entered++; @@ -1079,7 +1079,7 @@ vcd_handle_events (void) { number_addend *= 10; number_addend += digit_entered; - dbg_print(INPUT_DBG_EVENT, + dbg_print(INPUT_DBG_EVENT, "digit added number is now: %d\n", number_addend); break; } @@ -1088,65 +1088,65 @@ vcd_handle_events (void) vcdplayer_debug = number_addend; number_addend = 0; break; - case XINE_EVENT_INPUT_MENU1: + case XINE_EVENT_INPUT_MENU1: case XINE_EVENT_INPUT_MENU2: - case XINE_EVENT_INPUT_NEXT: + case XINE_EVENT_INPUT_NEXT: case XINE_EVENT_INPUT_PREVIOUS: { int num = number_addend; vcdinfo_itemid_t itemid; - + number_addend = 0; - + /* If no number was given it's really the same as 1, not 0. */ if (num == 0) num++; - - dbg_print(INPUT_DBG_EVENT, - "RETURN/NEXT/PREV/DEFAULT (%d) iteration count %d\n", + + dbg_print(INPUT_DBG_EVENT, + "RETURN/NEXT/PREV/DEFAULT (%d) iteration count %d\n", p_event->type, num); for ( ; num > 0; num--) { itemid = p_vcdplayer->play_item; switch (p_event->type) { - case XINE_EVENT_INPUT_MENU1: + case XINE_EVENT_INPUT_MENU1: if (p_vcdplayer->return_entry == VCDINFO_INVALID_ENTRY) { LOG_MSG("%s\n", _("selection has no RETURN entry")); return false; } itemid.num = p_vcdplayer->return_entry; - dbg_print((INPUT_DBG_PBC|INPUT_DBG_EVENT), + dbg_print((INPUT_DBG_PBC|INPUT_DBG_EVENT), "RETURN to %d\n", itemid.num); /* Don't loop around -- doesn't make sense to loop a return*/ - num = 0; + num = 0; break; - case XINE_EVENT_INPUT_MENU2: + case XINE_EVENT_INPUT_MENU2: if (vcdplayer_pbc_is_on(p_vcdplayer)) { - lid_t lid=vcdinfo_get_multi_default_lid(p_vcdplayer->vcd, + lid_t lid=vcdinfo_get_multi_default_lid(p_vcdplayer->vcd, p_vcdplayer->i_lid, p_vcdplayer->i_lsn); if (VCDINFO_INVALID_LID != lid) { itemid.num = lid; - dbg_print((INPUT_DBG_PBC|INPUT_DBG_EVENT), + dbg_print((INPUT_DBG_PBC|INPUT_DBG_EVENT), "DEFAULT to %d\n", itemid.num); } else { - dbg_print((INPUT_DBG_PBC|INPUT_DBG_EVENT), - "no DEFAULT for LID %d\n", + dbg_print((INPUT_DBG_PBC|INPUT_DBG_EVENT), + "no DEFAULT for LID %d\n", p_vcdplayer->i_lid); } - + /* Don't loop around -- doesn't make sense to loop a return*/ - num = 0; + num = 0; } else { - /* PBC is not on. "default" selection beginning of current + /* PBC is not on. "default" selection beginning of current selection . Alternative: */ LOG_MSG("%s\n", _("DEFAULT selected, but PBC is not on.")); } break; - case XINE_EVENT_INPUT_NEXT: + case XINE_EVENT_INPUT_NEXT: if (p_vcdplayer->next_entry == VCDINFO_INVALID_ENTRY) { LOG_MSG("%s\n", _("selection has no NEXT entry")); return false; - } + } itemid.num = p_vcdplayer->next_entry; dbg_print(INPUT_DBG_PBC, "NEXT to %d\n", itemid.num); break; @@ -1158,7 +1158,7 @@ vcd_handle_events (void) itemid.num = p_vcdplayer->prev_entry; dbg_print(INPUT_DBG_PBC, "PREVIOUS to %d\n", itemid.num); break; - default: + default: LOG_MSG("%s %d\n", _("Unknown event type: "), p_event->type); } _x_demux_flush_engine(my_vcd.stream); @@ -1172,13 +1172,13 @@ vcd_handle_events (void) /* In the future will have to test to see if we are in a menu selection. But if not... */ vcdinfo_itemid_t itemid = p_vcdplayer->play_item; - + itemid.num = number_addend; number_addend = 0; - + if (vcdplayer_pbc_is_on(p_vcdplayer)) { - lid_t i_next=vcdinfo_selection_get_lid(p_vcdplayer->vcd, - p_vcdplayer->i_lid, + lid_t i_next=vcdinfo_selection_get_lid(p_vcdplayer->vcd, + p_vcdplayer->i_lid, itemid.num); if (VCDINFO_INVALID_LID != i_next) { itemid.num = i_next; @@ -1189,30 +1189,30 @@ vcd_handle_events (void) } break; } - case XINE_EVENT_INPUT_MOUSE_BUTTON: + case XINE_EVENT_INPUT_MOUSE_BUTTON: if (my_vcd.stream) { xine_input_data_t *p_input = p_event->data; - if (p_input->button == 1) + if (p_input->button == 1) { #if LIBVCD_VERSION_NUM >= 23 int i_selection; #endif - dbg_print(INPUT_DBG_EVENT, - "Button to x: %d, y: %d, scaled x: %d, scaled y %d\n", + dbg_print(INPUT_DBG_EVENT, + "Button to x: %d, y: %d, scaled x: %d, scaled y %d\n", p_input->x, p_input->y, p_input->x * 255 / p_vcdplayer->max_x, p_input->y * 255 / p_vcdplayer->max_y); - + #if LIBVCD_VERSION_NUM >= 23 /* xine_dvd_send_button_update(this, 1); */ - + if (my_vcd.b_mouse_in) send_mouse_enter_leave_event(&my_vcd, false); - i_selection = vcdinfo_get_area_selection(p_vcdplayer->vcd, - p_vcdplayer->i_lid, + i_selection = vcdinfo_get_area_selection(p_vcdplayer->vcd, + p_vcdplayer->i_lid, p_input->x, p_input->y, p_vcdplayer->max_x, @@ -1221,8 +1221,8 @@ vcd_handle_events (void) if (vcdplayer_pbc_is_on(p_vcdplayer)) { vcdinfo_itemid_t itemid = p_vcdplayer->play_item; - lid_t i_next=vcdinfo_selection_get_lid(p_vcdplayer->vcd, - p_vcdplayer->i_lid, + lid_t i_next=vcdinfo_selection_get_lid(p_vcdplayer->vcd, + p_vcdplayer->i_lid, i_selection); if (VCDINFO_INVALID_LID != i_next) { itemid.num = i_next; @@ -1235,33 +1235,33 @@ vcd_handle_events (void) } } break; - case XINE_EVENT_INPUT_BUTTON_FORCE: + case XINE_EVENT_INPUT_BUTTON_FORCE: break; - case XINE_EVENT_INPUT_MOUSE_MOVE: - if (my_vcd.stream) + case XINE_EVENT_INPUT_MOUSE_MOVE: + if (my_vcd.stream) { xine_input_data_t *p_input = p_event->data; #if LIBVCD_VERSION_NUM >= 23 - int32_t i_selection = vcdinfo_get_area_selection(p_vcdplayer->vcd, - p_vcdplayer->i_lid, + int32_t i_selection = vcdinfo_get_area_selection(p_vcdplayer->vcd, + p_vcdplayer->i_lid, p_input->x, p_input->y, p_vcdplayer->max_x, p_vcdplayer->max_y); - dbg_print(INPUT_DBG_EVENT, "Move to x: %d, y: %d\n", + dbg_print(INPUT_DBG_EVENT, "Move to x: %d, y: %d\n", p_input->x, p_input->y); - + if (my_vcd.i_mouse_button != i_selection) { - dbg_print(INPUT_DBG_EVENT, "Old selection: %d, selection: %d\n", + dbg_print(INPUT_DBG_EVENT, "Old selection: %d, selection: %d\n", my_vcd.i_mouse_button, i_selection); my_vcd.i_mouse_button = i_selection; - if (i_selection < 0) + if (i_selection < 0) send_mouse_enter_leave_event(&my_vcd, false); - else + else send_mouse_enter_leave_event(&my_vcd, true); } #else - dbg_print(INPUT_DBG_EVENT, "Move to x: %d, y: %d\n", + dbg_print(INPUT_DBG_EVENT, "Move to x: %d, y: %d\n", p_input->x, p_input->y); #endif } @@ -1292,19 +1292,19 @@ vcd_handle_events (void) request optional data from input plugin. */ -static int -vcd_get_optional_data (input_plugin_t *this_gen, +static int +vcd_get_optional_data (input_plugin_t *this_gen, void *data, int data_type) { - dbg_print( (INPUT_DBG_CALL|INPUT_DBG_EXT), + dbg_print( (INPUT_DBG_CALL|INPUT_DBG_EXT), "called with %d\n", data_type); if (NULL == my_vcd.stream) return INPUT_OPTIONAL_UNSUPPORTED; /* Fill this out more fully... */ switch(data_type) { - - case INPUT_OPTIONAL_DATA_AUDIOLANG: + + case INPUT_OPTIONAL_DATA_AUDIOLANG: { uint8_t channel; channel = _x_get_audio_channel(my_vcd.stream); @@ -1328,8 +1328,8 @@ vcd_get_optional_data (input_plugin_t *this_gen, } return INPUT_OPTIONAL_SUCCESS; } - - case INPUT_OPTIONAL_DATA_SPULANG: + + case INPUT_OPTIONAL_DATA_SPULANG: { /*uint16_t lang;*/ int8_t channel; @@ -1340,12 +1340,12 @@ vcd_get_optional_data (input_plugin_t *this_gen, } else { sprintf(data, "%1d", channel); } - + } default: ; } - + return INPUT_OPTIONAL_UNSUPPORTED; } @@ -1363,7 +1363,7 @@ vcd_get_optional_data (input_plugin_t *this_gen, */ static char ** -vcd_class_get_autoplay_list (input_class_t *this_gen, int *num_files) +vcd_class_get_autoplay_list (input_class_t *this_gen, int *num_files) { vcd_input_class_t *class = (vcd_input_class_t *) this_gen; static char *filelist[MAX_DIR_ENTRIES]; @@ -1376,9 +1376,9 @@ vcd_class_get_autoplay_list (input_class_t *this_gen, int *num_files) } else { int i; int size = 0; - vcdinfo_item_enum_t itemtype = + vcdinfo_item_enum_t itemtype = autoplay2itemtype[my_vcd.player.default_autoplay]; - + int offset = vcd_get_mrl_type_offset(&my_vcd, itemtype, &size); /* A VCD is not required to have PBC or LID's, default to entry if @@ -1389,7 +1389,7 @@ vcd_class_get_autoplay_list (input_class_t *this_gen, int *num_files) offset = vcd_get_mrl_type_offset(&my_vcd, itemtype, &size); } - /* This is because entries start at 0 while other playable units + /* This is because entries start at 0 while other playable units start at 1. Can remove the below when everything has the same origin. */ @@ -1410,14 +1410,14 @@ vcd_class_get_autoplay_list (input_class_t *this_gen, int *num_files) } /*! - Things that need to be done when a stream is closed. + Things that need to be done when a stream is closed. */ -static void -vcd_plugin_dispose(input_plugin_t *this_gen) +static void +vcd_plugin_dispose(input_plugin_t *this_gen) { /* Not sure there's much more to do here... - In open_plugin we are given a stream which + In open_plugin we are given a stream which we save... */ dbg_print((INPUT_DBG_CALL|INPUT_DBG_EXT), "called\n"); @@ -1433,10 +1433,10 @@ vcd_plugin_dispose(input_plugin_t *this_gen) static vcd_log_handler_t gl_default_vcd_log_handler = NULL; static cdio_log_handler_t gl_default_cdio_log_handler = NULL; -/*! This routine is called by libvcd routines on error. +/*! This routine is called by libvcd routines on error. Setup is done by init_input_plugin. */ -static void +static void vcd_log_handler (vcd_log_level_t level, const char message[]) { switch (level) { @@ -1453,19 +1453,19 @@ vcd_log_handler (vcd_log_level_t level, const char message[]) LOG_ERR("%s", message); break; default: - LOG_ERR("%s\n%s %d", - message, - _("The above message had unknown vcdimager log level"), + LOG_ERR("%s\n%s %d", + message, + _("The above message had unknown vcdimager log level"), level); } - + /* gl_default_vcd_log_handler (level, message); */ } -/*! This routine is called by libcdio routines on error. +/*! This routine is called by libcdio routines on error. Setup is done by init_input_plugin. */ -static void +static void cdio_log_handler (cdio_log_level_t level, const char message[]) { switch (level) { @@ -1478,10 +1478,10 @@ cdio_log_handler (cdio_log_level_t level, const char message[]) } } -/*! This routine is when xine is not around. +/*! This routine is when xine is not around. Setup is done by vcd_class_dispose. */ -static void +static void uninit_log_handler (vcd_log_level_t level, const char message[]) { switch (level) { @@ -1501,25 +1501,25 @@ uninit_log_handler (vcd_log_level_t level, const char message[]) break; default: fprintf(stderr, "UNKNOWN ERROR: %s\n%s %d", - message, - _("The above message had unknown vcdimager log level"), + message, + _("The above message had unknown vcdimager log level"), level); } - + /* gl_default_vcd_log_handler (level, message); */ } /*! - Things that need to be done the vcd plugin is closed. + Things that need to be done the vcd plugin is closed. */ -static void +static void vcd_class_dispose (input_class_t *this_gen) { vcd_input_class_t *class = (vcd_input_class_t *) this_gen; class->xine->config->unregister_callback(class->xine->config, "media.vcd.device"); gl_default_vcd_log_handler = vcd_log_set_handler (uninit_log_handler); - gl_default_cdio_log_handler = + gl_default_cdio_log_handler = cdio_log_set_handler ((cdio_log_handler_t) uninit_log_handler); dbg_print((INPUT_DBG_CALL|INPUT_DBG_EXT), "called\n"); @@ -1528,22 +1528,22 @@ vcd_class_dispose (input_class_t *this_gen) { } /* Update the xine player title text. */ -static void -vcd_update_title_display(void) +static void +vcd_update_title_display(void) { xine_event_t uevent; xine_ui_data_t data; char *title_str; - - title_str = vcdplayer_format_str(&my_vcd.player, + + title_str = vcdplayer_format_str(&my_vcd.player, my_vcd.v_config.title_format); meta_info_assign(XINE_META_INFO_TITLE, my_vcd.stream, title_str); meta_info_assign(XINE_META_INFO_COMMENT, my_vcd.stream, - vcdplayer_format_str(&my_vcd.player, + vcdplayer_format_str(&my_vcd.player, my_vcd.v_config.comment_format)); - stream_info_assign(XINE_STREAM_INFO_VIDEO_HAS_STILL, my_vcd.stream, + stream_info_assign(XINE_STREAM_INFO_VIDEO_HAS_STILL, my_vcd.stream, my_vcd.player.i_still); /* Set_str title/chapter display */ @@ -1561,8 +1561,8 @@ vcd_update_title_display(void) } #if LIBVCD_VERSION_NUM >= 23 -static void -send_mouse_enter_leave_event(vcd_input_plugin_t *p_this, bool b_mouse_in) +static void +send_mouse_enter_leave_event(vcd_input_plugin_t *p_this, bool b_mouse_in) { if (b_mouse_in && p_this->b_mouse_in) { /* Set up to enter the following "if" statement. */ @@ -1572,16 +1572,16 @@ send_mouse_enter_leave_event(vcd_input_plugin_t *p_this, bool b_mouse_in) if (b_mouse_in != p_this->b_mouse_in) { xine_event_t event; xine_spu_button_t spu_event; - + spu_event.direction = b_mouse_in ? 1 : 0; spu_event.button = p_this->i_mouse_button; - + event.type = XINE_EVENT_SPU_BUTTON; event.stream = p_this->stream; event.data = &spu_event; event.data_length = sizeof(spu_event); xine_event_send(p_this->stream, &event); - + p_this->b_mouse_in = b_mouse_in; } @@ -1589,22 +1589,22 @@ send_mouse_enter_leave_event(vcd_input_plugin_t *p_this, bool b_mouse_in) p_this->i_mouse_button = -1; } #endif - -/* - Not much special initialization needed here. All of the initialization + +/* + Not much special initialization needed here. All of the initialization is either done in the class or when we have an actual MRL we want to deal with. */ -static int +static int vcd_plugin_open (input_plugin_t *this_gen ) { vcd_input_class_t *class = (vcd_input_class_t *) this_gen->input_class; gl_default_vcd_log_handler = vcd_log_set_handler (vcd_log_handler); gl_default_cdio_log_handler = cdio_log_set_handler (cdio_log_handler); - /* actually, this is also done by class initialization. But just in + /* actually, this is also done by class initialization. But just in case... */ - class->ip = &my_vcd; + class->ip = &my_vcd; my_vcd.i_old_still = 0; return 1; @@ -1615,17 +1615,17 @@ vcd_plugin_open (input_plugin_t *this_gen ) { routine is called, xine-lib can read blocks from the thing specified by the MRL, set the position of the thing specified by the MRL, get its size or read its current position... - + See vcdplayer_parses_mrl for the for the format that a valid MRL can take. - Return values: + Return values: pointer to input plugin NULL on failure */ static input_plugin_t * vcd_class_get_instance (input_class_t *class_gen, xine_stream_t *stream, - const char *mrl) + const char *mrl) { vcd_input_class_t *class = (vcd_input_class_t *) class_gen; @@ -1634,9 +1634,9 @@ vcd_class_get_instance (input_class_t *class_gen, xine_stream_t *stream, char *check_mrl=NULL; bool used_default; - if (mrl == NULL) + if (mrl == NULL) check_mrl = strdup(MRL_PREFIX); - else + else check_mrl = strdup(mrl); dbg_print((INPUT_DBG_CALL|INPUT_DBG_EXT), "called with %s\n", mrl); @@ -1647,7 +1647,7 @@ vcd_class_get_instance (input_class_t *class_gen, xine_stream_t *stream, vcd_get_default_device(class, false); - if (!vcd_parse_mrl(class->vcd_device, check_mrl, + if (!vcd_parse_mrl(class->vcd_device, check_mrl, intended_vcd_device, &itemid, my_vcd.player.default_autoplay, &used_default)) { dbg_print(INPUT_DBG_MRL, "parsing MRL %s failed\n", check_mrl); @@ -1667,32 +1667,32 @@ vcd_class_get_instance (input_class_t *class_gen, xine_stream_t *stream, my_vcd.player.user_data = (void *) class; /* Do we set PBC (via LID) on? */ - my_vcd.player.i_lid = - ( VCDINFO_ITEM_TYPE_LID == itemid.type + my_vcd.player.i_lid = + ( VCDINFO_ITEM_TYPE_LID == itemid.type && my_vcd.player.i_lids > itemid.num ) ? itemid.num : VCDINFO_INVALID_ENTRY; if ( VCDINFO_ITEM_TYPE_LID == itemid.type && used_default) { - /* LID was selected automatically but we don't have PBC for this VCD. + /* LID was selected automatically but we don't have PBC for this VCD. So silently change LID to track and continue. */ itemid.type=VCDINFO_ITEM_TYPE_TRACK; } - if ( 0==itemid.num - && ( (VCDINFO_ITEM_TYPE_LID == itemid.type) + if ( 0==itemid.num + && ( (VCDINFO_ITEM_TYPE_LID == itemid.type) || (VCDINFO_ITEM_TYPE_TRACK == itemid.type) ) ) itemid.num = 1; - dbg_print(INPUT_DBG_PBC, "Jumping to NUM >%i<, type >%i<\n", + dbg_print(INPUT_DBG_PBC, "Jumping to NUM >%i<, type >%i<\n", itemid.num, itemid.type); vcd_set_meta_info(&my_vcd); vcdplayer_play(&my_vcd.player, itemid); - - dbg_print(INPUT_DBG_MRL, "Successfully opened MRL %s.\n", + + dbg_print(INPUT_DBG_MRL, "Successfully opened MRL %s.\n", my_vcd.mrl); free (check_mrl); @@ -1731,30 +1731,30 @@ vcd_class_get_instance (input_class_t *class_gen, xine_stream_t *stream, var = strdup(entry->str_value); \ } -VCD_STR_CALLBACK(vcd_default_dev_changed_cb, +VCD_STR_CALLBACK(vcd_default_dev_changed_cb, my_vcd.class->vcd_device) -VCD_STR_CALLBACK(vcd_title_format_changed_cb, +VCD_STR_CALLBACK(vcd_title_format_changed_cb, my_vcd.v_config.title_format) -VCD_STR_CALLBACK(vcd_comment_format_changed_cb, +VCD_STR_CALLBACK(vcd_comment_format_changed_cb, my_vcd.v_config.comment_format) VCD_NUM_CALLBACK(vcd_show_rejected_cb, show_rejected) VCD_NUM_CALLBACK(vcd_autoadvance_cb, autoadvance) -VCD_ENUM_CALLBACK(vcd_slider_length_cb, vcdplayer_slider_length_t, +VCD_ENUM_CALLBACK(vcd_slider_length_cb, vcdplayer_slider_length_t, slider_length) VCD_ENUM_CALLBACK(vcd_default_autoplay_cb, vcdinfo_item_enum_t, default_autoplay) -static void -vcd_debug_cb(void *this_gen, xine_cfg_entry_t *entry) +static void +vcd_debug_cb(void *this_gen, xine_cfg_entry_t *entry) { dbg_print(INPUT_DBG_CALL, "Called setting %d\n", entry->num_value); - vcdplayer_debug = entry->num_value; + vcdplayer_debug = entry->num_value; } static void * @@ -1776,7 +1776,7 @@ vcd_init (xine_t *xine, void *data) class->input_class.get_instance = vcd_class_get_instance; class->input_class.get_identifier = vcd_class_get_identifier; class->input_class.get_description = vcd_class_get_description; - class->input_class.get_dir = vcd_class_get_dir; + class->input_class.get_dir = vcd_class_get_dir; class->input_class.get_autoplay_list = vcd_class_get_autoplay_list; class->input_class.dispose = vcd_class_dispose; class->input_class.eject_media = vcd_class_eject_media; @@ -1792,9 +1792,9 @@ vcd_init (xine_t *xine, void *data) my_vcd.player.log_msg = (generic_fn) &xine_log_msg; my_vcd.player.force_redisplay = &vcd_force_redisplay; my_vcd.player.set_aspect_ratio = &vcd_set_aspect_ratio; - + /*------------------------------------------------------------- - Playback control-specific fields + Playback control-specific fields --------------------------------------------------------------*/ my_vcd.player.i_lid = VCDINFO_INVALID_ENTRY; @@ -1810,58 +1810,58 @@ vcd_init (xine_t *xine, void *data) my_vcd.player.prev_entry = -1; my_vcd.player.return_entry = -1; my_vcd.player.default_entry = -1; - + /*-------------------------------------------------------------- Configuration variables ---------------------------------------------------------------*/ - { + { /*Note: these labels have to be listed in the same order as the - enumeration vcdplayer_autoplay_t in vcdplayer.h. + enumeration vcdplayer_autoplay_t in vcdplayer.h. */ - static const char *autoplay_modes[] = + static const char *autoplay_modes[] = { "MPEG track", "entry", "segment", "playback-control item", NULL }; - + /*Note: these labels have to be listed in the same order as the - enumeration vcdplayer_slider_length_t in vcdplayer.h. + enumeration vcdplayer_slider_length_t in vcdplayer.h. */ - static const char *length_reporting_modes[] = + static const char *length_reporting_modes[] = { "auto", "track", "entry", NULL }; - - my_vcd.player.default_autoplay = - config->register_enum(config, + + my_vcd.player.default_autoplay = + config->register_enum(config, "media.vcd.autoplay", VCDPLAYER_AUTOPLAY_PBC, (char **) autoplay_modes, _("VCD default type to use on autoplay"), _("The VCD play unit to use when none is specified in an MRL, e.g. " "vcd:// or vcd:///dev/dvd:"), - 10, + 10, vcd_default_autoplay_cb, class); - - - class->vcd_device = - strdup (config->register_filename(config, + + + class->vcd_device = + strdup (config->register_filename(config, "media.vcd.device", "", XINE_CONFIG_STRING_IS_DEVICE_NAME, _("CD-ROM drive used for VCD when none given"), -_("What to use if no drive specified. If the setting is empty, xine will scan for CD drives."), +_("What to use if no drive specified. If the setting is empty, xine will scan for CD drives."), 20, - vcd_default_dev_changed_cb, + vcd_default_dev_changed_cb, (void *) class)); my_vcd.player.slider_length = - config->register_enum(config, + config->register_enum(config, "media.vcd.length_reporting", - VCDPLAYER_SLIDER_LENGTH_AUTO, + VCDPLAYER_SLIDER_LENGTH_AUTO, (char **) length_reporting_modes, _("VCD position slider range"), _("range that the stream playback position slider represents playing a VCD."), - 10, + 10, vcd_slider_length_cb, NULL); #if READAHEAD_FINISHED - my_vcd.player.readahead = + my_vcd.player.readahead = config->register_bool(config, "vcd.use_readahead", (int) false, _("VCD read-ahead caching?"), @@ -1871,29 +1871,29 @@ _("range that the stream playback position slider represents playing a VCD."), vcd_read_ahead_cb, NULL); #endif - my_vcd.player.autoadvance = - config->register_bool(config, + my_vcd.player.autoadvance = + config->register_bool(config, "media.vcd.autoadvance", (int) true, _("automatically advance VCD track/entry"), _("If enabled, we should automatically advance to the next entry or track. Used only when playback control (PBC) is disabled."), - 10, - vcd_autoadvance_cb, - NULL); + 10, + vcd_autoadvance_cb, + NULL); - my_vcd.player.show_rejected = - config->register_bool(config, + my_vcd.player.show_rejected = + config->register_bool(config, "media.vcd.show_rejected", (int) false, _("show 'rejected' VCD LIDs"), _("Some playback list IDs (LIDs) are marked not showable, " "but you can see them in the MRL list if this is set. Rejected entries " "are marked with an asterisk (*) appended to the MRL."), - 10, - vcd_show_rejected_cb, - NULL); + 10, + vcd_show_rejected_cb, + NULL); - my_vcd.v_config.title_format = + my_vcd.v_config.title_format = strdup(config->register_string(config, "media.vcd.title_format", "%F - %I %N%L%S, disk %c of %C - %v %A", @@ -1919,7 +1919,7 @@ _("VCD format used in the GUI Title. Similar to the Unix date " vcd_title_format_changed_cb, NULL)); - my_vcd.v_config.comment_format = + my_vcd.v_config.comment_format = strdup(config->register_string(config, "media.vcd.comment_format", "%P - Track %T", @@ -1932,8 +1932,8 @@ _("VCD format used in the GUI Title. Similar to the Unix date " vcd_comment_format_changed_cb, NULL)); - vcdplayer_debug = - config->register_num(config, + vcdplayer_debug = + config->register_num(config, "media.vcd.debug", 0, _("VCD debug flag mask"), @@ -1952,12 +1952,12 @@ _("For tracking down bugs in the VCD plugin. Mask values are:\n" "2048: Debugging from VCDINFO\n" ), 20, - vcd_debug_cb, - class); + vcd_debug_cb, + class); } - + gl_default_vcd_log_handler = vcd_log_set_handler (uninit_log_handler); - gl_default_cdio_log_handler = + gl_default_cdio_log_handler = cdio_log_set_handler ((cdio_log_handler_t) uninit_log_handler); my_vcd.input_plugin.open = vcd_plugin_open; @@ -1977,7 +1977,7 @@ _("For tracking down bugs in the VCD plugin. Mask values are:\n" my_vcd.class = class; my_vcd.i_mouse_button = -1; my_vcd.b_mouse_in = false; - + my_vcd.player.psz_source = NULL; my_vcd.player.b_opened = false; @@ -1989,11 +1989,11 @@ _("For tracking down bugs in the VCD plugin. Mask values are:\n" return class; } -/* +/* Exported plugin catalog entries. All plugins listing only the current API number break when the API - number is increased. This is by design. + number is increased. This is by design. Sometimes in the rush to get out a buggy release, the API number is increased without communication let alone a concern for whether it @@ -2010,13 +2010,13 @@ _("For tracking down bugs in the VCD plugin. Mask values are:\n" */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_INPUT | PLUGIN_MUST_PRELOAD, 17, (char *) SHORT_PLUGIN_NAME, XINE_VERSION_CODE, NULL, vcd_init }, { PLUGIN_NONE, 0, (char *) "", 0, NULL, NULL } }; -/* +/* * Local variables: * c-file-style: "gnu" * tab-width: 8 diff --git a/src/input/videodev2.h b/src/input/videodev2.h index ce32ec9eb..7863e454b 100644 --- a/src/input/videodev2.h +++ b/src/input/videodev2.h @@ -113,14 +113,14 @@ enum v4l2_field { transmitted first */ }; #define V4L2_FIELD_HAS_TOP(field) \ - ((field) == V4L2_FIELD_TOP ||\ + ((field) == V4L2_FIELD_TOP ||\ (field) == V4L2_FIELD_INTERLACED ||\ (field) == V4L2_FIELD_INTERLACED_TB ||\ (field) == V4L2_FIELD_INTERLACED_BT ||\ (field) == V4L2_FIELD_SEQ_TB ||\ (field) == V4L2_FIELD_SEQ_BT) #define V4L2_FIELD_HAS_BOTTOM(field) \ - ((field) == V4L2_FIELD_BOTTOM ||\ + ((field) == V4L2_FIELD_BOTTOM ||\ (field) == V4L2_FIELD_INTERLACED ||\ (field) == V4L2_FIELD_INTERLACED_TB ||\ (field) == V4L2_FIELD_INTERLACED_BT ||\ @@ -254,12 +254,12 @@ struct v4l2_capability */ struct v4l2_pix_format { - __u32 width; + __u32 width; __u32 height; __u32 pixelformat; - enum v4l2_field field; - __u32 bytesperline; /* for padding, zero if unused */ - __u32 sizeimage; + enum v4l2_field field; + __u32 bytesperline; /* for padding, zero if unused */ + __u32 sizeimage; enum v4l2_colorspace colorspace; __u32 priv; /* private data, depends on pixelformat */ }; @@ -542,7 +542,7 @@ struct v4l2_clip struct v4l2_window { struct v4l2_rect w; - enum v4l2_field field; + enum v4l2_field field; __u32 chromakey; struct v4l2_clip *clips; __u32 clipcount; @@ -660,7 +660,7 @@ typedef __u64 v4l2_std_id; #define V4L2_STD_NTSC (V4L2_STD_NTSC_M |\ V4L2_STD_NTSC_M_JP |\ V4L2_STD_NTSC_M_KR) -#define V4L2_STD_SECAM_DK (V4L2_STD_SECAM_D |\ +#define V4L2_STD_SECAM_DK (V4L2_STD_SECAM_D |\ V4L2_STD_SECAM_K |\ V4L2_STD_SECAM_K1) #define V4L2_STD_SECAM (V4L2_STD_SECAM_B |\ @@ -784,7 +784,7 @@ struct v4l2_ext_controls #define V4L2_CTRL_CLASS_USER 0x00980000 /* Old-style 'user' controls */ #define V4L2_CTRL_CLASS_MPEG 0x00990000 /* MPEG-compression controls */ -#define V4L2_CTRL_ID_MASK (0x0fffffff) +#define V4L2_CTRL_ID_MASK (0x0fffffff) #define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL) #define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000) @@ -814,21 +814,21 @@ struct v4l2_querymenu /* Control flags */ #define V4L2_CTRL_FLAG_DISABLED 0x0001 #define V4L2_CTRL_FLAG_GRABBED 0x0002 -#define V4L2_CTRL_FLAG_READ_ONLY 0x0004 -#define V4L2_CTRL_FLAG_UPDATE 0x0008 -#define V4L2_CTRL_FLAG_INACTIVE 0x0010 -#define V4L2_CTRL_FLAG_SLIDER 0x0020 +#define V4L2_CTRL_FLAG_READ_ONLY 0x0004 +#define V4L2_CTRL_FLAG_UPDATE 0x0008 +#define V4L2_CTRL_FLAG_INACTIVE 0x0010 +#define V4L2_CTRL_FLAG_SLIDER 0x0020 /* Query flag, to be ORed with the control ID */ #define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000 /* User-class control IDs defined by V4L2 */ #define V4L2_CID_BASE (V4L2_CTRL_CLASS_USER | 0x900) -#define V4L2_CID_USER_BASE V4L2_CID_BASE +#define V4L2_CID_USER_BASE V4L2_CID_BASE /* IDs reserved for driver specific controls */ #define V4L2_CID_PRIVATE_BASE 0x08000000 -#define V4L2_CID_USER_CLASS (V4L2_CTRL_CLASS_USER | 1) +#define V4L2_CID_USER_CLASS (V4L2_CTRL_CLASS_USER | 1) #define V4L2_CID_BRIGHTNESS (V4L2_CID_BASE+0) #define V4L2_CID_CONTRAST (V4L2_CID_BASE+1) #define V4L2_CID_SATURATION (V4L2_CID_BASE+2) @@ -856,11 +856,11 @@ struct v4l2_querymenu #define V4L2_CID_LASTP1 (V4L2_CID_BASE+24) /* last CID + 1 */ /* MPEG-class control IDs defined by V4L2 */ -#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900) -#define V4L2_CID_MPEG_CLASS (V4L2_CTRL_CLASS_MPEG | 1) +#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900) +#define V4L2_CID_MPEG_CLASS (V4L2_CTRL_CLASS_MPEG | 1) /* MPEG streams */ -#define V4L2_CID_MPEG_STREAM_TYPE (V4L2_CID_MPEG_BASE+0) +#define V4L2_CID_MPEG_STREAM_TYPE (V4L2_CID_MPEG_BASE+0) enum v4l2_mpeg_stream_type { V4L2_MPEG_STREAM_TYPE_MPEG2_PS = 0, /* MPEG-2 program stream */ V4L2_MPEG_STREAM_TYPE_MPEG2_TS = 1, /* MPEG-2 transport stream */ @@ -869,32 +869,32 @@ enum v4l2_mpeg_stream_type { V4L2_MPEG_STREAM_TYPE_MPEG1_VCD = 4, /* MPEG-1 VCD-compatible stream */ V4L2_MPEG_STREAM_TYPE_MPEG2_SVCD = 5, /* MPEG-2 SVCD-compatible stream */ }; -#define V4L2_CID_MPEG_STREAM_PID_PMT (V4L2_CID_MPEG_BASE+1) -#define V4L2_CID_MPEG_STREAM_PID_AUDIO (V4L2_CID_MPEG_BASE+2) -#define V4L2_CID_MPEG_STREAM_PID_VIDEO (V4L2_CID_MPEG_BASE+3) -#define V4L2_CID_MPEG_STREAM_PID_PCR (V4L2_CID_MPEG_BASE+4) -#define V4L2_CID_MPEG_STREAM_PES_ID_AUDIO (V4L2_CID_MPEG_BASE+5) -#define V4L2_CID_MPEG_STREAM_PES_ID_VIDEO (V4L2_CID_MPEG_BASE+6) -#define V4L2_CID_MPEG_STREAM_VBI_FMT (V4L2_CID_MPEG_BASE+7) +#define V4L2_CID_MPEG_STREAM_PID_PMT (V4L2_CID_MPEG_BASE+1) +#define V4L2_CID_MPEG_STREAM_PID_AUDIO (V4L2_CID_MPEG_BASE+2) +#define V4L2_CID_MPEG_STREAM_PID_VIDEO (V4L2_CID_MPEG_BASE+3) +#define V4L2_CID_MPEG_STREAM_PID_PCR (V4L2_CID_MPEG_BASE+4) +#define V4L2_CID_MPEG_STREAM_PES_ID_AUDIO (V4L2_CID_MPEG_BASE+5) +#define V4L2_CID_MPEG_STREAM_PES_ID_VIDEO (V4L2_CID_MPEG_BASE+6) +#define V4L2_CID_MPEG_STREAM_VBI_FMT (V4L2_CID_MPEG_BASE+7) enum v4l2_mpeg_stream_vbi_fmt { V4L2_MPEG_STREAM_VBI_FMT_NONE = 0, /* No VBI in the MPEG stream */ V4L2_MPEG_STREAM_VBI_FMT_IVTV = 1, /* VBI in private packets, IVTV format */ }; /* MPEG audio */ -#define V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ (V4L2_CID_MPEG_BASE+100) +#define V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ (V4L2_CID_MPEG_BASE+100) enum v4l2_mpeg_audio_sampling_freq { V4L2_MPEG_AUDIO_SAMPLING_FREQ_44100 = 0, V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000 = 1, V4L2_MPEG_AUDIO_SAMPLING_FREQ_32000 = 2, }; -#define V4L2_CID_MPEG_AUDIO_ENCODING (V4L2_CID_MPEG_BASE+101) +#define V4L2_CID_MPEG_AUDIO_ENCODING (V4L2_CID_MPEG_BASE+101) enum v4l2_mpeg_audio_encoding { V4L2_MPEG_AUDIO_ENCODING_LAYER_1 = 0, V4L2_MPEG_AUDIO_ENCODING_LAYER_2 = 1, V4L2_MPEG_AUDIO_ENCODING_LAYER_3 = 2, }; -#define V4L2_CID_MPEG_AUDIO_L1_BITRATE (V4L2_CID_MPEG_BASE+102) +#define V4L2_CID_MPEG_AUDIO_L1_BITRATE (V4L2_CID_MPEG_BASE+102) enum v4l2_mpeg_audio_l1_bitrate { V4L2_MPEG_AUDIO_L1_BITRATE_32K = 0, V4L2_MPEG_AUDIO_L1_BITRATE_64K = 1, @@ -911,7 +911,7 @@ enum v4l2_mpeg_audio_l1_bitrate { V4L2_MPEG_AUDIO_L1_BITRATE_416K = 12, V4L2_MPEG_AUDIO_L1_BITRATE_448K = 13, }; -#define V4L2_CID_MPEG_AUDIO_L2_BITRATE (V4L2_CID_MPEG_BASE+103) +#define V4L2_CID_MPEG_AUDIO_L2_BITRATE (V4L2_CID_MPEG_BASE+103) enum v4l2_mpeg_audio_l2_bitrate { V4L2_MPEG_AUDIO_L2_BITRATE_32K = 0, V4L2_MPEG_AUDIO_L2_BITRATE_48K = 1, @@ -928,7 +928,7 @@ enum v4l2_mpeg_audio_l2_bitrate { V4L2_MPEG_AUDIO_L2_BITRATE_320K = 12, V4L2_MPEG_AUDIO_L2_BITRATE_384K = 13, }; -#define V4L2_CID_MPEG_AUDIO_L3_BITRATE (V4L2_CID_MPEG_BASE+104) +#define V4L2_CID_MPEG_AUDIO_L3_BITRATE (V4L2_CID_MPEG_BASE+104) enum v4l2_mpeg_audio_l3_bitrate { V4L2_MPEG_AUDIO_L3_BITRATE_32K = 0, V4L2_MPEG_AUDIO_L3_BITRATE_40K = 1, @@ -945,70 +945,70 @@ enum v4l2_mpeg_audio_l3_bitrate { V4L2_MPEG_AUDIO_L3_BITRATE_256K = 12, V4L2_MPEG_AUDIO_L3_BITRATE_320K = 13, }; -#define V4L2_CID_MPEG_AUDIO_MODE (V4L2_CID_MPEG_BASE+105) +#define V4L2_CID_MPEG_AUDIO_MODE (V4L2_CID_MPEG_BASE+105) enum v4l2_mpeg_audio_mode { V4L2_MPEG_AUDIO_MODE_STEREO = 0, V4L2_MPEG_AUDIO_MODE_JOINT_STEREO = 1, V4L2_MPEG_AUDIO_MODE_DUAL = 2, V4L2_MPEG_AUDIO_MODE_MONO = 3, }; -#define V4L2_CID_MPEG_AUDIO_MODE_EXTENSION (V4L2_CID_MPEG_BASE+106) +#define V4L2_CID_MPEG_AUDIO_MODE_EXTENSION (V4L2_CID_MPEG_BASE+106) enum v4l2_mpeg_audio_mode_extension { V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_4 = 0, V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_8 = 1, V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_12 = 2, V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_16 = 3, }; -#define V4L2_CID_MPEG_AUDIO_EMPHASIS (V4L2_CID_MPEG_BASE+107) +#define V4L2_CID_MPEG_AUDIO_EMPHASIS (V4L2_CID_MPEG_BASE+107) enum v4l2_mpeg_audio_emphasis { V4L2_MPEG_AUDIO_EMPHASIS_NONE = 0, V4L2_MPEG_AUDIO_EMPHASIS_50_DIV_15_uS = 1, V4L2_MPEG_AUDIO_EMPHASIS_CCITT_J17 = 2, }; -#define V4L2_CID_MPEG_AUDIO_CRC (V4L2_CID_MPEG_BASE+108) +#define V4L2_CID_MPEG_AUDIO_CRC (V4L2_CID_MPEG_BASE+108) enum v4l2_mpeg_audio_crc { V4L2_MPEG_AUDIO_CRC_NONE = 0, V4L2_MPEG_AUDIO_CRC_CRC16 = 1, }; -#define V4L2_CID_MPEG_AUDIO_MUTE (V4L2_CID_MPEG_BASE+109) +#define V4L2_CID_MPEG_AUDIO_MUTE (V4L2_CID_MPEG_BASE+109) /* MPEG video */ -#define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200) +#define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200) enum v4l2_mpeg_video_encoding { V4L2_MPEG_VIDEO_ENCODING_MPEG_1 = 0, V4L2_MPEG_VIDEO_ENCODING_MPEG_2 = 1, }; -#define V4L2_CID_MPEG_VIDEO_ASPECT (V4L2_CID_MPEG_BASE+201) +#define V4L2_CID_MPEG_VIDEO_ASPECT (V4L2_CID_MPEG_BASE+201) enum v4l2_mpeg_video_aspect { V4L2_MPEG_VIDEO_ASPECT_1x1 = 0, V4L2_MPEG_VIDEO_ASPECT_4x3 = 1, V4L2_MPEG_VIDEO_ASPECT_16x9 = 2, V4L2_MPEG_VIDEO_ASPECT_221x100 = 3, }; -#define V4L2_CID_MPEG_VIDEO_B_FRAMES (V4L2_CID_MPEG_BASE+202) -#define V4L2_CID_MPEG_VIDEO_GOP_SIZE (V4L2_CID_MPEG_BASE+203) -#define V4L2_CID_MPEG_VIDEO_GOP_CLOSURE (V4L2_CID_MPEG_BASE+204) -#define V4L2_CID_MPEG_VIDEO_PULLDOWN (V4L2_CID_MPEG_BASE+205) -#define V4L2_CID_MPEG_VIDEO_BITRATE_MODE (V4L2_CID_MPEG_BASE+206) +#define V4L2_CID_MPEG_VIDEO_B_FRAMES (V4L2_CID_MPEG_BASE+202) +#define V4L2_CID_MPEG_VIDEO_GOP_SIZE (V4L2_CID_MPEG_BASE+203) +#define V4L2_CID_MPEG_VIDEO_GOP_CLOSURE (V4L2_CID_MPEG_BASE+204) +#define V4L2_CID_MPEG_VIDEO_PULLDOWN (V4L2_CID_MPEG_BASE+205) +#define V4L2_CID_MPEG_VIDEO_BITRATE_MODE (V4L2_CID_MPEG_BASE+206) enum v4l2_mpeg_video_bitrate_mode { V4L2_MPEG_VIDEO_BITRATE_MODE_VBR = 0, V4L2_MPEG_VIDEO_BITRATE_MODE_CBR = 1, }; -#define V4L2_CID_MPEG_VIDEO_BITRATE (V4L2_CID_MPEG_BASE+207) -#define V4L2_CID_MPEG_VIDEO_BITRATE_PEAK (V4L2_CID_MPEG_BASE+208) +#define V4L2_CID_MPEG_VIDEO_BITRATE (V4L2_CID_MPEG_BASE+207) +#define V4L2_CID_MPEG_VIDEO_BITRATE_PEAK (V4L2_CID_MPEG_BASE+208) #define V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION (V4L2_CID_MPEG_BASE+209) -#define V4L2_CID_MPEG_VIDEO_MUTE (V4L2_CID_MPEG_BASE+210) -#define V4L2_CID_MPEG_VIDEO_MUTE_YUV (V4L2_CID_MPEG_BASE+211) +#define V4L2_CID_MPEG_VIDEO_MUTE (V4L2_CID_MPEG_BASE+210) +#define V4L2_CID_MPEG_VIDEO_MUTE_YUV (V4L2_CID_MPEG_BASE+211) /* MPEG-class control IDs specific to the CX2584x driver as defined by V4L2 */ -#define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000) -#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+0) +#define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000) +#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+0) enum v4l2_mpeg_cx2341x_video_spatial_filter_mode { V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_MANUAL = 0, V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO = 1, }; -#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE+1) -#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+2) +#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE+1) +#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+2) enum v4l2_mpeg_cx2341x_video_luma_spatial_filter_type { V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_OFF = 0, V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_HOR = 1, @@ -1016,18 +1016,18 @@ enum v4l2_mpeg_cx2341x_video_luma_spatial_filter_type { V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_HV_SEPARABLE = 3, V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_SYM_NON_SEPARABLE = 4, }; -#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+3) +#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+3) enum v4l2_mpeg_cx2341x_video_chroma_spatial_filter_type { V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_OFF = 0, V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR = 1, }; -#define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+4) +#define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+4) enum v4l2_mpeg_cx2341x_video_temporal_filter_mode { V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL = 0, V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_AUTO = 1, }; -#define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE+5) -#define V4L2_CID_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+6) +#define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE+5) +#define V4L2_CID_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+6) enum v4l2_mpeg_cx2341x_video_median_filter_type { V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF = 0, V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR = 1, @@ -1035,11 +1035,11 @@ enum v4l2_mpeg_cx2341x_video_median_filter_type { V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR_VERT = 3, V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_DIAG = 4, }; -#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+7) -#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+8) +#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+7) +#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+8) #define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+9) -#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+10) -#define V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS (V4L2_CID_MPEG_CX2341X_BASE+11) +#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+10) +#define V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS (V4L2_CID_MPEG_CX2341X_BASE+11) /* * T U N I N G @@ -1362,8 +1362,8 @@ struct v4l2_chip_ident { #define VIDIOC_S_CROP _IOW ('V', 60, struct v4l2_crop) #define VIDIOC_G_JPEGCOMP _IOR ('V', 61, struct v4l2_jpegcompression) #define VIDIOC_S_JPEGCOMP _IOW ('V', 62, struct v4l2_jpegcompression) -#define VIDIOC_QUERYSTD _IOR ('V', 63, v4l2_std_id) -#define VIDIOC_TRY_FMT _IOWR ('V', 64, struct v4l2_format) +#define VIDIOC_QUERYSTD _IOR ('V', 63, v4l2_std_id) +#define VIDIOC_TRY_FMT _IOWR ('V', 64, struct v4l2_format) #define VIDIOC_ENUMAUDIO _IOWR ('V', 65, struct v4l2_audio) #define VIDIOC_ENUMAUDOUT _IOWR ('V', 66, struct v4l2_audioout) #define VIDIOC_G_PRIORITY _IOR ('V', 67, enum v4l2_priority) @@ -1381,20 +1381,20 @@ struct v4l2_chip_ident { #define VIDIOC_TRY_ENCODER_CMD _IOWR ('V', 78, struct v4l2_encoder_cmd) /* Experimental, only implemented if CONFIG_VIDEO_ADV_DEBUG is defined */ -#define VIDIOC_DBG_S_REGISTER _IOW ('V', 79, struct v4l2_register) -#define VIDIOC_DBG_G_REGISTER _IOWR ('V', 80, struct v4l2_register) +#define VIDIOC_DBG_S_REGISTER _IOW ('V', 79, struct v4l2_register) +#define VIDIOC_DBG_G_REGISTER _IOWR ('V', 80, struct v4l2_register) #define VIDIOC_G_CHIP_IDENT _IOWR ('V', 81, struct v4l2_chip_ident) #endif #ifdef __OLD_VIDIOC_ /* for compatibility, will go away some day */ -#define VIDIOC_OVERLAY_OLD _IOWR ('V', 14, int) -#define VIDIOC_S_PARM_OLD _IOW ('V', 22, struct v4l2_streamparm) -#define VIDIOC_S_CTRL_OLD _IOW ('V', 28, struct v4l2_control) -#define VIDIOC_G_AUDIO_OLD _IOWR ('V', 33, struct v4l2_audio) -#define VIDIOC_G_AUDOUT_OLD _IOWR ('V', 49, struct v4l2_audioout) -#define VIDIOC_CROPCAP_OLD _IOR ('V', 58, struct v4l2_cropcap) +#define VIDIOC_OVERLAY_OLD _IOWR ('V', 14, int) +#define VIDIOC_S_PARM_OLD _IOW ('V', 22, struct v4l2_streamparm) +#define VIDIOC_S_CTRL_OLD _IOW ('V', 28, struct v4l2_control) +#define VIDIOC_G_AUDIO_OLD _IOWR ('V', 33, struct v4l2_audio) +#define VIDIOC_G_AUDOUT_OLD _IOWR ('V', 49, struct v4l2_audioout) +#define VIDIOC_CROPCAP_OLD _IOR ('V', 58, struct v4l2_cropcap) #endif #define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */ diff --git a/src/liba52/bit_allocate.c b/src/liba52/bit_allocate.c index 0567b2285..9da1661dc 100644 --- a/src/liba52/bit_allocate.c +++ b/src/liba52/bit_allocate.c @@ -100,7 +100,7 @@ static int8_t latab[256] = { 0, 0, 0, 0 }; -#define UPDATE_LEAK() \ +#define UPDATE_LEAK() \ do { \ fastleak += fdecay; \ if (fastleak > psd + fgain) \ diff --git a/src/liba52/bitstream.c b/src/liba52/bitstream.c index 04e8ca6d0..b645cb79f 100644 --- a/src/liba52/bitstream.c +++ b/src/liba52/bitstream.c @@ -88,7 +88,7 @@ int32_t a52_bitstream_get_bh_2 (a52_state_t * state, uint32_t num_bits) if (num_bits != 0) result = (result << num_bits) | (state->current_word >> (32 - num_bits)); - + state->bits_left = 32 - num_bits; return result; diff --git a/src/liba52/bitstream.h b/src/liba52/bitstream.h index f242c37c4..59f91cc0e 100644 --- a/src/liba52/bitstream.h +++ b/src/liba52/bitstream.h @@ -57,7 +57,7 @@ int32_t a52_bitstream_get_bh_2 (a52_state_t * state, uint32_t num_bits); static inline uint32_t bitstream_get (a52_state_t * state, uint32_t num_bits) { uint32_t result; - + if (num_bits < state->bits_left) { result = (state->current_word << (32 - state->bits_left)) >> (32 - num_bits); state->bits_left -= num_bits; @@ -70,7 +70,7 @@ static inline uint32_t bitstream_get (a52_state_t * state, uint32_t num_bits) static inline int32_t bitstream_get_2 (a52_state_t * state, uint32_t num_bits) { int32_t result; - + if (num_bits < state->bits_left) { result = (((int32_t)state->current_word) << (32 - state->bits_left)) >> (32 - num_bits); state->bits_left -= num_bits; diff --git a/src/liba52/crc.c b/src/liba52/crc.c index 38254c9ef..ac7666a90 100644 --- a/src/liba52/crc.c +++ b/src/liba52/crc.c @@ -1,23 +1,23 @@ -/* +/* * crc.c * * Copyright (C) Aaron Holtzman - May 1999 * * This file is part of ac3dec, a free Dolby AC-3 stream decoder. - * + * * ac3dec 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. - * + * * ac3dec 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ @@ -25,7 +25,7 @@ #include <stdio.h> #include <inttypes.h> -static const uint16_t crc_lut[256] = +static const uint16_t crc_lut[256] = { 0x0000,0x8005,0x800f,0x000a,0x801b,0x001e,0x0014,0x8011, 0x8033,0x0036,0x003c,0x8039,0x0028,0x802d,0x8027,0x0022, diff --git a/src/liba52/imdct.c b/src/liba52/imdct.c index 5835e70a1..672b54c2e 100644 --- a/src/liba52/imdct.c +++ b/src/liba52/imdct.c @@ -247,7 +247,7 @@ void a52_imdct_512 (sample_t * data, sample_t * delay, sample_t bias) sample_t t_r, t_i, a_r, a_i, b_r, b_i, w_1, w_2; const sample_t * window = a52_imdct_window; complex_t buf[128]; - + for (i = 0; i < 128; i++) { k = fftorder[i]; t_r = pre1[i].real; @@ -311,7 +311,7 @@ void a52_imdct_256(sample_t * data, sample_t * delay, sample_t bias) /* Post IFFT complex multiply */ /* Window and convert to real valued signal */ for (i = 0; i < 32; i++) { - /* y1[n] = z1[n] * (xcos2[n] + j * xs in2[n]) ; */ + /* y1[n] = z1[n] * (xcos2[n] + j * xs in2[n]) ; */ t_r = post2[i].real; t_i = post2[i].imag; diff --git a/src/liba52/parse.c b/src/liba52/parse.c index f1adc2f40..c7531ec61 100644 --- a/src/liba52/parse.c +++ b/src/liba52/parse.c @@ -253,7 +253,7 @@ static int parse_exponents (a52_state_t * state, int expstr, int ngrps, case EXP_D15: *(dest++) = exponent; } - } + } return 0; } @@ -301,7 +301,7 @@ static inline int16_t dither_gen (a52_state_t * state) int16_t nstate; nstate = dither_lut[state->lfsr_state >> 8] ^ (state->lfsr_state << 8); - + state->lfsr_state = (uint16_t) nstate; return nstate; @@ -631,7 +631,7 @@ int a52_block (a52_state_t * state) cplexpstr = bitstream_get (state, 2); for (i = 0; i < nfchans; i++) chexpstr[i] = bitstream_get (state, 2); - if (state->lfeon) + if (state->lfeon) lfeexpstr = bitstream_get (state, 1); for (i = 0; i < nfchans; i++) @@ -849,7 +849,7 @@ int a52_block (a52_state_t * state) if (blksw[i]) a52_imdct_256 (samples + 256 * i, samples + 1536 + 256 * i, bias); - else + else a52_imdct_512 (samples + 256 * i, samples + 1536 + 256 * i, bias); } else { @@ -878,7 +878,7 @@ int a52_block (a52_state_t * state) for (i = 0; i < nfchans; i++) a52_imdct_256 (samples + 256 * i, samples + 1536 + 256 * i, state->bias); - else + else for (i = 0; i < nfchans; i++) a52_imdct_512 (samples + 256 * i, samples + 1536 + 256 * i, state->bias); diff --git a/src/liba52/xine_a52_decoder.c b/src/liba52/xine_a52_decoder.c index 47babce7a..9e590f77d 100644 --- a/src/liba52/xine_a52_decoder.c +++ b/src/liba52/xine_a52_decoder.c @@ -72,11 +72,11 @@ int a52file; typedef struct { audio_decoder_class_t decoder_class; config_values_t *config; - + float a52_level; int disable_dynrng_compress; int enable_surround_downmix; - + } a52dec_class_t; typedef struct a52dec_decoder_s { @@ -221,7 +221,7 @@ static void a52dec_decode_frame (a52dec_decoder_t *this, int64_t pts, int previe */ #ifdef LOG_PTS printf("a52dec:decode_frame:pts=%lld\n",pts); -#endif +#endif if (!this->bypass_mode) { int a52_output_flags, i; @@ -273,7 +273,7 @@ static void a52dec_decode_frame (a52dec_decoder_t *this, int64_t pts, int previe this->stream->audio_out->close (this->stream->audio_out, this->stream); - this->output_open = (this->stream->audio_out->open) (this->stream->audio_out, + this->output_open = (this->stream->audio_out->open) (this->stream->audio_out, this->stream, 16, this->a52_sample_rate, output_mode) ; @@ -297,13 +297,13 @@ static void a52dec_decode_frame (a52dec_decoder_t *this, int64_t pts, int previe for (i = 0; i < 6; i++) { if (a52_block (this->a52_state)) { xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "liba52: a52_block error on audio channel %d\n", i); -#if 0 +#if 0 for(n=0;n<2000;n++) { printf("%02x ",this->frame_buffer[n]); if ((n % 32) == 0) printf("\n"); } printf("\n"); -#endif +#endif buf->num_frames = 0; break; } @@ -457,7 +457,7 @@ static void a52dec_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { * We call the start of an A52 frame a frame header. * So, if a A52 pack has 2 "Number of frame headers" is means that the A52 pack contains 2 A52 frame headers. * The "First access unit" then tells us which A52 frame the PTS value applies to. - * + * * Take the following example: - * PACK1: PTS = 10. Contains the entire A52 frame1, followed by the beginning of the frame2. PTS applies to frame1. * PACK2: PTS = 1000, Contains the rest of frame2, and the whole of frame3. and the start of frame4. PTS applies to frame4. @@ -579,14 +579,14 @@ static void a52dec_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { } } break; - + case 2: /* Filling frame_buffer with sync_info bytes */ *this->frame_ptr++ = *current++; this->frame_todo--; if (this->frame_todo < 1) { this->sync_state = 3; } else break; - + case 3: /* Ready for decode */ crc16 = (uint16_t) ((this->frame_buffer[2] << 8) | this->frame_buffer[3]) ; crc16_result = crc16_block(&this->frame_buffer[2], this->frame_length - 2) ; /* frame_length */ @@ -620,7 +620,7 @@ static void a52dec_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { this->syncword = 0; this->sync_state = 0; break; - default: /* No come here */ + default: /* No come here */ break; } } @@ -674,14 +674,14 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, xine_stre this->pts_list_position = 0; if( !this->a52_state ) { - this->a52_state = + this->a52_state = #ifdef HAVE_A52DEC_A52_H /* External liba52 */ /* When using external liba52, enable _all_ capabilities, even if that might break stuff if they add some new capability that depends on CPU's caps. At the moment the only capability is DJBFFT, which is tested only if djbfft is being used at compile time. - + The actual question would be: why don't they check for capabilities themselves? */ diff --git a/src/libdts/Makefile.am b/src/libdts/Makefile.am index b7ec60016..e5fafd80b 100644 --- a/src/libdts/Makefile.am +++ b/src/libdts/Makefile.am @@ -12,7 +12,7 @@ fnsa = internal_sources = else fnsa = -fno-strict-aliasing -internal_sources = bitstream.c downmix.c parse.c +internal_sources = bitstream.c downmix.c parse.c endif xineplug_decode_dts_la_SOURCES = xine_dts_decoder.c $(internal_sources) diff --git a/src/libdts/parse.c b/src/libdts/parse.c index 67067addb..d8f8267e7 100644 --- a/src/libdts/parse.c +++ b/src/libdts/parse.c @@ -769,7 +769,7 @@ static int dts_subsubframe (dts_state_t * state) */ /* Select quantization step size table */ - if (state->bit_rate == 0x1f) + if (state->bit_rate == 0x1f) quant_step_table = lossless_quant_d; else quant_step_table = lossy_quant_d; @@ -787,11 +787,11 @@ static int dts_subsubframe (dts_state_t * state) double rscale; /* - * Determine quantization index code book and its type + * Determine quantization index code book and its type */ /* Select quantization index code book */ - int sel = state->quant_index_huffman[k][abits]; + int sel = state->quant_index_huffman[k][abits]; /* Determine its type */ int q_type = 1; /* (Assume Huffman type by default) */ @@ -805,7 +805,7 @@ static int dts_subsubframe (dts_state_t * state) if (abits == 0) q_type = 0; /* No bits allocated */ /* - * Extract bits from the bit stream + * Extract bits from the bit stream */ switch (q_type) { @@ -942,7 +942,7 @@ static int dts_subsubframe (dts_state_t * state) for (m=0; m<8; m++) { - subband_samples[k][l][m] = + subband_samples[k][l][m] = high_freq_vq[state->high_freq_vq[k][l]][subsubframe*8+m] * (double)state->scale_factor[k][l][0] / 16.0; } @@ -1101,7 +1101,7 @@ int dts_block (dts_state_t * state) /* Very compact version of the block code decoder that does not use table * look-up but is slightly slower */ int decode_blockcode( int code, int levels, int *values ) -{ +{ int i; int offset = (levels - 1) >> 1; diff --git a/src/libdts/tables_huffman.h b/src/libdts/tables_huffman.h index 6690d356c..ec7aa3c9a 100644 --- a/src/libdts/tables_huffman.h +++ b/src/libdts/tables_huffman.h @@ -29,41 +29,41 @@ typedef struct huff_entry_s huff_entry_t bitalloc_a_12[] = { - { 1, 0, 1}, { 2, 2, 2}, { 3, 6, 3}, { 4, 14, 4}, - { 5, 30, 5}, { 6, 62, 6}, { 8, 255, 7}, { 8, 254, 8}, - { 9, 507, 9}, { 9, 506, 10}, { 9, 505, 11}, { 9, 504, 12}, + { 1, 0, 1}, { 2, 2, 2}, { 3, 6, 3}, { 4, 14, 4}, + { 5, 30, 5}, { 6, 62, 6}, { 8, 255, 7}, { 8, 254, 8}, + { 9, 507, 9}, { 9, 506, 10}, { 9, 505, 11}, { 9, 504, 12}, { 0, 0, 0} }; huff_entry_t bitalloc_b_12[] = { - { 1, 1, 1}, { 2, 0, 2}, { 3, 2, 3}, { 5, 15, 4}, - { 5, 12, 5}, { 6, 29, 6}, { 7, 57, 7}, { 7, 56, 8}, - { 7, 55, 9}, { 7, 54, 10}, { 7, 53, 11}, { 7, 52, 12}, - { 0, 0, 0} + { 1, 1, 1}, { 2, 0, 2}, { 3, 2, 3}, { 5, 15, 4}, + { 5, 12, 5}, { 6, 29, 6}, { 7, 57, 7}, { 7, 56, 8}, + { 7, 55, 9}, { 7, 54, 10}, { 7, 53, 11}, { 7, 52, 12}, + { 0, 0, 0} }; huff_entry_t bitalloc_c_12[] = { - { 2, 0, 1}, { 3, 7, 2}, { 3, 5, 3}, { 3, 4, 4}, - { 3, 2, 5}, { 4, 13, 6}, { 4, 12, 7}, { 4, 6, 8}, - { 5, 15, 9}, { 6, 29, 10}, { 7, 57, 11}, { 7, 56, 12}, + { 2, 0, 1}, { 3, 7, 2}, { 3, 5, 3}, { 3, 4, 4}, + { 3, 2, 5}, { 4, 13, 6}, { 4, 12, 7}, { 4, 6, 8}, + { 5, 15, 9}, { 6, 29, 10}, { 7, 57, 11}, { 7, 56, 12}, { 0, 0, 0} }; huff_entry_t bitalloc_d_12[] = { - { 2, 3, 1}, { 2, 2, 2}, { 2, 0, 3}, { 3, 2, 4}, - { 4, 6, 5}, { 5, 14, 6}, { 6, 30, 7}, { 7, 62, 8}, - { 8, 126, 9}, { 9, 254, 10}, {10, 511, 11}, {10, 510, 12}, + { 2, 3, 1}, { 2, 2, 2}, { 2, 0, 3}, { 3, 2, 4}, + { 4, 6, 5}, { 5, 14, 6}, { 6, 30, 7}, { 7, 62, 8}, + { 8, 126, 9}, { 9, 254, 10}, {10, 511, 11}, {10, 510, 12}, { 0, 0, 0} }; huff_entry_t bitalloc_e_12[] = { - { 1, 1, 1}, { 2, 0, 2}, { 3, 2, 3}, { 4, 6, 4}, - { 5, 14, 5}, { 7, 63, 6}, { 7, 61, 7}, { 8, 124, 8}, - { 8, 121, 9}, { 8, 120, 10}, { 9, 251, 11}, { 9, 250, 12}, + { 1, 1, 1}, { 2, 0, 2}, { 3, 2, 3}, { 4, 6, 4}, + { 5, 14, 5}, { 7, 63, 6}, { 7, 61, 7}, { 8, 124, 8}, + { 8, 121, 9}, { 8, 120, 10}, { 9, 251, 11}, { 9, 250, 12}, { 0, 0, 0} }; @@ -78,186 +78,186 @@ huff_entry_t *bitalloc_12[] = huff_entry_t scales_a_129[] = { - { 2, 1, 0}, { 3, 6, 1}, { 3, 5, -1}, { 3, 0, 2}, - { 4, 15, -2}, { 4, 8, 3}, { 4, 3, -3}, { 5, 28, 4}, - { 5, 19, -4}, { 5, 4, 5}, { 6, 59, -5}, { 6, 36, 6}, - { 6, 11, -6}, { 7, 75, 7}, { 7, 74, -7}, { 8, 233, 8}, - { 8, 232, -8}, { 8, 41, 9}, { 8, 40, -9}, { 9, 87, 10}, - { 9, 86,-10}, {10, 937, 11}, {10, 936,-11}, {11, 1877, 12}, - {11, 1876,-12}, {11, 341, 13}, {11, 340,-13}, {12, 686, 14}, - {12, 685,-14}, {13, 1375, 15}, {13, 1374,-15}, {13, 1369, 16}, - {13, 1368,-16}, {13, 1359, 17}, {13, 1358,-17}, {13, 1357, 18}, - {13, 1356,-18}, {13, 1355, 19}, {13, 1354,-19}, {13, 1353, 20}, - {13, 1352,-20}, {13, 1351, 21}, {13, 1350,-21}, {13, 1349, 22}, - {13, 1348,-22}, {13, 1347, 23}, {13, 1346,-23}, {13, 1345, 24}, - {13, 1344,-24}, {14, 15103, 25}, {14, 15102,-25}, {14, 15101, 26}, - {14, 15100,-26}, {14, 15099, 27}, {14, 15098,-27}, {14, 15097, 28}, - {14, 15096,-28}, {14, 15095, 29}, {14, 15094,-29}, {14, 15093, 30}, - {14, 15092,-30}, {14, 15091, 31}, {14, 15090,-31}, {14, 15089, 32}, - {14, 15088,-32}, {14, 15087, 33}, {14, 15086,-33}, {14, 15085, 34}, - {14, 15084,-34}, {14, 15083, 35}, {14, 15082,-35}, {14, 15081, 36}, - {14, 15080,-36}, {14, 15079, 37}, {14, 15078,-37}, {14, 15077, 38}, - {14, 15076,-38}, {14, 15075, 39}, {14, 15074,-39}, {14, 15073, 40}, - {14, 15072,-40}, {14, 15071, 41}, {14, 15070,-41}, {14, 15069, 42}, - {14, 15068,-42}, {14, 15067, 43}, {14, 15066,-43}, {14, 15065, 44}, - {14, 15064,-44}, {14, 15063, 45}, {14, 15062,-45}, {14, 15061, 46}, - {14, 15060,-46}, {14, 15059, 47}, {14, 15058,-47}, {14, 15057, 48}, - {14, 15056,-48}, {14, 15055, 49}, {14, 15054,-49}, {14, 15053, 50}, - {14, 15052,-50}, {14, 15051, 51}, {14, 15050,-51}, {14, 15049, 52}, - {14, 15048,-52}, {14, 15047, 53}, {14, 15046,-53}, {14, 15045, 54}, - {14, 15044,-54}, {14, 15043, 55}, {14, 15042,-55}, {14, 15041, 56}, - {14, 15040,-56}, {14, 15039, 57}, {14, 15038,-57}, {14, 15037, 58}, - {14, 15036,-58}, {14, 15035, 59}, {14, 15034,-59}, {14, 15033, 60}, - {14, 15032,-60}, {14, 15031, 61}, {14, 15030,-61}, {14, 15029, 62}, - {14, 15028,-62}, {14, 15027, 63}, {14, 15026,-63}, {14, 15025, 64}, + { 2, 1, 0}, { 3, 6, 1}, { 3, 5, -1}, { 3, 0, 2}, + { 4, 15, -2}, { 4, 8, 3}, { 4, 3, -3}, { 5, 28, 4}, + { 5, 19, -4}, { 5, 4, 5}, { 6, 59, -5}, { 6, 36, 6}, + { 6, 11, -6}, { 7, 75, 7}, { 7, 74, -7}, { 8, 233, 8}, + { 8, 232, -8}, { 8, 41, 9}, { 8, 40, -9}, { 9, 87, 10}, + { 9, 86,-10}, {10, 937, 11}, {10, 936,-11}, {11, 1877, 12}, + {11, 1876,-12}, {11, 341, 13}, {11, 340,-13}, {12, 686, 14}, + {12, 685,-14}, {13, 1375, 15}, {13, 1374,-15}, {13, 1369, 16}, + {13, 1368,-16}, {13, 1359, 17}, {13, 1358,-17}, {13, 1357, 18}, + {13, 1356,-18}, {13, 1355, 19}, {13, 1354,-19}, {13, 1353, 20}, + {13, 1352,-20}, {13, 1351, 21}, {13, 1350,-21}, {13, 1349, 22}, + {13, 1348,-22}, {13, 1347, 23}, {13, 1346,-23}, {13, 1345, 24}, + {13, 1344,-24}, {14, 15103, 25}, {14, 15102,-25}, {14, 15101, 26}, + {14, 15100,-26}, {14, 15099, 27}, {14, 15098,-27}, {14, 15097, 28}, + {14, 15096,-28}, {14, 15095, 29}, {14, 15094,-29}, {14, 15093, 30}, + {14, 15092,-30}, {14, 15091, 31}, {14, 15090,-31}, {14, 15089, 32}, + {14, 15088,-32}, {14, 15087, 33}, {14, 15086,-33}, {14, 15085, 34}, + {14, 15084,-34}, {14, 15083, 35}, {14, 15082,-35}, {14, 15081, 36}, + {14, 15080,-36}, {14, 15079, 37}, {14, 15078,-37}, {14, 15077, 38}, + {14, 15076,-38}, {14, 15075, 39}, {14, 15074,-39}, {14, 15073, 40}, + {14, 15072,-40}, {14, 15071, 41}, {14, 15070,-41}, {14, 15069, 42}, + {14, 15068,-42}, {14, 15067, 43}, {14, 15066,-43}, {14, 15065, 44}, + {14, 15064,-44}, {14, 15063, 45}, {14, 15062,-45}, {14, 15061, 46}, + {14, 15060,-46}, {14, 15059, 47}, {14, 15058,-47}, {14, 15057, 48}, + {14, 15056,-48}, {14, 15055, 49}, {14, 15054,-49}, {14, 15053, 50}, + {14, 15052,-50}, {14, 15051, 51}, {14, 15050,-51}, {14, 15049, 52}, + {14, 15048,-52}, {14, 15047, 53}, {14, 15046,-53}, {14, 15045, 54}, + {14, 15044,-54}, {14, 15043, 55}, {14, 15042,-55}, {14, 15041, 56}, + {14, 15040,-56}, {14, 15039, 57}, {14, 15038,-57}, {14, 15037, 58}, + {14, 15036,-58}, {14, 15035, 59}, {14, 15034,-59}, {14, 15033, 60}, + {14, 15032,-60}, {14, 15031, 61}, {14, 15030,-61}, {14, 15029, 62}, + {14, 15028,-62}, {14, 15027, 63}, {14, 15026,-63}, {14, 15025, 64}, {14, 15024,-64}, { 0, 0, 0} }; huff_entry_t scales_b_129[] = { - { 3, 3, 0}, { 3, 2, 1}, { 3, 1, -1}, { 4, 15, 2}, - { 4, 14, -2}, { 4, 12, 3}, { 4, 11, -3}, { 4, 10, 4}, - { 4, 9, -4}, { 4, 0, 5}, { 5, 27, -5}, { 5, 17, 6}, - { 5, 16, -6}, { 6, 53, 7}, { 6, 52, -7}, { 6, 5, 8}, - { 6, 4, -8}, { 7, 13, 9}, { 7, 12, -9}, { 8, 29, 10}, - { 8, 28,-10}, { 9, 60, 11}, {10, 127,-11}, {11, 253, 12}, - {11, 252,-12}, {12, 491, 13}, {12, 490,-13}, {13, 979, 14}, - {13, 978,-14}, {14, 1955, 15}, {14, 1954,-15}, {14, 1953, 16}, - {14, 1952,-16}, {15, 4031, 17}, {15, 4030,-17}, {15, 4029, 18}, - {15, 4028,-18}, {15, 4027, 19}, {15, 4026,-19}, {15, 4025, 20}, - {15, 4024,-20}, {15, 4023, 21}, {15, 4022,-21}, {15, 4021, 22}, - {15, 4020,-22}, {15, 4019, 23}, {15, 4018,-23}, {15, 4017, 24}, - {15, 4016,-24}, {15, 4015, 25}, {15, 4014,-25}, {15, 4013, 26}, - {15, 4012,-26}, {15, 4011, 27}, {15, 4010,-27}, {15, 4009, 28}, - {15, 4008,-28}, {15, 4007, 29}, {15, 4006,-29}, {15, 4005, 30}, - {15, 4004,-30}, {15, 4003, 31}, {15, 4002,-31}, {15, 4001, 32}, - {15, 4000,-32}, {15, 3999, 33}, {15, 3998,-33}, {15, 3997, 34}, - {15, 3996,-34}, {15, 3995, 35}, {15, 3994,-35}, {15, 3993, 36}, - {15, 3992,-36}, {15, 3991, 37}, {15, 3990,-37}, {15, 3989, 38}, - {15, 3988,-38}, {15, 3987, 39}, {15, 3986,-39}, {15, 3985, 40}, - {15, 3984,-40}, {15, 3983, 41}, {15, 3982,-41}, {15, 3981, 42}, - {15, 3980,-42}, {15, 3979, 43}, {15, 3978,-43}, {15, 3977, 44}, - {15, 3976,-44}, {15, 3975, 45}, {15, 3974,-45}, {15, 3973, 46}, - {15, 3972,-46}, {15, 3971, 47}, {15, 3970,-47}, {15, 3969, 48}, - {15, 3968,-48}, {15, 3967, 49}, {15, 3966,-49}, {15, 3965, 50}, - {15, 3964,-50}, {15, 3963, 51}, {15, 3962,-51}, {15, 3961, 52}, - {15, 3960,-52}, {15, 3959, 53}, {15, 3958,-53}, {15, 3957, 54}, - {15, 3956,-54}, {15, 3955, 55}, {15, 3954,-55}, {15, 3953, 56}, - {15, 3952,-56}, {15, 3951, 57}, {15, 3950,-57}, {15, 3949, 58}, - {15, 3948,-58}, {15, 3947, 59}, {15, 3946,-59}, {15, 3945, 60}, - {15, 3944,-60}, {15, 3943, 61}, {15, 3942,-61}, {15, 3941, 62}, - {15, 3940,-62}, {15, 3939, 63}, {15, 3938,-63}, {15, 3937, 64}, + { 3, 3, 0}, { 3, 2, 1}, { 3, 1, -1}, { 4, 15, 2}, + { 4, 14, -2}, { 4, 12, 3}, { 4, 11, -3}, { 4, 10, 4}, + { 4, 9, -4}, { 4, 0, 5}, { 5, 27, -5}, { 5, 17, 6}, + { 5, 16, -6}, { 6, 53, 7}, { 6, 52, -7}, { 6, 5, 8}, + { 6, 4, -8}, { 7, 13, 9}, { 7, 12, -9}, { 8, 29, 10}, + { 8, 28,-10}, { 9, 60, 11}, {10, 127,-11}, {11, 253, 12}, + {11, 252,-12}, {12, 491, 13}, {12, 490,-13}, {13, 979, 14}, + {13, 978,-14}, {14, 1955, 15}, {14, 1954,-15}, {14, 1953, 16}, + {14, 1952,-16}, {15, 4031, 17}, {15, 4030,-17}, {15, 4029, 18}, + {15, 4028,-18}, {15, 4027, 19}, {15, 4026,-19}, {15, 4025, 20}, + {15, 4024,-20}, {15, 4023, 21}, {15, 4022,-21}, {15, 4021, 22}, + {15, 4020,-22}, {15, 4019, 23}, {15, 4018,-23}, {15, 4017, 24}, + {15, 4016,-24}, {15, 4015, 25}, {15, 4014,-25}, {15, 4013, 26}, + {15, 4012,-26}, {15, 4011, 27}, {15, 4010,-27}, {15, 4009, 28}, + {15, 4008,-28}, {15, 4007, 29}, {15, 4006,-29}, {15, 4005, 30}, + {15, 4004,-30}, {15, 4003, 31}, {15, 4002,-31}, {15, 4001, 32}, + {15, 4000,-32}, {15, 3999, 33}, {15, 3998,-33}, {15, 3997, 34}, + {15, 3996,-34}, {15, 3995, 35}, {15, 3994,-35}, {15, 3993, 36}, + {15, 3992,-36}, {15, 3991, 37}, {15, 3990,-37}, {15, 3989, 38}, + {15, 3988,-38}, {15, 3987, 39}, {15, 3986,-39}, {15, 3985, 40}, + {15, 3984,-40}, {15, 3983, 41}, {15, 3982,-41}, {15, 3981, 42}, + {15, 3980,-42}, {15, 3979, 43}, {15, 3978,-43}, {15, 3977, 44}, + {15, 3976,-44}, {15, 3975, 45}, {15, 3974,-45}, {15, 3973, 46}, + {15, 3972,-46}, {15, 3971, 47}, {15, 3970,-47}, {15, 3969, 48}, + {15, 3968,-48}, {15, 3967, 49}, {15, 3966,-49}, {15, 3965, 50}, + {15, 3964,-50}, {15, 3963, 51}, {15, 3962,-51}, {15, 3961, 52}, + {15, 3960,-52}, {15, 3959, 53}, {15, 3958,-53}, {15, 3957, 54}, + {15, 3956,-54}, {15, 3955, 55}, {15, 3954,-55}, {15, 3953, 56}, + {15, 3952,-56}, {15, 3951, 57}, {15, 3950,-57}, {15, 3949, 58}, + {15, 3948,-58}, {15, 3947, 59}, {15, 3946,-59}, {15, 3945, 60}, + {15, 3944,-60}, {15, 3943, 61}, {15, 3942,-61}, {15, 3941, 62}, + {15, 3940,-62}, {15, 3939, 63}, {15, 3938,-63}, {15, 3937, 64}, {15, 3936,-64}, { 0, 0, 0} }; huff_entry_t scales_c_129[] = { - { 3, 4, 0}, { 3, 1, 1}, { 3, 0, -1}, { 4, 13, 2}, - { 4, 12, -2}, { 4, 7, 3}, { 4, 6, -3}, { 5, 31, 4}, - { 5, 30, -4}, { 5, 23, 5}, { 5, 22, -5}, { 5, 11, 6}, - { 5, 10, -6}, { 6, 59, 7}, { 6, 58, -7}, { 6, 43, 8}, - { 6, 42, -8}, { 6, 19, 9}, { 6, 18, -9}, { 7, 115, 10}, - { 7, 114,-10}, { 7, 83, 11}, { 7, 82,-11}, { 7, 35, 12}, - { 7, 34,-12}, { 8, 227, 13}, { 8, 226,-13}, { 8, 162, 14}, - { 8, 161,-14}, { 8, 66, 15}, { 8, 65,-15}, { 9, 450, 16}, - { 9, 449,-16}, { 9, 321, 17}, { 9, 320,-17}, { 9, 129, 18}, - { 9, 128,-18}, {10, 897, 19}, {10, 896,-19}, {10, 652, 20}, - {10, 271,-20}, {10, 268, 21}, {11, 1807,-21}, {11, 1308, 22}, - {11, 1307,-22}, {11, 540, 23}, {11, 539,-23}, {12, 3612, 24}, - {12, 3611,-24}, {12, 2613, 25}, {12, 2612,-25}, {12, 1077, 26}, - {12, 1076,-26}, {13, 7226, 27}, {13, 7221,-27}, {13, 2167, 28}, - {13, 2166,-28}, {13, 2164, 29}, {14, 14455,-29}, {14, 14441, 30}, - {14, 14440,-30}, {14, 4331, 31}, {14, 4330,-31}, {15, 28909, 32}, - {15, 28908,-32}, {15, 28879, 33}, {15, 28878,-33}, {15, 28877, 34}, - {15, 28876,-34}, {15, 28875, 35}, {15, 28874,-35}, {15, 28873, 36}, - {15, 28872,-36}, {15, 28871, 37}, {15, 28870,-37}, {15, 28869, 38}, - {15, 28868,-38}, {15, 28867, 39}, {15, 28866,-39}, {15, 28865, 40}, - {15, 28864,-40}, {15, 20991, 41}, {15, 20990,-41}, {15, 20989, 42}, - {15, 20988,-42}, {15, 20987, 43}, {15, 20986,-43}, {15, 20985, 44}, - {15, 20984,-44}, {15, 20983, 45}, {15, 20982,-45}, {15, 20981, 46}, - {15, 20980,-46}, {15, 20979, 47}, {15, 20978,-47}, {15, 20977, 48}, - {15, 20976,-48}, {15, 20975, 49}, {15, 20974,-49}, {15, 20973, 50}, - {15, 20972,-50}, {15, 20971, 51}, {15, 20970,-51}, {15, 20969, 52}, - {15, 20968,-52}, {15, 20967, 53}, {15, 20966,-53}, {15, 20965, 54}, - {15, 20964,-54}, {15, 20963, 55}, {15, 20962,-55}, {15, 20961, 56}, - {15, 20960,-56}, {15, 20959, 57}, {15, 20958,-57}, {15, 20957, 58}, - {15, 20956,-58}, {15, 20955, 59}, {15, 20954,-59}, {15, 20953, 60}, - {15, 20952,-60}, {15, 20951, 61}, {15, 20950,-61}, {15, 20949, 62}, - {15, 20948,-62}, {15, 20947, 63}, {15, 20946,-63}, {15, 20945, 64}, + { 3, 4, 0}, { 3, 1, 1}, { 3, 0, -1}, { 4, 13, 2}, + { 4, 12, -2}, { 4, 7, 3}, { 4, 6, -3}, { 5, 31, 4}, + { 5, 30, -4}, { 5, 23, 5}, { 5, 22, -5}, { 5, 11, 6}, + { 5, 10, -6}, { 6, 59, 7}, { 6, 58, -7}, { 6, 43, 8}, + { 6, 42, -8}, { 6, 19, 9}, { 6, 18, -9}, { 7, 115, 10}, + { 7, 114,-10}, { 7, 83, 11}, { 7, 82,-11}, { 7, 35, 12}, + { 7, 34,-12}, { 8, 227, 13}, { 8, 226,-13}, { 8, 162, 14}, + { 8, 161,-14}, { 8, 66, 15}, { 8, 65,-15}, { 9, 450, 16}, + { 9, 449,-16}, { 9, 321, 17}, { 9, 320,-17}, { 9, 129, 18}, + { 9, 128,-18}, {10, 897, 19}, {10, 896,-19}, {10, 652, 20}, + {10, 271,-20}, {10, 268, 21}, {11, 1807,-21}, {11, 1308, 22}, + {11, 1307,-22}, {11, 540, 23}, {11, 539,-23}, {12, 3612, 24}, + {12, 3611,-24}, {12, 2613, 25}, {12, 2612,-25}, {12, 1077, 26}, + {12, 1076,-26}, {13, 7226, 27}, {13, 7221,-27}, {13, 2167, 28}, + {13, 2166,-28}, {13, 2164, 29}, {14, 14455,-29}, {14, 14441, 30}, + {14, 14440,-30}, {14, 4331, 31}, {14, 4330,-31}, {15, 28909, 32}, + {15, 28908,-32}, {15, 28879, 33}, {15, 28878,-33}, {15, 28877, 34}, + {15, 28876,-34}, {15, 28875, 35}, {15, 28874,-35}, {15, 28873, 36}, + {15, 28872,-36}, {15, 28871, 37}, {15, 28870,-37}, {15, 28869, 38}, + {15, 28868,-38}, {15, 28867, 39}, {15, 28866,-39}, {15, 28865, 40}, + {15, 28864,-40}, {15, 20991, 41}, {15, 20990,-41}, {15, 20989, 42}, + {15, 20988,-42}, {15, 20987, 43}, {15, 20986,-43}, {15, 20985, 44}, + {15, 20984,-44}, {15, 20983, 45}, {15, 20982,-45}, {15, 20981, 46}, + {15, 20980,-46}, {15, 20979, 47}, {15, 20978,-47}, {15, 20977, 48}, + {15, 20976,-48}, {15, 20975, 49}, {15, 20974,-49}, {15, 20973, 50}, + {15, 20972,-50}, {15, 20971, 51}, {15, 20970,-51}, {15, 20969, 52}, + {15, 20968,-52}, {15, 20967, 53}, {15, 20966,-53}, {15, 20965, 54}, + {15, 20964,-54}, {15, 20963, 55}, {15, 20962,-55}, {15, 20961, 56}, + {15, 20960,-56}, {15, 20959, 57}, {15, 20958,-57}, {15, 20957, 58}, + {15, 20956,-58}, {15, 20955, 59}, {15, 20954,-59}, {15, 20953, 60}, + {15, 20952,-60}, {15, 20951, 61}, {15, 20950,-61}, {15, 20949, 62}, + {15, 20948,-62}, {15, 20947, 63}, {15, 20946,-63}, {15, 20945, 64}, {15, 20944,-64}, { 0, 0, 0} }; huff_entry_t scales_d_129[] = { - { 2, 0, 0}, { 3, 5, 1}, { 3, 4, -1}, { 4, 15, 2}, - { 4, 14, -2}, { 4, 7, 3}, { 4, 6, -3}, { 5, 26, 4}, - { 5, 25, -4}, { 5, 10, 5}, { 5, 9, -5}, { 6, 54, 6}, - { 6, 49, -6}, { 6, 22, 7}, { 6, 17, -7}, { 7, 110, 8}, - { 7, 97, -8}, { 7, 46, 9}, { 7, 33, -9}, { 8, 193, 10}, - { 8, 192,-10}, { 8, 65, 11}, { 8, 64,-11}, { 9, 444, 12}, - { 9, 191,-12}, { 9, 188, 13}, {10, 895,-13}, {10, 890, 14}, - {10, 381,-14}, {10, 378, 15}, {11, 1789,-15}, {11, 761, 16}, - {11, 760,-16}, {12, 3577, 17}, {12, 3576,-17}, {12, 1519, 18}, - {12, 1518,-18}, {12, 1516, 19}, {13, 7151,-19}, {13, 7128, 20}, - {13, 3035,-20}, {14, 14301, 21}, {14, 14300,-21}, {14, 6069, 22}, - {14, 6068,-22}, {15, 28599, 23}, {15, 28598,-23}, {15, 28597, 24}, - {15, 28596,-24}, {15, 28595, 25}, {15, 28594,-25}, {15, 28593, 26}, - {15, 28592,-26}, {15, 28591, 27}, {15, 28590,-27}, {15, 28589, 28}, - {15, 28588,-28}, {15, 28587, 29}, {15, 28586,-29}, {15, 28585, 30}, - {15, 28584,-30}, {15, 28583, 31}, {15, 28582,-31}, {15, 28581, 32}, - {15, 28580,-32}, {15, 28579, 33}, {15, 28578,-33}, {15, 28577, 34}, - {15, 28576,-34}, {15, 28575, 35}, {15, 28574,-35}, {15, 28573, 36}, - {15, 28572,-36}, {15, 28571, 37}, {15, 28570,-37}, {15, 28569, 38}, - {15, 28568,-38}, {15, 28567, 39}, {15, 28566,-39}, {15, 28565, 40}, - {15, 28564,-40}, {15, 28563, 41}, {15, 28562,-41}, {15, 28561, 42}, - {15, 28560,-42}, {15, 28559, 43}, {15, 28558,-43}, {15, 28557, 44}, - {15, 28556,-44}, {15, 28555, 45}, {15, 28554,-45}, {15, 28553, 46}, - {15, 28552,-46}, {15, 28551, 47}, {15, 28550,-47}, {15, 28549, 48}, - {15, 28548,-48}, {15, 28547, 49}, {15, 28546,-49}, {15, 28545, 50}, - {15, 28544,-50}, {15, 28543, 51}, {15, 28542,-51}, {15, 28541, 52}, - {15, 28540,-52}, {15, 28539, 53}, {15, 28538,-53}, {15, 28537, 54}, - {15, 28536,-54}, {15, 28535, 55}, {15, 28534,-55}, {15, 28533, 56}, - {15, 28532,-56}, {15, 28531, 57}, {15, 28530,-57}, {15, 28529, 58}, - {15, 28528,-58}, {15, 28527, 59}, {15, 28526,-59}, {15, 28525, 60}, - {15, 28524,-60}, {15, 28523, 61}, {15, 28522,-61}, {15, 28521, 62}, - {15, 28520,-62}, {15, 28519, 63}, {15, 28518,-63}, {15, 28517, 64}, + { 2, 0, 0}, { 3, 5, 1}, { 3, 4, -1}, { 4, 15, 2}, + { 4, 14, -2}, { 4, 7, 3}, { 4, 6, -3}, { 5, 26, 4}, + { 5, 25, -4}, { 5, 10, 5}, { 5, 9, -5}, { 6, 54, 6}, + { 6, 49, -6}, { 6, 22, 7}, { 6, 17, -7}, { 7, 110, 8}, + { 7, 97, -8}, { 7, 46, 9}, { 7, 33, -9}, { 8, 193, 10}, + { 8, 192,-10}, { 8, 65, 11}, { 8, 64,-11}, { 9, 444, 12}, + { 9, 191,-12}, { 9, 188, 13}, {10, 895,-13}, {10, 890, 14}, + {10, 381,-14}, {10, 378, 15}, {11, 1789,-15}, {11, 761, 16}, + {11, 760,-16}, {12, 3577, 17}, {12, 3576,-17}, {12, 1519, 18}, + {12, 1518,-18}, {12, 1516, 19}, {13, 7151,-19}, {13, 7128, 20}, + {13, 3035,-20}, {14, 14301, 21}, {14, 14300,-21}, {14, 6069, 22}, + {14, 6068,-22}, {15, 28599, 23}, {15, 28598,-23}, {15, 28597, 24}, + {15, 28596,-24}, {15, 28595, 25}, {15, 28594,-25}, {15, 28593, 26}, + {15, 28592,-26}, {15, 28591, 27}, {15, 28590,-27}, {15, 28589, 28}, + {15, 28588,-28}, {15, 28587, 29}, {15, 28586,-29}, {15, 28585, 30}, + {15, 28584,-30}, {15, 28583, 31}, {15, 28582,-31}, {15, 28581, 32}, + {15, 28580,-32}, {15, 28579, 33}, {15, 28578,-33}, {15, 28577, 34}, + {15, 28576,-34}, {15, 28575, 35}, {15, 28574,-35}, {15, 28573, 36}, + {15, 28572,-36}, {15, 28571, 37}, {15, 28570,-37}, {15, 28569, 38}, + {15, 28568,-38}, {15, 28567, 39}, {15, 28566,-39}, {15, 28565, 40}, + {15, 28564,-40}, {15, 28563, 41}, {15, 28562,-41}, {15, 28561, 42}, + {15, 28560,-42}, {15, 28559, 43}, {15, 28558,-43}, {15, 28557, 44}, + {15, 28556,-44}, {15, 28555, 45}, {15, 28554,-45}, {15, 28553, 46}, + {15, 28552,-46}, {15, 28551, 47}, {15, 28550,-47}, {15, 28549, 48}, + {15, 28548,-48}, {15, 28547, 49}, {15, 28546,-49}, {15, 28545, 50}, + {15, 28544,-50}, {15, 28543, 51}, {15, 28542,-51}, {15, 28541, 52}, + {15, 28540,-52}, {15, 28539, 53}, {15, 28538,-53}, {15, 28537, 54}, + {15, 28536,-54}, {15, 28535, 55}, {15, 28534,-55}, {15, 28533, 56}, + {15, 28532,-56}, {15, 28531, 57}, {15, 28530,-57}, {15, 28529, 58}, + {15, 28528,-58}, {15, 28527, 59}, {15, 28526,-59}, {15, 28525, 60}, + {15, 28524,-60}, {15, 28523, 61}, {15, 28522,-61}, {15, 28521, 62}, + {15, 28520,-62}, {15, 28519, 63}, {15, 28518,-63}, {15, 28517, 64}, {15, 28516,-64}, { 0, 0, 0} }; huff_entry_t scales_e_129[] = { - { 4, 14, 0}, { 4, 11, 1}, { 4, 10, -1}, { 4, 7, 2}, - { 4, 6, -2}, { 4, 3, 3}, { 4, 2, -3}, { 5, 31, 4}, - { 5, 30, -4}, { 5, 25, 5}, { 5, 24, -5}, { 5, 17, 6}, - { 5, 16, -6}, { 5, 9, 7}, { 5, 8, -7}, { 5, 1, 8}, - { 5, 0, -8}, { 6, 53, 9}, { 6, 52, -9}, { 6, 37, 10}, - { 6, 36,-10}, { 6, 21, 11}, { 6, 20,-11}, { 6, 5, 12}, - { 6, 4,-12}, { 7, 109, 13}, { 7, 108,-13}, { 7, 77, 14}, - { 7, 76,-14}, { 7, 45, 15}, { 7, 44,-15}, { 7, 13, 16}, - { 7, 12,-16}, { 8, 221, 17}, { 8, 220,-17}, { 8, 157, 18}, - { 8, 156,-18}, { 8, 93, 19}, { 8, 92,-19}, { 8, 29, 20}, - { 8, 28,-20}, { 9, 445, 21}, { 9, 444,-21}, { 9, 317, 22}, - { 9, 316,-22}, { 9, 189, 23}, { 9, 188,-23}, { 9, 61, 24}, - { 9, 60,-24}, {10, 892, 25}, {10, 639,-25}, {10, 637, 26}, - {10, 636,-26}, {10, 381, 27}, {10, 380,-27}, {10, 125, 28}, - {10, 124,-28}, {11, 1788, 29}, {11, 1787,-29}, {11, 1276, 30}, - {11, 767,-30}, {11, 764, 31}, {11, 255,-31}, {11, 252, 32}, - {12, 3583,-32}, {12, 3579, 33}, {12, 3578,-33}, {12, 2555, 34}, - {12, 2554,-34}, {12, 1531, 35}, {12, 1530,-35}, {12, 507, 36}, - {12, 506,-36}, {13, 7160, 37}, {13, 7147,-37}, {13, 7144, 38}, - {13, 3067,-38}, {13, 3065, 39}, {13, 3064,-39}, {13, 1017, 40}, - {13, 1016,-40}, {14, 14330, 41}, {14, 14329,-41}, {14, 14291, 42}, - {14, 14290,-42}, {14, 6132, 43}, {14, 2039,-43}, {14, 2038, 44}, - {14, 2037,-44}, {15, 28663, 45}, {15, 28662,-45}, {15, 28585, 46}, - {15, 28584,-46}, {15, 12267, 47}, {15, 12266,-47}, {15, 4073, 48}, - {15, 4072,-48}, {16, 57315, 49}, {16, 57314,-49}, {16, 57313, 50}, - {16, 57312,-50}, {16, 57311, 51}, {16, 57310,-51}, {16, 57309, 52}, - {16, 57308,-52}, {16, 57307, 53}, {16, 57306,-53}, {16, 57305, 54}, - {16, 57304,-54}, {16, 57303, 55}, {16, 57302,-55}, {16, 57301, 56}, - {16, 57300,-56}, {16, 57299, 57}, {16, 57298,-57}, {16, 57297, 58}, - {16, 57296,-58}, {16, 57295, 59}, {16, 57294,-59}, {16, 57293, 60}, - {16, 57292,-60}, {16, 57291, 61}, {16, 57290,-61}, {16, 57289, 62}, - {16, 57288,-62}, {16, 57175, 63}, {16, 57174,-63}, {16, 57173, 64}, + { 4, 14, 0}, { 4, 11, 1}, { 4, 10, -1}, { 4, 7, 2}, + { 4, 6, -2}, { 4, 3, 3}, { 4, 2, -3}, { 5, 31, 4}, + { 5, 30, -4}, { 5, 25, 5}, { 5, 24, -5}, { 5, 17, 6}, + { 5, 16, -6}, { 5, 9, 7}, { 5, 8, -7}, { 5, 1, 8}, + { 5, 0, -8}, { 6, 53, 9}, { 6, 52, -9}, { 6, 37, 10}, + { 6, 36,-10}, { 6, 21, 11}, { 6, 20,-11}, { 6, 5, 12}, + { 6, 4,-12}, { 7, 109, 13}, { 7, 108,-13}, { 7, 77, 14}, + { 7, 76,-14}, { 7, 45, 15}, { 7, 44,-15}, { 7, 13, 16}, + { 7, 12,-16}, { 8, 221, 17}, { 8, 220,-17}, { 8, 157, 18}, + { 8, 156,-18}, { 8, 93, 19}, { 8, 92,-19}, { 8, 29, 20}, + { 8, 28,-20}, { 9, 445, 21}, { 9, 444,-21}, { 9, 317, 22}, + { 9, 316,-22}, { 9, 189, 23}, { 9, 188,-23}, { 9, 61, 24}, + { 9, 60,-24}, {10, 892, 25}, {10, 639,-25}, {10, 637, 26}, + {10, 636,-26}, {10, 381, 27}, {10, 380,-27}, {10, 125, 28}, + {10, 124,-28}, {11, 1788, 29}, {11, 1787,-29}, {11, 1276, 30}, + {11, 767,-30}, {11, 764, 31}, {11, 255,-31}, {11, 252, 32}, + {12, 3583,-32}, {12, 3579, 33}, {12, 3578,-33}, {12, 2555, 34}, + {12, 2554,-34}, {12, 1531, 35}, {12, 1530,-35}, {12, 507, 36}, + {12, 506,-36}, {13, 7160, 37}, {13, 7147,-37}, {13, 7144, 38}, + {13, 3067,-38}, {13, 3065, 39}, {13, 3064,-39}, {13, 1017, 40}, + {13, 1016,-40}, {14, 14330, 41}, {14, 14329,-41}, {14, 14291, 42}, + {14, 14290,-42}, {14, 6132, 43}, {14, 2039,-43}, {14, 2038, 44}, + {14, 2037,-44}, {15, 28663, 45}, {15, 28662,-45}, {15, 28585, 46}, + {15, 28584,-46}, {15, 12267, 47}, {15, 12266,-47}, {15, 4073, 48}, + {15, 4072,-48}, {16, 57315, 49}, {16, 57314,-49}, {16, 57313, 50}, + {16, 57312,-50}, {16, 57311, 51}, {16, 57310,-51}, {16, 57309, 52}, + {16, 57308,-52}, {16, 57307, 53}, {16, 57306,-53}, {16, 57305, 54}, + {16, 57304,-54}, {16, 57303, 55}, {16, 57302,-55}, {16, 57301, 56}, + {16, 57300,-56}, {16, 57299, 57}, {16, 57298,-57}, {16, 57297, 58}, + {16, 57296,-58}, {16, 57295, 59}, {16, 57294,-59}, {16, 57293, 60}, + {16, 57292,-60}, {16, 57291, 61}, {16, 57290,-61}, {16, 57289, 62}, + {16, 57288,-62}, {16, 57175, 63}, {16, 57174,-63}, {16, 57173, 64}, {16, 57172,-64}, { 0, 0, 0} }; @@ -277,25 +277,25 @@ huff_entry_t bitalloc_a_3[] = huff_entry_t bitalloc_a_4[] = { - { 1, 0, 0}, { 2, 2, 1}, { 3, 6, 2}, { 3, 7, 3}, + { 1, 0, 0}, { 2, 2, 1}, { 3, 6, 2}, { 3, 7, 3}, { 0, 0, 0} }; huff_entry_t bitalloc_b_4[] = { - { 2, 2, 0}, { 3, 6, 1}, { 3, 7, 2}, { 1, 0, 3}, + { 2, 2, 0}, { 3, 6, 1}, { 3, 7, 2}, { 1, 0, 3}, { 0, 0, 0} }; huff_entry_t bitalloc_c_4[] = { - { 3, 6, 0}, { 3, 7, 1}, { 1, 0, 2}, { 2, 2, 3}, + { 3, 6, 0}, { 3, 7, 1}, { 1, 0, 2}, { 2, 2, 3}, { 0, 0, 0} }; huff_entry_t bitalloc_d_4[] = { - { 2, 0, 0}, { 2, 1, 1}, { 2, 2, 2}, { 2, 3, 3}, + { 2, 0, 0}, { 2, 1, 1}, { 2, 2, 2}, { 2, 3, 3}, { 0, 0, 0} }; @@ -309,719 +309,719 @@ huff_entry_t *tmode[] = huff_entry_t bitalloc_a_5[] = { - { 1, 0, 0}, { 2, 2, 1}, { 3, 6, -1}, { 4, 14, 2}, + { 1, 0, 0}, { 2, 2, 1}, { 3, 6, -1}, { 4, 14, 2}, { 4, 15, -2}, { 0, 0, 0} }; huff_entry_t bitalloc_b_5[] = { - { 2, 2, 0}, { 2, 0, 1}, { 2, 1, -1}, { 3, 6, 2}, + { 2, 2, 0}, { 2, 0, 1}, { 2, 1, -1}, { 3, 6, 2}, { 3, 7, -2}, { 0, 0, 0} }; huff_entry_t bitalloc_c_5[] = { - { 1, 0, 0}, { 3, 4, 1}, { 3, 5, -1}, { 3, 6, 2}, + { 1, 0, 0}, { 3, 4, 1}, { 3, 5, -1}, { 3, 6, 2}, { 3, 7, -2}, { 0, 0, 0} }; huff_entry_t bitalloc_a_7[] = { - { 1, 0, 0}, { 3, 6, 1}, { 3, 5, -1}, { 3, 4, 2}, + { 1, 0, 0}, { 3, 6, 1}, { 3, 5, -1}, { 3, 4, 2}, { 4, 14, -2}, { 5, 31, 3}, { 5, 30, -3}, { 0, 0, 0} }; huff_entry_t bitalloc_b_7[] = { - { 2, 3, 0}, { 2, 1, 1}, { 2, 0, -1}, { 3, 4, 2}, + { 2, 3, 0}, { 2, 1, 1}, { 2, 0, -1}, { 3, 4, 2}, { 4, 11, -2}, { 5, 21, 3}, { 5, 20, -3}, { 0, 0, 0} }; huff_entry_t bitalloc_c_7[] = { - { 2, 3, 0}, { 2, 2, 1}, { 2, 1, -1}, { 4, 3, 2}, + { 2, 3, 0}, { 2, 2, 1}, { 2, 1, -1}, { 4, 3, 2}, { 4, 2, -2}, { 4, 1, 3}, { 4, 0, -3}, { 0, 0, 0} }; huff_entry_t bitalloc_a_9[] = { - { 1, 0, 0}, { 3, 7, 1}, { 3, 5, -1}, { 4, 13, 2}, - { 4, 9, -2}, { 4, 8, 3}, { 5, 25, -3}, { 6, 49, 4}, + { 1, 0, 0}, { 3, 7, 1}, { 3, 5, -1}, { 4, 13, 2}, + { 4, 9, -2}, { 4, 8, 3}, { 5, 25, -3}, { 6, 49, 4}, { 6, 48, -4}, { 0, 0, 0} }; huff_entry_t bitalloc_b_9[] = { - { 2, 2, 0}, { 2, 0, 1}, { 3, 7, -1}, { 3, 3, 2}, - { 3, 2, -2}, { 5, 27, 3}, { 5, 26, -3}, { 5, 25, 4}, + { 2, 2, 0}, { 2, 0, 1}, { 3, 7, -1}, { 3, 3, 2}, + { 3, 2, -2}, { 5, 27, 3}, { 5, 26, -3}, { 5, 25, 4}, { 5, 24, -4}, { 0, 0, 0} }; huff_entry_t bitalloc_c_9[] = { - { 2, 2, 0}, { 2, 0, 1}, { 3, 7, -1}, { 3, 6, 2}, - { 3, 2, -2}, { 4, 6, 3}, { 5, 15, -3}, { 6, 29, 4}, + { 2, 2, 0}, { 2, 0, 1}, { 3, 7, -1}, { 3, 6, 2}, + { 3, 2, -2}, { 4, 6, 3}, { 5, 15, -3}, { 6, 29, 4}, { 6, 28, -4}, { 0, 0, 0} }; huff_entry_t bitalloc_a_13[] = { - { 1, 0, 0}, { 3, 4, 1}, { 4, 15, -1}, { 4, 13, 2}, - { 4, 12, -2}, { 4, 10, 3}, { 5, 29, -3}, { 5, 22, 4}, - { 6, 57, -4}, { 6, 47, 5}, { 6, 46, -5}, { 7, 113, 6}, + { 1, 0, 0}, { 3, 4, 1}, { 4, 15, -1}, { 4, 13, 2}, + { 4, 12, -2}, { 4, 10, 3}, { 5, 29, -3}, { 5, 22, 4}, + { 6, 57, -4}, { 6, 47, 5}, { 6, 46, -5}, { 7, 113, 6}, { 7, 112, -6}, { 0, 0, 0} }; huff_entry_t bitalloc_b_13[] = { - { 2, 0, 0}, { 3, 6, 1}, { 3, 5, -1}, { 3, 2, 2}, - { 4, 15, -2}, { 4, 9, 3}, { 4, 7, -3}, { 4, 6, 4}, - { 5, 29, -4}, { 5, 17, 5}, { 5, 16, -5}, { 6, 57, 6}, + { 2, 0, 0}, { 3, 6, 1}, { 3, 5, -1}, { 3, 2, 2}, + { 4, 15, -2}, { 4, 9, 3}, { 4, 7, -3}, { 4, 6, 4}, + { 5, 29, -4}, { 5, 17, 5}, { 5, 16, -5}, { 6, 57, 6}, { 6, 56, -6}, { 0, 0, 0} }; huff_entry_t bitalloc_c_13[] = { - { 3, 5, 0}, { 3, 4, 1}, { 3, 3, -1}, { 3, 2, 2}, - { 3, 0, -2}, { 4, 15, 3}, { 4, 14, -3}, { 4, 12, 4}, - { 4, 3, -4}, { 5, 27, 5}, { 5, 26, -5}, { 5, 5, 6}, + { 3, 5, 0}, { 3, 4, 1}, { 3, 3, -1}, { 3, 2, 2}, + { 3, 0, -2}, { 4, 15, 3}, { 4, 14, -3}, { 4, 12, 4}, + { 4, 3, -4}, { 5, 27, 5}, { 5, 26, -5}, { 5, 5, 6}, { 5, 4, -6}, { 0, 0, 0} }; huff_entry_t bitalloc_a_17[] = { - { 2, 1, 0}, { 3, 7, 1}, { 3, 6, -1}, { 3, 4, 2}, - { 3, 1, -2}, { 4, 11, 3}, { 4, 10, -3}, { 4, 0, 4}, - { 5, 3, -4}, { 6, 4, 5}, { 7, 11, -5}, { 8, 20, 6}, - { 9, 43, -6}, {10, 84, 7}, {11, 171, -7}, {12, 341, 8}, + { 2, 1, 0}, { 3, 7, 1}, { 3, 6, -1}, { 3, 4, 2}, + { 3, 1, -2}, { 4, 11, 3}, { 4, 10, -3}, { 4, 0, 4}, + { 5, 3, -4}, { 6, 4, 5}, { 7, 11, -5}, { 8, 20, 6}, + { 9, 43, -6}, {10, 84, 7}, {11, 171, -7}, {12, 341, 8}, {12, 340, -8}, { 0, 0, 0} }; huff_entry_t bitalloc_b_17[] = { - { 2, 0, 0}, { 3, 6, 1}, { 3, 5, -1}, { 3, 2, 2}, - { 4, 15, -2}, { 4, 9, 3}, { 4, 8, -3}, { 5, 29, 4}, - { 5, 28, -4}, { 5, 14, 5}, { 5, 13, -5}, { 6, 30, 6}, - { 6, 25, -6}, { 6, 24, 7}, { 7, 63, -7}, { 8, 125, 8}, + { 2, 0, 0}, { 3, 6, 1}, { 3, 5, -1}, { 3, 2, 2}, + { 4, 15, -2}, { 4, 9, 3}, { 4, 8, -3}, { 5, 29, 4}, + { 5, 28, -4}, { 5, 14, 5}, { 5, 13, -5}, { 6, 30, 6}, + { 6, 25, -6}, { 6, 24, 7}, { 7, 63, -7}, { 8, 125, 8}, { 8, 124, -8}, { 0, 0, 0} }; huff_entry_t bitalloc_c_17[] = { - { 3, 6, 0}, { 3, 4, 1}, { 3, 3, -1}, { 3, 0, 2}, - { 4, 15, -2}, { 4, 11, 3}, { 4, 10, -3}, { 4, 4, 4}, - { 4, 3, -4}, { 5, 29, 5}, { 5, 28, -5}, { 5, 10, 6}, - { 5, 5, -6}, { 5, 4, 7}, { 6, 23, -7}, { 7, 45, 8}, + { 3, 6, 0}, { 3, 4, 1}, { 3, 3, -1}, { 3, 0, 2}, + { 4, 15, -2}, { 4, 11, 3}, { 4, 10, -3}, { 4, 4, 4}, + { 4, 3, -4}, { 5, 29, 5}, { 5, 28, -5}, { 5, 10, 6}, + { 5, 5, -6}, { 5, 4, 7}, { 6, 23, -7}, { 7, 45, 8}, { 7, 44, -8}, { 0, 0, 0} }; huff_entry_t bitalloc_d_17[] = { - { 1, 0, 0}, { 3, 7, 1}, { 3, 6, -1}, { 4, 11, 2}, - { 4, 10, -2}, { 5, 19, 3}, { 5, 18, -3}, { 6, 35, 4}, - { 6, 34, -4}, { 7, 67, 5}, { 7, 66, -5}, { 8, 131, 6}, - { 8, 130, -6}, { 9, 259, 7}, { 9, 258, -7}, { 9, 257, 8}, + { 1, 0, 0}, { 3, 7, 1}, { 3, 6, -1}, { 4, 11, 2}, + { 4, 10, -2}, { 5, 19, 3}, { 5, 18, -3}, { 6, 35, 4}, + { 6, 34, -4}, { 7, 67, 5}, { 7, 66, -5}, { 8, 131, 6}, + { 8, 130, -6}, { 9, 259, 7}, { 9, 258, -7}, { 9, 257, 8}, { 9, 256, -8}, { 0, 0, 0} }; huff_entry_t bitalloc_e_17[] = { - { 1, 0, 0}, { 3, 5, 1}, { 3, 4, -1}, { 4, 12, 2}, - { 5, 31, -2}, { 5, 28, 3}, { 5, 27, -3}, { 6, 60, 4}, - { 6, 59, -4}, { 6, 53, 5}, { 6, 52, -5}, { 7, 122, 6}, - { 7, 117, -6}, { 8, 247, 7}, { 8, 246, -7}, { 8, 233, 8}, + { 1, 0, 0}, { 3, 5, 1}, { 3, 4, -1}, { 4, 12, 2}, + { 5, 31, -2}, { 5, 28, 3}, { 5, 27, -3}, { 6, 60, 4}, + { 6, 59, -4}, { 6, 53, 5}, { 6, 52, -5}, { 7, 122, 6}, + { 7, 117, -6}, { 8, 247, 7}, { 8, 246, -7}, { 8, 233, 8}, { 8, 232, -8}, { 0, 0, 0} }; huff_entry_t bitalloc_f_17[] = { - { 3, 6, 0}, { 3, 5, 1}, { 3, 4, -1}, { 3, 2, 2}, - { 3, 1, -2}, { 4, 15, 3}, { 4, 14, -3}, { 4, 6, 4}, - { 4, 1, -4}, { 5, 14, 5}, { 5, 1, -5}, { 6, 31, 6}, - { 6, 30, -6}, { 6, 0, 7}, { 7, 3, -7}, { 8, 5, 8}, + { 3, 6, 0}, { 3, 5, 1}, { 3, 4, -1}, { 3, 2, 2}, + { 3, 1, -2}, { 4, 15, 3}, { 4, 14, -3}, { 4, 6, 4}, + { 4, 1, -4}, { 5, 14, 5}, { 5, 1, -5}, { 6, 31, 6}, + { 6, 30, -6}, { 6, 0, 7}, { 7, 3, -7}, { 8, 5, 8}, { 8, 4, -8}, { 0, 0, 0} }; huff_entry_t bitalloc_g_17[] = { - { 2, 2, 0}, { 3, 7, 1}, { 3, 6, -1}, { 3, 1, 2}, - { 3, 0, -2}, { 4, 5, 3}, { 4, 4, -3}, { 5, 14, 4}, - { 5, 13, -4}, { 6, 30, 5}, { 6, 25, -5}, { 7, 62, 6}, - { 7, 49, -6}, { 8, 127, 7}, { 8, 126, -7}, { 8, 97, 8}, + { 2, 2, 0}, { 3, 7, 1}, { 3, 6, -1}, { 3, 1, 2}, + { 3, 0, -2}, { 4, 5, 3}, { 4, 4, -3}, { 5, 14, 4}, + { 5, 13, -4}, { 6, 30, 5}, { 6, 25, -5}, { 7, 62, 6}, + { 7, 49, -6}, { 8, 127, 7}, { 8, 126, -7}, { 8, 97, 8}, { 8, 96, -8}, { 0, 0, 0} }; huff_entry_t bitalloc_a_25[] = { - { 3, 6, 0}, { 3, 4, 1}, { 3, 3, -1}, { 3, 1, 2}, - { 3, 0, -2}, { 4, 15, 3}, { 4, 14, -3}, { 4, 5, 4}, - { 4, 4, -4}, { 5, 22, 5}, { 5, 21, -5}, { 6, 47, 6}, - { 6, 46, -6}, { 7, 83, 7}, { 7, 82, -7}, { 8, 163, 8}, - { 8, 162, -8}, { 8, 160, 9}, { 9, 323, -9}, {10, 644, 10}, - {11, 1291,-10}, {12, 2580, 11}, {13, 5163,-11}, {14, 10325, 12}, + { 3, 6, 0}, { 3, 4, 1}, { 3, 3, -1}, { 3, 1, 2}, + { 3, 0, -2}, { 4, 15, 3}, { 4, 14, -3}, { 4, 5, 4}, + { 4, 4, -4}, { 5, 22, 5}, { 5, 21, -5}, { 6, 47, 6}, + { 6, 46, -6}, { 7, 83, 7}, { 7, 82, -7}, { 8, 163, 8}, + { 8, 162, -8}, { 8, 160, 9}, { 9, 323, -9}, {10, 644, 10}, + {11, 1291,-10}, {12, 2580, 11}, {13, 5163,-11}, {14, 10325, 12}, {14, 10324,-12}, { 0, 0, 0} }; huff_entry_t bitalloc_b_25[] = { - { 3, 5, 0}, { 3, 2, 1}, { 3, 1, -1}, { 4, 15, 2}, - { 4, 14, -2}, { 4, 9, 3}, { 4, 8, -3}, { 4, 6, 4}, - { 4, 1, -4}, { 5, 26, 5}, { 5, 25, -5}, { 5, 15, 6}, - { 5, 14, -6}, { 6, 55, 7}, { 6, 54, -7}, { 6, 49, 8}, - { 6, 48, -8}, { 6, 1, 9}, { 6, 0, -9}, { 7, 6, 10}, - { 7, 5,-10}, { 7, 4, 11}, { 8, 15,-11}, { 9, 29, 12}, + { 3, 5, 0}, { 3, 2, 1}, { 3, 1, -1}, { 4, 15, 2}, + { 4, 14, -2}, { 4, 9, 3}, { 4, 8, -3}, { 4, 6, 4}, + { 4, 1, -4}, { 5, 26, 5}, { 5, 25, -5}, { 5, 15, 6}, + { 5, 14, -6}, { 6, 55, 7}, { 6, 54, -7}, { 6, 49, 8}, + { 6, 48, -8}, { 6, 1, 9}, { 6, 0, -9}, { 7, 6, 10}, + { 7, 5,-10}, { 7, 4, 11}, { 8, 15,-11}, { 9, 29, 12}, { 9, 28,-12}, { 0, 0, 0} }; huff_entry_t bitalloc_c_25[] = { - { 3, 1, 0}, { 4, 15, 1}, { 4, 14, -1}, { 4, 12, 2}, - { 4, 11, -2}, { 4, 9, 3}, { 4, 8, -3}, { 4, 6, 4}, - { 4, 5, -4}, { 4, 1, 5}, { 4, 0, -5}, { 5, 26, 6}, - { 5, 21, -6}, { 5, 15, 7}, { 5, 14, -7}, { 5, 8, 8}, - { 6, 55, -8}, { 6, 41, 9}, { 6, 40, -9}, { 6, 18, 10}, - { 7, 109,-10}, { 7, 108, 11}, { 7, 39,-11}, { 8, 77, 12}, + { 3, 1, 0}, { 4, 15, 1}, { 4, 14, -1}, { 4, 12, 2}, + { 4, 11, -2}, { 4, 9, 3}, { 4, 8, -3}, { 4, 6, 4}, + { 4, 5, -4}, { 4, 1, 5}, { 4, 0, -5}, { 5, 26, 6}, + { 5, 21, -6}, { 5, 15, 7}, { 5, 14, -7}, { 5, 8, 8}, + { 6, 55, -8}, { 6, 41, 9}, { 6, 40, -9}, { 6, 18, 10}, + { 7, 109,-10}, { 7, 108, 11}, { 7, 39,-11}, { 8, 77, 12}, { 8, 76,-12}, { 0, 0, 0} }; huff_entry_t bitalloc_d_25[] = { - { 2, 2, 0}, { 3, 7, 1}, { 3, 6, -1}, { 3, 1, 2}, - { 3, 0, -2}, { 4, 5, 3}, { 4, 4, -3}, { 5, 13, 4}, - { 5, 12, -4}, { 6, 29, 5}, { 6, 28, -5}, { 7, 62, 6}, - { 7, 61, -6}, { 8, 126, 7}, { 8, 121, -7}, { 9, 255, 8}, - { 9, 254, -8}, {10, 483, 9}, {10, 482, -9}, {11, 963, 10}, - {11, 962,-10}, {12, 1923, 11}, {12, 1922,-11}, {12, 1921, 12}, + { 2, 2, 0}, { 3, 7, 1}, { 3, 6, -1}, { 3, 1, 2}, + { 3, 0, -2}, { 4, 5, 3}, { 4, 4, -3}, { 5, 13, 4}, + { 5, 12, -4}, { 6, 29, 5}, { 6, 28, -5}, { 7, 62, 6}, + { 7, 61, -6}, { 8, 126, 7}, { 8, 121, -7}, { 9, 255, 8}, + { 9, 254, -8}, {10, 483, 9}, {10, 482, -9}, {11, 963, 10}, + {11, 962,-10}, {12, 1923, 11}, {12, 1922,-11}, {12, 1921, 12}, {12, 1920,-12}, { 0, 0, 0} }; huff_entry_t bitalloc_e_25[] = { - { 2, 3, 0}, { 3, 3, 1}, { 3, 2, -1}, { 4, 11, 2}, - { 4, 10, -2}, { 4, 1, 3}, { 4, 0, -3}, { 5, 17, 4}, - { 5, 16, -4}, { 5, 5, 5}, { 5, 4, -5}, { 6, 38, 6}, - { 6, 37, -6}, { 6, 14, 7}, { 6, 13, -7}, { 7, 79, 8}, - { 7, 78, -8}, { 7, 72, 9}, { 7, 31, -9}, { 7, 25, 10}, - { 7, 24,-10}, { 8, 147, 11}, { 8, 146,-11}, { 8, 61, 12}, + { 2, 3, 0}, { 3, 3, 1}, { 3, 2, -1}, { 4, 11, 2}, + { 4, 10, -2}, { 4, 1, 3}, { 4, 0, -3}, { 5, 17, 4}, + { 5, 16, -4}, { 5, 5, 5}, { 5, 4, -5}, { 6, 38, 6}, + { 6, 37, -6}, { 6, 14, 7}, { 6, 13, -7}, { 7, 79, 8}, + { 7, 78, -8}, { 7, 72, 9}, { 7, 31, -9}, { 7, 25, 10}, + { 7, 24,-10}, { 8, 147, 11}, { 8, 146,-11}, { 8, 61, 12}, { 8, 60,-12}, { 0, 0, 0} }; huff_entry_t bitalloc_f_25[] = { - { 3, 1, 0}, { 3, 0, 1}, { 4, 15, -1}, { 4, 14, 2}, - { 4, 13, -2}, { 4, 11, 3}, { 4, 10, -3}, { 4, 8, 4}, - { 4, 7, -4}, { 4, 5, 5}, { 4, 4, -5}, { 5, 24, 6}, - { 5, 19, -6}, { 5, 13, 7}, { 5, 12, -7}, { 6, 37, 8}, - { 6, 36, -8}, { 7, 102, 9}, { 7, 101, -9}, { 8, 207, 10}, - { 8, 206,-10}, { 8, 200, 11}, { 9, 403,-11}, {10, 805, 12}, + { 3, 1, 0}, { 3, 0, 1}, { 4, 15, -1}, { 4, 14, 2}, + { 4, 13, -2}, { 4, 11, 3}, { 4, 10, -3}, { 4, 8, 4}, + { 4, 7, -4}, { 4, 5, 5}, { 4, 4, -5}, { 5, 24, 6}, + { 5, 19, -6}, { 5, 13, 7}, { 5, 12, -7}, { 6, 37, 8}, + { 6, 36, -8}, { 7, 102, 9}, { 7, 101, -9}, { 8, 207, 10}, + { 8, 206,-10}, { 8, 200, 11}, { 9, 403,-11}, {10, 805, 12}, {10, 804,-12}, { 0, 0, 0} }; huff_entry_t bitalloc_g_25[] = { - { 2, 1, 0}, { 3, 6, 1}, { 3, 5, -1}, { 3, 0, 2}, - { 4, 15, -2}, { 4, 8, 3}, { 4, 3, -3}, { 5, 28, 4}, - { 5, 19, -4}, { 5, 4, 5}, { 6, 59, -5}, { 6, 36, 6}, - { 6, 11, -6}, { 7, 116, 7}, { 7, 75, -7}, { 7, 21, 8}, - { 7, 20, -8}, { 8, 149, 9}, { 8, 148, -9}, { 9, 470, 10}, - { 9, 469,-10}, {10, 943, 11}, {10, 942,-11}, {10, 937, 12}, + { 2, 1, 0}, { 3, 6, 1}, { 3, 5, -1}, { 3, 0, 2}, + { 4, 15, -2}, { 4, 8, 3}, { 4, 3, -3}, { 5, 28, 4}, + { 5, 19, -4}, { 5, 4, 5}, { 6, 59, -5}, { 6, 36, 6}, + { 6, 11, -6}, { 7, 116, 7}, { 7, 75, -7}, { 7, 21, 8}, + { 7, 20, -8}, { 8, 149, 9}, { 8, 148, -9}, { 9, 470, 10}, + { 9, 469,-10}, {10, 943, 11}, {10, 942,-11}, {10, 937, 12}, {10, 936,-12}, { 0, 0, 0} }; huff_entry_t bitalloc_a_33[] = { - { 3, 2, 0}, { 3, 1, 1}, { 3, 0, -1}, { 4, 14, 2}, - { 4, 13, -2}, { 4, 12, 3}, { 4, 11, -3}, { 4, 9, 4}, - { 4, 8, -4}, { 4, 6, 5}, { 5, 31, -5}, { 5, 20, 6}, - { 5, 15, -6}, { 6, 61, 7}, { 6, 60, -7}, { 6, 29, 8}, - { 6, 28, -8}, { 7, 85, 9}, { 7, 84, -9}, { 8, 174, 10}, - { 8, 173,-10}, { 9, 351, 11}, { 9, 350,-11}, {10, 691, 12}, - {10, 690,-12}, {11, 1379, 13}, {11, 1378,-13}, {12, 2755, 14}, - {12, 2754,-14}, {13, 5507, 15}, {13, 5506,-15}, {13, 5505, 16}, + { 3, 2, 0}, { 3, 1, 1}, { 3, 0, -1}, { 4, 14, 2}, + { 4, 13, -2}, { 4, 12, 3}, { 4, 11, -3}, { 4, 9, 4}, + { 4, 8, -4}, { 4, 6, 5}, { 5, 31, -5}, { 5, 20, 6}, + { 5, 15, -6}, { 6, 61, 7}, { 6, 60, -7}, { 6, 29, 8}, + { 6, 28, -8}, { 7, 85, 9}, { 7, 84, -9}, { 8, 174, 10}, + { 8, 173,-10}, { 9, 351, 11}, { 9, 350,-11}, {10, 691, 12}, + {10, 690,-12}, {11, 1379, 13}, {11, 1378,-13}, {12, 2755, 14}, + {12, 2754,-14}, {13, 5507, 15}, {13, 5506,-15}, {13, 5505, 16}, {13, 5504,-16}, { 0, 0, 0} }; huff_entry_t bitalloc_b_33[] = { - { 3, 1, 0}, { 4, 15, 1}, { 4, 14, -1}, { 4, 11, 2}, - { 4, 10, -2}, { 4, 8, 3}, { 4, 7, -3}, { 4, 4, 4}, - { 4, 1, -4}, { 5, 27, 5}, { 5, 26, -5}, { 5, 19, 6}, - { 5, 18, -6}, { 5, 12, 7}, { 5, 11, -7}, { 5, 1, 8}, - { 5, 0, -8}, { 6, 50, 9}, { 6, 49, -9}, { 6, 26, 10}, - { 6, 21,-10}, { 7, 103, 11}, { 7, 102,-11}, { 7, 96, 12}, - { 7, 55,-12}, { 7, 41, 13}, { 7, 40,-13}, { 8, 194, 14}, - { 8, 109,-14}, { 8, 108, 15}, { 9, 391,-15}, {10, 781, 16}, + { 3, 1, 0}, { 4, 15, 1}, { 4, 14, -1}, { 4, 11, 2}, + { 4, 10, -2}, { 4, 8, 3}, { 4, 7, -3}, { 4, 4, 4}, + { 4, 1, -4}, { 5, 27, 5}, { 5, 26, -5}, { 5, 19, 6}, + { 5, 18, -6}, { 5, 12, 7}, { 5, 11, -7}, { 5, 1, 8}, + { 5, 0, -8}, { 6, 50, 9}, { 6, 49, -9}, { 6, 26, 10}, + { 6, 21,-10}, { 7, 103, 11}, { 7, 102,-11}, { 7, 96, 12}, + { 7, 55,-12}, { 7, 41, 13}, { 7, 40,-13}, { 8, 194, 14}, + { 8, 109,-14}, { 8, 108, 15}, { 9, 391,-15}, {10, 781, 16}, {10, 780,-16}, { 0, 0, 0} }; huff_entry_t bitalloc_c_33[] = { - { 4, 13, 0}, { 4, 11, 1}, { 4, 10, -1}, { 4, 8, 2}, - { 4, 7, -2}, { 4, 4, 3}, { 4, 3, -3}, { 4, 2, 4}, - { 4, 1, -4}, { 5, 30, 5}, { 5, 29, -5}, { 5, 25, 6}, - { 5, 24, -6}, { 5, 19, 7}, { 5, 18, -7}, { 5, 11, 8}, - { 5, 10, -8}, { 5, 0, 9}, { 6, 63, -9}, { 6, 62, 10}, - { 6, 57,-10}, { 6, 27, 11}, { 6, 26,-11}, { 6, 24, 12}, - { 6, 3,-12}, { 7, 113, 13}, { 7, 112,-13}, { 7, 50, 14}, - { 7, 5,-14}, { 7, 4, 15}, { 8, 103,-15}, { 9, 205, 16}, + { 4, 13, 0}, { 4, 11, 1}, { 4, 10, -1}, { 4, 8, 2}, + { 4, 7, -2}, { 4, 4, 3}, { 4, 3, -3}, { 4, 2, 4}, + { 4, 1, -4}, { 5, 30, 5}, { 5, 29, -5}, { 5, 25, 6}, + { 5, 24, -6}, { 5, 19, 7}, { 5, 18, -7}, { 5, 11, 8}, + { 5, 10, -8}, { 5, 0, 9}, { 6, 63, -9}, { 6, 62, 10}, + { 6, 57,-10}, { 6, 27, 11}, { 6, 26,-11}, { 6, 24, 12}, + { 6, 3,-12}, { 7, 113, 13}, { 7, 112,-13}, { 7, 50, 14}, + { 7, 5,-14}, { 7, 4, 15}, { 8, 103,-15}, { 9, 205, 16}, { 9, 204,-16}, { 0, 0, 0} }; huff_entry_t bitalloc_d_33[] = { - { 2, 1, 0}, { 3, 6, 1}, { 3, 5, -1}, { 3, 0, 2}, - { 4, 15, -2}, { 4, 8, 3}, { 4, 3, -3}, { 5, 28, 4}, - { 5, 19, -4}, { 5, 4, 5}, { 6, 59, -5}, { 6, 36, 6}, - { 6, 11, -6}, { 7, 116, 7}, { 7, 75, -7}, { 7, 21, 8}, - { 7, 20, -8}, { 8, 149, 9}, { 8, 148, -9}, { 9, 469, 10}, - { 9, 468,-10}, {10, 941, 11}, {10, 940,-11}, {11, 1885, 12}, - {11, 1884,-12}, {12, 3773, 13}, {12, 3772,-13}, {13, 7551, 14}, - {13, 7550,-14}, {14, 15099, 15}, {14, 15098,-15}, {14, 15097, 16}, + { 2, 1, 0}, { 3, 6, 1}, { 3, 5, -1}, { 3, 0, 2}, + { 4, 15, -2}, { 4, 8, 3}, { 4, 3, -3}, { 5, 28, 4}, + { 5, 19, -4}, { 5, 4, 5}, { 6, 59, -5}, { 6, 36, 6}, + { 6, 11, -6}, { 7, 116, 7}, { 7, 75, -7}, { 7, 21, 8}, + { 7, 20, -8}, { 8, 149, 9}, { 8, 148, -9}, { 9, 469, 10}, + { 9, 468,-10}, {10, 941, 11}, {10, 940,-11}, {11, 1885, 12}, + {11, 1884,-12}, {12, 3773, 13}, {12, 3772,-13}, {13, 7551, 14}, + {13, 7550,-14}, {14, 15099, 15}, {14, 15098,-15}, {14, 15097, 16}, {14, 15096,-16}, { 0, 0, 0} }; huff_entry_t bitalloc_e_33[] = { - { 2, 2, 0}, { 3, 2, 1}, { 3, 1, -1}, { 4, 12, 2}, - { 4, 7, -2}, { 4, 0, 3}, { 5, 31, -3}, { 5, 27, 4}, - { 5, 26, -4}, { 5, 3, 5}, { 5, 2, -5}, { 6, 59, 6}, - { 6, 58, -6}, { 6, 27, 7}, { 6, 26, -7}, { 7, 123, 8}, - { 7, 122, -8}, { 7, 120, 9}, { 7, 115, -9}, { 7, 112, 10}, - { 7, 51,-10}, { 7, 49, 11}, { 7, 48,-11}, { 8, 242, 12}, - { 8, 229,-12}, { 8, 227, 13}, { 8, 226,-13}, { 8, 101, 14}, - { 8, 100,-14}, { 9, 487, 15}, { 9, 486,-15}, { 9, 457, 16}, + { 2, 2, 0}, { 3, 2, 1}, { 3, 1, -1}, { 4, 12, 2}, + { 4, 7, -2}, { 4, 0, 3}, { 5, 31, -3}, { 5, 27, 4}, + { 5, 26, -4}, { 5, 3, 5}, { 5, 2, -5}, { 6, 59, 6}, + { 6, 58, -6}, { 6, 27, 7}, { 6, 26, -7}, { 7, 123, 8}, + { 7, 122, -8}, { 7, 120, 9}, { 7, 115, -9}, { 7, 112, 10}, + { 7, 51,-10}, { 7, 49, 11}, { 7, 48,-11}, { 8, 242, 12}, + { 8, 229,-12}, { 8, 227, 13}, { 8, 226,-13}, { 8, 101, 14}, + { 8, 100,-14}, { 9, 487, 15}, { 9, 486,-15}, { 9, 457, 16}, { 9, 456,-16}, { 0, 0, 0} }; huff_entry_t bitalloc_f_33[] = { - { 4, 13, 0}, { 4, 12, 1}, { 4, 11, -1}, { 4, 9, 2}, - { 4, 8, -2}, { 4, 7, 3}, { 4, 6, -3}, { 4, 4, 4}, - { 4, 3, -4}, { 4, 1, 5}, { 4, 0, -5}, { 5, 30, 6}, - { 5, 29, -6}, { 5, 21, 7}, { 5, 20, -7}, { 5, 10, 8}, - { 5, 5, -8}, { 6, 63, 9}, { 6, 62, -9}, { 6, 56, 10}, - { 6, 23,-10}, { 6, 9, 11}, { 6, 8,-11}, { 7, 45, 12}, - { 7, 44,-12}, { 8, 230, 13}, { 8, 229,-13}, { 9, 463, 14}, - { 9, 462,-14}, { 9, 456, 15}, {10, 915,-15}, {11, 1829, 16}, + { 4, 13, 0}, { 4, 12, 1}, { 4, 11, -1}, { 4, 9, 2}, + { 4, 8, -2}, { 4, 7, 3}, { 4, 6, -3}, { 4, 4, 4}, + { 4, 3, -4}, { 4, 1, 5}, { 4, 0, -5}, { 5, 30, 6}, + { 5, 29, -6}, { 5, 21, 7}, { 5, 20, -7}, { 5, 10, 8}, + { 5, 5, -8}, { 6, 63, 9}, { 6, 62, -9}, { 6, 56, 10}, + { 6, 23,-10}, { 6, 9, 11}, { 6, 8,-11}, { 7, 45, 12}, + { 7, 44,-12}, { 8, 230, 13}, { 8, 229,-13}, { 9, 463, 14}, + { 9, 462,-14}, { 9, 456, 15}, {10, 915,-15}, {11, 1829, 16}, {11, 1828,-16}, { 0, 0, 0} }; huff_entry_t bitalloc_g_33[] = { - { 3, 6, 0}, { 3, 3, 1}, { 3, 2, -1}, { 4, 15, 2}, - { 4, 14, -2}, { 4, 9, 3}, { 4, 8, -3}, { 4, 1, 4}, - { 4, 0, -4}, { 5, 22, 5}, { 5, 21, -5}, { 5, 6, 6}, - { 5, 5, -6}, { 6, 46, 7}, { 6, 41, -7}, { 6, 14, 8}, - { 6, 9, -8}, { 7, 94, 9}, { 7, 81, -9}, { 7, 30, 10}, - { 7, 17,-10}, { 8, 191, 11}, { 8, 190,-11}, { 8, 63, 12}, - { 8, 62,-12}, { 8, 32, 13}, { 9, 323,-13}, { 9, 321, 14}, - { 9, 320,-14}, { 9, 67, 15}, { 9, 66,-15}, {10, 645, 16}, + { 3, 6, 0}, { 3, 3, 1}, { 3, 2, -1}, { 4, 15, 2}, + { 4, 14, -2}, { 4, 9, 3}, { 4, 8, -3}, { 4, 1, 4}, + { 4, 0, -4}, { 5, 22, 5}, { 5, 21, -5}, { 5, 6, 6}, + { 5, 5, -6}, { 6, 46, 7}, { 6, 41, -7}, { 6, 14, 8}, + { 6, 9, -8}, { 7, 94, 9}, { 7, 81, -9}, { 7, 30, 10}, + { 7, 17,-10}, { 8, 191, 11}, { 8, 190,-11}, { 8, 63, 12}, + { 8, 62,-12}, { 8, 32, 13}, { 9, 323,-13}, { 9, 321, 14}, + { 9, 320,-14}, { 9, 67, 15}, { 9, 66,-15}, {10, 645, 16}, {10, 644,-16}, { 0, 0, 0} }; huff_entry_t bitalloc_a_65[] = { - { 4, 6, 0}, { 4, 5, 1}, { 4, 4, -1}, { 4, 2, 2}, - { 4, 1, -2}, { 4, 0, 3}, { 5, 31, -3}, { 5, 29, 4}, - { 5, 28, -4}, { 5, 27, 5}, { 5, 26, -5}, { 5, 24, 6}, - { 5, 23, -6}, { 5, 21, 7}, { 5, 20, -7}, { 5, 18, 8}, - { 5, 17, -8}, { 5, 14, 9}, { 5, 7, -9}, { 5, 6, 10}, - { 6, 61,-10}, { 6, 50, 11}, { 6, 45,-11}, { 6, 38, 12}, - { 6, 33,-12}, { 6, 31, 13}, { 6, 30,-13}, { 7, 120, 14}, - { 7, 103,-14}, { 7, 89, 15}, { 7, 88,-15}, { 7, 65, 16}, - { 7, 64,-16}, { 8, 205, 17}, { 8, 204,-17}, { 8, 157, 18}, - { 8, 156,-18}, { 9, 486, 19}, { 9, 485,-19}, { 9, 318, 20}, - { 9, 317,-20}, {10, 975, 21}, {10, 974,-21}, {10, 639, 22}, - {10, 638,-22}, {11, 1939, 23}, {11, 1938,-23}, {11, 1936, 24}, - {11, 1267,-24}, {11, 1264, 25}, {12, 3875,-25}, {12, 2532, 26}, - {12, 2531,-26}, {13, 7749, 27}, {13, 7748,-27}, {13, 5061, 28}, - {13, 5060,-28}, {14, 10133, 29}, {14, 10132,-29}, {15, 20269, 30}, - {15, 20268,-30}, {16, 40543, 31}, {16, 40542,-31}, {16, 40541, 32}, + { 4, 6, 0}, { 4, 5, 1}, { 4, 4, -1}, { 4, 2, 2}, + { 4, 1, -2}, { 4, 0, 3}, { 5, 31, -3}, { 5, 29, 4}, + { 5, 28, -4}, { 5, 27, 5}, { 5, 26, -5}, { 5, 24, 6}, + { 5, 23, -6}, { 5, 21, 7}, { 5, 20, -7}, { 5, 18, 8}, + { 5, 17, -8}, { 5, 14, 9}, { 5, 7, -9}, { 5, 6, 10}, + { 6, 61,-10}, { 6, 50, 11}, { 6, 45,-11}, { 6, 38, 12}, + { 6, 33,-12}, { 6, 31, 13}, { 6, 30,-13}, { 7, 120, 14}, + { 7, 103,-14}, { 7, 89, 15}, { 7, 88,-15}, { 7, 65, 16}, + { 7, 64,-16}, { 8, 205, 17}, { 8, 204,-17}, { 8, 157, 18}, + { 8, 156,-18}, { 9, 486, 19}, { 9, 485,-19}, { 9, 318, 20}, + { 9, 317,-20}, {10, 975, 21}, {10, 974,-21}, {10, 639, 22}, + {10, 638,-22}, {11, 1939, 23}, {11, 1938,-23}, {11, 1936, 24}, + {11, 1267,-24}, {11, 1264, 25}, {12, 3875,-25}, {12, 2532, 26}, + {12, 2531,-26}, {13, 7749, 27}, {13, 7748,-27}, {13, 5061, 28}, + {13, 5060,-28}, {14, 10133, 29}, {14, 10132,-29}, {15, 20269, 30}, + {15, 20268,-30}, {16, 40543, 31}, {16, 40542,-31}, {16, 40541, 32}, {16, 40540,-32}, { 0, 0, 0} }; huff_entry_t bitalloc_b_65[] = { - { 4, 4, 0}, { 4, 2, 1}, { 4, 1, -1}, { 5, 30, 2}, - { 5, 29, -2}, { 5, 26, 3}, { 5, 25, -3}, { 5, 23, 4}, - { 5, 22, -4}, { 5, 19, 5}, { 5, 18, -5}, { 5, 16, 6}, - { 5, 15, -6}, { 5, 12, 7}, { 5, 11, -7}, { 5, 7, 8}, - { 5, 6, -8}, { 6, 63, 9}, { 6, 62, -9}, { 6, 56, 10}, - { 6, 55,-10}, { 6, 49, 11}, { 6, 48,-11}, { 6, 41, 12}, - { 6, 40,-12}, { 6, 34, 13}, { 6, 29,-13}, { 6, 26, 14}, - { 6, 21,-14}, { 6, 20, 15}, { 6, 3,-15}, { 6, 0, 16}, - { 7, 115,-16}, { 7, 109, 17}, { 7, 108,-17}, { 7, 86, 18}, - { 7, 85,-18}, { 7, 70, 19}, { 7, 57,-19}, { 7, 56, 20}, - { 7, 55,-20}, { 7, 4, 21}, { 7, 3,-21}, { 8, 229, 22}, - { 8, 228,-22}, { 8, 175, 23}, { 8, 174,-23}, { 8, 143, 24}, - { 8, 142,-24}, { 8, 108, 25}, { 8, 11,-25}, { 8, 10, 26}, - { 8, 5,-26}, { 9, 339, 27}, { 9, 338,-27}, { 9, 336, 28}, - { 9, 219,-28}, { 9, 9, 29}, { 9, 8,-29}, {10, 674, 30}, - {10, 437,-30}, {10, 436, 31}, {11, 1351,-31}, {12, 2701, 32}, + { 4, 4, 0}, { 4, 2, 1}, { 4, 1, -1}, { 5, 30, 2}, + { 5, 29, -2}, { 5, 26, 3}, { 5, 25, -3}, { 5, 23, 4}, + { 5, 22, -4}, { 5, 19, 5}, { 5, 18, -5}, { 5, 16, 6}, + { 5, 15, -6}, { 5, 12, 7}, { 5, 11, -7}, { 5, 7, 8}, + { 5, 6, -8}, { 6, 63, 9}, { 6, 62, -9}, { 6, 56, 10}, + { 6, 55,-10}, { 6, 49, 11}, { 6, 48,-11}, { 6, 41, 12}, + { 6, 40,-12}, { 6, 34, 13}, { 6, 29,-13}, { 6, 26, 14}, + { 6, 21,-14}, { 6, 20, 15}, { 6, 3,-15}, { 6, 0, 16}, + { 7, 115,-16}, { 7, 109, 17}, { 7, 108,-17}, { 7, 86, 18}, + { 7, 85,-18}, { 7, 70, 19}, { 7, 57,-19}, { 7, 56, 20}, + { 7, 55,-20}, { 7, 4, 21}, { 7, 3,-21}, { 8, 229, 22}, + { 8, 228,-22}, { 8, 175, 23}, { 8, 174,-23}, { 8, 143, 24}, + { 8, 142,-24}, { 8, 108, 25}, { 8, 11,-25}, { 8, 10, 26}, + { 8, 5,-26}, { 9, 339, 27}, { 9, 338,-27}, { 9, 336, 28}, + { 9, 219,-28}, { 9, 9, 29}, { 9, 8,-29}, {10, 674, 30}, + {10, 437,-30}, {10, 436, 31}, {11, 1351,-31}, {12, 2701, 32}, {12, 2700,-32}, { 0, 0, 0} }; huff_entry_t bitalloc_c_65[] = { - { 5, 28, 0}, { 5, 25, 1}, { 5, 24, -1}, { 5, 23, 2}, - { 5, 22, -2}, { 5, 19, 3}, { 5, 18, -3}, { 5, 16, 4}, - { 5, 15, -4}, { 5, 13, 5}, { 5, 12, -5}, { 5, 10, 6}, - { 5, 9, -6}, { 5, 7, 7}, { 5, 6, -7}, { 5, 4, 8}, - { 5, 3, -8}, { 5, 1, 9}, { 5, 0, -9}, { 6, 62, 10}, - { 6, 61,-10}, { 6, 59, 11}, { 6, 58,-11}, { 6, 54, 12}, - { 6, 53,-12}, { 6, 43, 13}, { 6, 42,-13}, { 6, 40, 14}, - { 6, 35,-14}, { 6, 29, 15}, { 6, 28,-15}, { 6, 17, 16}, - { 6, 16,-16}, { 6, 11, 17}, { 6, 10,-17}, { 6, 4, 18}, - { 7, 127,-18}, { 7, 121, 19}, { 7, 120,-19}, { 7, 110, 20}, - { 7, 105,-20}, { 7, 83, 21}, { 7, 82,-21}, { 7, 68, 22}, - { 7, 47,-22}, { 7, 46, 23}, { 7, 45,-23}, { 7, 11, 24}, - { 7, 10,-24}, { 8, 252, 25}, { 8, 223,-25}, { 8, 209, 26}, - { 8, 208,-26}, { 8, 138, 27}, { 8, 89,-27}, { 8, 88, 28}, - { 9, 507,-28}, { 9, 445, 29}, { 9, 444,-29}, { 9, 278, 30}, - {10, 1013,-30}, {10, 1012, 31}, {10, 559,-31}, {11, 1117, 32}, + { 5, 28, 0}, { 5, 25, 1}, { 5, 24, -1}, { 5, 23, 2}, + { 5, 22, -2}, { 5, 19, 3}, { 5, 18, -3}, { 5, 16, 4}, + { 5, 15, -4}, { 5, 13, 5}, { 5, 12, -5}, { 5, 10, 6}, + { 5, 9, -6}, { 5, 7, 7}, { 5, 6, -7}, { 5, 4, 8}, + { 5, 3, -8}, { 5, 1, 9}, { 5, 0, -9}, { 6, 62, 10}, + { 6, 61,-10}, { 6, 59, 11}, { 6, 58,-11}, { 6, 54, 12}, + { 6, 53,-12}, { 6, 43, 13}, { 6, 42,-13}, { 6, 40, 14}, + { 6, 35,-14}, { 6, 29, 15}, { 6, 28,-15}, { 6, 17, 16}, + { 6, 16,-16}, { 6, 11, 17}, { 6, 10,-17}, { 6, 4, 18}, + { 7, 127,-18}, { 7, 121, 19}, { 7, 120,-19}, { 7, 110, 20}, + { 7, 105,-20}, { 7, 83, 21}, { 7, 82,-21}, { 7, 68, 22}, + { 7, 47,-22}, { 7, 46, 23}, { 7, 45,-23}, { 7, 11, 24}, + { 7, 10,-24}, { 8, 252, 25}, { 8, 223,-25}, { 8, 209, 26}, + { 8, 208,-26}, { 8, 138, 27}, { 8, 89,-27}, { 8, 88, 28}, + { 9, 507,-28}, { 9, 445, 29}, { 9, 444,-29}, { 9, 278, 30}, + {10, 1013,-30}, {10, 1012, 31}, {10, 559,-31}, {11, 1117, 32}, {11, 1116,-32}, { 0, 0, 0} }; huff_entry_t bitalloc_d_65[] = { - { 3, 4, 0}, { 3, 1, 1}, { 3, 0, -1}, { 4, 13, 2}, - { 4, 12, -2}, { 4, 7, 3}, { 4, 6, -3}, { 5, 31, 4}, - { 5, 30, -4}, { 5, 23, 5}, { 5, 22, -5}, { 5, 11, 6}, - { 5, 10, -6}, { 6, 59, 7}, { 6, 58, -7}, { 6, 43, 8}, - { 6, 42, -8}, { 6, 19, 9}, { 6, 18, -9}, { 7, 115, 10}, - { 7, 114,-10}, { 7, 83, 11}, { 7, 82,-11}, { 7, 35, 12}, - { 7, 34,-12}, { 8, 227, 13}, { 8, 226,-13}, { 8, 163, 14}, - { 8, 162,-14}, { 8, 160, 15}, { 8, 67,-15}, { 8, 64, 16}, - { 9, 451,-16}, { 9, 448, 17}, { 9, 323,-17}, { 9, 132, 18}, - { 9, 131,-18}, {10, 900, 19}, {10, 899,-19}, {10, 644, 20}, - {10, 267,-20}, {10, 261, 21}, {10, 260,-21}, {11, 1797, 22}, - {11, 1796,-22}, {11, 533, 23}, {11, 532,-23}, {12, 3605, 24}, - {12, 3604,-24}, {12, 2582, 25}, {12, 2581,-25}, {13, 7215, 26}, - {13, 7214,-26}, {13, 5167, 27}, {13, 5166,-27}, {13, 5160, 28}, - {14, 14427,-28}, {14, 10323, 29}, {14, 10322,-29}, {15, 28853, 30}, - {15, 28852,-30}, {15, 28851, 31}, {15, 28850,-31}, {15, 28849, 32}, + { 3, 4, 0}, { 3, 1, 1}, { 3, 0, -1}, { 4, 13, 2}, + { 4, 12, -2}, { 4, 7, 3}, { 4, 6, -3}, { 5, 31, 4}, + { 5, 30, -4}, { 5, 23, 5}, { 5, 22, -5}, { 5, 11, 6}, + { 5, 10, -6}, { 6, 59, 7}, { 6, 58, -7}, { 6, 43, 8}, + { 6, 42, -8}, { 6, 19, 9}, { 6, 18, -9}, { 7, 115, 10}, + { 7, 114,-10}, { 7, 83, 11}, { 7, 82,-11}, { 7, 35, 12}, + { 7, 34,-12}, { 8, 227, 13}, { 8, 226,-13}, { 8, 163, 14}, + { 8, 162,-14}, { 8, 160, 15}, { 8, 67,-15}, { 8, 64, 16}, + { 9, 451,-16}, { 9, 448, 17}, { 9, 323,-17}, { 9, 132, 18}, + { 9, 131,-18}, {10, 900, 19}, {10, 899,-19}, {10, 644, 20}, + {10, 267,-20}, {10, 261, 21}, {10, 260,-21}, {11, 1797, 22}, + {11, 1796,-22}, {11, 533, 23}, {11, 532,-23}, {12, 3605, 24}, + {12, 3604,-24}, {12, 2582, 25}, {12, 2581,-25}, {13, 7215, 26}, + {13, 7214,-26}, {13, 5167, 27}, {13, 5166,-27}, {13, 5160, 28}, + {14, 14427,-28}, {14, 10323, 29}, {14, 10322,-29}, {15, 28853, 30}, + {15, 28852,-30}, {15, 28851, 31}, {15, 28850,-31}, {15, 28849, 32}, {15, 28848,-32}, { 0, 0, 0} }; huff_entry_t bitalloc_e_65[] = { - { 3, 4, 0}, { 3, 0, 1}, { 4, 15, -1}, { 4, 7, 2}, - { 4, 6, -2}, { 5, 29, 3}, { 5, 28, -3}, { 5, 23, 4}, - { 5, 22, -4}, { 5, 10, 5}, { 5, 9, -5}, { 5, 6, 6}, - { 5, 5, -6}, { 6, 54, 7}, { 6, 53, -7}, { 6, 48, 8}, - { 6, 43, -8}, { 6, 40, 9}, { 6, 23, -9}, { 6, 16, 10}, - { 6, 15,-10}, { 6, 9, 11}, { 6, 8,-11}, { 7, 105, 12}, - { 7, 104,-12}, { 7, 100, 13}, { 7, 99,-13}, { 7, 84, 14}, - { 7, 83,-14}, { 7, 45, 15}, { 7, 44,-15}, { 7, 29, 16}, - { 7, 28,-16}, { 8, 221, 17}, { 8, 220,-17}, { 8, 206, 18}, - { 8, 205,-18}, { 8, 202, 19}, { 8, 197,-19}, { 8, 171, 20}, - { 8, 170,-20}, { 8, 164, 21}, { 8, 71,-21}, { 8, 69, 22}, - { 8, 68,-22}, { 9, 446, 23}, { 9, 445,-23}, { 9, 415, 24}, - { 9, 414,-24}, { 9, 408, 25}, { 9, 407,-25}, { 9, 393, 26}, - { 9, 392,-26}, { 9, 331, 27}, { 9, 330,-27}, { 9, 141, 28}, - { 9, 140,-28}, {10, 895, 29}, {10, 894,-29}, {10, 889, 30}, - {10, 888,-30}, {10, 819, 31}, {10, 818,-31}, {10, 813, 32}, + { 3, 4, 0}, { 3, 0, 1}, { 4, 15, -1}, { 4, 7, 2}, + { 4, 6, -2}, { 5, 29, 3}, { 5, 28, -3}, { 5, 23, 4}, + { 5, 22, -4}, { 5, 10, 5}, { 5, 9, -5}, { 5, 6, 6}, + { 5, 5, -6}, { 6, 54, 7}, { 6, 53, -7}, { 6, 48, 8}, + { 6, 43, -8}, { 6, 40, 9}, { 6, 23, -9}, { 6, 16, 10}, + { 6, 15,-10}, { 6, 9, 11}, { 6, 8,-11}, { 7, 105, 12}, + { 7, 104,-12}, { 7, 100, 13}, { 7, 99,-13}, { 7, 84, 14}, + { 7, 83,-14}, { 7, 45, 15}, { 7, 44,-15}, { 7, 29, 16}, + { 7, 28,-16}, { 8, 221, 17}, { 8, 220,-17}, { 8, 206, 18}, + { 8, 205,-18}, { 8, 202, 19}, { 8, 197,-19}, { 8, 171, 20}, + { 8, 170,-20}, { 8, 164, 21}, { 8, 71,-21}, { 8, 69, 22}, + { 8, 68,-22}, { 9, 446, 23}, { 9, 445,-23}, { 9, 415, 24}, + { 9, 414,-24}, { 9, 408, 25}, { 9, 407,-25}, { 9, 393, 26}, + { 9, 392,-26}, { 9, 331, 27}, { 9, 330,-27}, { 9, 141, 28}, + { 9, 140,-28}, {10, 895, 29}, {10, 894,-29}, {10, 889, 30}, + {10, 888,-30}, {10, 819, 31}, {10, 818,-31}, {10, 813, 32}, {10, 812,-32}, { 0, 0, 0} }; huff_entry_t bitalloc_f_65[] = { - { 3, 6, 0}, { 3, 3, 1}, { 3, 2, -1}, { 4, 15, 2}, - { 4, 14, -2}, { 4, 9, 3}, { 4, 8, -3}, { 4, 1, 4}, - { 4, 0, -4}, { 5, 21, 5}, { 5, 20, -5}, { 5, 5, 6}, - { 5, 4, -6}, { 6, 45, 7}, { 6, 44, -7}, { 6, 13, 8}, - { 6, 12, -8}, { 7, 93, 9}, { 7, 92, -9}, { 7, 29, 10}, - { 7, 28,-10}, { 8, 189, 11}, { 8, 188,-11}, { 8, 61, 12}, - { 8, 60,-12}, { 9, 381, 13}, { 9, 380,-13}, { 9, 125, 14}, - { 9, 124,-14}, {10, 765, 15}, {10, 764,-15}, {10, 252, 16}, - {11, 1535,-16}, {11, 1532, 17}, {11, 511,-17}, {11, 506, 18}, - {12, 3069,-18}, {12, 3067, 19}, {12, 3066,-19}, {12, 1015, 20}, - {12, 1014,-20}, {13, 6136, 21}, {13, 2043,-21}, {13, 2035, 22}, - {13, 2034,-22}, {14, 12275, 23}, {14, 12274,-23}, {14, 4085, 24}, - {14, 4084,-24}, {14, 4083, 25}, {14, 4082,-25}, {14, 4081, 26}, - {14, 4080,-26}, {14, 4079, 27}, {14, 4078,-27}, {14, 4077, 28}, - {14, 4076,-28}, {14, 4075, 29}, {14, 4074,-29}, {14, 4073, 30}, - {14, 4072,-30}, {14, 4067, 31}, {14, 4066,-31}, {14, 4065, 32}, + { 3, 6, 0}, { 3, 3, 1}, { 3, 2, -1}, { 4, 15, 2}, + { 4, 14, -2}, { 4, 9, 3}, { 4, 8, -3}, { 4, 1, 4}, + { 4, 0, -4}, { 5, 21, 5}, { 5, 20, -5}, { 5, 5, 6}, + { 5, 4, -6}, { 6, 45, 7}, { 6, 44, -7}, { 6, 13, 8}, + { 6, 12, -8}, { 7, 93, 9}, { 7, 92, -9}, { 7, 29, 10}, + { 7, 28,-10}, { 8, 189, 11}, { 8, 188,-11}, { 8, 61, 12}, + { 8, 60,-12}, { 9, 381, 13}, { 9, 380,-13}, { 9, 125, 14}, + { 9, 124,-14}, {10, 765, 15}, {10, 764,-15}, {10, 252, 16}, + {11, 1535,-16}, {11, 1532, 17}, {11, 511,-17}, {11, 506, 18}, + {12, 3069,-18}, {12, 3067, 19}, {12, 3066,-19}, {12, 1015, 20}, + {12, 1014,-20}, {13, 6136, 21}, {13, 2043,-21}, {13, 2035, 22}, + {13, 2034,-22}, {14, 12275, 23}, {14, 12274,-23}, {14, 4085, 24}, + {14, 4084,-24}, {14, 4083, 25}, {14, 4082,-25}, {14, 4081, 26}, + {14, 4080,-26}, {14, 4079, 27}, {14, 4078,-27}, {14, 4077, 28}, + {14, 4076,-28}, {14, 4075, 29}, {14, 4074,-29}, {14, 4073, 30}, + {14, 4072,-30}, {14, 4067, 31}, {14, 4066,-31}, {14, 4065, 32}, {14, 4064,-32}, { 0, 0, 0} }; huff_entry_t bitalloc_g_65[] = { - { 4, 14, 0}, { 4, 11, 1}, { 4, 10, -1}, { 4, 8, 2}, - { 4, 6, -2}, { 4, 4, 3}, { 4, 3, -3}, { 4, 0, 4}, - { 5, 31, -4}, { 5, 26, 5}, { 5, 25, -5}, { 5, 18, 6}, - { 5, 15, -6}, { 5, 10, 7}, { 5, 5, -7}, { 5, 2, 8}, - { 6, 61, -8}, { 6, 54, 9}, { 6, 49, -9}, { 6, 38, 10}, - { 6, 29,-10}, { 6, 22, 11}, { 6, 9,-11}, { 6, 6, 12}, - { 7, 121,-12}, { 7, 110, 13}, { 7, 97,-13}, { 7, 78, 14}, - { 7, 57,-14}, { 7, 46, 15}, { 7, 17,-15}, { 7, 14, 16}, - { 8, 241,-16}, { 8, 223, 17}, { 8, 222,-17}, { 8, 159, 18}, - { 8, 158,-18}, { 8, 95, 19}, { 8, 94,-19}, { 8, 31, 20}, - { 8, 30,-20}, { 9, 480, 21}, { 9, 387,-21}, { 9, 384, 22}, - { 9, 227,-22}, { 9, 225, 23}, { 9, 224,-23}, { 9, 65, 24}, - { 9, 64,-24}, {10, 962, 25}, {10, 773,-25}, {10, 771, 26}, - {10, 770,-26}, {10, 452, 27}, {10, 135,-27}, {10, 133, 28}, - {10, 132,-28}, {11, 1927, 29}, {11, 1926,-29}, {11, 1545, 30}, - {11, 1544,-30}, {11, 907, 31}, {11, 906,-31}, {11, 269, 32}, + { 4, 14, 0}, { 4, 11, 1}, { 4, 10, -1}, { 4, 8, 2}, + { 4, 6, -2}, { 4, 4, 3}, { 4, 3, -3}, { 4, 0, 4}, + { 5, 31, -4}, { 5, 26, 5}, { 5, 25, -5}, { 5, 18, 6}, + { 5, 15, -6}, { 5, 10, 7}, { 5, 5, -7}, { 5, 2, 8}, + { 6, 61, -8}, { 6, 54, 9}, { 6, 49, -9}, { 6, 38, 10}, + { 6, 29,-10}, { 6, 22, 11}, { 6, 9,-11}, { 6, 6, 12}, + { 7, 121,-12}, { 7, 110, 13}, { 7, 97,-13}, { 7, 78, 14}, + { 7, 57,-14}, { 7, 46, 15}, { 7, 17,-15}, { 7, 14, 16}, + { 8, 241,-16}, { 8, 223, 17}, { 8, 222,-17}, { 8, 159, 18}, + { 8, 158,-18}, { 8, 95, 19}, { 8, 94,-19}, { 8, 31, 20}, + { 8, 30,-20}, { 9, 480, 21}, { 9, 387,-21}, { 9, 384, 22}, + { 9, 227,-22}, { 9, 225, 23}, { 9, 224,-23}, { 9, 65, 24}, + { 9, 64,-24}, {10, 962, 25}, {10, 773,-25}, {10, 771, 26}, + {10, 770,-26}, {10, 452, 27}, {10, 135,-27}, {10, 133, 28}, + {10, 132,-28}, {11, 1927, 29}, {11, 1926,-29}, {11, 1545, 30}, + {11, 1544,-30}, {11, 907, 31}, {11, 906,-31}, {11, 269, 32}, {11, 268,-32}, { 0, 0, 0} }; huff_entry_t bitalloc_a_129[] = { - { 4, 8, 0}, { 4, 10, 1}, { 4, 9, -1}, { 4, 0, 2}, - { 5, 31, -2}, { 5, 24, 3}, { 5, 23, -3}, { 5, 12, 4}, - { 5, 11, -4}, { 5, 5, 5}, { 5, 4, -5}, { 6, 60, 6}, - { 6, 58, -6}, { 6, 54, 7}, { 6, 53, -7}, { 6, 45, 8}, - { 6, 44, -8}, { 6, 28, 9}, { 6, 27, -9}, { 6, 19, 10}, - { 6, 18,-10}, { 6, 14, 11}, { 6, 13,-11}, { 6, 6, 12}, - { 6, 5,-12}, { 7, 122, 13}, { 7, 119,-13}, { 7, 113, 14}, - { 7, 112,-14}, { 7, 104, 15}, { 7, 103,-15}, { 7, 100, 16}, - { 7, 63,-16}, { 7, 60, 17}, { 7, 59,-17}, { 7, 52, 18}, - { 7, 43,-18}, { 7, 40, 19}, { 7, 35,-19}, { 7, 32, 20}, - { 7, 31,-20}, { 7, 15, 21}, { 7, 14,-21}, { 8, 247, 22}, - { 8, 246,-22}, { 8, 231, 23}, { 8, 230,-23}, { 8, 223, 24}, - { 8, 222,-24}, { 8, 211, 25}, { 8, 210,-25}, { 8, 203, 26}, - { 8, 202,-26}, { 8, 123, 27}, { 8, 122,-27}, { 8, 116, 28}, - { 8, 107,-28}, { 8, 84, 29}, { 8, 83,-29}, { 8, 68, 30}, - { 8, 67,-30}, { 8, 60, 31}, { 8, 51,-31}, { 8, 49, 32}, - { 8, 48,-32}, { 8, 17, 33}, { 8, 16,-33}, { 9, 474, 34}, - { 9, 473,-34}, { 9, 458, 35}, { 9, 457,-35}, { 9, 442, 36}, - { 9, 441,-36}, { 9, 411, 37}, { 9, 410,-37}, { 9, 251, 38}, - { 9, 250,-38}, { 9, 248, 39}, { 9, 235,-39}, { 9, 213, 40}, - { 9, 212,-40}, { 9, 170, 41}, { 9, 165,-41}, { 9, 139, 42}, - { 9, 138,-42}, { 9, 132, 43}, { 9, 123,-43}, { 9, 101, 44}, - { 9, 100,-44}, { 9, 37, 45}, { 9, 36,-45}, {10, 950, 46}, - {10, 945,-46}, {10, 919, 47}, {10, 918,-47}, {10, 912, 48}, - {10, 887,-48}, {10, 881, 49}, {10, 880,-49}, {10, 818, 50}, - {10, 817,-50}, {10, 499, 51}, {10, 498,-51}, {10, 469, 52}, - {10, 468,-52}, {10, 343, 53}, {10, 342,-53}, {10, 329, 54}, - {10, 328,-54}, {10, 267, 55}, {10, 266,-55}, {10, 245, 56}, - {10, 244,-56}, {10, 79, 57}, {10, 78,-57}, {10, 77, 58}, - {10, 76,-58}, {11, 1903, 59}, {11, 1902,-59}, {11, 1889, 60}, - {11, 1888,-60}, {11, 1827, 61}, {11, 1826,-61}, {11, 1773, 62}, - {11, 1772,-62}, {11, 1639, 63}, {11, 1638,-63}, {11, 1633, 64}, + { 4, 8, 0}, { 4, 10, 1}, { 4, 9, -1}, { 4, 0, 2}, + { 5, 31, -2}, { 5, 24, 3}, { 5, 23, -3}, { 5, 12, 4}, + { 5, 11, -4}, { 5, 5, 5}, { 5, 4, -5}, { 6, 60, 6}, + { 6, 58, -6}, { 6, 54, 7}, { 6, 53, -7}, { 6, 45, 8}, + { 6, 44, -8}, { 6, 28, 9}, { 6, 27, -9}, { 6, 19, 10}, + { 6, 18,-10}, { 6, 14, 11}, { 6, 13,-11}, { 6, 6, 12}, + { 6, 5,-12}, { 7, 122, 13}, { 7, 119,-13}, { 7, 113, 14}, + { 7, 112,-14}, { 7, 104, 15}, { 7, 103,-15}, { 7, 100, 16}, + { 7, 63,-16}, { 7, 60, 17}, { 7, 59,-17}, { 7, 52, 18}, + { 7, 43,-18}, { 7, 40, 19}, { 7, 35,-19}, { 7, 32, 20}, + { 7, 31,-20}, { 7, 15, 21}, { 7, 14,-21}, { 8, 247, 22}, + { 8, 246,-22}, { 8, 231, 23}, { 8, 230,-23}, { 8, 223, 24}, + { 8, 222,-24}, { 8, 211, 25}, { 8, 210,-25}, { 8, 203, 26}, + { 8, 202,-26}, { 8, 123, 27}, { 8, 122,-27}, { 8, 116, 28}, + { 8, 107,-28}, { 8, 84, 29}, { 8, 83,-29}, { 8, 68, 30}, + { 8, 67,-30}, { 8, 60, 31}, { 8, 51,-31}, { 8, 49, 32}, + { 8, 48,-32}, { 8, 17, 33}, { 8, 16,-33}, { 9, 474, 34}, + { 9, 473,-34}, { 9, 458, 35}, { 9, 457,-35}, { 9, 442, 36}, + { 9, 441,-36}, { 9, 411, 37}, { 9, 410,-37}, { 9, 251, 38}, + { 9, 250,-38}, { 9, 248, 39}, { 9, 235,-39}, { 9, 213, 40}, + { 9, 212,-40}, { 9, 170, 41}, { 9, 165,-41}, { 9, 139, 42}, + { 9, 138,-42}, { 9, 132, 43}, { 9, 123,-43}, { 9, 101, 44}, + { 9, 100,-44}, { 9, 37, 45}, { 9, 36,-45}, {10, 950, 46}, + {10, 945,-46}, {10, 919, 47}, {10, 918,-47}, {10, 912, 48}, + {10, 887,-48}, {10, 881, 49}, {10, 880,-49}, {10, 818, 50}, + {10, 817,-50}, {10, 499, 51}, {10, 498,-51}, {10, 469, 52}, + {10, 468,-52}, {10, 343, 53}, {10, 342,-53}, {10, 329, 54}, + {10, 328,-54}, {10, 267, 55}, {10, 266,-55}, {10, 245, 56}, + {10, 244,-56}, {10, 79, 57}, {10, 78,-57}, {10, 77, 58}, + {10, 76,-58}, {11, 1903, 59}, {11, 1902,-59}, {11, 1889, 60}, + {11, 1888,-60}, {11, 1827, 61}, {11, 1826,-61}, {11, 1773, 62}, + {11, 1772,-62}, {11, 1639, 63}, {11, 1638,-63}, {11, 1633, 64}, {11, 1632,-64}, { 0, 0, 0} }; huff_entry_t bitalloc_b_129[] = { - { 5, 10, 0}, { 5, 7, 1}, { 5, 6, -1}, { 5, 4, 2}, - { 5, 3, -2}, { 5, 0, 3}, { 6, 63, -3}, { 6, 60, 4}, - { 6, 59, -4}, { 6, 57, 5}, { 6, 56, -5}, { 6, 53, 6}, - { 6, 52, -6}, { 6, 50, 7}, { 6, 49, -7}, { 6, 46, 8}, - { 6, 45, -8}, { 6, 43, 9}, { 6, 42, -9}, { 6, 39, 10}, - { 6, 38,-10}, { 6, 35, 11}, { 6, 34,-11}, { 6, 32, 12}, - { 6, 31,-12}, { 6, 28, 13}, { 6, 27,-13}, { 6, 25, 14}, - { 6, 24,-14}, { 6, 22, 15}, { 6, 19,-15}, { 6, 16, 16}, - { 6, 11,-16}, { 6, 5, 17}, { 6, 4,-17}, { 7, 125, 18}, - { 7, 124,-18}, { 7, 122, 19}, { 7, 117,-19}, { 7, 110, 20}, - { 7, 109,-20}, { 7, 103, 21}, { 7, 102,-21}, { 7, 96, 22}, - { 7, 95,-22}, { 7, 89, 23}, { 7, 88,-23}, { 7, 81, 24}, - { 7, 80,-24}, { 7, 74, 25}, { 7, 73,-25}, { 7, 66, 26}, - { 7, 61,-26}, { 7, 59, 27}, { 7, 58,-27}, { 7, 52, 28}, - { 7, 47,-28}, { 7, 37, 29}, { 7, 36,-29}, { 7, 21, 30}, - { 7, 20,-30}, { 7, 6, 31}, { 7, 5,-31}, { 8, 247, 32}, - { 8, 246,-32}, { 8, 223, 33}, { 8, 222,-33}, { 8, 217, 34}, - { 8, 216,-34}, { 8, 189, 35}, { 8, 188,-35}, { 8, 166, 36}, - { 8, 165,-36}, { 8, 151, 37}, { 8, 150,-37}, { 8, 144, 38}, - { 8, 135,-38}, { 8, 121, 39}, { 8, 120,-39}, { 8, 106, 40}, - { 8, 93,-40}, { 8, 71, 41}, { 8, 70,-41}, { 8, 68, 42}, - { 8, 15,-42}, { 8, 9, 43}, { 8, 8,-43}, { 9, 466, 44}, - { 9, 465,-44}, { 9, 391, 45}, { 9, 390,-45}, { 9, 388, 46}, - { 9, 335,-46}, { 9, 329, 47}, { 9, 328,-47}, { 9, 269, 48}, - { 9, 268,-48}, { 9, 215, 49}, { 9, 214,-49}, { 9, 184, 50}, - { 9, 139,-50}, { 9, 29, 51}, { 9, 28,-51}, {10, 934, 52}, - {10, 929,-52}, {10, 779, 53}, {10, 778,-53}, {10, 668, 54}, - {10, 583,-54}, {10, 582, 55}, {10, 581,-55}, {10, 371, 56}, - {10, 370,-56}, {10, 276, 57}, {11, 1871,-57}, {11, 1857, 58}, - {11, 1856,-58}, {11, 1338, 59}, {11, 1161,-59}, {11, 1160, 60}, - {11, 555,-60}, {12, 3741, 61}, {12, 3740,-61}, {12, 2678, 62}, - {12, 1109,-62}, {12, 1108, 63}, {13, 5359,-63}, {14, 10717, 64}, + { 5, 10, 0}, { 5, 7, 1}, { 5, 6, -1}, { 5, 4, 2}, + { 5, 3, -2}, { 5, 0, 3}, { 6, 63, -3}, { 6, 60, 4}, + { 6, 59, -4}, { 6, 57, 5}, { 6, 56, -5}, { 6, 53, 6}, + { 6, 52, -6}, { 6, 50, 7}, { 6, 49, -7}, { 6, 46, 8}, + { 6, 45, -8}, { 6, 43, 9}, { 6, 42, -9}, { 6, 39, 10}, + { 6, 38,-10}, { 6, 35, 11}, { 6, 34,-11}, { 6, 32, 12}, + { 6, 31,-12}, { 6, 28, 13}, { 6, 27,-13}, { 6, 25, 14}, + { 6, 24,-14}, { 6, 22, 15}, { 6, 19,-15}, { 6, 16, 16}, + { 6, 11,-16}, { 6, 5, 17}, { 6, 4,-17}, { 7, 125, 18}, + { 7, 124,-18}, { 7, 122, 19}, { 7, 117,-19}, { 7, 110, 20}, + { 7, 109,-20}, { 7, 103, 21}, { 7, 102,-21}, { 7, 96, 22}, + { 7, 95,-22}, { 7, 89, 23}, { 7, 88,-23}, { 7, 81, 24}, + { 7, 80,-24}, { 7, 74, 25}, { 7, 73,-25}, { 7, 66, 26}, + { 7, 61,-26}, { 7, 59, 27}, { 7, 58,-27}, { 7, 52, 28}, + { 7, 47,-28}, { 7, 37, 29}, { 7, 36,-29}, { 7, 21, 30}, + { 7, 20,-30}, { 7, 6, 31}, { 7, 5,-31}, { 8, 247, 32}, + { 8, 246,-32}, { 8, 223, 33}, { 8, 222,-33}, { 8, 217, 34}, + { 8, 216,-34}, { 8, 189, 35}, { 8, 188,-35}, { 8, 166, 36}, + { 8, 165,-36}, { 8, 151, 37}, { 8, 150,-37}, { 8, 144, 38}, + { 8, 135,-38}, { 8, 121, 39}, { 8, 120,-39}, { 8, 106, 40}, + { 8, 93,-40}, { 8, 71, 41}, { 8, 70,-41}, { 8, 68, 42}, + { 8, 15,-42}, { 8, 9, 43}, { 8, 8,-43}, { 9, 466, 44}, + { 9, 465,-44}, { 9, 391, 45}, { 9, 390,-45}, { 9, 388, 46}, + { 9, 335,-46}, { 9, 329, 47}, { 9, 328,-47}, { 9, 269, 48}, + { 9, 268,-48}, { 9, 215, 49}, { 9, 214,-49}, { 9, 184, 50}, + { 9, 139,-50}, { 9, 29, 51}, { 9, 28,-51}, {10, 934, 52}, + {10, 929,-52}, {10, 779, 53}, {10, 778,-53}, {10, 668, 54}, + {10, 583,-54}, {10, 582, 55}, {10, 581,-55}, {10, 371, 56}, + {10, 370,-56}, {10, 276, 57}, {11, 1871,-57}, {11, 1857, 58}, + {11, 1856,-58}, {11, 1338, 59}, {11, 1161,-59}, {11, 1160, 60}, + {11, 555,-60}, {12, 3741, 61}, {12, 3740,-61}, {12, 2678, 62}, + {12, 1109,-62}, {12, 1108, 63}, {13, 5359,-63}, {14, 10717, 64}, {14, 10716,-64}, { 0, 0, 0} }; huff_entry_t bitalloc_c_129[] = { - { 6, 58, 0}, { 6, 55, 1}, { 6, 54, -1}, { 6, 52, 2}, - { 6, 51, -2}, { 6, 49, 3}, { 6, 48, -3}, { 6, 46, 4}, - { 6, 45, -4}, { 6, 43, 5}, { 6, 42, -5}, { 6, 40, 6}, - { 6, 39, -6}, { 6, 37, 7}, { 6, 36, -7}, { 6, 34, 8}, - { 6, 33, -8}, { 6, 30, 9}, { 6, 29, -9}, { 6, 27, 10}, - { 6, 26,-10}, { 6, 24, 11}, { 6, 23,-11}, { 6, 21, 12}, - { 6, 20,-12}, { 6, 18, 13}, { 6, 17,-13}, { 6, 14, 14}, - { 6, 13,-14}, { 6, 12, 15}, { 6, 11,-15}, { 6, 8, 16}, - { 6, 7,-16}, { 6, 6, 17}, { 6, 5,-17}, { 6, 3, 18}, - { 6, 2,-18}, { 7, 127, 19}, { 7, 126,-19}, { 7, 124, 20}, - { 7, 123,-20}, { 7, 121, 21}, { 7, 120,-21}, { 7, 118, 22}, - { 7, 115,-22}, { 7, 113, 23}, { 7, 112,-23}, { 7, 106, 24}, - { 7, 101,-24}, { 7, 95, 25}, { 7, 94,-25}, { 7, 88, 26}, - { 7, 83,-26}, { 7, 77, 27}, { 7, 76,-27}, { 7, 70, 28}, - { 7, 65,-28}, { 7, 64, 29}, { 7, 63,-29}, { 7, 56, 30}, - { 7, 51,-30}, { 7, 45, 31}, { 7, 44,-31}, { 7, 39, 32}, - { 7, 38,-32}, { 7, 31, 33}, { 7, 30,-33}, { 7, 20, 34}, - { 7, 19,-34}, { 7, 18, 35}, { 7, 9,-35}, { 7, 3, 36}, - { 7, 2,-36}, { 7, 0, 37}, { 8, 251,-37}, { 8, 245, 38}, - { 8, 244,-38}, { 8, 238, 39}, { 8, 229,-39}, { 8, 215, 40}, - { 8, 214,-40}, { 8, 200, 41}, { 8, 179,-41}, { 8, 165, 42}, - { 8, 164,-42}, { 8, 143, 43}, { 8, 142,-43}, { 8, 124, 44}, - { 8, 115,-44}, { 8, 101, 45}, { 8, 100,-45}, { 8, 66, 46}, - { 8, 65,-46}, { 8, 43, 47}, { 8, 42,-47}, { 8, 17, 48}, - { 8, 16,-48}, { 8, 2, 49}, { 9, 501,-49}, { 9, 479, 50}, - { 9, 478,-50}, { 9, 456, 51}, { 9, 403,-51}, { 9, 357, 52}, - { 9, 356,-52}, { 9, 251, 53}, { 9, 250,-53}, { 9, 228, 54}, - { 9, 135,-54}, { 9, 129, 55}, { 9, 128,-55}, { 9, 6, 56}, - {10, 1001,-56}, {10, 1000, 57}, {10, 915,-57}, {10, 805, 58}, - {10, 804,-58}, {10, 458, 59}, {10, 269,-59}, {10, 268, 60}, - {10, 15,-60}, {11, 1829, 61}, {11, 1828,-61}, {11, 918, 62}, - {11, 29,-62}, {11, 28, 63}, {12, 1839,-63}, {13, 3677, 64}, + { 6, 58, 0}, { 6, 55, 1}, { 6, 54, -1}, { 6, 52, 2}, + { 6, 51, -2}, { 6, 49, 3}, { 6, 48, -3}, { 6, 46, 4}, + { 6, 45, -4}, { 6, 43, 5}, { 6, 42, -5}, { 6, 40, 6}, + { 6, 39, -6}, { 6, 37, 7}, { 6, 36, -7}, { 6, 34, 8}, + { 6, 33, -8}, { 6, 30, 9}, { 6, 29, -9}, { 6, 27, 10}, + { 6, 26,-10}, { 6, 24, 11}, { 6, 23,-11}, { 6, 21, 12}, + { 6, 20,-12}, { 6, 18, 13}, { 6, 17,-13}, { 6, 14, 14}, + { 6, 13,-14}, { 6, 12, 15}, { 6, 11,-15}, { 6, 8, 16}, + { 6, 7,-16}, { 6, 6, 17}, { 6, 5,-17}, { 6, 3, 18}, + { 6, 2,-18}, { 7, 127, 19}, { 7, 126,-19}, { 7, 124, 20}, + { 7, 123,-20}, { 7, 121, 21}, { 7, 120,-21}, { 7, 118, 22}, + { 7, 115,-22}, { 7, 113, 23}, { 7, 112,-23}, { 7, 106, 24}, + { 7, 101,-24}, { 7, 95, 25}, { 7, 94,-25}, { 7, 88, 26}, + { 7, 83,-26}, { 7, 77, 27}, { 7, 76,-27}, { 7, 70, 28}, + { 7, 65,-28}, { 7, 64, 29}, { 7, 63,-29}, { 7, 56, 30}, + { 7, 51,-30}, { 7, 45, 31}, { 7, 44,-31}, { 7, 39, 32}, + { 7, 38,-32}, { 7, 31, 33}, { 7, 30,-33}, { 7, 20, 34}, + { 7, 19,-34}, { 7, 18, 35}, { 7, 9,-35}, { 7, 3, 36}, + { 7, 2,-36}, { 7, 0, 37}, { 8, 251,-37}, { 8, 245, 38}, + { 8, 244,-38}, { 8, 238, 39}, { 8, 229,-39}, { 8, 215, 40}, + { 8, 214,-40}, { 8, 200, 41}, { 8, 179,-41}, { 8, 165, 42}, + { 8, 164,-42}, { 8, 143, 43}, { 8, 142,-43}, { 8, 124, 44}, + { 8, 115,-44}, { 8, 101, 45}, { 8, 100,-45}, { 8, 66, 46}, + { 8, 65,-46}, { 8, 43, 47}, { 8, 42,-47}, { 8, 17, 48}, + { 8, 16,-48}, { 8, 2, 49}, { 9, 501,-49}, { 9, 479, 50}, + { 9, 478,-50}, { 9, 456, 51}, { 9, 403,-51}, { 9, 357, 52}, + { 9, 356,-52}, { 9, 251, 53}, { 9, 250,-53}, { 9, 228, 54}, + { 9, 135,-54}, { 9, 129, 55}, { 9, 128,-55}, { 9, 6, 56}, + {10, 1001,-56}, {10, 1000, 57}, {10, 915,-57}, {10, 805, 58}, + {10, 804,-58}, {10, 458, 59}, {10, 269,-59}, {10, 268, 60}, + {10, 15,-60}, {11, 1829, 61}, {11, 1828,-61}, {11, 918, 62}, + {11, 29,-62}, {11, 28, 63}, {12, 1839,-63}, {13, 3677, 64}, {13, 3676,-64}, { 0, 0, 0} }; huff_entry_t bitalloc_d_129[] = { - { 4, 9, 0}, { 4, 6, 1}, { 4, 5, -1}, { 4, 2, 2}, - { 4, 1, -2}, { 5, 30, 3}, { 5, 29, -3}, { 5, 26, 4}, - { 5, 25, -4}, { 5, 22, 5}, { 5, 21, -5}, { 5, 16, 6}, - { 5, 15, -6}, { 5, 8, 7}, { 5, 7, -7}, { 5, 0, 8}, - { 6, 63, -8}, { 6, 56, 9}, { 6, 55, -9}, { 6, 48, 10}, - { 6, 47,-10}, { 6, 40, 11}, { 6, 35,-11}, { 6, 28, 12}, - { 6, 19,-12}, { 6, 12, 13}, { 6, 3,-13}, { 7, 124, 14}, - { 7, 115,-14}, { 7, 108, 15}, { 7, 99,-15}, { 7, 92, 16}, - { 7, 83,-16}, { 7, 68, 17}, { 7, 59,-17}, { 7, 36, 18}, - { 7, 27,-18}, { 7, 4, 19}, { 8, 251,-19}, { 8, 228, 20}, - { 8, 219,-20}, { 8, 196, 21}, { 8, 187,-21}, { 8, 164, 22}, - { 8, 139,-22}, { 8, 116, 23}, { 8, 75,-23}, { 8, 52, 24}, - { 8, 11,-24}, { 9, 501, 25}, { 9, 500,-25}, { 9, 437, 26}, - { 9, 436,-26}, { 9, 373, 27}, { 9, 372,-27}, { 9, 277, 28}, - { 9, 276,-28}, { 9, 149, 29}, { 9, 148,-29}, { 9, 21, 30}, - { 9, 20,-30}, {10, 917, 31}, {10, 916,-31}, {10, 789, 32}, - {10, 788,-32}, {10, 661, 33}, {10, 660,-33}, {10, 469, 34}, - {10, 468,-34}, {10, 214, 35}, {10, 213,-35}, {11, 1838, 36}, - {11, 1837,-36}, {11, 1582, 37}, {11, 1581,-37}, {11, 1326, 38}, - {11, 1325,-38}, {11, 942, 39}, {11, 941,-39}, {11, 431, 40}, - {11, 430,-40}, {12, 3679, 41}, {12, 3678,-41}, {12, 3167, 42}, - {12, 3166,-42}, {12, 3160, 43}, {12, 2655,-43}, {12, 2648, 44}, - {12, 1887,-44}, {12, 1880, 45}, {12, 851,-45}, {12, 849, 46}, - {12, 848,-46}, {13, 7346, 47}, {13, 7345,-47}, {13, 6322, 48}, - {13, 5309,-48}, {13, 3773, 49}, {13, 3772,-49}, {13, 3762, 50}, - {13, 1701,-50}, {14, 14695, 51}, {14, 14694,-51}, {14, 14688, 52}, - {14, 12647,-52}, {14, 10617, 53}, {14, 10616,-53}, {14, 10596, 54}, - {14, 7527,-54}, {14, 3401, 55}, {14, 3400,-55}, {15, 29378, 56}, - {15, 25293,-56}, {15, 21195, 57}, {15, 21194,-57}, {15, 15053, 58}, - {15, 15052,-58}, {16, 58759, 59}, {16, 58758,-59}, {16, 50585, 60}, - {16, 50584,-60}, {16, 42399, 61}, {16, 42398,-61}, {16, 42397, 62}, - {16, 42396,-62}, {16, 42395, 63}, {16, 42394,-63}, {16, 42393, 64}, + { 4, 9, 0}, { 4, 6, 1}, { 4, 5, -1}, { 4, 2, 2}, + { 4, 1, -2}, { 5, 30, 3}, { 5, 29, -3}, { 5, 26, 4}, + { 5, 25, -4}, { 5, 22, 5}, { 5, 21, -5}, { 5, 16, 6}, + { 5, 15, -6}, { 5, 8, 7}, { 5, 7, -7}, { 5, 0, 8}, + { 6, 63, -8}, { 6, 56, 9}, { 6, 55, -9}, { 6, 48, 10}, + { 6, 47,-10}, { 6, 40, 11}, { 6, 35,-11}, { 6, 28, 12}, + { 6, 19,-12}, { 6, 12, 13}, { 6, 3,-13}, { 7, 124, 14}, + { 7, 115,-14}, { 7, 108, 15}, { 7, 99,-15}, { 7, 92, 16}, + { 7, 83,-16}, { 7, 68, 17}, { 7, 59,-17}, { 7, 36, 18}, + { 7, 27,-18}, { 7, 4, 19}, { 8, 251,-19}, { 8, 228, 20}, + { 8, 219,-20}, { 8, 196, 21}, { 8, 187,-21}, { 8, 164, 22}, + { 8, 139,-22}, { 8, 116, 23}, { 8, 75,-23}, { 8, 52, 24}, + { 8, 11,-24}, { 9, 501, 25}, { 9, 500,-25}, { 9, 437, 26}, + { 9, 436,-26}, { 9, 373, 27}, { 9, 372,-27}, { 9, 277, 28}, + { 9, 276,-28}, { 9, 149, 29}, { 9, 148,-29}, { 9, 21, 30}, + { 9, 20,-30}, {10, 917, 31}, {10, 916,-31}, {10, 789, 32}, + {10, 788,-32}, {10, 661, 33}, {10, 660,-33}, {10, 469, 34}, + {10, 468,-34}, {10, 214, 35}, {10, 213,-35}, {11, 1838, 36}, + {11, 1837,-36}, {11, 1582, 37}, {11, 1581,-37}, {11, 1326, 38}, + {11, 1325,-38}, {11, 942, 39}, {11, 941,-39}, {11, 431, 40}, + {11, 430,-40}, {12, 3679, 41}, {12, 3678,-41}, {12, 3167, 42}, + {12, 3166,-42}, {12, 3160, 43}, {12, 2655,-43}, {12, 2648, 44}, + {12, 1887,-44}, {12, 1880, 45}, {12, 851,-45}, {12, 849, 46}, + {12, 848,-46}, {13, 7346, 47}, {13, 7345,-47}, {13, 6322, 48}, + {13, 5309,-48}, {13, 3773, 49}, {13, 3772,-49}, {13, 3762, 50}, + {13, 1701,-50}, {14, 14695, 51}, {14, 14694,-51}, {14, 14688, 52}, + {14, 12647,-52}, {14, 10617, 53}, {14, 10616,-53}, {14, 10596, 54}, + {14, 7527,-54}, {14, 3401, 55}, {14, 3400,-55}, {15, 29378, 56}, + {15, 25293,-56}, {15, 21195, 57}, {15, 21194,-57}, {15, 15053, 58}, + {15, 15052,-58}, {16, 58759, 59}, {16, 58758,-59}, {16, 50585, 60}, + {16, 50584,-60}, {16, 42399, 61}, {16, 42398,-61}, {16, 42397, 62}, + {16, 42396,-62}, {16, 42395, 63}, {16, 42394,-63}, {16, 42393, 64}, {16, 42392,-64}, { 0, 0, 0} }; huff_entry_t bitalloc_e_129[] = { - { 5, 12, 0}, { 5, 11, 1}, { 5, 10, -1}, { 5, 9, 2}, - { 5, 8, -2}, { 5, 7, 3}, { 5, 6, -3}, { 5, 4, 4}, - { 5, 3, -4}, { 5, 2, 5}, { 5, 1, -5}, { 5, 0, 6}, - { 6, 63, -6}, { 6, 61, 7}, { 6, 60, -7}, { 6, 59, 8}, - { 6, 58, -8}, { 6, 56, 9}, { 6, 55, -9}, { 6, 53, 10}, - { 6, 52,-10}, { 6, 51, 11}, { 6, 50,-11}, { 6, 47, 12}, - { 6, 46,-12}, { 6, 45, 13}, { 6, 44,-13}, { 6, 42, 14}, - { 6, 41,-14}, { 6, 38, 15}, { 6, 37,-15}, { 6, 36, 16}, - { 6, 35,-16}, { 6, 32, 17}, { 6, 31,-17}, { 6, 29, 18}, - { 6, 28,-18}, { 6, 26, 19}, { 6, 11,-19}, { 7, 125, 20}, - { 7, 124,-20}, { 7, 109, 21}, { 7, 108,-21}, { 7, 98, 22}, - { 7, 97,-22}, { 7, 87, 23}, { 7, 86,-23}, { 7, 79, 24}, - { 7, 78,-24}, { 7, 68, 25}, { 7, 67,-25}, { 7, 60, 26}, - { 7, 55,-26}, { 7, 21, 27}, { 7, 20,-27}, { 8, 230, 28}, - { 8, 229,-28}, { 8, 198, 29}, { 8, 193,-29}, { 8, 163, 30}, - { 8, 162,-30}, { 8, 139, 31}, { 8, 138,-31}, { 8, 123, 32}, - { 8, 122,-32}, { 8, 108, 33}, { 9, 463,-33}, { 9, 457, 34}, - { 9, 456,-34}, { 9, 385, 35}, { 9, 384,-35}, { 9, 321, 36}, - { 9, 320,-36}, { 9, 266, 37}, { 9, 265,-37}, { 9, 218, 38}, - {10, 925,-38}, {10, 798, 39}, {10, 797,-39}, {10, 646, 40}, - {10, 645,-40}, {10, 535, 41}, {10, 534,-41}, {10, 528, 42}, - {10, 439,-42}, {11, 1848, 43}, {11, 1599,-43}, {11, 1592, 44}, - {11, 1295,-44}, {11, 1288, 45}, {11, 1059,-45}, {11, 877, 46}, - {11, 876,-46}, {12, 3197, 47}, {12, 3196,-47}, {12, 2589, 48}, - {12, 2588,-48}, {12, 2117, 49}, {12, 2116,-49}, {13, 7398, 50}, - {13, 7397,-50}, {13, 6374, 51}, {13, 6373,-51}, {13, 5158, 52}, - {13, 5157,-52}, {14, 14799, 53}, {14, 14798,-53}, {14, 12751, 54}, - {14, 12750,-54}, {14, 10318, 55}, {14, 10313,-55}, {15, 29587, 56}, - {15, 29586,-56}, {15, 29584, 57}, {15, 25491,-57}, {15, 20625, 58}, - {15, 20624,-58}, {16, 59171, 59}, {16, 59170,-59}, {16, 50980, 60}, - {16, 41277,-60}, {16, 50981, 61}, {16, 41278,-61}, {16, 50978, 62}, - {16, 41279,-62}, {16, 50979, 63}, {16, 50976,-63}, {16, 50977, 64}, + { 5, 12, 0}, { 5, 11, 1}, { 5, 10, -1}, { 5, 9, 2}, + { 5, 8, -2}, { 5, 7, 3}, { 5, 6, -3}, { 5, 4, 4}, + { 5, 3, -4}, { 5, 2, 5}, { 5, 1, -5}, { 5, 0, 6}, + { 6, 63, -6}, { 6, 61, 7}, { 6, 60, -7}, { 6, 59, 8}, + { 6, 58, -8}, { 6, 56, 9}, { 6, 55, -9}, { 6, 53, 10}, + { 6, 52,-10}, { 6, 51, 11}, { 6, 50,-11}, { 6, 47, 12}, + { 6, 46,-12}, { 6, 45, 13}, { 6, 44,-13}, { 6, 42, 14}, + { 6, 41,-14}, { 6, 38, 15}, { 6, 37,-15}, { 6, 36, 16}, + { 6, 35,-16}, { 6, 32, 17}, { 6, 31,-17}, { 6, 29, 18}, + { 6, 28,-18}, { 6, 26, 19}, { 6, 11,-19}, { 7, 125, 20}, + { 7, 124,-20}, { 7, 109, 21}, { 7, 108,-21}, { 7, 98, 22}, + { 7, 97,-22}, { 7, 87, 23}, { 7, 86,-23}, { 7, 79, 24}, + { 7, 78,-24}, { 7, 68, 25}, { 7, 67,-25}, { 7, 60, 26}, + { 7, 55,-26}, { 7, 21, 27}, { 7, 20,-27}, { 8, 230, 28}, + { 8, 229,-28}, { 8, 198, 29}, { 8, 193,-29}, { 8, 163, 30}, + { 8, 162,-30}, { 8, 139, 31}, { 8, 138,-31}, { 8, 123, 32}, + { 8, 122,-32}, { 8, 108, 33}, { 9, 463,-33}, { 9, 457, 34}, + { 9, 456,-34}, { 9, 385, 35}, { 9, 384,-35}, { 9, 321, 36}, + { 9, 320,-36}, { 9, 266, 37}, { 9, 265,-37}, { 9, 218, 38}, + {10, 925,-38}, {10, 798, 39}, {10, 797,-39}, {10, 646, 40}, + {10, 645,-40}, {10, 535, 41}, {10, 534,-41}, {10, 528, 42}, + {10, 439,-42}, {11, 1848, 43}, {11, 1599,-43}, {11, 1592, 44}, + {11, 1295,-44}, {11, 1288, 45}, {11, 1059,-45}, {11, 877, 46}, + {11, 876,-46}, {12, 3197, 47}, {12, 3196,-47}, {12, 2589, 48}, + {12, 2588,-48}, {12, 2117, 49}, {12, 2116,-49}, {13, 7398, 50}, + {13, 7397,-50}, {13, 6374, 51}, {13, 6373,-51}, {13, 5158, 52}, + {13, 5157,-52}, {14, 14799, 53}, {14, 14798,-53}, {14, 12751, 54}, + {14, 12750,-54}, {14, 10318, 55}, {14, 10313,-55}, {15, 29587, 56}, + {15, 29586,-56}, {15, 29584, 57}, {15, 25491,-57}, {15, 20625, 58}, + {15, 20624,-58}, {16, 59171, 59}, {16, 59170,-59}, {16, 50980, 60}, + {16, 41277,-60}, {16, 50981, 61}, {16, 41278,-61}, {16, 50978, 62}, + {16, 41279,-62}, {16, 50979, 63}, {16, 50976,-63}, {16, 50977, 64}, {16, 41276,-64}, { 0, 0, 0} }; huff_entry_t bitalloc_f_129[] = { - { 6, 56, 0}, { 6, 55, 1}, { 6, 54, -1}, { 6, 52, 2}, - { 6, 51, -2}, { 6, 50, 3}, { 6, 49, -3}, { 6, 48, 4}, - { 6, 47, -4}, { 6, 46, 5}, { 6, 45, -5}, { 6, 44, 6}, - { 6, 43, -6}, { 6, 41, 7}, { 6, 40, -7}, { 6, 39, 8}, - { 6, 38, -8}, { 6, 36, 9}, { 6, 35, -9}, { 6, 34, 10}, - { 6, 33,-10}, { 6, 31, 11}, { 6, 30,-11}, { 6, 29, 12}, - { 6, 28,-12}, { 6, 26, 13}, { 6, 25,-13}, { 6, 23, 14}, - { 6, 22,-14}, { 6, 21, 15}, { 6, 20,-15}, { 6, 18, 16}, - { 6, 17,-16}, { 6, 15, 17}, { 6, 14,-17}, { 6, 12, 18}, - { 6, 11,-18}, { 6, 9, 19}, { 6, 8,-19}, { 6, 7, 20}, - { 6, 6,-20}, { 6, 3, 21}, { 6, 2,-21}, { 6, 1, 22}, - { 6, 0,-22}, { 7, 125, 23}, { 7, 124,-23}, { 7, 123, 24}, - { 7, 122,-24}, { 7, 120, 25}, { 7, 119,-25}, { 7, 116, 26}, - { 7, 115,-26}, { 7, 114, 27}, { 7, 107,-27}, { 7, 84, 28}, - { 7, 75,-28}, { 7, 65, 29}, { 7, 64,-29}, { 7, 54, 30}, - { 7, 49,-30}, { 7, 39, 31}, { 7, 38,-31}, { 7, 27, 32}, - { 7, 26,-32}, { 7, 20, 33}, { 7, 11,-33}, { 7, 10, 34}, - { 7, 9,-34}, { 8, 254, 35}, { 8, 253,-35}, { 8, 243, 36}, - { 8, 242,-36}, { 8, 235, 37}, { 8, 234,-37}, { 8, 213, 38}, - { 8, 212,-38}, { 8, 149, 39}, { 8, 148,-39}, { 8, 110, 40}, - { 8, 97,-40}, { 8, 66, 41}, { 8, 65,-41}, { 8, 43, 42}, - { 8, 42,-42}, { 8, 16, 43}, { 9, 511,-43}, { 9, 505, 44}, - { 9, 504,-44}, { 9, 474, 45}, { 9, 473,-45}, { 9, 343, 46}, - { 9, 342,-46}, { 9, 340, 47}, { 9, 223,-47}, { 9, 192, 48}, - { 9, 135,-48}, { 9, 129, 49}, { 9, 128,-49}, { 9, 34, 50}, - {10, 1021,-50}, {10, 951, 51}, {10, 950,-51}, {10, 944, 52}, - {10, 683,-52}, {10, 445, 53}, {10, 444,-53}, {10, 269, 54}, - {10, 268,-54}, {10, 71, 55}, {10, 70,-55}, {11, 2040, 56}, - {11, 1891,-56}, {11, 1364, 57}, {11, 775,-57}, {11, 774, 58}, - {11, 773,-58}, {12, 4083, 59}, {12, 4082,-59}, {12, 3780, 60}, - {12, 2731,-60}, {12, 1545, 61}, {12, 1544,-61}, {13, 7562, 62}, - {13, 5461,-62}, {13, 5460, 63}, {14, 15127,-63}, {15, 30253, 64}, + { 6, 56, 0}, { 6, 55, 1}, { 6, 54, -1}, { 6, 52, 2}, + { 6, 51, -2}, { 6, 50, 3}, { 6, 49, -3}, { 6, 48, 4}, + { 6, 47, -4}, { 6, 46, 5}, { 6, 45, -5}, { 6, 44, 6}, + { 6, 43, -6}, { 6, 41, 7}, { 6, 40, -7}, { 6, 39, 8}, + { 6, 38, -8}, { 6, 36, 9}, { 6, 35, -9}, { 6, 34, 10}, + { 6, 33,-10}, { 6, 31, 11}, { 6, 30,-11}, { 6, 29, 12}, + { 6, 28,-12}, { 6, 26, 13}, { 6, 25,-13}, { 6, 23, 14}, + { 6, 22,-14}, { 6, 21, 15}, { 6, 20,-15}, { 6, 18, 16}, + { 6, 17,-16}, { 6, 15, 17}, { 6, 14,-17}, { 6, 12, 18}, + { 6, 11,-18}, { 6, 9, 19}, { 6, 8,-19}, { 6, 7, 20}, + { 6, 6,-20}, { 6, 3, 21}, { 6, 2,-21}, { 6, 1, 22}, + { 6, 0,-22}, { 7, 125, 23}, { 7, 124,-23}, { 7, 123, 24}, + { 7, 122,-24}, { 7, 120, 25}, { 7, 119,-25}, { 7, 116, 26}, + { 7, 115,-26}, { 7, 114, 27}, { 7, 107,-27}, { 7, 84, 28}, + { 7, 75,-28}, { 7, 65, 29}, { 7, 64,-29}, { 7, 54, 30}, + { 7, 49,-30}, { 7, 39, 31}, { 7, 38,-31}, { 7, 27, 32}, + { 7, 26,-32}, { 7, 20, 33}, { 7, 11,-33}, { 7, 10, 34}, + { 7, 9,-34}, { 8, 254, 35}, { 8, 253,-35}, { 8, 243, 36}, + { 8, 242,-36}, { 8, 235, 37}, { 8, 234,-37}, { 8, 213, 38}, + { 8, 212,-38}, { 8, 149, 39}, { 8, 148,-39}, { 8, 110, 40}, + { 8, 97,-40}, { 8, 66, 41}, { 8, 65,-41}, { 8, 43, 42}, + { 8, 42,-42}, { 8, 16, 43}, { 9, 511,-43}, { 9, 505, 44}, + { 9, 504,-44}, { 9, 474, 45}, { 9, 473,-45}, { 9, 343, 46}, + { 9, 342,-46}, { 9, 340, 47}, { 9, 223,-47}, { 9, 192, 48}, + { 9, 135,-48}, { 9, 129, 49}, { 9, 128,-49}, { 9, 34, 50}, + {10, 1021,-50}, {10, 951, 51}, {10, 950,-51}, {10, 944, 52}, + {10, 683,-52}, {10, 445, 53}, {10, 444,-53}, {10, 269, 54}, + {10, 268,-54}, {10, 71, 55}, {10, 70,-55}, {11, 2040, 56}, + {11, 1891,-56}, {11, 1364, 57}, {11, 775,-57}, {11, 774, 58}, + {11, 773,-58}, {12, 4083, 59}, {12, 4082,-59}, {12, 3780, 60}, + {12, 2731,-60}, {12, 1545, 61}, {12, 1544,-61}, {13, 7562, 62}, + {13, 5461,-62}, {13, 5460, 63}, {14, 15127,-63}, {15, 30253, 64}, {15, 30252,-64}, { 0, 0, 0} }; huff_entry_t bitalloc_g_129[] = { - { 4, 0, 0}, { 5, 29, 1}, { 5, 28, -1}, { 5, 25, 2}, - { 5, 24, -2}, { 5, 21, 3}, { 5, 20, -3}, { 5, 17, 4}, - { 5, 16, -4}, { 5, 13, 5}, { 5, 12, -5}, { 5, 9, 6}, - { 5, 8, -6}, { 5, 5, 7}, { 5, 4, -7}, { 6, 63, 8}, - { 6, 62, -8}, { 6, 55, 9}, { 6, 54, -9}, { 6, 47, 10}, - { 6, 46,-10}, { 6, 39, 11}, { 6, 38,-11}, { 6, 31, 12}, - { 6, 30,-12}, { 6, 23, 13}, { 6, 22,-13}, { 6, 15, 14}, - { 6, 14,-14}, { 6, 7, 15}, { 6, 6,-15}, { 7, 123, 16}, - { 7, 122,-16}, { 7, 107, 17}, { 7, 106,-17}, { 7, 91, 18}, - { 7, 90,-18}, { 7, 75, 19}, { 7, 74,-19}, { 7, 59, 20}, - { 7, 58,-20}, { 7, 43, 21}, { 7, 42,-21}, { 7, 27, 22}, - { 7, 26,-22}, { 7, 11, 23}, { 7, 10,-23}, { 7, 8, 24}, - { 8, 243,-24}, { 8, 240, 25}, { 8, 211,-25}, { 8, 208, 26}, - { 8, 179,-26}, { 8, 176, 27}, { 8, 147,-27}, { 8, 144, 28}, - { 8, 115,-28}, { 8, 112, 29}, { 8, 83,-29}, { 8, 80, 30}, - { 8, 51,-30}, { 8, 48, 31}, { 8, 19,-31}, { 9, 484, 32}, - { 9, 483,-32}, { 9, 421, 33}, { 9, 420,-33}, { 9, 357, 34}, - { 9, 356,-34}, { 9, 293, 35}, { 9, 292,-35}, { 9, 229, 36}, - { 9, 228,-36}, { 9, 226, 37}, { 9, 165,-37}, { 9, 162, 38}, - { 9, 101,-38}, { 9, 98, 39}, { 9, 37,-39}, {10, 970, 40}, - {10, 965,-40}, {10, 839, 41}, {10, 838,-41}, {10, 711, 42}, - {10, 710,-42}, {10, 708, 43}, {10, 583,-43}, {10, 580, 44}, - {10, 455,-44}, {10, 329, 45}, {10, 328,-45}, {10, 201, 46}, - {10, 200,-46}, {10, 198, 47}, {10, 73,-47}, {11, 1942, 48}, - {11, 1929,-48}, {11, 1675, 49}, {11, 1674,-49}, {11, 1672, 50}, - {11, 1419,-50}, {11, 1165, 51}, {11, 1164,-51}, {11, 1162, 52}, - {11, 909,-52}, {11, 655, 53}, {11, 654,-53}, {11, 652, 54}, - {11, 399,-54}, {11, 145, 55}, {11, 144,-55}, {12, 3886, 56}, - {12, 3857,-56}, {12, 3347, 57}, {12, 3346,-57}, {12, 2837, 58}, - {12, 2836,-58}, {12, 2327, 59}, {12, 2326,-59}, {12, 1817, 60}, - {12, 1816,-60}, {12, 1307, 61}, {12, 1306,-61}, {12, 797, 62}, - {12, 796,-62}, {13, 7775, 63}, {13, 7774,-63}, {13, 7713, 64}, + { 4, 0, 0}, { 5, 29, 1}, { 5, 28, -1}, { 5, 25, 2}, + { 5, 24, -2}, { 5, 21, 3}, { 5, 20, -3}, { 5, 17, 4}, + { 5, 16, -4}, { 5, 13, 5}, { 5, 12, -5}, { 5, 9, 6}, + { 5, 8, -6}, { 5, 5, 7}, { 5, 4, -7}, { 6, 63, 8}, + { 6, 62, -8}, { 6, 55, 9}, { 6, 54, -9}, { 6, 47, 10}, + { 6, 46,-10}, { 6, 39, 11}, { 6, 38,-11}, { 6, 31, 12}, + { 6, 30,-12}, { 6, 23, 13}, { 6, 22,-13}, { 6, 15, 14}, + { 6, 14,-14}, { 6, 7, 15}, { 6, 6,-15}, { 7, 123, 16}, + { 7, 122,-16}, { 7, 107, 17}, { 7, 106,-17}, { 7, 91, 18}, + { 7, 90,-18}, { 7, 75, 19}, { 7, 74,-19}, { 7, 59, 20}, + { 7, 58,-20}, { 7, 43, 21}, { 7, 42,-21}, { 7, 27, 22}, + { 7, 26,-22}, { 7, 11, 23}, { 7, 10,-23}, { 7, 8, 24}, + { 8, 243,-24}, { 8, 240, 25}, { 8, 211,-25}, { 8, 208, 26}, + { 8, 179,-26}, { 8, 176, 27}, { 8, 147,-27}, { 8, 144, 28}, + { 8, 115,-28}, { 8, 112, 29}, { 8, 83,-29}, { 8, 80, 30}, + { 8, 51,-30}, { 8, 48, 31}, { 8, 19,-31}, { 9, 484, 32}, + { 9, 483,-32}, { 9, 421, 33}, { 9, 420,-33}, { 9, 357, 34}, + { 9, 356,-34}, { 9, 293, 35}, { 9, 292,-35}, { 9, 229, 36}, + { 9, 228,-36}, { 9, 226, 37}, { 9, 165,-37}, { 9, 162, 38}, + { 9, 101,-38}, { 9, 98, 39}, { 9, 37,-39}, {10, 970, 40}, + {10, 965,-40}, {10, 839, 41}, {10, 838,-41}, {10, 711, 42}, + {10, 710,-42}, {10, 708, 43}, {10, 583,-43}, {10, 580, 44}, + {10, 455,-44}, {10, 329, 45}, {10, 328,-45}, {10, 201, 46}, + {10, 200,-46}, {10, 198, 47}, {10, 73,-47}, {11, 1942, 48}, + {11, 1929,-48}, {11, 1675, 49}, {11, 1674,-49}, {11, 1672, 50}, + {11, 1419,-50}, {11, 1165, 51}, {11, 1164,-51}, {11, 1162, 52}, + {11, 909,-52}, {11, 655, 53}, {11, 654,-53}, {11, 652, 54}, + {11, 399,-54}, {11, 145, 55}, {11, 144,-55}, {12, 3886, 56}, + {12, 3857,-56}, {12, 3347, 57}, {12, 3346,-57}, {12, 2837, 58}, + {12, 2836,-58}, {12, 2327, 59}, {12, 2326,-59}, {12, 1817, 60}, + {12, 1816,-60}, {12, 1307, 61}, {12, 1306,-61}, {12, 797, 62}, + {12, 796,-62}, {13, 7775, 63}, {13, 7774,-63}, {13, 7713, 64}, {13, 7712,-64}, { 0, 0, 0} }; diff --git a/src/libdts/tables_quantization.h b/src/libdts/tables_quantization.h index 904b1014e..447d6a8d0 100644 --- a/src/libdts/tables_quantization.h +++ b/src/libdts/tables_quantization.h @@ -22,59 +22,59 @@ int scale_factor_quant6[] = { - 1, 2, 2, 3, 3, 4, 6, 7, - 10, 12, 16, 20, 26, 34, 44, 56, - 72, 93, 120, 155, 200, 257, 331, 427, - 550, 708, 912, 1175, 1514, 1950, 2512, 3236, - 4169, 5370, 6918, 8913, 11482, 14791, 19055, 24547, - 31623, 40738, 52481, 67608, 87096, 112202, 144544, 186209, - 239883, 309030, 398107, 512861, 660693, 851138, 1096478, 1412538, + 1, 2, 2, 3, 3, 4, 6, 7, + 10, 12, 16, 20, 26, 34, 44, 56, + 72, 93, 120, 155, 200, 257, 331, 427, + 550, 708, 912, 1175, 1514, 1950, 2512, 3236, + 4169, 5370, 6918, 8913, 11482, 14791, 19055, 24547, + 31623, 40738, 52481, 67608, 87096, 112202, 144544, 186209, + 239883, 309030, 398107, 512861, 660693, 851138, 1096478, 1412538, 1819701, 2344229, 3019952, 3890451, 5011872, 6456542, 8317638, 0 }; int scale_factor_quant7[] = { - 1, 1, 2, 2, 2, 2, 3, 3, - 3, 4, 4, 5, 6, 7, 7, 8, - 10, 11, 12, 14, 16, 18, 20, 23, - 26, 30, 34, 38, 44, 50, 56, 64, - 72, 82, 93, 106, 120, 136, 155, 176, - 200, 226, 257, 292, 331, 376, 427, 484, - 550, 624, 708, 804, 912, 1035, 1175, 1334, - 1514, 1718, 1950, 2213, 2512, 2851, 3236, 3673, - 4169, 4732, 5370, 6095, 6918, 7852, 8913, 10116, - 11482, 13032, 14791, 16788, 19055, 21627, 24547, 27861, - 31623, 35892, 40738, 46238, 52481, 59566, 67608, 76736, - 87096, 98855, 112202, 127350, 144544, 164059, 186209, 211349, - 239883, 272270, 309030, 350752, 398107, 451856, 512861, 582103, - 660693, 749894, 851138, 966051, 1096478, 1244515, 1412538, 1603245, - 1819701, 2065380, 2344229, 2660725, 3019952, 3427678, 3890451, 4415704, + 1, 1, 2, 2, 2, 2, 3, 3, + 3, 4, 4, 5, 6, 7, 7, 8, + 10, 11, 12, 14, 16, 18, 20, 23, + 26, 30, 34, 38, 44, 50, 56, 64, + 72, 82, 93, 106, 120, 136, 155, 176, + 200, 226, 257, 292, 331, 376, 427, 484, + 550, 624, 708, 804, 912, 1035, 1175, 1334, + 1514, 1718, 1950, 2213, 2512, 2851, 3236, 3673, + 4169, 4732, 5370, 6095, 6918, 7852, 8913, 10116, + 11482, 13032, 14791, 16788, 19055, 21627, 24547, 27861, + 31623, 35892, 40738, 46238, 52481, 59566, 67608, 76736, + 87096, 98855, 112202, 127350, 144544, 164059, 186209, 211349, + 239883, 272270, 309030, 350752, 398107, 451856, 512861, 582103, + 660693, 749894, 851138, 966051, 1096478, 1244515, 1412538, 1603245, + 1819701, 2065380, 2344229, 2660725, 3019952, 3427678, 3890451, 4415704, 5011872, 5688529, 6456542, 7328245, 8317638, 0, 0, 0 }; /* 20bits unsigned fractional binary codes */ int lossy_quant[] = { - 0, 6710886, 4194304, 3355443, 2474639, 2097152, 1761608, 1426063, - 796918, 461373, 251658, 146801, 79692, 46137, 27263, 16777, - 10486, 5872, 3355, 1887, 1258, 713, 336, 168, + 0, 6710886, 4194304, 3355443, 2474639, 2097152, 1761608, 1426063, + 796918, 461373, 251658, 146801, 79692, 46137, 27263, 16777, + 10486, 5872, 3355, 1887, 1258, 713, 336, 168, 84, 42, 21, 0, 0, 0, 0, 0 }; double lossy_quant_d[] = { - 0, 1.6, 1.0, 0.8, 0.59, 0.50, 0.42, 0.34, - 0.19, 0.11, 0.06, 0.035, 0.019, 0.011, 0.0065, 0.0040, - 0.0025, 0.0014, 0.0008, 0.00045, 0.00030, 0.00017, 0.00008, 0.00004, + 0, 1.6, 1.0, 0.8, 0.59, 0.50, 0.42, 0.34, + 0.19, 0.11, 0.06, 0.035, 0.019, 0.011, 0.0065, 0.0040, + 0.0025, 0.0014, 0.0008, 0.00045, 0.00030, 0.00017, 0.00008, 0.00004, 0.00002, 0.00001, 0.000005, 0, 0, 0, 0, 0 }; /* 20bits unsigned fractional binary codes */ int lossless_quant[] = { - 0, 4194304, 2097152, 1384120, 1048576, 696254, 524288, 348127, - 262144, 131072, 65431, 33026, 16450, 8208, 4100, 2049, - 1024, 512, 256, 128, 64, 32, 16, 8, + 0, 4194304, 2097152, 1384120, 1048576, 696254, 524288, 348127, + 262144, 131072, 65431, 33026, 16450, 8208, 4100, 2049, + 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1, 0, 0, 0, 0, 0 }; diff --git a/src/libdts/tables_vq.h b/src/libdts/tables_vq.h index eae1ed94c..9c81505fa 100644 --- a/src/libdts/tables_vq.h +++ b/src/libdts/tables_vq.h @@ -24,2052 +24,2052 @@ static int8_t high_freq_vq[1024][32] = { - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { -4, -2, 2, 1, -16, -10, 1, 3, 1, 0, 6, 1, -3, 7, 1, -22, + { -4, -2, 2, 1, -16, -10, 1, 3, 1, 0, 6, 1, -3, 7, 1, -22, 2, -4, -3, 11, 14, 6, -1, 1, -13, 29, -28, 10, 10, -8, 0, -9 }, - { -8, 8, -7, 10, -3, -12, -5, -8, 1, -2, 9, -2, -5, -18, 1, 9, + { -8, 8, -7, 10, -3, -12, -5, -8, 1, -2, 9, -2, -5, -18, 1, 9, -8, -8, 3, 41, 7, -9, -9, 22, -42, -29, 14, -18, -14, -32, 1, -15 }, - { -16, 8, 15, 16, -16, 5, 2, 7, -6, -16, -7, 1, 1, -3, -2, 0, + { -16, 8, 15, 16, -16, 5, 2, 7, -6, -16, -7, 1, 1, -3, -2, 0, 8, 20, -26, -11, 2, -17, 0, -3, -34, -37, 10, 44, -2, 22, 2, -4 }, - { 7, 14, 5, 6, 15, -1, 3, -3, -9, -23, -5, -14, 8, -1, -14, -6, + { 7, 14, 5, 6, 15, -1, 3, -3, -9, -23, -5, -14, 8, -1, -14, -6, -5, -8, 54, 31, -6, 18, 2, -19, -2, -11, -30, -6, -19, 2, -2, -14 }, - { 1, 2, -2, -1, -3, -3, 1, -5, 1, -3, -4, -8, 5, -4, 0, 1, + { 1, 2, -2, -1, -3, -3, 1, -5, 1, -3, -4, -8, 5, -4, 0, 1, 3, 7, -5, -4, -3, -12, 3, -2, -3, 12, -53, -51, 6, -1, 6, 8 }, - { 0, -1, 5, 1, -6, -8, 7, 5, -18, -4, -1, 1, 0, -3, -3, -14, + { 0, -1, 5, 1, -6, -8, 7, 5, -18, -4, -1, 1, 0, -3, -3, -14, -1, -6, 0, -14, -1, -1, 5, -3, -11, 1, -20, 10, 2, 19, -2, -2 }, - { 2, 4, 3, 0, 5, 0, 3, 1, -2, 0, -6, -3, -4, -5, -3, -3, + { 2, 4, 3, 0, 5, 0, 3, 1, -2, 0, -6, -3, -4, -5, -3, -3, -7, 0, -34, 4, -43, 17, 0, -53, -13, -7, 24, 14, 5, -18, 9, -20 }, - { 1, 0, -3, 2, 3, -5, -2, 7, -21, 5, -25, 23, 11, -28, 2, 1, + { 1, 0, -3, 2, 3, -5, -2, 7, -21, 5, -25, 23, 11, -28, 2, 1, -11, 9, 13, -6, -12, 5, 7, 2, 4, -11, -6, -1, 8, 0, 1, -2 }, - { 2, -4, -6, -4, 0, -5, -29, 13, -6, -22, -3, -43, 12, -41, 5, 24, + { 2, -4, -6, -4, 0, -5, -29, 13, -6, -22, -3, -43, 12, -41, 5, 24, 18, -9, -36, -6, 4, -7, -4, 13, 4, -15, -1, -5, 1, 2, -5, 4 }, - { 0, -1, 13, -6, -5, 1, 0, -3, 1, -5, 19, -22, 31, -27, 4, -15, + { 0, -1, 13, -6, -5, 1, 0, -3, 1, -5, 19, -22, 31, -27, 4, -15, -6, 15, 9, -13, 1, -9, 10, -17, 4, -1, -1, 4, 2, 0, -3, -5 }, - { -7, 3, -8, 13, 19, -12, 8, -19, -3, -2, -24, 31, 14, 0, 7, -13, + { -7, 3, -8, 13, 19, -12, 8, -19, -3, -2, -24, 31, 14, 0, 7, -13, -18, 0, 3, 6, 13, -2, 1, -12, -21, 9, -2, 30, 21, -14, 2, -14 }, - { -3, -7, 8, -1, -2, -9, 6, 1, -7, 7, 13, 3, -1, -10, 30, 4, + { -3, -7, 8, -1, -2, -9, 6, 1, -7, 7, 13, 3, -1, -10, 30, 4, -10, 12, 5, 6, -13, -7, -4, -2, -2, 7, -3, -6, 3, 4, 1, 2 }, - { -8, 9, 2, -3, -5, 2, 0, 9, 3, 7, -4, -16, -13, 3, 23, -27, + { -8, 9, 2, -3, -5, 2, 0, 9, 3, 7, -4, -16, -13, 3, 23, -27, 18, 46, -38, 6, 4, 43, -1, 0, 8, -7, -4, -1, 11, -7, 6, -3 }, - { 1, 1, 18, -8, -6, 0, 3, 4, 22, -3, -4, -2, -4, -11, 40, -7, + { 1, 1, 18, -8, -6, 0, 3, 4, 22, -3, -4, -2, -4, -11, 40, -7, -3, -13, -14, -7, -10, 14, 7, 5, -14, 11, -5, 7, 21, -2, 9, -3 }, - { 0, 0, -2, 4, -2, 0, 2, 0, -1, 2, -1, 0, 0, 2, 2, 2, + { 0, 0, -2, 4, -2, 0, 2, 0, -1, 2, -1, 0, 0, 2, 2, 2, -1, 1, -3, -1, -15, -2, -63, -27, -21, -47, -14, 1, -14, 10, 0, 2 }, - { 1, 0, -4, 0, -3, -9, 4, 2, 6, -6, 0, -5, 11, -7, -15, 6, + { 1, 0, -4, 0, -3, -9, 4, 2, 6, -6, 0, -5, 11, -7, -15, 6, -7, -6, 3, 7, -15, -5, 23, -13, -6, 12, -8, 9, 2, -3, 3, 4 }, - { 6, 0, 3, 0, -2, -4, 2, 1, 1, -1, 1, -2, -1, -4, -22, -15, + { 6, 0, 3, 0, -2, -4, 2, 1, 1, -1, 1, -2, -1, -4, -22, -15, -46, -66, 10, 20, 2, -17, 12, -6, 1, -2, -2, 0, 1, -5, 1, 2 }, - { -1, 0, 0, 1, 0, -4, 0, 1, -10, -3, -8, 5, 7, -11, 2, -11, + { -1, 0, 0, 1, 0, -4, 0, 1, -10, -3, -8, 5, 7, -11, 2, -11, 29, -25, 11, 10, 0, -1, 5, -7, -2, -5, -2, 4, 4, -3, 5, -2 }, - { 1, -1, -1, -3, -2, 1, -8, -3, 2, -2, 4, -5, -1, -7, -2, 1, + { 1, -1, -1, -3, -2, 1, -8, -3, 2, -2, 4, -5, -1, -7, -2, 1, -14, -7, 3, -30, -15, -14, 3, -4, -1, 3, -13, -1, -3, 1, 2, 3 }, - { -1, -2, -3, 2, 2, -3, 3, 1, -3, 2, 0, -4, 6, 5, -5, 10, + { -1, -2, -3, 2, 2, -3, 3, 1, -3, 2, 0, -4, 6, 5, -5, 10, -57, 3, 22, -50, 1, -2, -5, -6, -1, 5, 1, 2, 2, 1, -2, 2 }, - { 2, 0, -1, -7, 2, 1, 3, 2, 0, 4, 3, -2, 3, -3, 4, -4, + { 2, 0, -1, -7, 2, 1, 3, 2, 0, 4, 3, -2, 3, -3, 4, -4, 24, -35, -3, 38, -6, -5, 15, 20, 3, 16, -7, -5, 0, -4, -5, 0 }, - { 0, 1, 0, 0, 0, -1, -1, 1, 1, -1, 1, -2, 0, 0, 0, 0, + { 0, 1, 0, 0, 0, -1, -1, 1, 1, -1, 1, -2, 0, 0, 0, 0, 0, -1, -2, -1, -5, -2, -43, -3, 46, -52, -10, 7, -8, 11, -2, -1 }, - { 0, 0, -1, 0, -1, 2, -41, 33, -44, -48, -15, -26, -9, 6, 3, 3, + { 0, 0, -1, 0, -1, 2, -41, 33, -44, -48, -15, -26, -9, 6, 3, 3, -3, 2, 2, 2, 2, -1, -1, -2, 1, 3, 0, 0, 5, 2, 3, 1 }, - { -4, 1, 6, 1, -6, -1, -2, 1, -14, -4, 0, -5, -2, 2, -2, 0, + { -4, 1, 6, 1, -6, -1, -2, 1, -14, -4, 0, -5, -2, 2, -2, 0, -6, 1, 0, 8, -21, 32, -3, -36, -6, -2, -1, -7, 3, 0, 1, -6 }, - { -3, -2, 3, 0, 2, 2, 8, -4, -4, 6, 2, 1, 3, -6, 4, 3, + { -3, -2, 3, 0, 2, 2, 8, -4, -4, 6, 2, 1, 3, -6, 4, 3, 13, 0, -12, -1, 25, -20, -2, -23, -15, 7, -3, -11, -3, 6, -1, 0 }, - { 0, 0, -3, -1, 0, 0, -2, -1, -2, -2, 1, -1, 0, 0, 10, 3, + { 0, 0, -3, -1, 0, 0, -2, -1, -2, -2, 1, -1, 0, 0, 10, 3, -2, 3, 3, -7, -6, -5, 0, -4, -60, -16, -6, 38, 5, 6, -5, 0 }, - { 0, 1, 0, 0, 0, 0, 0, 0, 1, -1, -1, 0, 1, 0, 0, 1, + { 0, 1, 0, 0, 0, 0, 0, 0, 1, -1, -1, 0, 1, 0, 0, 1, 0, 0, -1, 0, -8, 2, -9, 10, 40, 31, -56, -21, 4, 20, -4, 7 }, - { -2, -2, 0, 4, -3, -1, 7, 3, 1, 3, -8, 0, 3, 1, 2, 5, + { -2, -2, 0, 4, -3, -1, 7, 3, 1, 3, -8, 0, 3, 1, 2, 5, 1, -2, 14, 5, 4, 5, 5, 5, -5, 9, -66, 0, -20, -2, -8, 4 }, - { -2, -1, 4, -1, -8, -2, -4, -1, -3, -3, 2, -7, -3, 5, 7, -2, + { -2, -1, 4, -1, -8, -2, -4, -1, -3, -3, 2, -7, -3, 5, 7, -2, 45, 31, -17, -16, -2, -2, -1, -22, 1, -1, -3, 3, 5, -3, 5, -1 }, - { -4, 0, 7, 5, 8, 7, 2, 9, -9, -9, -7, -11, -3, -8, 17, -4, + { -4, 0, 7, 5, 8, 7, 2, 9, -9, -9, -7, -11, -3, -8, 17, -4, 34, 32, 18, 22, 1, 2, 1, -7, -5, 6, -1, 6, 4, 10, -2, -7 }, - { 6, 0, 14, 9, 6, -1, -2, -3, 4, -6, -8, 4, 7, -1, 28, 38, + { 6, 0, 14, 9, 6, -1, -2, -3, 4, -6, -8, 4, 7, -1, 28, 38, 15, -1, 16, -11, 5, 8, 4, -10, 3, -10, -17, 5, 3, 3, 3, 1 }, - { 1, 1, 2, -1, 2, 1, 0, 0, -1, 0, 0, -2, 1, -3, 0, 1, + { 1, 1, 2, -1, 2, 1, 0, 0, -1, 0, 0, -2, 1, -3, 0, 1, 2, -2, -4, -2, 0, -1, 1, -3, 1, 1, 1, -1, 8, 8, 66, 33 }, - { -5, 2, -3, -7, 2, -8, -4, 10, 17, -18, -7, 4, -4, -7, -6, -6, + { -5, 2, -3, -7, 2, -8, -4, 10, 17, -18, -7, 4, -4, -7, -6, -6, -5, 5, -12, 2, 0, 6, 8, -2, 1, 4, -11, 2, 1, 8, 31, 19 }, - { 6, 9, 16, -6, -6, -1, -2, -3, -11, -2, 7, 7, 17, 3, 4, 10, + { 6, 9, 16, -6, -6, -1, -2, -3, -11, -2, 7, 7, 17, 3, 4, 10, 2, 5, -13, 8, 7, 1, 4, 5, 7, 6, 7, -8, 9, -8, 33, 6 }, - { 3, -1, 1, 0, -7, -5, 0, 14, -7, 1, -7, 1, 2, -4, 7, 10, + { 3, -1, 1, 0, -7, -5, 0, 14, -7, 1, -7, 1, 2, -4, 7, 10, -16, 12, 1, -6, 3, 8, -1, 10, -13, -6, -12, -23, 12, -3, 30, 14 }, - { -2, -15, 0, 8, 3, -19, 5, -3, 2, 3, 13, 7, 14, -3, -10, 0, + { -2, -15, 0, 8, 3, -19, 5, -3, 2, 3, 13, 7, 14, -3, -10, 0, 8, 5, -6, -16, -8, -8, 14, 2, -1, 1, -9, -11, 11, -5, 27, 9 }, - { -8, 6, -4, 4, -4, -1, 5, 4, 1, -7, -5, -4, -15, 1, 9, 0, + { -8, 6, -4, 4, -4, -1, 5, 4, 1, -7, -5, -4, -15, 1, 9, 0, 8, 4, 1, -17, 11, -2, -19, -1, -6, -8, 3, -12, 3, -17, 33, -10 }, - { -3, -1, 2, 7, 7, -2, 9, 8, -18, -1, -13, -10, -3, -3, 11, 8, + { -3, -1, 2, 7, 7, -2, 9, 8, -18, -1, -13, -10, -3, -3, 11, 8, -2, -12, -8, 1, 4, 9, 14, 10, -3, 0, 2, 1, -2, 3, 31, 10 }, - { -3, -10, 8, -1, -5, -11, 7, -5, 3, 6, 1, 4, -16, 10, 5, -4, + { -3, -10, 8, -1, -5, -11, 7, -5, 3, 6, 1, 4, -16, 10, 5, -4, -2, -10, -1, 13, 6, -5, -7, 12, 7, -3, -17, 1, 12, -4, 29, 8 }, - { 1, 2, 5, 2, -6, -7, 0, -1, 6, -1, 10, 6, -4, 5, 2, 2, + { 1, 2, 5, 2, -6, -7, 0, -1, 6, -1, 10, 6, -4, 5, 2, 2, -2, -8, -6, -11, 14, -13, 27, 3, -2, -12, 5, -16, 2, -26, 20, 15 }, - { -1, -3, -5, -3, -3, 6, -1, 3, -5, 1, 7, 2, 1, 0, -1, -1, + { -1, -3, -5, -3, -3, 6, -1, 3, -5, 1, 7, 2, 1, 0, -1, -1, 0, -1, 9, 7, -6, -3, 4, -5, -4, 8, -8, -25, -8, -4, 34, 23 }, - { -1, -2, 1, 1, -1, -2, -1, 1, -1, 0, 0, 0, 0, -2, -1, 1, + { -1, -2, 1, 1, -1, -2, -1, 1, -1, 0, 0, 0, 0, -2, -1, 1, 0, 2, 1, -1, 4, 0, 0, 1, -1, 0, 5, 3, 12, -9, 68, -16 }, - { 10, 0, -8, 14, -6, 1, -12, 0, 0, -3, -5, -11, -6, 12, 9, -10, + { 10, 0, -8, 14, -6, 1, -12, 0, 0, -3, -5, -11, -6, 12, 9, -10, -3, 5, 0, 7, 11, 2, 4, -3, -8, -3, 7, 4, 3, -3, 34, 4 }, - { -12, 13, -5, 7, -11, -2, -1, 1, -4, -14, -21, 3, -3, -3, -4, -7, + { -12, 13, -5, 7, -11, -2, -1, 1, -4, -14, -21, 3, -3, -3, -4, -7, -9, -4, 3, -17, -2, -13, 10, -2, 12, -4, 0, -9, 1, -5, 31, 10 }, - { -10, 6, 5, 6, 4, -7, 10, 0, -28, -3, 0, -11, -1, -5, 16, -10, + { -10, 6, 5, 6, 4, -7, 10, 0, -28, -3, 0, -11, -1, -5, 16, -10, -16, 7, 20, 2, -4, 2, -5, 0, 15, 6, 5, -10, 7, -9, 20, 4 }, - { 1, -7, -2, -7, 4, -3, -2, -7, -1, -14, 6, -16, 4, -5, -4, -6, + { 1, -7, -2, -7, 4, -3, -2, -7, -1, -14, 6, -16, 4, -5, -4, -6, -5, 0, -2, 2, -6, 9, -5, 4, -18, 8, -10, 8, 15, 0, 32, 1 }, - { -5, 7, -3, 7, 15, -4, 0, -16, 9, 5, -5, 5, 4, -3, -12, -9, + { -5, 7, -3, 7, 15, -4, 0, -16, 9, 5, -5, 5, 4, -3, -12, -9, -18, 10, 2, 2, -3, 7, 3, -1, 6, -9, -10, 3, 15, -4, 35, -7 }, - { -1, -10, 2, 2, -4, -2, 10, 2, -1, 2, -2, 1, -1, -14, -11, 3, + { -1, -10, 2, 2, -4, -2, 10, 2, -1, 2, -2, 1, -1, -14, -11, 3, -8, 5, -8, -2, 6, -1, -7, 1, 7, 5, 7, 8, 30, -4, 30, 14 }, - { 2, -2, 1, 2, 3, -8, 3, 0, -2, 0, -9, 2, 1, 4, -6, -1, + { 2, -2, 1, 2, 3, -8, 3, 0, -2, 0, -9, 2, 1, 4, -6, -1, -2, 5, 0, 1, -2, 12, 6, -3, 9, -3, 4, -12, 21, -39, 24, -2 }, - { 3, 5, 1, -2, -2, -2, -3, 6, -8, -2, -11, -8, -1, 4, 2, 2, + { 3, 5, 1, -2, -2, -2, -3, 6, -8, -2, -11, -8, -1, 4, 2, 2, -4, -10, 12, -5, -11, 1, -15, -34, -11, -7, -11, -1, 7, -14, 38, -1 }, - { -4, 4, 8, 9, 8, 1, -5, -9, 4, -2, 15, -4, 11, -15, 20, -1, + { -4, 4, 8, 9, 8, 1, -5, -9, 4, -2, 15, -4, 11, -15, 20, -1, -1, -3, 4, -9, -2, -2, -2, 8, 6, 12, -5, 0, 11, -12, 27, -4 }, - { 0, 8, -4, 3, -11, 6, -11, 2, 3, 0, 5, -8, -7, -6, -9, -21, + { 0, 8, -4, 3, -11, 6, -11, 2, 3, 0, 5, -8, -7, -6, -9, -21, 4, -11, -1, -16, -7, 16, -3, 7, -7, 4, -5, 0, 11, -7, 31, 3 }, - { 1, 3, 4, 11, -11, -2, -3, -6, 6, 5, 0, 3, -9, -6, 4, -4, + { 1, 3, 4, 11, -11, -2, -3, -6, 6, 5, 0, 3, -9, -6, 4, -4, 0, 4, -8, 13, -6, -13, -1, -5, -1, 4, 0, 0, 9, -22, 24, 18 }, - { -7, 3, 10, -13, -6, 6, -6, 6, 22, 1, 0, -14, 2, 3, 7, -1, + { -7, 3, 10, -13, -6, 6, -6, 6, 22, 1, 0, -14, 2, 3, 7, -1, 8, 20, -1, 5, -4, 13, 9, -9, -9, 6, 0, -4, 0, -8, 31, -4 }, - { -3, -4, 0, 1, 7, 3, -7, 0, 5, -2, 1, 3, 3, 1, -5, -2, + { -3, -4, 0, 1, 7, 3, -7, 0, 5, -2, 1, 3, 3, 1, -5, -2, 5, 2, -11, 4, 0, -1, 12, 0, -3, -13, 15, 8, -6, -27, 34, 0 }, - { -3, -3, 10, -4, 2, -1, -3, 0, -1, -1, -4, 2, 6, -2, 12, 1, + { -3, -3, 10, -4, 2, -1, -3, 0, -1, -1, -4, 2, 6, -2, 12, 1, 3, -6, -7, -6, -5, 4, -19, -6, -8, -34, -4, -8, 10, -7, 23, 10 }, - { -7, 0, -1, -6, 8, 4, -4, 2, -5, -8, -7, -9, -8, 5, 9, 7, + { -7, 0, -1, -6, 8, 4, -4, 2, -5, -8, -7, -9, -8, 5, 9, 7, -6, 1, -12, -12, -1, -16, 5, 0, 16, 3, -7, -8, 27, -4, 23, 15 }, - { -8, 4, 8, 5, 6, 11, -3, 5, 3, -1, -11, 6, -5, 0, 2, -6, + { -8, 4, 8, 5, 6, 11, -3, 5, 3, -1, -11, 6, -5, 0, 2, -6, -3, -6, 4, -1, 5, -5, -12, -6, 7, -5, 9, 3, 6, -7, 29, 1 }, - { 1, 3, -2, -2, -6, -2, 1, 6, -6, -3, 1, 2, 3, 4, 1, 5, + { 1, 3, -2, -2, -6, -2, 1, 6, -6, -3, 1, 2, 3, 4, 1, 5, -1, 0, 4, 2, 11, 6, 2, -3, 13, -9, -19, 18, -15, -10, 36, 21 }, - { -3, -3, 2, -1, -7, 6, -4, 1, -3, -1, -2, 2, 3, -7, -3, 0, + { -3, -3, 2, -1, -7, 6, -4, 1, -3, -1, -2, 2, 3, -7, -3, 0, -2, 0, -2, 6, -19, 3, -8, 2, -6, 7, -1, 0, 29, -6, 28, -10 }, - { -5, 1, -3, -7, -12, -4, 1, 1, -1, 13, -10, -1, -9, -5, -13, 6, + { -5, 1, -3, -7, -12, -4, 1, 1, -1, 13, -10, -1, -9, -5, -13, 6, 13, 3, -4, 2, 3, 11, 2, 6, -25, -16, -6, 0, 14, -1, 27, 16 }, - { -6, -1, -7, -5, -2, -5, -5, -1, 9, 1, 0, 3, -8, -12, -6, 5, + { -6, -1, -7, -5, -2, -5, -5, -1, 9, 1, 0, 3, -8, -12, -6, 5, -6, 5, 3, -9, 1, 4, -7, -10, -9, -7, -17, -5, -15, -23, 25, 3 }, - { -8, -2, 9, -3, -4, 3, -1, 8, -7, -7, -5, -4, -2, 9, 4, -1, + { -8, -2, 9, -3, -4, 3, -1, 8, -7, -7, -5, -4, -2, 9, 4, -1, -7, -4, -5, -16, 3, -6, 18, -13, -9, 16, -15, 8, 15, -10, 24, 5 }, - { 1, -38, 2, 34, 9, 10, 11, 2, 2, -6, 3, 2, -2, 5, 4, -7, + { 1, -38, 2, 34, 9, 10, 11, 2, 2, -6, 3, 2, -2, 5, 4, -7, -1, 1, 4, 0, 3, 1, -8, -1, -6, 5, 4, 2, -4, 5, 2, -1 }, - { 1, -22, 15, 18, -2, 10, -16, -9, -8, -11, 8, 4, 0, 7, -14, -5, + { 1, -22, 15, 18, -2, 10, -16, -9, -8, -11, 8, 4, 0, 7, -14, -5, -1, -7, 12, 17, 9, 5, -7, -4, -12, -6, 7, 0, 7, 2, -2, 1 }, - { -11, -29, 7, 10, 19, -1, -8, -9, 7, 1, 9, 6, 8, -7, -14, 8, + { -11, -29, 7, 10, 19, -1, -8, -9, 7, 1, 9, 6, 8, -7, -14, 8, -3, -11, -13, 0, -7, -23, -2, -8, 12, 9, 2, 14, 19, 1, -1, 5 }, - { -24, -27, -11, 36, 2, 6, -3, 4, -6, 8, 0, 12, -1, -4, -6, 3, + { -24, -27, -11, 36, 2, 6, -3, 4, -6, 8, 0, 12, -1, -4, -6, 3, 4, -1, 2, -3, -2, 3, 2, -1, -2, -4, 0, -1, -2, 7, 2, 3 }, - { -9, -24, 11, 13, -10, -12, 12, -2, 7, 4, 8, 13, -3, -3, 2, 9, + { -9, -24, 11, 13, -10, -12, 12, -2, 7, 4, 8, 13, -3, -3, 2, 9, -3, -4, 4, 13, 5, 13, -6, -3, 1, 15, 7, -3, 0, 19, -2, -9 }, - { -8, -15, 7, 14, -4, -5, 2, -18, -19, -2, 2, 17, 16, 6, -10, 10, + { -8, -15, 7, 14, -4, -5, 2, -18, -19, -2, 2, 17, 16, 6, -10, 10, -9, 14, -1, -5, -1, -6, -7, 2, 9, 11, 13, 6, -5, -12, 3, 2 }, - { -10, -37, 13, 1, 3, -14, 0, -20, 4, -3, 8, 2, -2, -3, -9, -5, + { -10, -37, 13, 1, 3, -14, 0, -20, 4, -3, 8, 2, -2, -3, -9, -5, -3, -17, -1, 13, -11, 2, -6, 4, 4, 0, 3, 1, -9, -4, -5, -4 }, - { -2, -22, -5, 46, -8, 5, 9, -11, 8, 7, 7, -1, -1, -2, -7, 2, + { -2, -22, -5, 46, -8, 5, 9, -11, 8, 7, 7, -1, -1, -2, -7, 2, -3, 3, -1, -2, 7, 0, 2, -1, 1, -2, -2, -3, 6, 0, -4, -6 }, - { -16, -27, 15, 16, -4, 14, -7, -26, 2, -2, 6, 5, -3, 11, 0, 2, + { -16, -27, 15, 16, -4, 14, -7, -26, 2, -2, 6, 5, -3, 11, 0, 2, 3, 9, -7, -1, 2, -4, -4, -1, 6, 10, 1, 1, -3, -2, 3, 0 }, - { -3, -22, 10, 26, 1, 2, -3, 3, 17, -3, -7, 9, 1, -21, -4, 5, + { -3, -22, 10, 26, 1, 2, -3, 3, 17, -3, -7, 9, 1, -21, -4, 5, 3, 0, -7, -6, 3, 3, -8, -7, -9, 3, 7, 1, -8, 12, 6, -7 }, - { -9, -25, 3, 18, 9, -6, -11, 0, -5, -12, 9, -8, -7, -6, -6, 22, + { -9, -25, 3, 18, 9, -6, -11, 0, -5, -12, 9, -8, -7, -6, -6, 22, 2, -6, -3, 15, 3, 2, -2, 9, 14, -10, -7, 15, 13, 6, -2, 11 }, - { 5, -20, -5, 28, 11, 10, -4, -4, 0, -7, 3, 5, 2, -5, -8, 2, + { 5, -20, -5, 28, 11, 10, -4, -4, 0, -7, 3, 5, 2, -5, -8, 2, 6, 10, 9, -9, -18, 3, 14, 1, 3, -3, -1, -6, 7, 7, 2, -1 }, - { -8, -30, 7, 12, 10, 8, 7, -13, -16, 0, 1, -1, -6, -11, -15, 4, + { -8, -30, 7, 12, 10, 8, 7, -13, -16, 0, 1, -1, -6, -11, -15, 4, 1, -2, 10, -15, 1, 11, -2, 8, 9, -7, -7, 9, -5, 2, 7, -18 }, - { -10, -32, 10, 11, 3, -1, 3, -5, 5, 2, 14, -6, 3, 1, 5, -15, + { -10, -32, 10, 11, 3, -1, 3, -5, 5, 2, 14, -6, 3, 1, 5, -15, -11, 6, 20, 4, 0, -12, -7, 3, 1, -1, 10, 6, -1, -9, -4, -1 }, - { 1, -25, -14, 12, -11, 9, 9, -16, -24, -17, 22, -9, 11, -30, -3, -4, + { 1, -25, -14, 12, -11, 9, 9, -16, -24, -17, 22, -9, 11, -30, -3, -4, 6, -7, 9, 2, -1, -5, -6, 2, -1, -1, 10, 1, -3, 3, 4, 8 }, - { -14, -26, -6, 9, 8, 17, -11, -24, -7, -4, -8, -2, 10, 2, 2, -1, + { -14, -26, -6, 9, 8, 17, -11, -24, -7, -4, -8, -2, 10, 2, 2, -1, 2, 13, 12, -7, 4, -6, -10, 6, 6, -13, -11, -7, -16, 0, -2, 5 }, - { -4, -30, -13, 12, 16, -6, 12, -16, -13, 5, 15, -2, -2, -10, -7, 7, + { -4, -30, -13, 12, 16, -6, 12, -16, -13, 5, 15, -2, -2, -10, -7, 7, 11, -1, -4, -2, -4, 7, 4, -8, 1, 3, 0, 11, 3, -2, -5, 4 }, - { -4, -21, 20, 22, 2, 20, -8, 1, -12, -5, -9, 4, -10, -17, -3, -8, + { -4, -21, 20, 22, 2, 20, -8, 1, -12, -5, -9, 4, -10, -17, -3, -8, -3, 3, -12, 1, -3, 0, 7, 4, 7, 7, -3, 7, 5, 3, 1, -5 }, - { -12, -20, 2, 29, 11, -6, 9, -7, -6, -4, 0, 6, 17, -13, -2, -10, + { -12, -20, 2, 29, 11, -6, 9, -7, -6, -4, 0, 6, 17, -13, -2, -10, -17, -1, -18, 2, 0, 14, -6, 1, 0, 3, 2, -10, 1, -5, -2, 5 }, - { 16, -37, -1, 26, -2, -14, 1, -5, -14, 2, 2, 3, 6, 1, 1, 4, + { 16, -37, -1, 26, -2, -14, 1, -5, -14, 2, 2, 3, 6, 1, 1, 4, 0, -1, 0, -2, -2, 4, 9, -6, 0, -2, 10, -7, -2, 4, 1, 0 }, - { -9, -24, -12, 5, 5, 3, -17, -14, 4, 3, 2, -4, 10, -22, -8, -3, + { -9, -24, -12, 5, 5, 3, -17, -14, 4, 3, 2, -4, 10, -22, -8, -3, 6, 1, 12, -8, 4, 1, 9, -1, 18, -3, 6, 5, 3, -5, 9, -5 }, - { -14, -33, -2, 20, -13, -10, 2, -7, -1, 11, -9, -8, 18, -3, 1, 8, + { -14, -33, -2, 20, -13, -10, 2, -7, -1, 11, -9, -8, 18, -3, 1, 8, 0, -2, 10, 7, -2, -13, 9, -3, -4, 5, -2, -2, -1, -5, 1, -7 }, - { -10, -23, 8, 14, 1, 7, 1, -3, -7, 4, 1, 1, 8, -7, 15, -14, + { -10, -23, 8, 14, 1, 7, 1, -3, -7, 4, 1, 1, 8, -7, 15, -14, 13, 14, 2, 5, -13, -5, -8, -1, 6, 3, 6, 9, 6, 15, 14, 5 }, - { -13, -25, -10, 13, -17, -24, -7, -13, -6, -10, -8, 2, 0, -13, -10, -4, + { -13, -25, -10, 13, -17, -24, -7, -13, -6, -10, -8, 2, 0, -13, -10, -4, -8, 4, -9, 9, -4, 4, -3, -3, 3, 3, -5, -9, 1, -2, 11, 2 }, - { -12, -23, 1, 18, -11, -2, 5, 9, -5, 5, 14, -9, -3, -2, -6, 2, + { -12, -23, 1, 18, -11, -2, 5, 9, -5, 5, 14, -9, -3, -2, -6, 2, -2, 11, -13, 1, -3, 11, -9, -4, -2, -6, 8, 10, 1, 4, 2, 1 }, - { -5, -18, 16, 22, 2, 0, 8, -6, -9, -7, 10, -16, 23, 10, -11, -1, + { -5, -18, 16, 22, 2, 0, 8, -6, -9, -7, 10, -16, 23, 10, -11, -1, 7, 2, 7, 2, 1, -5, 6, 1, 0, -4, 9, 2, -3, 1, 0, -4 }, - { -3, -26, 14, 11, 2, -9, 17, -2, -1, -5, -16, -9, -5, 10, -13, 1, + { -3, -26, 14, 11, 2, -9, 17, -2, -1, -5, -16, -9, -5, 10, -13, 1, 6, 12, 10, 11, 0, 0, -3, -14, 6, -2, 0, 4, -5, -1, -7, -1 }, - { -10, -33, 1, 8, 11, -5, 1, -6, 7, 4, 5, 6, 1, -2, -10, -5, + { -10, -33, 1, 8, 11, -5, 1, -6, 7, 4, 5, 6, 1, -2, -10, -5, -6, 12, -11, 5, -10, 4, 12, -1, -1, -3, 4, -1, 9, 0, 16, -17 }, - { -14, -37, 7, 7, -2, 5, -8, -11, 2, -13, 4, -19, 1, 8, 8, 4, + { -14, -37, 7, 7, -2, 5, -8, -11, 2, -13, 4, -19, 1, 8, 8, 4, -9, 2, -4, 3, 12, 2, 4, -4, -8, 8, 1, 4, 8, -1, 6, -2 }, - { -6, -30, 18, 17, 1, -22, -3, 4, -7, -10, 7, 0, -8, 8, -1, 4, + { -6, -30, 18, 17, 1, -22, -3, 4, -7, -10, 7, 0, -8, 8, -1, 4, 2, 8, 6, -2, 2, 7, 4, 4, 3, -6, 2, 1, -3, 1, -1, -5 }, - { -17, -18, -3, 22, -8, 1, 9, -2, -17, 20, -5, -5, -12, -5, 4, -5, + { -17, -18, -3, 22, -8, 1, 9, -2, -17, 20, -5, -5, -12, -5, 4, -5, -9, 8, -2, 16, -3, 0, 19, -8, 8, 1, 2, -4, 0, 11, 0, -3 }, - { -9, -23, 3, 10, 4, 4, -3, -2, -2, -2, 1, -22, 11, 0, -2, 5, + { -9, -23, 3, 10, 4, 4, -3, -2, -2, -2, 1, -22, 11, 0, -2, 5, -2, 14, -9, -11, -4, 7, 5, 32, 1, -3, -7, 0, 21, -9, 7, -6 }, - { 0, 0, 0, 2, -1, 1, 0, 1, 3, 0, 0, 1, 0, 1, 0, 1, + { 0, 0, 0, 2, -1, 1, 0, 1, 3, 0, 0, 1, 0, 1, 0, 1, -3, 0, -1, -2, 0, -1, -1, -3, -1, 1, -4, 1, -1, -5, -69, -19 }, - { -3, -5, -8, -12, 4, -3, -19, -11, -5, 0, -14, 7, 18, -6, 7, 22, + { -3, -5, -8, -12, 4, -3, -19, -11, -5, 0, -14, 7, 18, -6, 7, 22, 8, 14, 15, 10, 3, -1, -3, 5, -1, 7, -7, 1, -6, 3, -26, -11 }, - { -1, -6, 4, -4, -5, -16, 0, -6, -3, 11, 1, 0, 9, 5, 16, 3, + { -1, -6, 4, -4, -5, -16, 0, -6, -3, 11, 1, 0, 9, 5, 16, 3, -4, -33, -4, 4, -7, 0, 1, 6, -11, -2, -13, -2, -18, 20, -25, -16 }, - { 4, 0, -1, 0, -5, 1, 0, 2, 0, 11, -10, 4, -10, 7, 16, 2, + { 4, 0, -1, 0, -5, 1, 0, 2, 0, 11, -10, 4, -10, 7, 16, 2, 16, 15, 2, -1, 2, 9, 2, 8, -3, -5, -2, 0, -3, 0, -33, -2 }, - { -3, -15, 10, 10, -9, -1, 7, 3, 5, -5, -8, -8, -3, 15, -9, 4, + { -3, -15, 10, 10, -9, -1, 7, 3, 5, -5, -8, -8, -3, 15, -9, 4, 12, 13, -13, -14, 10, -6, 9, 22, -27, 23, -1, 5, -24, 2, -30, 5 }, - { 0, -2, 7, -5, -5, 3, 5, 3, -3, -5, 2, 1, -4, 3, -3, -1, + { 0, -2, 7, -5, -5, 3, 5, 3, -3, -5, 2, 1, -4, 3, -3, -1, 1, -2, 10, 22, -3, -4, -2, -2, -7, 3, 8, 1, 14, 4, -37, 9 }, - { -3, -4, -1, 1, -4, 0, 6, 2, 6, -7, -10, -10, -1, -4, 11, -3, + { -3, -4, -1, 1, -4, 0, 6, 2, 6, -7, -10, -10, -1, -4, 11, -3, 7, -6, 4, -12, -1, 5, 1, -7, 10, -6, 17, -4, 8, 3, -40, 13 }, - { 2, 12, 4, -7, 14, -3, 16, -2, 18, 2, 13, 5, 5, 1, 11, -1, + { 2, 12, 4, -7, 14, -3, 16, -2, 18, 2, 13, 5, 5, 1, 11, -1, 0, 9, 2, -6, -1, 2, -6, 2, -5, 3, 5, 1, -1, 1, -32, -7 }, - { -16, 11, 7, -4, 2, -5, -9, 9, 11, 11, 15, -13, -11, 11, 9, 4, + { -16, 11, 7, -4, 2, -5, -9, 9, 11, 11, 15, -13, -11, 11, 9, 4, 3, -8, -10, 12, 12, 0, 0, -16, -9, 13, 2, 9, 4, -13, -33, 3 }, - { 6, 4, 5, 4, 3, -1, 5, 6, 4, 2, -11, -1, -15, -11, -1, 1, + { 6, 4, 5, 4, 3, -1, 5, 6, 4, 2, -11, -1, -15, -11, -1, 1, 11, -3, -2, 24, -4, -6, -25, -10, -15, -8, 0, 0, -5, 4, -30, 2 }, - { 10, -3, -6, 1, -9, -5, 6, 9, -10, -3, 8, -1, 4, -1, 11, -11, + { 10, -3, -6, 1, -9, -5, 6, 9, -10, -3, 8, -1, 4, -1, 11, -11, 3, 9, 11, -3, 6, -17, 5, -8, -33, 9, -13, 19, -2, 9, -25, 2 }, - { 0, 0, -1, -3, 0, -2, 1, 0, 0, 2, 1, 0, -2, 0, -1, 2, + { 0, 0, -1, -3, 0, -2, 1, 0, 0, 2, 1, 0, -2, 0, -1, 2, 0, -1, 4, -1, 2, -3, 4, -2, 3, 3, 1, 0, -15, 12, -63, 27 }, - { -2, 14, 9, -1, 3, 0, 1, 1, -19, 15, 3, 4, 0, -10, 1, -5, + { -2, 14, 9, -1, 3, 0, 1, 1, -19, 15, 3, 4, 0, -10, 1, -5, 3, 0, -5, -10, 2, -16, -4, 8, -12, -6, 7, -5, -10, -1, -33, -4 }, - { 0, 3, 1, 3, 1, 2, 4, 4, 9, -6, -8, -5, 1, -12, 3, 8, + { 0, 3, 1, 3, 1, 2, 4, 4, 9, -6, -8, -5, 1, -12, 3, 8, -10, 6, -1, 1, 13, -5, -5, 2, -4, 13, -18, -10, -7, -9, -33, 10 }, - { -6, -3, -12, 5, -1, 11, -6, 0, -2, 1, 2, -7, 3, 1, 3, -2, + { -6, -3, -12, 5, -1, 11, -6, 0, -2, 1, 2, -7, 3, 1, 3, -2, 1, 8, -10, 7, -1, -3, 3, 0, 13, 1, 6, 7, -16, -7, -39, 8 }, - { -6, -1, 11, 6, -3, 8, 3, -5, 3, 0, -5, -2, -6, -3, -4, 2, + { -6, -1, 11, 6, -3, 8, 3, -5, 3, 0, -5, -2, -6, -3, -4, 2, -3, 13, -11, 1, 7, 5, 19, -5, -3, -15, -1, 7, -1, 6, -33, 8 }, - { -7, 3, -4, -3, -4, 1, 6, -5, -5, 6, -8, -1, -7, 4, -1, -6, + { -7, 3, -4, -3, -4, 1, 6, -5, -5, 6, -8, -1, -7, 4, -1, -6, -2, 1, 7, 0, 1, 1, -5, 2, -2, 0, -13, -2, -31, -14, -39, -12 }, - { -10, 9, 0, -3, 1, -1, -1, 0, 1, -5, -1, -4, -2, 5, 2, -7, + { -10, 9, 0, -3, 1, -1, -1, 0, 1, -5, -1, -4, -2, 5, 2, -7, 18, -8, -2, -19, -7, -7, -12, -14, -11, -1, -9, -13, -7, -12, -31, -9 }, - { -3, -16, 10, 9, 1, -10, -12, 2, -2, 2, 7, -3, -3, 1, -4, -5, + { -3, -16, 10, 9, 1, -10, -12, 2, -2, 2, 7, -3, -3, 1, -4, -5, -9, 5, 7, 3, -1, 4, -11, -8, 4, 13, -10, 13, 10, -4, -36, 1 }, - { -7, -12, 4, -20, -7, -7, 2, 11, -1, -2, 3, -12, 1, 0, -6, -7, + { -7, -12, 4, -20, -7, -7, 2, 11, -1, -2, 3, -12, 1, 0, -6, -7, 6, 4, 13, 3, -3, 4, 3, -6, -12, 5, -5, -22, -13, -8, -37, -6 }, - { -7, 5, 3, 5, 7, 9, -14, -3, 10, 17, -1, 1, -12, 5, -6, 0, + { -7, 5, 3, 5, 7, 9, -14, -3, 10, 17, -1, 1, -12, 5, -6, 0, -4, -9, 0, -11, -14, 3, 13, 6, -25, -8, -12, 4, -10, 18, -30, -1 }, - { -10, 6, -10, 6, 6, 1, -10, 0, -7, 5, -2, 17, -18, -4, 0, -3, + { -10, 6, -10, 6, 6, 1, -10, 0, -7, 5, -2, 17, -18, -4, 0, -3, -16, -6, -3, -8, 5, 1, -4, 6, -7, 16, 6, 10, -1, 0, -32, -11 }, - { -1, 9, 9, -5, 4, 9, 6, 9, -4, -2, 7, 11, 4, 2, -5, -4, + { -1, 9, 9, -5, 4, 9, 6, 9, -4, -2, 7, 11, 4, 2, -5, -4, -6, 0, 2, -3, -1, 5, 10, 0, 12, -10, -18, -3, -1, 14, -33, 2 }, - { 4, -8, -18, -4, -5, -11, 4, -10, -4, 9, 13, -12, 1, -6, 1, 2, + { 4, -8, -18, -4, -5, -11, 4, -10, -4, 9, 13, -12, 1, -6, 1, 2, 4, -9, 8, 3, -6, 21, 13, -1, -2, 1, -2, 6, -7, 0, -30, 1 }, - { 6, -1, 2, -3, -1, -4, 6, -4, 0, 4, 2, 2, -9, 2, 6, 3, + { 6, -1, 2, -3, -1, -4, 6, -4, 0, 4, 2, 2, -9, 2, 6, 3, -2, 4, -1, 9, -6, 0, 7, -8, 5, 19, -2, 9, -5, 2, -33, -8 }, - { 2, 1, 12, -5, -8, 8, 3, -2, -4, 1, -2, 5, -4, -9, -8, -8, + { 2, 1, 12, -5, -8, 8, 3, -2, -4, 1, -2, 5, -4, -9, -8, -8, 7, -11, -4, 6, -10, 7, -1, -1, -2, -1, 16, 32, -7, 20, -33, -6 }, - { -18, 2, 6, 13, 9, 9, -1, 3, -17, 24, -2, -6, 28, 8, -2, 6, + { -18, 2, 6, 13, 9, 9, -1, 3, -17, 24, -2, -6, 28, 8, -2, 6, 3, -10, -34, -16, -13, -4, -15, -11, -12, -3, -10, 4, -8, 4, -31, -4 }, - { -11, 0, 18, 2, -16, -9, -13, -2, -2, -12, -3, -22, 30, 0, 8, 3, + { -11, 0, 18, 2, -16, -9, -13, -2, -2, -12, -3, -22, 30, 0, 8, 3, 9, -4, -16, 1, 0, -11, 15, -2, -4, 6, -5, 6, 1, 2, -25, -12 }, - { 14, -1, 5, 7, 3, -15, -8, 1, 5, -2, 12, 13, 11, -25, 3, 1, + { 14, -1, 5, 7, 3, -15, -8, 1, 5, -2, 12, 13, 11, -25, 3, 1, 0, -2, -4, -16, -23, 0, -5, -17, 7, 5, -9, 6, -5, 2, -32, -7 }, - { 3, -1, 6, 14, 2, -12, -9, -9, 4, 7, 4, 6, 5, -8, 4, 2, + { 3, -1, 6, 14, 2, -12, -9, -9, 4, 7, 4, 6, 5, -8, 4, 2, 4, 5, -2, 8, 8, -6, 0, 10, -20, -1, 3, -1, 8, 23, -33, -5 }, - { -3, 11, -6, 3, -4, 5, 7, 3, 4, 5, -2, 3, -1, 30, 6, 1, + { -3, 11, -6, 3, -4, 5, 7, 3, 4, 5, -2, 3, -1, 30, 6, 1, 8, -6, 0, 0, -9, 6, -9, 4, 2, 9, -6, 1, -12, 0, -34, 18 }, - { -17, 13, 0, 1, 9, -4, -11, 0, 7, 0, -10, -4, -1, 6, -6, 4, + { -17, 13, 0, 1, 9, -4, -11, 0, 7, 0, -10, -4, -1, 6, -6, 4, 1, 6, -9, 3, -5, -6, -11, 2, -4, 14, 23, -3, 2, 5, -30, 12 }, - { -14, 5, -27, 2, 0, 7, 1, 4, 30, 8, 7, 5, 1, -1, 0, 5, + { -14, 5, -27, 2, 0, 7, 1, 4, 30, 8, 7, 5, 1, -1, 0, 5, 8, -10, 48, -11, 12, 33, 6, 8, -15, 20, -2, -5, 32, 5, -19, 10 }, - { -16, -4, -12, -7, -2, 0, 8, -6, -20, -18, 16, -3, 0, 31, -2, 11, + { -16, -4, -12, -7, -2, 0, 8, -6, -20, -18, 16, -3, 0, 31, -2, 11, 2, -9, 49, -19, -12, -23, 10, 26, 16, -2, 4, -21, -14, 13, -11, -9 }, - { -5, -9, -1, 3, -5, -21, 2, 10, 0, 0, 10, -21, -7, 7, -26, -9, + { -5, -9, -1, 3, -5, -21, 2, 10, 0, 0, 10, -21, -7, 7, -26, -9, 22, 32, 58, 11, -3, 11, -5, -8, -13, 6, -5, -9, 1, 10, 14, -8 }, - { 7, 7, 10, 3, -2, -1, -11, -11, -6, -43, -3, 14, -19, -18, 19, 18, + { 7, 7, 10, 3, -2, -1, -11, -11, -6, -43, -3, 14, -19, -18, 19, 18, -32, 10, 45, -6, 6, 21, -20, -12, 2, 4, 6, 6, -4, 3, 3, 1 }, - { 21, 22, -3, -2, -11, -6, -1, -2, 8, 8, 32, -21, 7, 28, -4, -6, + { 21, 22, -3, -2, -11, -6, -1, -2, 8, 8, 32, -21, 7, 28, -4, -6, -3, -2, 50, 2, 2, 27, -5, -8, 12, 7, -5, -1, -4, -17, 27, 6 }, - { 13, 7, 2, -6, -12, 2, -10, -5, -17, 11, 4, 17, -12, -2, 5, -17, + { 13, 7, 2, -6, -12, 2, -10, -5, -17, 11, 4, 17, -12, -2, 5, -17, 37, -16, 48, -14, -18, 29, 8, 24, 11, -5, -9, 11, -1, 1, -13, -3 }, - { 1, 1, -1, 2, 0, 0, 0, -1, 1, -1, 7, 2, -3, 3, 0, 6, + { 1, 1, -1, 2, 0, 0, 0, -1, 1, -1, 7, 2, -3, 3, 0, 6, 2, 10, 54, -25, 7, 54, -5, -6, -1, -15, 9, 13, -24, -15, -12, 3 }, - { 21, 5, 8, 3, -3, -4, -2, -4, 3, -11, -5, -8, 9, 16, 8, -9, + { 21, 5, 8, 3, -3, -4, -2, -4, 3, -11, -5, -8, 9, 16, 8, -9, -10, -3, 46, -46, 2, 1, -10, 10, 17, 11, -20, -36, 10, 14, 0, -5 }, - { 7, -13, -6, -9, -24, 45, 2, 8, 8, 0, 17, 20, 12, -24, 1, -7, + { 7, -13, -6, -9, -24, 45, 2, 8, 8, 0, 17, 20, 12, -24, 1, -7, -15, -3, 46, -13, -2, 20, 1, -13, -11, -13, 2, 15, 1, 10, -1, 3 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, -2, -1, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, -2, -1, -16, -9, 31, -69, -34, 26, 7, 17, -1, -6, -1, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -4, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -4, -5, -20, 18, -82, 22, 3, -7, 9, 4, 6, 2, -4, -1, 0, -2, 2 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 4, -1, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 4, -1, 15, -5, 62, -36, 4, 52, -7, 5, 0, 6, 1, 2, 1, 1, -1, 0 }, - { 3, -19, 19, -20, 13, -4, -11, 8, 8, -16, 10, 1, -14, 30, 1, -33, + { 3, -19, 19, -20, 13, -4, -11, 8, 8, -16, 10, 1, -14, 30, 1, -33, 10, -11, 45, -30, 3, -4, -3, -13, 7, 12, 3, -22, 3, -2, -4, -2 }, - { -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 1, + { -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 1, 11, 8, 70, 48, -10, 21, 4, 9, -9, -9, -4, -6, 0, -1, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, -1, 80, 2, -15, -36, -10, -5, -2, 8, -2, 2, 0, 0, 0, 0 }, - { 10, 8, -8, -8, -24, 12, -1, 0, 20, 9, -1, -2, 2, -2, 12, -10, + { 10, 8, -8, -8, -24, 12, -1, 0, 20, 9, -1, -2, 2, -2, 12, -10, -2, -13, 35, -43, 44, 15, -10, -25, 4, 10, -3, -5, -5, 7, -1, 3 }, - { 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, -2, -1, + { 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, -2, -1, -18, 9, 49, -72, 7, -8, 7, -5, 2, 3, 2, -2, 1, -2, -3, 1 }, - { -1, 4, -3, 10, 19, 4, 3, 20, 6, -24, 6, 9, 8, 15, 18, 18, + { -1, 4, -3, 10, 19, 4, 3, 20, 6, -24, 6, 9, 8, 15, 18, 18, -36, 19, 57, -11, 4, -3, 8, 7, 2, -3, -2, -9, -15, -2, 12, -4 }, - { 20, 3, 11, -9, -4, 22, 42, -25, 1, 5, -10, -19, 0, 9, -16, 5, + { 20, 3, 11, -9, -4, 22, 42, -25, 1, 5, -10, -19, 0, 9, -16, 5, 2, 10, 44, -29, 17, -3, -9, -2, -1, 8, 14, -7, -1, 16, -5, 1 }, - { -7, 16, -11, 12, 6, 33, -15, 14, -23, 2, -26, 8, 2, 10, 0, -5, + { -7, 16, -11, 12, 6, 33, -15, 14, -23, 2, -26, 8, 2, 10, 0, -5, 8, -8, 38, -38, -4, 5, 5, 5, 1, 22, -15, 7, 6, 0, 4, 28 }, - { -1, -12, 2, 10, -2, 0, 7, 17, 12, 22, -4, 10, 25, 29, 5, 18, + { -1, -12, 2, 10, -2, 0, 7, 17, 12, 22, -4, 10, 25, 29, 5, 18, 4, 1, 27, -39, 31, 17, 2, 2, 22, -23, 13, 16, 1, -7, -4, -5 }, - { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, -2, 0, -14, 0, + { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, -2, 0, -14, 0, -7, -11, 49, -22, -4, 19, 17, -39, 4, -29, 10, 2, 36, -4, 23, -1 }, - { -2, -2, -2, -2, 1, 15, -5, -7, -16, -8, -19, 16, -3, -20, 36, -9, + { -2, -2, -2, -2, 1, 15, -5, -7, -16, -8, -19, 16, -3, -20, 36, -9, -3, 20, 39, -20, 0, 2, 27, -16, 10, 10, -14, -22, -16, -3, 13, -8 }, - { 5, -9, 6, -25, 7, 37, 13, -10, -5, 3, -5, 7, 18, -22, -7, 9, + { 5, -9, 6, -25, 7, 37, 13, -10, -5, 3, -5, 7, 18, -22, -7, 9, -5, -4, 50, -11, -4, -5, -5, 8, -4, -2, -4, -27, 14, 20, 7, -9 }, - { 0, -14, -10, -27, -14, -17, -6, 26, 10, 2, 14, -12, -5, 0, 8, 9, + { 0, -14, -10, -27, -14, -17, -6, 26, 10, 2, 14, -12, -5, 0, 8, 9, 0, -28, 55, -7, -12, -7, 4, -10, 10, 7, -12, 11, 3, 5, 9, -8 }, - { 2, 23, 4, -2, -1, -20, -2, 14, 10, -9, -9, -24, 10, 0, 11, -12, + { 2, 23, 4, -2, -1, -20, -2, 14, 10, -9, -9, -24, 10, 0, 11, -12, 12, 11, 49, -25, -2, 29, 7, -13, 21, -10, 11, -17, 3, 1, -8, 5 }, - { 3, 0, -14, -6, 18, -2, 17, -9, -19, 9, -5, 9, 14, 6, 19, -3, + { 3, 0, -14, -6, 18, -2, 17, -9, -19, 9, -5, 9, 14, 6, 19, -3, 27, 1, 41, -21, 20, -15, 33, 0, 26, 14, 7, 10, 3, 20, -3, -12 }, - { -1, 16, 15, -8, 3, -8, -8, 21, -5, -16, -29, 4, 1, -6, -4, -28, + { -1, 16, 15, -8, 3, -8, -8, 21, -5, -16, -29, 4, 1, -6, -4, -28, 2, 31, 37, -26, -2, 13, 24, 8, -9, -6, -29, 10, 7, 2, 7, 8 }, - { -10, -10, 11, 13, -32, 2, 16, 9, 14, 23, -15, -13, 24, 13, 4, -27, + { -10, -10, 11, 13, -32, 2, 16, 9, 14, 23, -15, -13, 24, 13, 4, -27, 14, 12, 31, -18, 17, 23, -2, -7, -14, 9, -17, -6, -10, 20, 9, 6 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 5, 1, 89, 8, 10, -6, 2, -1, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, -1, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, -1, 4, -7, 64, -50, 7, 37, 2, 5, 0, 0, 0, 0, 0, 0, 0, 0 }, - { -2, 5, 3, -4, -4, -3, 2, -3, 3, -3, 5, 4, 1, -6, -1, 1, + { -2, 5, 3, -4, -4, -3, 2, -3, 3, -3, 5, 4, 1, -6, -1, 1, 6, -2, 50, -35, -7, 43, 7, -7, -5, -26, 24, 21, 3, -15, 5, 6 }, - { -8, 21, -19, 33, -8, 22, -11, 17, 3, 0, 0, -2, 1, -3, 6, -1, + { -8, 21, -19, 33, -8, 22, -11, 17, 3, 0, 0, -2, 1, -3, 6, -1, 10, -8, 4, -11, -4, -5, 0, 8, -4, 3, 1, -4, 4, 2, 8, 4 }, - { -7, 5, -20, 9, -22, 3, -14, 1, 6, 13, 23, -2, -4, -7, 2, 0, + { -7, 5, -20, 9, -22, 3, -14, 1, 6, 13, 23, -2, -4, -7, 2, 0, 11, 4, 6, 3, -7, -11, -7, 4, 5, 5, -12, 8, 2, 4, 7, -3 }, - { -7, 6, -4, 20, -20, 16, -2, 7, 6, 16, 11, 12, -7, -7, 5, 3, + { -7, 6, -4, 20, -20, 16, -2, 7, 6, 16, 11, 12, -7, -7, 5, 3, -9, -4, 1, 2, 5, 2, 1, -9, -2, -17, -4, 6, -10, 7, -7, -6 }, - { -9, 18, -17, 12, -24, 1, -1, 4, 14, 9, 4, 3, 2, 8, -12, -14, + { -9, 18, -17, 12, -24, 1, -1, 4, 14, 9, 4, 3, 2, 8, -12, -14, 4, -8, -4, 7, 7, 6, -1, 13, -9, -4, -1, 1, 0, -4, 15, 8 }, - { -25, 2, -11, 6, -5, 24, -28, -5, 8, 12, -2, 6, 8, -3, 8, -9, + { -25, 2, -11, 6, -5, 24, -28, -5, 8, 12, -2, 6, 8, -3, 8, -9, -1, -5, -1, -5, 6, -1, -1, -1, -4, 8, -12, -2, -13, 7, 2, 1 }, - { -14, 14, -18, 20, -10, 12, -2, 9, 1, 0, 12, -2, 15, -10, 26, -17, + { -14, 14, -18, 20, -10, 12, -2, 9, 1, 0, 12, -2, 15, -10, 26, -17, 16, -11, 10, -10, 9, -2, 4, -8, 2, -3, 4, 4, 2, -3, -5, 1 }, - { -18, 12, -18, 21, -6, 12, -6, 13, -25, 18, 1, 11, -9, -5, 0, 10, + { -18, 12, -18, 21, -6, 12, -6, 13, -25, 18, 1, 11, -9, -5, 0, 10, -5, 3, -3, 8, -9, 7, 4, 2, -9, 0, 5, 0, 2, -3, 9, -8 }, - { -4, 16, 1, 18, -30, 9, 1, 6, -8, 13, 13, -12, -6, -1, 13, 7, + { -4, 16, 1, 18, -30, 9, 1, 6, -8, 13, 13, -12, -6, -1, 13, 7, 6, 2, -15, -3, 5, 5, 1, -6, 1, -5, 0, 2, -16, 0, 3, -4 }, - { -21, 1, -2, 6, -43, 18, -1, 5, -1, 4, 6, -2, -1, -3, -1, -3, + { -21, 1, -2, 6, -43, 18, -1, 5, -1, 4, 6, -2, -1, -3, -1, -3, 0, 1, 2, -9, 0, -1, 0, -2, 0, -1, -1, -2, 6, 0, 1, -2 }, - { -23, 10, 4, 7, -32, -11, -18, 2, -2, -7, -6, -3, -3, -12, 19, 3, + { -23, 10, 4, 7, -32, -11, -18, 2, -2, -7, -6, -3, -3, -12, 19, 3, -5, -6, 16, -6, 16, 2, 16, 16, 8, -2, 13, 8, -15, -11, 2, 10 }, - { -8, 2, -13, 2, -29, 24, -20, 19, 1, 10, -4, 10, 1, 2, -9, 11, + { -8, 2, -13, 2, -29, 24, -20, 19, 1, 10, -4, 10, 1, 2, -9, 11, -1, -2, 9, -5, 19, -7, 16, -9, -2, -18, 11, 1, 1, 0, 7, -3 }, - { -6, 3, 4, 13, -26, 10, -10, 28, -7, 28, 1, 7, 0, -14, 5, 7, + { -6, 3, 4, 13, -26, 10, -10, 28, -7, 28, 1, 7, 0, -14, 5, 7, 4, -4, 3, -2, 3, 3, -11, 7, 6, 4, 0, -1, 2, -1, -3, 2 }, - { -6, 16, -31, 13, -10, 17, -6, 4, -14, 4, 4, -1, -10, 12, -5, 1, + { -6, 16, -31, 13, -10, 17, -6, 4, -14, 4, 4, -1, -10, 12, -5, 1, -14, 15, 0, -8, 1, -5, 3, 3, 9, -5, 7, -20, 7, 4, 11, -5 }, - { -19, 3, -17, 14, -12, 16, -22, 18, 14, 8, -2, 4, 10, 12, -14, 4, + { -19, 3, -17, 14, -12, 16, -22, 18, 14, 8, -2, 4, 10, 12, -14, 4, -3, 2, 3, 7, -7, 7, -6, 2, -2, -4, -5, 0, -5, -2, 2, 1 }, - { -9, -7, -11, 24, -36, -9, -11, 5, 7, -12, -13, 18, -2, 20, 1, -4, + { -9, -7, -11, 24, -36, -9, -11, 5, 7, -12, -13, 18, -2, 20, 1, -4, -1, -10, 15, -6, 14, 1, 0, 2, 1, 2, -9, -16, -11, 7, 13, 0 }, - { -24, 24, -18, 18, -22, 14, -11, 13, -12, 11, -10, 11, -7, 11, -5, -4, + { -24, 24, -18, 18, -22, 14, -11, 13, -12, 11, -10, 11, -7, 11, -5, -4, -1, 1, 5, 2, 3, -1, 1, -5, 7, -4, 5, -6, 8, -7, 8, -6 }, - { -6, 18, -22, 22, 5, 11, -1, 6, 19, 22, 8, 4, -8, 20, -2, 15, + { -6, 18, -22, 22, 5, 11, -1, 6, 19, 22, 8, 4, -8, 20, -2, 15, -6, -18, 0, -33, -9, -12, -1, 6, 5, 2, 5, 5, -5, -17, -3, -3 }, - { 1, 11, -16, 9, -18, 11, -4, 18, 20, 26, -10, 8, 1, -11, 8, -4, + { 1, 11, -16, 9, -18, 11, -4, 18, 20, 26, -10, 8, 1, -11, 8, -4, 0, 7, 3, 5, 2, 2, 10, -2, -4, 4, -4, -2, 1, -4, -5, -1 }, - { -10, 6, -1, 18, -17, 27, -3, 10, -2, 12, -7, -9, 1, 1, -1, 7, + { -10, 6, -1, 18, -17, 27, -3, 10, -2, 12, -7, -9, 1, 1, -1, 7, -12, -1, -7, -6, -1, 8, 3, -15, 8, 9, 3, -7, 4, -1, 1, -1 }, - { -14, 6, -16, 22, 2, 5, 0, 5, -18, 11, 6, -3, 22, -20, -9, -3, + { -14, 6, -16, 22, 2, 5, 0, 5, -18, 11, 6, -3, 22, -20, -9, -3, 6, -6, -7, -15, 1, 15, -8, 11, 8, -3, -8, 1, -8, 2, 6, -2 }, - { -21, 5, -19, 19, -7, 4, -7, 0, -8, 6, 12, 5, -3, -22, -13, -6, + { -21, 5, -19, 19, -7, 4, -7, 0, -8, 6, 12, 5, -3, -22, -13, -6, -1, -3, -2, -14, 6, -3, 1, -8, -7, -5, -6, 11, -3, -10, -5, 2 }, - { -1, 9, -12, 15, -6, 6, -19, 14, -9, 11, 3, 12, -17, -3, 8, -4, + { -1, 9, -12, 15, -6, 6, -19, 14, -9, 11, 3, 12, -17, -3, 8, -4, -3, -4, 1, -5, 4, 5, -7, -15, -7, 15, -6, -5, 1, -5, -3, 1 }, - { -12, 20, -15, 20, -14, 3, -14, 9, -6, 33, -13, 6, -2, 8, -6, 7, + { -12, 20, -15, 20, -14, 3, -14, 9, -6, 33, -13, 6, -2, 8, -6, 7, -5, -6, -3, -3, 0, 8, -3, -3, 1, -2, 2, 2, 6, -5, -5, -2 }, - { -7, 12, -18, 12, -18, 10, -4, 8, 2, 4, 8, 9, 0, 3, -8, 3, + { -7, 12, -18, 12, -18, 10, -4, 8, 2, 4, 8, 9, 0, 3, -8, 3, 6, -12, -4, 1, 25, -5, -9, 6, -7, 0, -9, -7, 3, -5, -4, -4 }, - { -18, 12, -10, 11, -22, 0, -15, 5, -2, 2, -3, 6, -4, -4, -3, -15, + { -18, 12, -10, 11, -22, 0, -15, 5, -2, 2, -3, 6, -4, -4, -3, -15, -2, -3, 21, 6, -12, -11, 19, 3, 3, -14, 7, 0, -11, -22, -10, 0 }, - { -15, 2, -30, 15, -17, 13, -16, 8, -7, 10, -8, 2, 11, 3, 10, -7, + { -15, 2, -30, 15, -17, 13, -16, 8, -7, 10, -8, 2, 11, 3, 10, -7, 7, -22, 12, -10, 3, -12, 6, -10, 12, -10, 7, -8, 5, 2, 9, 1 }, - { -9, 11, -14, 6, -10, 21, 5, 12, -5, 5, 7, 21, 6, 2, -2, -1, + { -9, 11, -14, 6, -10, 21, 5, 12, -5, 5, 7, 21, 6, 2, -2, -1, -1, 4, 2, -20, -18, -1, -14, 3, -1, 4, -7, 10, 1, 11, 4, -4 }, - { -22, 8, -30, 13, -21, -4, 4, -1, 12, 9, -2, -3, 2, -6, 4, -13, + { -22, 8, -30, 13, -21, -4, 4, -1, 12, 9, -2, -3, 2, -6, 4, -13, -2, 8, 8, 1, -7, 3, -4, -5, -1, -7, -2, 8, 8, 7, 8, 0 }, - { -6, -4, -35, 16, -13, 15, -11, 14, -7, 9, -1, 11, 7, 0, 13, 10, + { -6, -4, -35, 16, -13, 15, -11, 14, -7, 9, -1, 11, 7, 0, 13, 10, -1, 8, 1, 1, -2, 8, -1, 2, 2, 3, -10, -1, 7, -13, -3, -7 }, - { -15, 7, -16, 14, -18, 17, -6, 14, 3, 4, 7, -3, 10, -22, 5, -15, + { -15, 7, -16, 14, -18, 17, -6, 14, 3, 4, 7, -3, 10, -22, 5, -15, 4, -4, -11, 15, -15, 11, -11, 20, 1, 0, 2, 1, 11, -3, 11, -7 }, - { -12, 3, 5, 16, -37, -1, 15, 15, -15, 10, 3, -10, 1, 15, 7, -15, + { -12, 3, 5, 16, -37, -1, 15, 15, -15, 10, 3, -10, 1, 15, 7, -15, -13, 8, 9, -3, 2, 12, -8, 2, -5, 0, -3, 4, 5, -9, -4, 5 }, - { -16, 26, -4, 14, -22, 26, 6, -3, -8, 4, 21, 6, 16, -4, -11, 7, + { -16, 26, -4, 14, -22, 26, 6, -3, -8, 4, 21, 6, 16, -4, -11, 7, -10, 3, 3, 7, -4, 2, -9, 8, -2, 2, 5, -2, -4, -2, 7, -1 }, - { -7, -10, 4, 3, 2, -4, -12, -10, -4, -5, 16, 19, -16, 1, 2, -9, + { -7, -10, 4, 3, 2, -4, -12, -10, -4, -5, 16, 19, -16, 1, 2, -9, -10, 0, 9, 7, -8, 3, 12, 8, -6, -11, -13, -1, -3, -20, 6, -5 }, - { -14, -17, 3, -5, 14, -12, -12, 8, -6, -25, 21, 21, 10, -8, -12, 4, + { -14, -17, 3, -5, 14, -12, -12, 8, -6, -25, 21, 21, 10, -8, -12, 4, 10, -4, 3, -9, 11, 9, 0, 4, 2, -15, 1, -14, 4, 1, 0, -4 }, - { -4, -9, -3, -1, 6, 3, -6, 6, -10, -4, 14, 8, 2, -3, -12, -19, + { -4, -9, -3, -1, 6, 3, -6, 6, -10, -4, 14, 8, 2, -3, -12, -19, 0, 11, -20, 1, 6, -2, -27, -6, 10, -17, -14, -17, -9, 8, -8, 3 }, - { -12, -13, 16, -4, -2, 12, -7, -11, 2, -13, 3, 7, -16, -18, -1, -12, + { -12, -13, 16, -4, -2, 12, -7, -11, 2, -13, 3, 7, -16, -18, -1, -12, -2, 1, -12, -9, -2, -6, 2, 9, -22, -3, -4, -14, -7, 7, -1, 2 }, - { -7, -8, -8, 15, 15, 18, 15, 16, -4, -37, 11, 15, -12, -1, -3, 3, + { -7, -8, -8, 15, 15, 18, 15, 16, -4, -37, 11, 15, -12, -1, -3, 3, 6, 6, 0, -5, -3, -5, 9, 1, 1, -11, -1, -8, -6, 2, 3, 0 }, - { -6, 7, -5, -12, 13, 10, -18, -4, -3, -21, 6, 16, -15, -7, -12, -9, + { -6, 7, -5, -12, 13, 10, -18, -4, -3, -21, 6, 16, -15, -7, -12, -9, 1, -12, -1, 10, -2, -1, -3, 4, -4, 1, -16, -1, 12, -9, 5, 9 }, - { -14, -5, 9, 3, 4, 26, -28, 3, -6, -24, 4, 5, 3, 13, 5, -1, + { -14, -5, 9, 3, 4, 26, -28, 3, -6, -24, 4, 5, 3, 13, 5, -1, 3, -1, 3, 1, 1, -5, 3, 0, -7, -8, -7, -3, 3, -5, 4, 0 }, - { -4, 2, -10, -6, 25, 26, -6, 10, -6, -8, 15, 11, -6, -3, 2, -7, + { -4, 2, -10, -6, 25, 26, -6, 10, -6, -8, 15, 11, -6, -3, 2, -7, 5, 14, 9, -1, 0, -12, 4, -4, -10, 1, -3, 3, -2, -2, -6, -1 }, - { -10, 8, -15, -10, 19, 17, -8, 0, -3, -7, 7, 5, -13, -1, 7, -7, + { -10, 8, -15, -10, 19, 17, -8, 0, -3, -7, 7, 5, -13, -1, 7, -7, 1, 13, -12, -13, 17, -12, 1, 26, -18, -3, -5, -6, 4, 5, 8, 1 }, - { 2, -5, 3, 0, 0, 0, 2, -3, -2, -5, 7, 13, -4, 9, 0, -5, + { 2, -5, 3, 0, 0, 0, 2, -3, -2, -5, 7, 13, -4, 9, 0, -5, 4, -1, -11, -8, -4, 0, -13, 2, -47, -23, -8, -11, -4, 4, -2, -3 }, - { -18, -4, 4, 5, -1, 17, -12, -8, 1, -12, 7, 20, -12, 3, -2, -11, + { -18, -4, 4, 5, -1, 17, -12, -8, 1, -12, 7, 20, -12, 3, -2, -11, 16, 12, -6, 1, -13, -16, -6, -3, -3, -5, 4, -12, -5, -9, 10, 1 }, - { -11, 0, 4, 7, 7, 8, 3, -1, 3, -19, 32, 8, -19, -8, 2, 4, + { -11, 0, 4, 7, 7, 8, 3, -1, 3, -19, 32, 8, -19, -8, 2, 4, -12, 15, -16, 3, 1, 9, -2, 1, -2, 8, 5, 6, -4, -1, 11, -8 }, - { 3, -1, 4, -2, 14, 32, -9, -23, -10, -12, 22, 15, -1, -2, 10, 0, + { 3, -1, 4, -2, 14, 32, -9, -23, -10, -12, 22, 15, -1, -2, 10, 0, 4, 6, -8, 4, -15, -2, -1, -4, 0, -8, 4, 1, -8, 3, 4, 1 }, - { -17, -12, 6, -8, 16, 13, -20, -8, -1, -16, 10, 21, -19, 11, -9, -5, + { -17, -12, 6, -8, 16, 13, -20, -8, -1, -16, 10, 21, -19, 11, -9, -5, 7, 18, -6, 7, -7, -18, 13, 2, -2, 8, -12, -9, 2, 4, -5, 16 }, - { 4, 0, 17, -11, 12, 7, -12, 5, -1, -25, 30, -8, -7, -6, -4, -7, + { 4, 0, 17, -11, 12, 7, -12, 5, -1, -25, 30, -8, -7, -6, -4, -7, 9, 8, 7, 3, 3, -16, 8, 0, -2, -2, -18, -3, -4, -5, 1, 4 }, - { -3, -6, 6, -16, 17, 6, -3, 2, -9, -17, 12, 11, 11, 2, -20, 8, + { -3, -6, 6, -16, 17, 6, -3, 2, -9, -17, 12, 11, 11, 2, -20, 8, 1, 1, 0, 2, -2, -6, -21, -13, -9, -15, -1, -8, -6, -8, 0, -2 }, - { -11, -7, 6, -9, 3, 6, 8, 16, 4, -5, 23, 26, -10, -3, 4, 0, + { -11, -7, 6, -9, 3, 6, 8, 16, 4, -5, 23, 26, -10, -3, 4, 0, 2, 2, -4, 4, -2, -12, 12, 10, -11, 0, -10, -16, 3, 0, 0, -10 }, - { -5, -16, 10, -6, 27, 13, -3, 4, -2, -13, 15, 5, 2, 5, 3, -4, + { -5, -16, 10, -6, 27, 13, -3, 4, -2, -13, 15, 5, 2, 5, 3, -4, 13, 12, -11, -7, 0, 1, 11, 12, 2, 13, -15, -8, 9, -2, 3, 8 }, - { -5, -8, 4, 3, 9, 3, -11, 10, 14, -25, 14, 8, -2, 5, -12, -21, + { -5, -8, 4, 3, 9, 3, -11, 10, 14, -25, 14, 8, -2, 5, -12, -21, 2, 10, -7, 2, -3, 2, 0, 2, -1, -3, -5, -6, -1, -16, 2, 8 }, - { -1, 5, 1, -11, 5, 9, -7, 8, -13, -12, 4, 12, -4, 1, -1, -1, + { -1, 5, 1, -11, 5, 9, -7, 8, -13, -12, 4, 12, -4, 1, -1, -1, 27, 29, 10, 15, 2, -6, -3, 4, -21, 10, -9, -11, -6, -1, -9, -3 }, - { -6, -3, -1, -6, 11, -5, 0, -2, -5, -31, 11, 3, -1, 5, -3, 4, + { -6, -3, -1, -6, 11, -5, 0, -2, -5, -31, 11, 3, -1, 5, -3, 4, 5, 7, -10, 5, -10, -13, 4, 12, -15, -2, 2, -7, 1, -9, -3, -10 }, - { -3, -7, 17, -8, -5, 36, 8, -7, -8, -20, 12, 8, 1, -1, 3, 0, + { -3, -7, 17, -8, -5, 36, 8, -7, -8, -20, 12, 8, 1, -1, 3, 0, 1, 4, -10, 3, 1, 4, -2, -3, -2, -3, -10, 4, -1, -7, 3, 2 }, - { -13, -3, -5, 9, 22, 6, -23, 3, -10, -7, 17, 17, 18, -14, -8, -8, + { -13, -3, -5, 9, 22, 6, -23, 3, -10, -7, 17, 17, 18, -14, -8, -8, 2, 4, -8, 2, -3, -8, 6, 4, -1, 7, 0, 0, -3, 0, -12, -3 }, - { -3, -10, -15, -3, 9, 3, -23, -9, -13, -18, 12, 13, -2, 0, 1, 8, + { -3, -10, -15, -3, 9, 3, -23, -9, -13, -18, 12, 13, -2, 0, 1, 8, -1, 2, -7, -12, -5, 14, 2, 1, -22, 6, -10, -8, -9, 28, -7, -14 }, - { -3, 1, 2, -1, 13, 7, -2, -7, 1, -3, 6, 9, -3, -2, 4, -2, + { -3, 1, 2, -1, 13, 7, -2, -7, 1, -3, 6, 9, -3, -2, 4, -2, 2, 1, -10, -2, -2, -22, -2, -7, -10, -5, -11, -27, -12, -16, 4, -7 }, - { 2, -6, -3, 1, 8, 0, -2, 12, -3, -4, 58, 15, -10, -4, -2, 2, + { 2, -6, -3, 1, 8, 0, -2, 12, -3, -4, 58, 15, -10, -4, -2, 2, -2, 0, -2, -6, 2, 4, -1, 1, -4, 1, -1, -5, -4, -3, 3, 1 }, - { 10, -1, 0, 5, 21, 7, -14, 6, -3, -16, 15, 17, -16, 13, 3, -6, + { 10, -1, 0, 5, 21, 7, -14, 6, -3, -16, 15, 17, -16, 13, 3, -6, -4, 6, -12, -5, 1, -4, -7, -8, 2, 3, -6, 6, -1, -8, 5, 4 }, - { -6, -2, -8, -11, 15, 10, 0, 8, -6, -15, 33, 8, -2, 18, -15, -11, + { -6, -2, -8, -11, 15, 10, 0, 8, -6, -15, 33, 8, -2, 18, -15, -11, 5, -1, 0, 15, -15, -4, -4, -1, 10, 7, -13, 4, -4, 0, 8, 3 }, - { -7, -2, 0, -2, 0, -2, -4, -5, -14, -16, 12, 38, 7, 12, 6, -4, + { -7, -2, 0, -2, 0, -2, -4, -5, -14, -16, 12, 38, 7, 12, 6, -4, 0, -1, 0, 3, -2, -6, 0, 2, -9, 1, 0, -1, 0, -2, 4, 1 }, - { -8, -4, 18, 1, 14, 5, -12, -3, 20, -17, 5, 19, -11, -8, 11, -3, + { -8, -4, 18, 1, 14, 5, -12, -3, 20, -17, 5, 19, -11, -8, 11, -3, 3, 9, -7, -8, 9, -17, 2, 15, -10, -11, 5, -5, 7, 15, -6, -2 }, - { -7, 2, 38, 5, 19, 16, -5, 4, -13, -20, 0, 4, -4, 6, 4, 2, + { -7, 2, 38, 5, 19, 16, -5, 4, -13, -20, 0, 4, -4, 6, 4, 2, -7, 6, -8, -2, -5, -7, 6, 3, -4, -3, -2, -3, 7, -6, -4, 0 }, - { -11, -12, 8, -15, -3, 14, -7, -22, -11, 2, 22, 14, -19, 2, -19, -6, + { -11, -12, 8, -15, -3, 14, -7, -22, -11, 2, 22, 14, -19, 2, -19, -6, 1, 3, -18, 14, 2, -6, -2, -8, -3, -6, 5, -7, -8, -4, 1, 1 }, - { 8, 7, 25, -21, 12, -6, -5, -4, -10, 6, 0, 10, 1, -12, 18, -5, + { 8, 7, 25, -21, 12, -6, -5, -4, -10, 6, 0, 10, 1, -12, 18, -5, -15, 4, 1, 14, -1, 5, 8, -7, 1, -7, -3, 9, 10, 1, -1, 0 }, - { 9, 10, 32, -15, 8, 2, 11, -7, -18, -8, 2, -6, -9, -16, -3, 3, + { 9, 10, 32, -15, 8, 2, 11, -7, -18, -8, 2, -6, -9, -16, -3, 3, -1, 3, 1, -5, 4, -2, 1, -8, 0, -6, -3, -11, 1, 5, 0, 0 }, - { 14, 0, 23, -25, 22, 3, 7, 10, 0, -2, 7, 8, 0, 10, 0, 0, + { 14, 0, 23, -25, 22, 3, 7, 10, 0, -2, 7, 8, 0, 10, 0, 0, 3, 2, 3, -10, 0, 10, 0, -7, 0, 10, -1, -5, -7, 1, -1, 2 }, - { 12, 0, 25, -18, -5, -4, 13, -10, 3, -6, 7, 21, 0, -16, 3, -10, + { 12, 0, 25, -18, -5, -4, 13, -10, 3, -6, 7, 21, 0, -16, 3, -10, -6, 5, -7, -3, 2, 5, 3, -6, 4, 9, -8, 12, -2, 3, 2, 4 }, - { 31, 15, 27, -20, 10, -7, 15, -10, 9, -8, 4, -5, 3, -3, 5, 6, + { 31, 15, 27, -20, 10, -7, 15, -10, 9, -8, 4, -5, 3, -3, 5, 6, 11, -2, -12, -2, 6, -2, 1, 2, -1, -1, 1, 1, 3, 1, 1, 2 }, - { 12, -4, 13, -23, 12, -6, 2, 4, -3, 13, 6, -7, 5, -19, -7, 18, + { 12, -4, 13, -23, 12, -6, 2, 4, -3, 13, 6, -7, 5, -19, -7, 18, 1, -7, 7, 1, 16, -7, 3, 0, 3, 0, -12, 8, -11, 9, 4, 7 }, - { 29, 1, 3, -22, -5, 6, 0, 12, -14, 11, 1, 6, -3, 4, 6, -2, + { 29, 1, 3, -22, -5, 6, 0, 12, -14, 11, 1, 6, -3, 4, 6, -2, 4, -13, 12, 1, 1, 3, -11, 9, -10, -1, -7, 16, -11, -1, 3, 9 }, - { 4, 4, 36, -23, -5, -8, -15, 1, -6, 3, 13, -1, -5, -7, 4, 9, + { 4, 4, 36, -23, -5, -8, -15, 1, -6, 3, 13, -1, -5, -7, 4, 9, 2, -11, -3, 5, 1, 3, -6, -1, -4, -4, -2, 2, 3, -1, -5, -2 }, - { 19, 10, 6, -17, 2, -4, -2, -4, -3, 13, 2, 2, -13, -7, -3, -11, + { 19, 10, 6, -17, 2, -4, -2, -4, -3, 13, 2, 2, -13, -7, -3, -11, 9, -6, 1, -9, -5, 4, -5, -9, -18, -7, -11, 9, 4, -11, 8, 4 }, - { 16, -3, 9, -16, 18, -2, -12, -16, -11, 11, -18, 16, -13, 6, 2, 8, + { 16, -3, 9, -16, 18, -2, -12, -16, -11, 11, -18, 16, -13, 6, 2, 8, 3, 8, -4, -16, 10, -11, -1, -3, -8, 5, -9, -4, 9, -4, 0, -3 }, - { 14, 15, 3, -23, -5, 7, -8, -6, 2, 17, 2, 12, -8, -12, 13, -1, + { 14, 15, 3, -23, -5, 7, -8, -6, 2, 17, 2, 12, -8, -12, 13, -1, -9, 3, 1, 1, 19, 15, 4, -1, 1, 2, -3, 2, -3, 1, 5, 3 }, - { 32, 5, -10, -47, -5, -1, 4, 11, -7, 0, 2, -2, 1, -7, 6, -4, + { 32, 5, -10, -47, -5, -1, 4, 11, -7, 0, 2, -2, 1, -7, 6, -4, 6, 2, -4, -2, 2, -2, 0, -4, 1, -6, -5, 2, -2, -1, -3, -4 }, - { 20, 8, 10, -21, -7, -9, -16, 12, 1, 4, 6, -5, 9, -11, -7, 4, + { 20, 8, 10, -21, -7, -9, -16, 12, 1, 4, 6, -5, 9, -11, -7, 4, -11, 28, -3, 2, 4, -6, 10, -8, -5, -5, -9, 9, -2, -1, 6, -5 }, - { 38, 3, 23, -25, -6, -18, 3, -10, -8, 6, -10, 1, -10, 2, 2, 0, + { 38, 3, 23, -25, -6, -18, 3, -10, -8, 6, -10, 1, -10, 2, 2, 0, -7, 2, -4, 5, -1, 8, -3, 0, 3, 3, -1, 1, 0, -4, -4, 0 }, - { 20, 5, 16, -22, 24, -18, 2, -12, -14, -7, -3, 10, 2, 7, -10, 2, + { 20, 5, 16, -22, 24, -18, 2, -12, -14, -7, -3, 10, 2, 7, -10, 2, -8, 1, 8, -1, 4, 1, 4, -2, 5, -9, -18, -8, -13, 5, -11, 10 }, - { 14, 8, -12, -16, 9, -11, -3, -6, -25, -7, 6, 5, -7, -16, 10, 2, + { 14, 8, -12, -16, 9, -11, -3, -6, -25, -7, 6, 5, -7, -16, 10, 2, -7, -1, -9, -3, 16, 4, 3, 3, -3, -3, -15, 13, -3, 4, 13, -7 }, - { 16, -9, 19, -23, 7, -19, -3, -5, -15, 11, -21, 21, -16, 18, -1, 6, + { 16, -9, 19, -23, 7, -19, -3, -5, -15, 11, -21, 21, -16, 18, -1, 6, 10, -10, 18, -14, 16, -15, 6, -5, -9, 5, -17, 13, -10, 13, 0, 10 }, - { 8, -4, 4, -24, 8, -21, -18, 9, -11, 4, -6, 17, 5, -9, -2, -2, + { 8, -4, 4, -24, 8, -21, -18, 9, -11, 4, -6, 17, 5, -9, -2, -2, 2, 15, -2, -3, -2, 1, 7, -13, 15, -10, -8, -11, 3, 3, -1, -1 }, - { 14, 17, 6, -32, 5, -17, -2, 0, 15, -1, -5, 16, 1, -5, -2, 9, + { 14, 17, 6, -32, 5, -17, -2, 0, 15, -1, -5, 16, 1, -5, -2, 9, -3, 8, 4, -2, -2, -4, -3, 1, 0, 7, -3, 4, -5, 0, -7, 2 }, - { 24, 6, 22, -12, 8, 3, -14, 4, -7, 8, 6, 5, 6, 1, 6, -12, + { 24, 6, 22, -12, 8, 3, -14, 4, -7, 8, 6, 5, 6, 1, 6, -12, 15, 10, 4, 11, 9, 6, -7, -4, 10, -9, 2, -1, -5, 11, 15, 3 }, - { 17, 12, 3, -23, 5, -1, -2, 1, -9, -1, -3, 1, 8, 1, -5, 17, + { 17, 12, 3, -23, 5, -1, -2, 1, -9, -1, -3, 1, 8, 1, -5, 17, 11, 0, -2, -11, 7, 4, 0, -27, -7, 1, 2, -8, 9, 7, 5, 3 }, - { 12, 10, 12, -10, -4, 5, -1, 2, -24, 5, -8, 2, 6, -17, 19, 5, + { 12, 10, 12, -10, -4, 5, -1, 2, -24, 5, -8, 2, 6, -17, 19, 5, 12, -2, 16, -7, -6, -14, 4, 1, -3, 13, -16, 5, -1, 4, 1, 1 }, - { 31, 9, 11, -17, 10, -3, -7, 7, 1, 2, 2, 4, -3, -1, 11, 4, + { 31, 9, 11, -17, 10, -3, -7, 7, 1, 2, 2, 4, -3, -1, 11, 4, -5, -8, 1, 4, 15, -6, -28, 1, 8, 3, -6, 5, 17, -2, 2, -4 }, - { 11, 19, 16, -26, 0, -7, -7, 2, -13, -15, -12, 9, -3, 27, 8, 4, + { 11, 19, 16, -26, 0, -7, -7, 2, -13, -15, -12, 9, -3, 27, 8, 4, -6, 1, 4, -6, 11, -1, -6, -7, -3, 0, -6, 4, -6, -7, -3, -1 }, - { 10, 18, 16, -32, 19, -9, -4, -3, -7, 8, 8, -3, -11, -2, -6, -16, + { 10, 18, 16, -32, 19, -9, -4, -3, -7, 8, 8, -3, -11, -2, -6, -16, 13, 13, -6, -1, 10, -2, -2, -9, 0, -3, 9, 4, 11, -2, -6, 6 }, - { 9, 4, 19, -33, 4, 7, -12, 36, -3, -1, 8, -2, 2, -8, -9, -4, + { 9, 4, 19, -33, 4, 7, -12, 36, -3, -1, 8, -2, 2, -8, -9, -4, -8, 0, 1, -1, 0, -4, -4, 3, 0, 3, 6, 0, -6, 2, 0, -2 }, - { 25, 7, 15, -12, 2, -24, -1, 24, -4, 4, 9, 0, -2, -9, 4, 6, + { 25, 7, 15, -12, 2, -24, -1, 24, -4, 4, 9, 0, -2, -9, 4, 6, 3, 13, -3, 1, 5, -1, -3, -5, -1, 7, -2, 3, 4, 4, 1, 0 }, - { 19, 6, 8, -20, 9, -9, 5, -4, -13, 7, 11, -3, 5, -13, -9, 6, + { 19, 6, 8, -20, 9, -9, 5, -4, -13, 7, 11, -3, 5, -13, -9, 6, -11, -1, 0, 4, 11, 26, 3, 6, -7, 12, 6, -3, 1, -9, 7, 1 }, - { 15, 6, 19, -23, -3, -9, 3, 16, -6, -4, 6, -5, -10, 1, 16, -14, + { 15, 6, 19, -23, -3, -9, 3, 16, -6, -4, 6, -5, -10, 1, 16, -14, 2, 0, 2, -13, -3, 8, -6, 3, 1, 1, 2, -5, 12, -4, -8, -3 }, - { 14, 4, 16, -20, 1, 12, 0, 6, -3, 9, 4, 16, 10, -16, 5, 7, + { 14, 4, 16, -20, 1, 12, 0, 6, -3, 9, 4, 16, 10, -16, 5, 7, 5, -4, -4, -18, -3, -11, -4, 4, -7, 3, 13, 7, 3, 3, 2, -7 }, - { 22, 3, -1, -30, 18, -3, -9, 9, -2, 11, -16, -2, -14, 12, 0, 4, + { 22, 3, -1, -30, 18, -3, -9, 9, -2, 11, -16, -2, -14, 12, 0, 4, -5, 4, -1, 3, -20, 12, 4, -10, -2, -2, -12, -12, 10, 6, 11, -3 }, - { 15, 7, 2, -21, 5, 4, 9, -9, -33, 7, 7, 3, -6, -14, -8, 10, + { 15, 7, 2, -21, 5, 4, 9, -9, -33, 7, 7, 3, -6, -14, -8, 10, 12, 0, 2, -1, 5, 4, -2, 0, -7, 0, 2, 4, 0, 1, -3, 8 }, - { -7, 0, 12, 3, 0, -6, 8, -4, 0, 2, 14, -15, 2, -7, -31, -3, + { -7, 0, 12, 3, 0, -6, 8, -4, 0, 2, 14, -15, 2, -7, -31, -3, 14, 0, 14, -15, -1, -4, -15, 10, 1, -3, 1, 2, 5, 2, -8, 1 }, - { -2, 5, 1, 0, -3, 3, 3, -6, -1, 2, -4, 1, -19, 0, -11, 18, + { -2, 5, 1, 0, -3, 3, 3, -6, -1, 2, -4, 1, -19, 0, -11, 18, 11, 10, 21, 5, 6, 2, 10, 3, -6, 0, -2, 13, 5, -1, -2, 9 }, - { -9, 1, -5, 0, 0, -15, 8, 4, 8, 3, 8, 12, -13, -2, -39, -2, + { -9, 1, -5, 0, 0, -15, 8, 4, 8, 3, 8, 12, -13, -2, -39, -2, 4, -4, 5, -3, -4, 3, -3, 3, 10, 5, 3, 2, -3, 5, -2, 8 }, - { -9, 6, 6, -8, 12, -12, 23, -18, 4, -15, -5, 2, -20, 13, -7, 7, + { -9, 6, 6, -8, 12, -12, 23, -18, 4, -15, -5, 2, -20, 13, -7, 7, 7, -12, 14, -12, 6, 1, 1, -3, -8, 9, 0, 1, -7, 3, 7, -6 }, - { -18, 13, 4, 3, -10, -30, -10, -6, -14, 1, -7, -4, -35, 5, -25, 11, + { -18, 13, 4, 3, -10, -30, -10, -6, -14, 1, -7, -4, -35, 5, -25, 11, 9, 8, 19, -4, -7, -3, -18, -8, 1, 5, 10, -4, -14, -9, 3, -4 }, - { -6, -1, 4, -9, -9, 4, 20, 0, 0, 3, 11, 7, -16, -17, -20, 11, + { -6, -1, 4, -9, -9, 4, 20, 0, 0, 3, 11, 7, -16, -17, -20, 11, -6, -14, 1, 4, 19, 2, -8, 6, -15, 3, 6, -5, -14, 3, 7, 2 }, - { 1, 6, -2, -8, -5, -3, 3, -8, 21, 1, 3, 16, -14, -2, -9, -4, + { 1, 6, -2, -8, -5, -3, 3, -8, 21, 1, 3, 16, -14, -2, -9, -4, 13, -2, 18, 14, 14, 19, -13, 5, -10, 2, -3, 3, 5, 5, 1, -1 }, - { -1, -5, -6, -2, -11, -7, 5, -4, 5, -1, 0, 3, -3, 2, -19, 18, + { -1, -5, -6, -2, -11, -7, 5, -4, 5, -1, 0, 3, -3, 2, -19, 18, 16, 4, 14, -22, -2, -11, -22, 1, -1, 11, 1, 2, 11, -10, 7, -12 }, - { 1, 4, 5, -1, -9, -5, 1, 12, 5, 6, 12, 9, -24, 23, 1, 20, + { 1, 4, 5, -1, -9, -5, 1, 12, 5, 6, 12, 9, -24, 23, 1, 20, 14, -11, 13, 5, -2, -2, 5, 6, 2, 1, -9, 6, 10, 5, -4, 11 }, - { -1, -1, 1, 7, -3, -4, 8, -16, 15, -1, -7, 9, -22, -11, -11, 10, + { -1, -1, 1, 7, -3, -4, 8, -16, 15, -1, -7, 9, -22, -11, -11, 10, 16, 9, -2, 4, 13, 10, 6, 16, 4, 7, 1, -8, -7, -14, -7, 4 }, - { 1, 3, -6, 0, 15, -9, -4, 0, 4, 6, 12, 9, -6, -5, -22, 17, + { 1, 3, -6, 0, 15, -9, -4, 0, 4, 6, 12, 9, -6, -5, -22, 17, 7, -11, 15, -5, 1, 3, -19, 0, -15, -3, 16, 5, 5, -7, -11, 12 }, - { -2, -1, 13, 2, 4, -24, 37, -5, -2, -6, 12, 7, -2, -23, -4, 9, + { -2, -1, 13, 2, 4, -24, 37, -5, -2, -6, 12, 7, -2, -23, -4, 9, 2, -3, 3, 2, 3, 3, -14, 11, 0, -4, -2, -2, 3, 10, -10, 4 }, - { 2, 9, 8, -6, -28, 14, 28, -11, 18, -11, 0, 2, -2, 4, -12, 3, + { 2, 9, 8, -6, -28, 14, 28, -11, 18, -11, 0, 2, -2, 4, -12, 3, 6, 0, 7, -7, -6, 2, 5, -1, -1, -1, 5, 2, 3, 0, -3, 9 }, - { -7, 14, 5, -10, -3, 7, 4, -5, 7, -8, -7, 4, -12, 14, -16, 25, + { -7, 14, 5, -10, -3, 7, 4, -5, 7, -8, -7, 4, -12, 14, -16, 25, 3, 0, 1, -5, 12, -10, 0, -10, 0, 12, 12, 17, 12, 10, -1, 0 }, - { -4, -2, 5, -2, -17, -3, 5, -5, 7, -17, 1, 5, -4, 4, -20, 0, + { -4, -2, 5, -2, -17, -3, 5, -5, 7, -17, 1, 5, -4, 4, -20, 0, 11, -15, 13, -8, 10, 1, 1, 5, -12, 9, -8, 0, 6, -1, -11, 4 }, - { -3, 12, 13, -15, -7, -7, 0, 5, 33, 3, 3, -6, -13, -7, -15, 10, + { -3, 12, 13, -15, -7, -7, 0, 5, 33, 3, 3, -6, -13, -7, -15, 10, 3, 3, 3, -5, 2, 7, -1, 0, -12, 2, 11, -6, -9, 0, 5, 11 }, - { -8, 5, 10, -7, -14, -4, 13, 0, 18, -3, -6, 7, 1, -6, 0, 21, + { -8, 5, 10, -7, -14, -4, 13, 0, 18, -3, -6, 7, 1, -6, 0, 21, 8, -7, 10, -8, -3, 17, -9, 0, -5, 1, 4, 8, -3, 11, -5, 0 }, - { -8, 8, -3, -8, 8, -11, 16, -16, 17, 0, 8, 16, -17, 10, -16, 10, + { -8, 8, -3, -8, 8, -11, 16, -16, 17, 0, 8, 16, -17, 10, -16, 10, -8, 6, 11, 0, 10, 7, 4, 5, 7, -5, -5, -6, -7, -5, -1, 16 }, - { -6, 0, 6, 1, -8, -8, 8, -7, -5, -10, -11, 8, -19, 6, -7, 13, + { -6, 0, 6, 1, -8, -8, 8, -7, -5, -10, -11, 8, -19, 6, -7, 13, 5, -3, 4, -8, 7, -1, -18, 9, 0, -5, 6, 26, 3, 8, 2, 4 }, - { -2, -2, 23, -2, -20, 2, 7, -7, -6, -15, 3, 9, -19, -2, -10, 7, + { -2, -2, 23, -2, -20, 2, 7, -7, -6, -15, 3, 9, -19, -2, -10, 7, -2, 7, 9, 11, 0, 4, -4, 6, 9, -2, 4, -3, 4, 3, 2, 8 }, - { -6, 12, 10, -10, -7, 4, 17, 11, -6, 1, 12, 11, -18, 8, -12, 4, + { -6, 12, 10, -10, -7, 4, 17, 11, -6, 1, 12, 11, -18, 8, -12, 4, 1, 13, 6, -13, 23, 9, -5, 8, -2, -5, 1, 3, 0, -2, -4, 4 }, - { 7, 1, 7, -17, -8, 8, -1, -7, 5, -6, 4, -3, -16, 9, -24, 18, + { 7, 1, 7, -17, -8, 8, -1, -7, 5, -6, 4, -3, -16, 9, -24, 18, -3, 10, 13, -11, -6, -11, -4, 10, 0, 11, 8, 2, 6, -5, -11, 4 }, - { -4, 1, -5, -10, 0, -3, 9, -2, 4, -1, 1, 5, -41, -10, -7, 4, + { -4, 1, -5, -10, 0, -3, 9, -2, 4, -1, 1, 5, -41, -10, -7, 4, -3, 3, 1, 0, -12, 4, -3, 0, 2, -1, -2, -5, 3, 2, -7, 5 }, - { -2, 1, 4, 4, -3, -6, 1, 0, 12, -5, 11, 0, -17, -3, -1, 11, + { -2, 1, 4, 4, -3, -6, 1, 0, 12, -5, 11, 0, -17, -3, -1, 11, 4, 1, 27, -12, 0, -14, 2, -15, -3, -9, 0, -7, -3, 15, -8, 6 }, - { -6, 4, 9, 2, 4, 3, 7, -10, 28, 1, -2, 48, 7, 0, -10, 10, + { -6, 4, 9, 2, 4, 3, 7, -10, 28, 1, -2, 48, 7, 0, -10, 10, 1, -9, 2, -1, 0, 3, -5, 5, -4, -2, 7, 7, 1, 3, 2, 5 }, - { -3, 3, -1, 3, -9, 0, -1, 3, 2, -6, 39, -14, -12, 5, -19, 21, + { -3, 3, -1, 3, -9, 0, -1, 3, 2, -6, 39, -14, -12, 5, -19, 21, 7, -6, 4, -1, -4, 0, -4, 1, 0, -9, 1, 10, 0, -2, 0, 7 }, - { 4, 2, -29, 12, 5, -3, 16, -6, 15, -13, -4, -1, -13, 22, -16, 17, + { 4, 2, -29, 12, 5, -3, 16, -6, 15, -13, -4, -1, -13, 22, -16, 17, 16, 4, 9, -4, 4, -6, -4, 11, -8, 7, 8, 4, 3, -3, -7, -13 }, - { 0, 3, 3, -6, -4, 0, 9, 0, 5, 0, 10, 10, 4, -13, -12, 16, + { 0, 3, 3, -6, -4, 0, 9, 0, 5, 0, 10, 10, 4, -13, -12, 16, 23, -4, -12, -6, -4, 20, 2, 0, -4, 23, 1, 8, 11, -4, -5, 15 }, - { -6, 4, -15, -9, -1, -19, 12, -30, -17, -4, 1, -13, -13, 4, -3, 26, + { -6, 4, -15, -9, -1, -19, 12, -30, -17, -4, 1, -13, -13, 4, -3, 26, 5, -25, 11, -14, -6, -13, 0, -7, 9, 2, 8, -1, -8, 1, -8, 13 }, - { 1, 6, 1, -4, -4, 1, 2, 0, -3, 2, 10, 6, -6, -2, -11, 4, + { 1, 6, 1, -4, -4, 1, 2, 0, -3, 2, 10, 6, -6, -2, -11, 4, 32, 15, 15, -47, -8, 3, -12, 4, -5, 4, -1, 0, -5, 5, 1, -7 }, - { 2, -1, 0, 0, -1, -6, 0, -6, 4, -4, 5, 9, -5, 1, -3, 51, + { 2, -1, 0, 0, -1, -6, 0, -6, 4, -4, 5, 9, -5, 1, -3, 51, 4, -5, 4, -14, -1, -4, -3, 1, -4, -1, 0, 2, -8, 0, 1, 2 }, - { 0, 4, -2, -7, -2, -9, 6, -8, 11, -3, -6, 3, -11, -8, -12, 8, + { 0, 4, -2, -7, -2, -9, 6, -8, 11, -3, -6, 3, -11, -8, -12, 8, 11, 5, 19, 3, -24, 19, -14, 11, -5, -18, -8, -12, -5, -4, -1, 4 }, - { 16, 9, 10, 14, -18, -2, -18, -27, 10, -5, 12, 14, 4, 0, -2, -6, + { 16, 9, 10, 14, -18, -2, -18, -27, 10, -5, 12, 14, 4, 0, -2, -6, -12, -7, -1, 3, 4, 7, 11, 10, 5, -5, -7, -16, -3, -6, 6, 9 }, - { 7, 15, -9, 10, -19, 4, -5, -37, -2, -4, 8, 2, 4, -1, 1, 9, + { 7, 15, -9, 10, -19, 4, -5, -37, -2, -4, 8, 2, 4, -1, 1, 9, -5, -5, -12, 1, -1, -8, 3, -3, 4, 6, 9, 3, 3, -1, 2, 4 }, - { 13, 17, 3, 9, -7, -7, -15, -17, -8, -13, -4, -8, 19, 2, 16, 25, + { 13, 17, 3, 9, -7, -7, -15, -17, -8, -13, -4, -8, 19, 2, 16, 25, 7, 15, 2, 16, -5, -6, -10, -9, -7, -6, -2, -7, 7, 2, 4, 5 }, - { 24, 7, 9, 8, -13, -2, 0, -4, 1, -13, 3, 6, 7, 10, -4, 15, + { 24, 7, 9, 8, -13, -2, 0, -4, 1, -13, 3, 6, 7, 10, -4, 15, 5, 7, -4, 5, -5, 3, 13, -7, 5, 15, -11, -2, 7, 5, 8, 6 }, - { 17, 6, -15, 23, -2, -1, -6, -2, 0, -4, 11, -3, 12, 15, 6, -8, + { 17, 6, -15, 23, -2, -1, -6, -2, 0, -4, 11, -3, 12, 15, 6, -8, -15, 10, -9, 7, -1, -11, 2, -8, -4, 3, 4, -10, 4, 4, 11, 1 }, - { 21, 12, -3, 6, -8, 8, -11, -8, -5, -5, 3, 7, -1, -5, 12, 15, + { 21, 12, -3, 6, -8, 8, -11, -8, -5, -5, 3, 7, -1, -5, 12, 15, -10, -11, 3, 15, 8, 4, 2, -15, 0, 14, 1, -8, -1, 3, 10, -7 }, - { 16, 12, 5, 13, -6, 15, -23, 0, -17, -9, 0, 4, -9, 13, 6, 18, + { 16, 12, 5, 13, -6, 15, -23, 0, -17, -9, 0, 4, -9, 13, 6, 18, 0, 0, -4, -1, 0, 14, 5, -1, 8, -4, -8, -6, 5, -2, -2, 0 }, - { 14, 16, -1, 12, -15, -9, -6, -20, 4, 6, 8, 9, 3, 1, -9, -4, + { 14, 16, -1, 12, -15, -9, -6, -20, 4, 6, 8, 9, 3, 1, -9, -4, -1, -11, 9, 11, -12, 1, -14, -7, 2, -8, 11, 9, -4, 10, 4, -16 }, - { 13, 10, 3, 7, 0, -8, -33, -6, 4, -4, 19, -2, 14, 6, 5, 7, + { 13, 10, 3, 7, 0, -8, -33, -6, 4, -4, 19, -2, 14, 6, 5, 7, 6, -3, -1, -10, -10, -9, 4, -3, 5, 9, 2, 2, 10, 9, -2, -3 }, - { 11, 10, 25, 18, -1, -6, -21, -21, -11, -16, 6, 5, 14, 4, 8, 7, + { 11, 10, 25, 18, -1, -6, -21, -21, -11, -16, 6, 5, 14, 4, 8, 7, 0, -10, -7, -9, -5, -4, 3, -1, 1, 6, -1, 6, -2, 2, -3, -9 }, - { 15, 9, 5, 22, -17, 15, -9, 7, 7, -9, 13, 9, 10, -1, 8, -3, + { 15, 9, 5, 22, -17, 15, -9, 7, 7, -9, 13, 9, 10, -1, 8, -3, -2, 6, 1, 17, 8, -14, 7, -3, 12, 9, 1, 0, 1, -5, 17, -18 }, - { 25, 19, -17, 12, -4, -10, 1, -13, -19, -7, -3, 9, 6, -2, 3, 1, + { 25, 19, -17, 12, -4, -10, 1, -13, -19, -7, -3, 9, 6, -2, 3, 1, 4, -2, -11, -14, -1, -7, -5, -9, 7, -1, -3, 4, -5, 1, 0, -1 }, - { 20, 8, -3, -10, -24, 3, -6, -2, 0, -12, 14, 6, 7, 11, 4, 7, + { 20, 8, -3, -10, -24, 3, -6, -2, 0, -12, 14, 6, 7, 11, 4, 7, -12, -5, -8, -10, 5, -1, -4, 4, 16, 7, -14, 6, -1, -2, -7, -11 }, - { 16, 18, 17, 1, -15, -6, -5, -3, -1, -19, 8, -2, 2, 8, 12, -19, + { 16, 18, 17, 1, -15, -6, -5, -3, -1, -19, 8, -2, 2, 8, 12, -19, -12, 8, 0, -3, -1, -1, 4, -14, 9, -1, -12, -1, -7, 10, -3, 5 }, - { 18, 12, -7, 7, 0, -3, -13, 0, -1, -4, 9, -2, 6, -1, 0, 1, + { 18, 12, -7, 7, 0, -3, -13, 0, -1, -4, 9, -2, 6, -1, 0, 1, 15, -21, 1, -8, 25, -19, 13, -9, 2, 12, 5, -7, -3, -1, -3, 1 }, - { 13, 16, -4, 9, -2, 2, -1, -19, -7, -4, 18, -6, 14, 18, -5, 4, + { 13, 16, -4, 9, -2, 2, -1, -19, -7, -4, 18, -6, 14, 18, -5, 4, -6, -3, -19, -14, -1, -12, 10, 6, 7, 17, -12, -13, -10, -4, 5, 4 }, - { 27, 17, 4, 14, -9, -2, -4, -8, 0, -6, 14, -11, -7, 2, -3, -3, + { 27, 17, 4, 14, -9, -2, -4, -8, 0, -6, 14, -11, -7, 2, -3, -3, -2, -3, -13, 12, 16, 1, -5, -9, -10, -11, -2, 3, -7, 5, 11, -7 }, - { 7, 17, -16, -2, -14, -28, -7, -8, 15, -10, 7, 15, 8, 17, 13, -1, + { 7, 17, -16, -2, -14, -28, -7, -8, 15, -10, 7, 15, 8, 17, 13, -1, 4, -7, -12, -11, 0, 0, 2, 3, -3, 7, -6, 6, 1, -16, 1, -2 }, - { 23, 11, -9, 15, -23, -4, -6, -4, 2, -9, -7, 9, -8, 3, -13, -4, + { 23, 11, -9, 15, -23, -4, -6, -4, 2, -9, -7, 9, -8, 3, -13, -4, 8, 18, -6, -2, 1, -5, 6, -14, -5, -2, -6, -5, -3, -2, 4, -5 }, - { 12, 13, 18, 18, -35, 2, 7, -17, 3, -11, 6, 9, -3, -2, 10, -4, + { 12, 13, 18, 18, -35, 2, 7, -17, 3, -11, 6, 9, -3, -2, 10, -4, 3, 3, -2, -7, 0, 2, -4, 0, -4, 0, -6, 5, 10, 4, -3, -1 }, - { 19, 11, 1, 20, -14, 4, -9, -13, -2, 11, 0, 17, -1, -1, -1, -1, + { 19, 11, 1, 20, -14, 4, -9, -13, -2, 11, 0, 17, -1, -1, -1, -1, -5, -8, 0, 5, -1, -8, 5, -1, 3, 2, -12, 21, -2, -24, 5, 7 }, - { 15, 15, -15, 17, -14, -22, 3, -4, -11, -3, -7, 1, 18, 10, 1, 10, + { 15, 15, -15, 17, -14, -22, 3, -4, -11, -3, -7, 1, 18, 10, 1, 10, -6, -3, 8, 2, -7, 0, -2, 1, 1, 2, -9, -2, 1, 2, -3, 4 }, - { 45, 13, 8, 17, -5, 2, -16, 2, 8, -2, 8, -15, 4, 5, -1, 7, + { 45, 13, 8, 17, -5, 2, -16, 2, 8, -2, 8, -15, 4, 5, -1, 7, -6, -2, -6, 2, -3, 0, 0, -9, -1, 7, 2, 3, -3, -3, -1, 5 }, - { 1, 18, -8, 18, -12, -10, 3, 4, -22, -12, 20, 8, -3, 9, 2, 10, + { 1, 18, -8, 18, -12, -10, 3, 4, -22, -12, 20, 8, -3, 9, 2, 10, -10, -3, 9, 3, 6, -3, 10, -1, -3, 2, -2, 4, 2, 3, -3, -18 }, - { 9, 10, -5, 9, -35, -21, -18, -16, -1, -12, -6, -7, -15, -19, 12, 4, + { 9, 10, -5, 9, -35, -21, -18, -16, -1, -12, -6, -7, -15, -19, 12, 4, 4, 9, -7, 2, 14, 1, 4, 0, -1, 6, -7, 2, 1, 1, -4, 4 }, - { 31, 8, -17, 35, -8, 1, -5, -6, -7, -6, 10, -2, -3, 6, 9, 3, + { 31, 8, -17, 35, -8, 1, -5, -6, -7, -6, 10, -2, -3, 6, 9, 3, -6, -2, 3, 3, 5, -3, 0, 6, 0, 1, -5, -3, -2, -4, -1, 0 }, - { 18, 4, -8, 7, -8, -15, -1, -16, 12, 18, 3, 19, 2, 4, 8, 8, + { 18, 4, -8, 7, -8, -15, -1, -16, 12, 18, 3, 19, 2, 4, 8, 8, 0, -5, -8, -12, 10, -5, 0, 1, 0, 4, -3, 16, 11, 11, -2, -6 }, - { 27, 15, -17, -10, -23, -22, -1, -14, -4, -7, 20, -2, -7, 6, 15, -5, + { 27, 15, -17, -10, -23, -22, -1, -14, -4, -7, 20, -2, -7, 6, 15, -5, 32, 4, 9, -11, -3, -8, 11, -4, -1, -4, -8, -6, -4, -5, -2, -7 }, - { 22, 4, -7, 2, -15, -11, -17, -10, 2, 0, 15, 11, 7, 12, -8, 6, + { 22, 4, -7, 2, -15, -11, -17, -10, 2, 0, 15, 11, 7, 12, -8, 6, -10, -18, -6, -12, 7, 3, 22, 3, -7, 14, -5, -2, -13, -7, -1, -7 }, - { 18, 13, 9, 24, -4, -19, -9, -11, 13, 8, 2, 4, -1, 8, 14, 10, + { 18, 13, 9, 24, -4, -19, -9, -11, 13, 8, 2, 4, -1, 8, 14, 10, -12, 0, 0, 5, 10, 5, 4, -1, 5, 1, -1, 11, 2, -4, 0, -9 }, - { 15, 19, -5, 1, -4, -10, -8, -27, 6, 8, 5, 10, 4, 11, 5, -5, + { 15, 19, -5, 1, -4, -10, -8, -27, 6, 8, 5, 10, 4, 11, 5, -5, -11, 0, -11, -14, -4, -9, -8, -8, 6, -9, 4, -5, -1, 1, 5, -4 }, - { 18, 1, -13, 14, -14, 9, -15, -7, 12, 1, 13, -4, -20, 12, 10, 12, + { 18, 1, -13, 14, -14, 9, -15, -7, 12, 1, 13, -4, -20, 12, 10, 12, -12, 7, 1, -13, 10, -6, 5, -3, 4, 8, 10, -13, -3, -6, 9, -3 }, - { 19, -14, 5, -8, -6, 2, -5, 5, -3, -1, -28, 11, 18, -6, -4, -2, + { 19, -14, 5, -8, -6, 2, -5, 5, -3, -1, -28, 11, 18, -6, -4, -2, 11, 14, -43, -42, 9, 2, 20, -23, 6, 32, 0, 5, 0, 6, 9, 5 }, - { 8, 11, -14, -1, 7, 12, -7, 2, -16, 2, 10, -3, -1, -7, -7, -1, + { 8, 11, -14, -1, 7, 12, -7, 2, -16, 2, 10, -3, -1, -7, -7, -1, 1, -10, -60, -23, -18, 42, -13, 9, 18, -11, 0, 1, 0, 2, -5, 1 }, - { -5, -1, 2, 0, 3, -3, 3, -2, -6, 0, -3, -3, 7, 2, 0, -2, + { -5, -1, 2, 0, 3, -3, 3, -2, -6, 0, -3, -3, 7, 2, 0, -2, -2, 3, -34, -15, 37, 47, 10, 20, 9, 1, 3, -21, -25, -33, -14, 8 }, - { 5, 6, 2, -2, -2, -2, 6, 5, -5, 7, -3, 1, -5, -13, 9, 3, + { 5, 6, 2, -2, -2, -2, 6, 5, -5, 7, -3, 1, -5, -13, 9, 3, -17, -19, -2, -79, -12, -7, -8, -6, -2, -2, -1, -1, -7, -13, 6, -1 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, 0, 3, 4, -87, 6, -11, 16, -9, -1, 8, 0, 5, 0, 1, 2, 1 }, - { -5, 6, 2, -24, 5, -9, -7, 0, 7, 3, -3, 16, -14, -16, 0, 18, + { -5, 6, 2, -24, 5, -9, -7, 0, 7, 3, -3, 16, -14, -16, 0, 18, 15, -9, -14, -28, -17, 53, 14, -6, -28, -1, -3, -10, -7, -14, 19, -15 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -3, 0, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -3, 0, -13, 0, -53, 3, -22, 63, 19, 16, 1, -11, 0, -3, 0, -3, 0, 1 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -6, -43, -43, -2, 65, -13, -4, 9, 1, 1, 2, 1, 0, 0, 1 }, - { 0, 1, 0, 0, -1, 0, 1, 1, 0, 0, 1, 2, -1, -1, -3, -1, + { 0, 1, 0, 0, -1, 0, 1, 1, 0, 0, 1, 2, -1, -1, -3, -1, -23, 1, -61, -55, 3, -28, -6, -4, -4, 8, 2, 1, 1, -1, 0, 0 }, - { 0, 1, -1, 1, -1, 0, -1, 0, 1, -1, 0, 1, -1, 0, -9, -4, + { 0, 1, -1, 1, -1, 0, -1, 0, 1, -1, 0, 1, -1, 0, -9, -4, -48, -19, -52, -46, 11, -12, 5, -14, 0, -10, 0, 0, -1, -2, -1, 0 }, - { 0, -3, -1, -4, 2, -1, -7, 3, 1, 3, -1, 1, -3, 0, -7, 0, + { 0, -3, -1, -4, 2, -1, -7, 3, 1, 3, -1, 1, -3, 0, -7, 0, 3, -7, -61, -51, -4, -21, -16, -21, -11, 14, -7, 8, 3, -5, 1, 2 }, - { 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, -1, 9, -3, + { 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, -1, 9, -3, 56, -11, -6, -67, -1, 13, 0, 7, 1, -9, -1, -1, 0, 0, 1, 0 }, - { 14, 9, -2, 14, -10, -10, 9, -5, 1, -8, -23, 30, 8, -7, 23, 8, + { 14, 9, -2, 14, -10, -10, 9, -5, 1, -8, -23, 30, 8, -7, 23, 8, 2, 10, -1, -27, -17, 57, 22, 4, -5, 2, -12, -6, 2, -7, -4, -9 }, - { 1, 5, 12, -2, -2, -3, 2, -3, 6, 0, 4, -2, -8, -6, 0, 16, + { 1, 5, 12, -2, -2, -3, 2, -3, 6, 0, 4, -2, -8, -6, 0, 16, -15, 29, -55, -29, -24, 29, 3, 10, 6, 13, 10, -5, 21, 11, -14, 5 }, - { 4, 2, 26, -6, 10, 11, -23, -10, -27, -20, 3, -24, -11, -10, -13, 25, + { 4, 2, 26, -6, 10, 11, -23, -10, -27, -20, 3, -24, -11, -10, -13, 25, -10, 5, -9, -36, -7, 43, 3, -13, 6, 13, -2, 0, 1, 3, -3, -4 }, - { -1, 0, -1, 0, 0, 0, 0, -1, 1, 0, -1, 0, 0, 0, -1, 1, + { -1, 0, -1, 0, 0, 0, 0, -1, 1, 0, -1, 0, 0, 0, -1, 1, -12, 12, -26, -64, -15, 29, 37, -7, -3, -12, -5, 14, 8, -8, -10, -2 }, - { 19, -4, -11, -16, 8, 14, 5, 19, 3, 22, -11, -21, -1, -6, -11, 11, + { 19, -4, -11, -16, 8, 14, 5, 19, 3, 22, -11, -21, -1, -6, -11, 11, 10, -24, -23, -40, -8, 20, 17, 5, 13, -6, 3, 14, -20, -8, 3, 28 }, - { 2, -12, 10, -14, -18, 26, -22, 4, -2, 5, -21, 8, 3, 1, 19, 0, + { 2, -12, 10, -14, -18, 26, -22, 4, -2, 5, -21, 8, 3, 1, 19, 0, -12, 24, -14, -40, 15, 29, -15, 6, 15, 1, -19, 2, 4, 7, -12, -3 }, - { 0, 17, 13, 7, -5, -11, 2, -19, 3, 38, -21, -3, -6, -4, 7, 1, + { 0, 17, 13, 7, -5, -11, 2, -19, 3, 38, -21, -3, -6, -4, 7, 1, 1, -5, -40, -10, -2, 35, 8, 8, -10, -8, -9, 33, 4, 4, 0, -2 }, - { -2, -12, 7, 29, -24, 2, 16, -1, -7, 16, 10, -2, -2, -2, 13, -2, + { -2, -12, 7, 29, -24, 2, 16, -1, -7, 16, 10, -2, -2, -2, 13, -2, -37, 15, -22, -40, -11, 33, 10, -1, 8, 10, 6, 8, 9, 0, -12, 2 }, - { 15, -8, -9, -2, 7, -17, 7, 19, 14, 4, 12, 27, 11, 10, 4, 11, + { 15, -8, -9, -2, 7, -17, 7, 19, 14, 4, 12, 27, 11, 10, 4, 11, -15, 14, -13, -48, 5, 18, 0, -9, -36, -11, 2, 4, 5, 5, -15, -12 }, - { -12, 0, 3, 4, 7, -5, 5, -14, -24, -18, -6, -15, -8, -20, 1, -7, + { -12, 0, 3, 4, 7, -5, 5, -14, -24, -18, -6, -15, -8, -20, 1, -7, -33, -28, -40, -38, -18, -10, -5, 17, -12, 4, 3, -5, 5, -13, 4, -7 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -3, -9, -49, -60, -5, 45, -1, 6, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -3, -9, -49, -60, -5, 45, -1, 6, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, + { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 3, -2, 9, -29, -11, 55, 8, 32, -36, -13, -7, 37, 4, 11, 0, 3 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, -1, -39, -4, -30, 63, 28, -17, -6, 10, 7, -14, -9, 11, 9, 7 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 13, -2, -50, -32, 22, 51, 4, 7, 6, 11, -20, -13, 9, -5, 21, -4 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -3, -9, -49, -60, -5, 45, -1, 6, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -3, -9, -49, -60, -5, 45, -1, 6, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, + { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 3, -2, 9, -29, -11, 55, 8, 32, -36, -13, -7, 37, 4, 11, 0, 3 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, -1, -39, -4, -30, 63, 28, -17, -6, 10, 7, -14, -9, 11, 9, 7 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 13, -2, -50, -32, 22, 51, 4, 7, 6, 11, -20, -13, 9, -5, 21, -4 }, - { -8, 2, 1, 22, -31, -6, -25, -3, -3, 1, -15, -11, -2, -3, 4, -13, + { -8, 2, 1, 22, -31, -6, -25, -3, -3, 1, -15, -11, -2, -3, 4, -13, -9, 15, -18, 37, -7, -37, 12, -13, -11, -25, -10, -11, -22, 7, 16, 7 }, - { 14, 10, 4, -10, -1, -5, -7, -3, 16, 13, -5, -15, 5, 11, -1, 8, + { 14, 10, 4, -10, -1, -5, -7, -3, 16, 13, -5, -15, 5, 11, -1, 8, -27, 7, -12, 49, 17, -22, 9, -2, -9, -1, 2, -15, -1, 41, -18, -17 }, - { -4, -9, -15, -3, 3, 4, 4, 2, 7, -3, -7, -8, -5, 17, -19, -7, + { -4, -9, -15, -3, 3, 4, 4, 2, 7, -3, -7, -8, -5, 17, -19, -7, 36, -9, -38, 17, 1, -48, 11, -18, -13, -2, -8, 4, -10, -5, 21, 11 }, - { 15, -13, 4, 2, 1, -5, -2, 1, -10, 7, -1, 3, -6, 0, 11, -11, + { 15, -13, 4, 2, 1, -5, -2, 1, -10, 7, -1, 3, -6, 0, 11, -11, 8, 20, -17, 51, -17, -41, 2, 15, 4, 8, -2, 16, -32, -1, 17, 6 }, - { -8, 8, -18, -5, 4, 6, -3, 8, 0, -4, 2, 0, -1, -4, 5, 8, + { -8, 8, -18, -5, 4, 6, -3, 8, 0, -4, 2, 0, -1, -4, 5, 8, 30, 30, -8, 70, 2, 8, 2, 0, 7, 1, 13, -1, -6, -7, -11, 2 }, - { -8, -7, 9, -10, -13, 6, -11, -14, 13, 25, -26, 5, 2, -5, -5, 5, + { -8, -7, 9, -10, -13, 6, -11, -14, 13, 25, -26, 5, 2, -5, -5, 5, -8, 4, 0, 33, 12, -38, -4, 6, 13, 6, 25, 34, -1, 25, -19, -5 }, - { 18, 3, -17, 4, -8, 7, 20, 1, -1, 5, -5, -2, -8, 8, -35, 15, + { 18, 3, -17, 4, -8, 7, 20, 1, -1, 5, -5, -2, -8, 8, -35, 15, 24, 43, -5, 51, 5, -12, -3, 1, -2, 3, -3, -3, -9, 8, -9, 2 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 10, 24, 76, -2, -22, 11, -1, 4, 33, 4, 1, -1, 1, 2, 0 }, - { 0, -1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 2, 0, + { 0, -1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 2, 0, 24, 13, 32, 70, 26, 5, -21, -9, -6, -15, 2, -2, 2, 4, 1, 1 }, - { 5, -4, -11, 4, -4, 22, 10, -2, 13, -11, -4, -21, -17, 0, -7, 4, + { 5, -4, -11, 4, -4, 22, 10, -2, 13, -11, -4, -21, -17, 0, -7, 4, 10, -34, 11, 52, 2, -46, -5, 0, 0, -1, 2, 4, -9, 1, 1, -7 }, - { 0, 1, 1, 0, -1, 0, 1, 0, 1, 1, 0, 1, 0, 0, -3, 1, + { 0, 1, 1, 0, -1, 0, 1, 0, 1, 1, 0, 1, 0, 0, -3, 1, -8, 9, -1, 64, -13, -61, -3, 3, -5, 10, 1, 3, -1, -1, -1, -1 }, - { 0, 1, 0, -1, 0, -1, 0, 0, 1, 0, 0, 0, 1, 1, 2, 1, + { 0, 1, 0, -1, 0, -1, 0, 0, 1, 0, 0, 0, 1, 1, 2, 1, 10, -2, -31, 79, -10, 27, 0, -1, 3, 8, 1, 1, 0, -1, 0, -1 }, - { 3, 12, 10, 26, -19, 10, -9, 6, -4, -15, 10, 3, -16, 6, 11, -19, + { 3, 12, 10, 26, -19, 10, -9, 6, -4, -15, 10, 3, -16, 6, 11, -19, 3, 10, 18, 44, 5, -30, 5, -9, 21, 4, 20, 10, 14, -25, 8, -17 }, - { 0, 0, 0, 1, -1, 0, -1, 0, 1, 0, 1, 1, 0, 0, -6, -2, + { 0, 0, 0, 1, -1, 0, -1, 0, 1, 0, 1, 1, 0, 0, -6, -2, 8, -8, 13, 69, 26, -19, -25, -17, 16, 6, -12, 22, 2, -6, 9, 5 }, - { 0, -1, 0, 1, 0, -1, -1, 0, 0, 1, -2, 1, 0, 0, -4, -1, + { 0, -1, 0, 1, 0, -1, -1, 0, 0, 1, -2, 1, 0, 0, -4, -1, -34, -15, -33, 56, 9, -42, 9, 10, 6, 9, -8, -11, 0, -6, 15, 5 }, - { 10, 2, -14, -3, -15, -35, -1, 7, -18, 14, 8, -1, -15, -26, 6, -15, + { 10, 2, -14, -3, -15, -35, -1, 7, -18, 14, 8, -1, -15, -26, 6, -15, -18, 22, 9, 33, 0, -32, -9, 3, -11, 7, 4, -1, 5, 30, 9, 1 }, - { 4, 15, 0, 6, -5, -11, 9, 6, 6, 6, 14, 2, -1, 10, -24, -25, + { 4, 15, 0, 6, -5, -11, 9, 6, 6, 6, 14, 2, -1, 10, -24, -25, -2, -4, -1, 37, 2, -29, 14, -9, 22, 17, -2, 33, 10, -25, 11, -11 }, - { 0, 5, 2, 18, -12, 21, 22, 33, -7, 21, -9, -7, 7, -15, -7, 16, + { 0, 5, 2, 18, -12, 21, 22, 33, -7, 21, -9, -7, 7, -15, -7, 16, 7, 0, -14, 44, 10, -25, 5, -4, 15, -8, 10, -4, 5, 9, -1, 16 }, - { 3, 13, 12, 12, 8, 25, -23, 8, -22, -3, -18, -8, 15, 12, 9, 19, + { 3, 13, 12, 12, 8, 25, -23, 8, -22, -3, -18, -8, 15, 12, 9, 19, 0, 0, -9, 49, -27, -15, -9, -15, 12, -8, -16, -7, 13, 5, 13, 2 }, - { 12, -6, 7, -2, 20, -9, -14, 12, 13, -5, -17, 22, -8, -4, 2, 7, + { 12, -6, 7, -2, 20, -9, -14, 12, 13, -5, -17, 22, -8, -4, 2, 7, -13, -2, -15, 43, -5, -30, 27, 4, 10, -27, 5, 27, -10, -10, -18, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, 10, -18, 70, -2, -52, -1, -7, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, 10, -18, 70, -2, -52, -1, -7, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 15, -13, -20, 16, 2, 13, 5, -11, -8, -5, -3, 2, 24, -23, 30, -7, + { 15, -13, -20, 16, 2, 13, 5, -11, -8, -5, -3, 2, 24, -23, 30, -7, 11, 30, -15, 43, 5, -15, 15, -3, -14, 1, -23, 8, 3, 9, 4, -11 }, - { 0, -1, 0, 1, 0, -1, -1, 0, 0, 1, -2, 1, 0, 0, -4, -1, + { 0, -1, 0, 1, 0, -1, -1, 0, 0, 1, -2, 1, 0, 0, -4, -1, -34, -15, -33, 56, 9, -42, 9, 10, 6, 9, -8, -11, 0, -6, 15, 5 }, - { 10, 2, -14, -3, -15, -35, -1, 7, -18, 14, 8, -1, -15, -26, 6, -15, + { 10, 2, -14, -3, -15, -35, -1, 7, -18, 14, 8, -1, -15, -26, 6, -15, -18, 22, 9, 33, 0, -32, -9, 3, -11, 7, 4, -1, 5, 30, 9, 1 }, - { 4, 15, 0, 6, -5, -11, 9, 6, 6, 6, 14, 2, -1, 10, -24, -25, + { 4, 15, 0, 6, -5, -11, 9, 6, 6, 6, 14, 2, -1, 10, -24, -25, -2, -4, -1, 37, 2, -29, 14, -9, 22, 17, -2, 33, 10, -25, 11, -11 }, - { 0, 5, 2, 18, -12, 21, 22, 33, -7, 21, -9, -7, 7, -15, -7, 16, + { 0, 5, 2, 18, -12, 21, 22, 33, -7, 21, -9, -7, 7, -15, -7, 16, 7, 0, -14, 44, 10, -25, 5, -4, 15, -8, 10, -4, 5, 9, -1, 16 }, - { 3, 13, 12, 12, 8, 25, -23, 8, -22, -3, -18, -8, 15, 12, 9, 19, + { 3, 13, 12, 12, 8, 25, -23, 8, -22, -3, -18, -8, 15, 12, 9, 19, 0, 0, -9, 49, -27, -15, -9, -15, 12, -8, -16, -7, 13, 5, 13, 2 }, - { 12, -6, 7, -2, 20, -9, -14, 12, 13, -5, -17, 22, -8, -4, 2, 7, + { 12, -6, 7, -2, 20, -9, -14, 12, 13, -5, -17, 22, -8, -4, 2, 7, -13, -2, -15, 43, -5, -30, 27, 4, 10, -27, 5, 27, -10, -10, -18, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, 10, -18, 70, -2, -52, -1, -7, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, 10, -18, 70, -2, -52, -1, -7, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 15, -13, -20, 16, 2, 13, 5, -11, -8, -5, -3, 2, 24, -23, 30, -7, + { 15, -13, -20, 16, 2, 13, 5, -11, -8, -5, -3, 2, 24, -23, 30, -7, 11, 30, -15, 43, 5, -15, 15, -3, -14, 1, -23, 8, 3, 9, 4, -11 }, - { 16, -18, 7, -4, 31, -15, -9, -13, 20, -12, -6, 0, 12, -6, -2, 4, + { 16, -18, 7, -4, 31, -15, -9, -13, 20, -12, -6, 0, 12, -6, -2, 4, 3, -3, -1, 0, 1, 3, 3, -2, 1, 6, 4, 0, -3, 2, -5, 1 }, - { 38, -5, -13, -4, 8, -15, 11, 1, 2, -4, -1, 9, 13, 4, -12, -7, + { 38, -5, -13, -4, 8, -15, 11, 1, 2, -4, -1, 9, 13, 4, -12, -7, 0, -2, 7, 2, -6, -2, -3, -2, 3, -4, 6, 15, 1, 1, -11, -2 }, - { 47, -22, 9, -26, 3, -5, 2, -7, 4, -2, 2, -2, 3, 0, 3, -4, + { 47, -22, 9, -26, 3, -5, 2, -7, 4, -2, 2, -2, 3, 0, 3, -4, 3, -3, 2, -3, 7, -3, -1, 1, 1, -5, 5, 0, 2, -5, -3, -2 }, - { 14, -16, 2, -6, 7, -2, -7, -4, -4, -7, 14, -3, 7, -19, -14, -17, + { 14, -16, 2, -6, 7, -2, -7, -4, -4, -7, 14, -3, 7, -19, -14, -17, -29, 6, 26, 16, -5, 13, -4, -1, 21, 14, 1, 3, -6, 0, -7, -1 }, - { 29, -11, 5, -3, 4, 11, 4, -10, 1, -22, -3, -10, 5, 4, 2, 8, + { 29, -11, 5, -3, 4, 11, 4, -10, 1, -22, -3, -10, 5, 4, 2, 8, -2, -7, -12, -12, -8, -3, -18, -2, -9, -5, -1, -3, 2, -14, -14, 7 }, - { 28, -12, 5, 3, 9, -7, 0, -2, 2, 1, 4, 0, -7, -3, -2, 4, + { 28, -12, 5, 3, 9, -7, 0, -2, 2, 1, 4, 0, -7, -3, -2, 4, 4, 14, 8, -1, -4, 14, -7, 17, -2, -2, -9, 2, 19, -7, 9, -8 }, - { 31, -18, -22, 8, 15, -5, -10, -15, 1, 10, 6, 7, 6, -8, 2, -1, + { 31, -18, -22, 8, 15, -5, -10, -15, 1, 10, 6, 7, 6, -8, 2, -1, 12, -3, 3, -1, 1, 5, -6, -4, 0, 1, 7, -10, -2, 4, -3, -4 }, - { 53, -30, -4, 12, 2, 3, -3, -3, 0, 1, 6, 5, -5, -4, -7, 1, + { 53, -30, -4, 12, 2, 3, -3, -3, 0, 1, 6, 5, -5, -4, -7, 1, 0, 2, 1, 3, 1, 5, 0, 2, 2, -1, 0, 4, 2, 0, -2, 0 }, - { 27, -18, -3, -2, 4, -8, 3, -2, -11, 2, 10, -8, -8, -4, 0, -2, + { 27, -18, -3, -2, 4, -8, 3, -2, -11, 2, 10, -8, -8, -4, 0, -2, 8, 0, 9, 0, -16, 11, 1, -6, 13, -3, -10, -13, -15, 25, 1, 0 }, - { 35, -5, -1, -8, 23, 11, -14, -3, 2, -2, 8, -6, 17, -2, 7, 0, + { 35, -5, -1, -8, 23, 11, -14, -3, 2, -2, 8, -6, 17, -2, 7, 0, -2, 10, -17, 13, -2, -2, 11, 11, -14, 2, -2, -3, -8, -1, -12, -5 }, - { 29, -9, 7, 3, 2, -10, 0, 3, 9, 0, -3, 5, 1, -10, 10, -5, + { 29, -9, 7, 3, 2, -10, 0, 3, 9, 0, -3, 5, 1, -10, 10, -5, 3, 6, -20, -9, -6, -4, 1, 0, 12, 17, -8, 9, 3, -1, -9, 0 }, - { 15, -16, 18, -19, 16, -15, 17, -18, 13, -16, 17, -14, 15, -9, 13, -17, + { 15, -16, 18, -19, 16, -15, 17, -18, 13, -16, 17, -14, 15, -9, 13, -17, 9, -7, 4, -5, 3, -4, -3, 0, -6, 7, -9, 7, -2, 7, -9, 9 }, - { 21, -10, 7, -2, 12, -7, 13, -17, 11, -2, 20, 3, 5, -11, -6, -6, + { 21, -10, 7, -2, 12, -7, 13, -17, 11, -2, 20, 3, 5, -11, -6, -6, -15, 0, -9, 5, -11, 7, -1, 7, 8, -10, -9, 3, -5, 9, -8, -2 }, - { 23, -22, 15, -5, 16, -4, -3, -12, 9, 3, -1, -2, -8, 2, -2, -16, + { 23, -22, 15, -5, 16, -4, -3, -12, 9, 3, -1, -2, -8, 2, -2, -16, 3, 4, -2, -6, -7, 12, -8, 2, -14, 2, -7, 11, -2, 6, -4, -1 }, - { 34, -17, -4, 8, 4, -6, 1, 8, 4, 16, 3, 6, 12, -1, -1, -15, + { 34, -17, -4, 8, 4, -6, 1, 8, 4, 16, 3, 6, 12, -1, -1, -15, 6, 4, -7, -6, 6, 0, 2, 1, -2, 2, 3, 3, -3, -2, 8, -6 }, - { 18, -18, 2, -2, 10, 1, 18, -23, -3, -10, 0, 4, 20, -19, -3, -4, + { 18, -18, 2, -2, 10, 1, 18, -23, -3, -10, 0, 4, 20, -19, -3, -4, 2, 8, 6, 1, -3, 1, 1, 3, 5, -1, -11, 3, -7, 5, -1, 1 }, - { 15, -14, 2, 3, 10, -8, 12, -13, 13, -15, 6, -8, -4, -10, 14, -9, + { 15, -14, 2, 3, 10, -8, 12, -13, 13, -15, 6, -8, -4, -10, 14, -9, 24, 2, -7, -18, 13, -11, 8, 14, -6, -2, 3, -1, -4, 7, -7, -4 }, - { 20, -12, 13, 5, -1, -10, 15, -6, 8, -1, -3, -10, 17, 0, -6, -19, + { 20, -12, 13, 5, -1, -10, 15, -6, 8, -1, -3, -10, 17, 0, -6, -19, 2, -1, 8, -3, -16, 0, -3, 2, -2, 0, 8, -9, 0, 1, -10, -9 }, - { 32, 0, -9, -5, -1, 5, 13, -11, 8, 3, 11, -11, 0, -8, -2, -14, + { 32, 0, -9, -5, -1, 5, 13, -11, 8, 3, 11, -11, 0, -8, -2, -14, 7, 10, 6, -5, 1, 10, 2, 12, -10, 4, 4, 6, 4, 0, -7, -10 }, - { 16, -14, 10, -7, 11, -11, 11, -11, 18, -13, 8, -15, 16, -11, 13, -9, + { 16, -14, 10, -7, 11, -11, 11, -11, 18, -13, 8, -15, 16, -11, 13, -9, 8, -7, 12, -11, 7, -6, 3, -5, 9, -5, 4, -1, 7, -4, 8, -3 }, - { 24, -27, -1, 5, 8, -5, 12, 7, 4, -3, 3, -1, -9, -11, -13, -5, + { 24, -27, -1, 5, 8, -5, 12, 7, 4, -3, 3, -1, -9, -11, -13, -5, 10, 0, -13, 7, 1, -5, 4, -9, 7, -3, 13, 2, -5, -3, -17, -2 }, - { 23, -19, 15, 1, -10, -18, -12, -6, 8, -3, 12, 0, -12, -10, -4, -4, + { 23, -19, 15, 1, -10, -18, -12, -6, 8, -3, 12, 0, -12, -10, -4, -4, 8, -10, 4, 2, -2, -8, 13, -3, -2, -6, 2, -3, 5, -2, 2, 11 }, - { 25, -12, 4, 2, 24, -3, 3, -6, 14, 11, 0, -21, -3, -3, 1, -8, + { 25, -12, 4, 2, 24, -3, 3, -6, 14, 11, 0, -21, -3, -3, 1, -8, 7, 0, 0, 3, 3, -6, -7, 6, 2, 1, -4, 5, -1, 10, -2, 9 }, - { 24, -8, -6, 7, 16, -12, 13, -1, 11, -21, 2, -6, 3, -12, 0, 9, + { 24, -8, -6, 7, 16, -12, 13, -1, 11, -21, 2, -6, 3, -12, 0, 9, 4, 11, -7, 1, 4, 1, -8, 3, 3, -6, 3, 3, 0, -8, 8, 4 }, - { 25, -21, 13, 14, 13, -18, 4, -3, 0, -5, -4, 5, -3, 0, 4, 12, + { 25, -21, 13, 14, 13, -18, 4, -3, 0, -5, -4, 5, -3, 0, 4, 12, 7, 3, 5, -5, 2, -2, 3, -10, 2, -9, -15, 6, 1, 7, -5, 1 }, - { 23, -16, -2, 10, 4, -1, 3, 1, 32, 3, -5, -2, 9, 10, -1, -4, + { 23, -16, -2, 10, 4, -1, 3, 1, 32, 3, -5, -2, 9, 10, -1, -4, -6, 2, 9, -1, 14, 12, -6, -1, -17, -2, -4, -9, -7, -6, -8, 3 }, - { 50, -8, 5, 2, -11, 10, 0, 0, 6, -3, 7, 0, -3, -2, -3, 0, + { 50, -8, 5, 2, -11, 10, 0, 0, 6, -3, 7, 0, -3, -2, -3, 0, 6, -4, 2, -5, -9, 0, 3, 10, 1, -7, -2, -3, -6, -9, 1, -2 }, - { 28, -17, 0, -2, 2, -9, 1, 5, -4, -1, 0, 0, 19, -27, 5, -12, + { 28, -17, 0, -2, 2, -9, 1, 5, -4, -1, 0, 0, 19, -27, 5, -12, 7, -14, -3, -6, 10, -2, -4, -2, 4, -5, -2, -7, 1, 7, -9, 4 }, - { 22, -19, -6, -6, 3, -22, 3, 5, 20, -8, -14, -5, 1, 1, 20, 2, + { 22, -19, -6, -6, 3, -22, 3, 5, 20, -8, -14, -5, 1, 1, 20, 2, 16, 6, 3, 14, 4, 3, 5, 1, 5, -7, -10, -6, 3, -6, 1, -14 }, - { 29, -14, -8, 13, 8, -10, -6, 4, 4, -6, 5, -7, 1, 12, 14, 11, + { 29, -14, -8, 13, 8, -10, -6, 4, 4, -6, 5, -7, 1, 12, 14, 11, -7, 1, 2, -9, -11, -9, 0, 4, -1, 7, 10, 4, 4, 20, -1, -11 }, - { 18, -9, 4, 1, 7, -29, 12, 1, -1, -9, -2, -1, -2, 2, 9, -8, + { 18, -9, 4, 1, 7, -29, 12, 1, -1, -9, -2, -1, -2, 2, 9, -8, -13, 5, 4, -13, -4, 2, -5, -7, -6, 14, -10, -34, -3, 1, -3, -13 }, - { 38, -9, 24, 8, 11, 4, -6, -11, -2, -12, 1, 1, -11, -8, -5, -2, + { 38, -9, 24, 8, 11, 4, -6, -11, -2, -12, 1, 1, -11, -8, -5, -2, -15, -8, 8, 0, 1, -7, 5, 4, -1, 8, -2, 11, -3, -1, -5, -5 }, - { -20, 11, -4, 24, -11, 1, 15, 4, 0, -28, -10, -1, 10, 10, -6, 5, + { -20, 11, -4, 24, -11, 1, 15, 4, 0, -28, -10, -1, 10, 10, -6, 5, -6, 2, 7, -2, 1, -2, -6, -3, -7, 1, 2, 12, -1, 7, 0, -2 }, - { -9, 10, -23, 27, -4, -17, 20, -6, 14, -17, 5, -1, 5, -9, -7, 5, + { -9, 10, -23, 27, -4, -17, 20, -6, 14, -17, 5, -1, 5, -9, -7, 5, -6, 4, -2, 9, 0, 8, 0, 1, -3, -3, -5, -8, 5, -2, -2, 12 }, - { -10, 19, 4, 9, 1, -16, 17, -2, 9, -29, -16, -11, -4, 7, -5, 4, + { -10, 19, 4, 9, 1, -16, 17, -2, 9, -29, -16, -11, -4, 7, -5, 4, -1, -3, 3, 2, 3, -4, 5, -12, -2, 6, 5, -4, 4, 1, 4, 10 }, - { -20, 10, -24, 14, -5, 11, 9, 0, 16, -20, 10, -5, -6, -6, -1, 2, + { -20, 10, -24, 14, -5, 11, 9, 0, 16, -20, 10, -5, -6, -6, -1, 2, -4, 5, -16, 8, -2, 5, 5, -11, 9, -11, 4, -11, -1, -1, 4, 3 }, - { -9, 11, 3, 19, 24, 4, 5, -14, 30, -17, -4, -2, -17, 7, 2, 3, + { -9, 11, 3, 19, 24, 4, 5, -14, 30, -17, -4, -2, -17, 7, 2, 3, 1, 3, -7, -4, 2, -3, 1, 4, -1, -1, 3, -12, -2, 3, -3, 10 }, - { -19, 18, 11, 19, 19, 19, 10, 4, 13, 6, 5, 4, 8, 3, -2, 12, + { -19, 18, 11, 19, 19, 19, 10, 4, 13, 6, 5, 4, 8, 3, -2, 12, -6, -2, 7, -6, 15, 12, 16, 16, 18, -3, -4, -20, 0, 10, -9, -3 }, - { -21, 9, 20, 12, 0, -3, 5, -9, 15, -13, 5, -5, -6, 24, 2, 9, + { -21, 9, 20, 12, 0, -3, 5, -9, 15, -13, 5, -5, -6, 24, 2, 9, -5, 2, -7, 2, 5, 7, -5, 2, 15, 3, 1, -1, -4, -2, 7, 0 }, - { -18, 16, 13, 15, 2, -10, 14, -11, 4, -11, 5, 12, 12, 20, 8, 30, + { -18, 16, 13, 15, 2, -10, 14, -11, 4, -11, 5, 12, 12, 20, 8, 30, 2, 11, -9, 7, 0, -3, -16, -5, -6, 5, -4, -21, 0, 5, 6, 1 }, - { -26, 8, -13, 9, 6, -10, 2, -11, 7, -4, 6, -19, -11, -6, -12, 16, + { -26, 8, -13, 9, 6, -10, 2, -11, 7, -4, 6, -19, -11, -6, -12, 16, 0, 5, -7, 8, 5, 6, 17, -9, 10, -10, 5, -3, -11, 2, 4, 10 }, - { -11, 17, -3, 22, -5, 18, 3, 1, 4, -5, 14, -27, 5, -7, -4, -5, + { -11, 17, -3, 22, -5, 18, 3, 1, 4, -5, 14, -27, 5, -7, -4, -5, -10, 11, 1, 15, 1, 1, -6, -5, 10, -22, -7, -7, -15, 13, -4, 5 }, - { -17, 14, -7, 13, 3, 0, 13, -6, 9, -14, -22, -1, 1, 19, 14, -3, + { -17, 14, -7, 13, 3, 0, 13, -6, 9, -14, -22, -1, 1, 19, 14, -3, 4, -13, -13, 2, -4, 8, -2, -2, 13, -12, 13, -12, -7, -5, -3, 6 }, - { -17, 17, -1, 33, 6, 3, 9, -16, 3, -14, -8, 6, -17, 8, 3, 13, + { -17, 17, -1, 33, 6, 3, 9, -16, 3, -14, -8, 6, -17, 8, 3, 13, 8, -6, 3, 1, -2, 0, -2, 8, 4, 9, 13, -10, 4, -17, 0, -6 }, - { -20, 7, 7, 21, 1, -3, 7, -3, -2, -12, 9, -7, 2, -3, 14, 1, + { -20, 7, 7, 21, 1, -3, 7, -3, -2, -12, 9, -7, 2, -3, 14, 1, -1, -7, 12, -10, 5, -20, 11, -2, 0, -24, -17, 6, 6, -4, 3, -1 }, - { -8, 10, 6, 7, -1, -6, 28, -6, 10, -33, 1, -20, 0, -12, 10, 1, + { -8, 10, 6, 7, -1, -6, 28, -6, 10, -33, 1, -20, 0, -12, 10, 1, -6, 8, -3, -1, -10, 8, 5, 0, 10, -2, 8, 16, -5, -3, -7, 4 }, - { -17, 13, 3, 15, 1, -5, 27, -5, 6, -6, 12, 2, -4, 8, -1, -3, + { -17, 13, 3, 15, 1, -5, 27, -5, 6, -6, 12, 2, -4, 8, -1, -3, -2, 12, -15, 3, 4, 1, 2, -9, 0, -16, -21, 2, -4, 16, -7, 4 }, - { -15, 20, 8, 17, 5, -14, 15, -11, 21, -11, 13, -13, 2, -15, -13, 1, + { -15, 20, 8, 17, 5, -14, 15, -11, 21, -11, 13, -13, 2, -15, -13, 1, -5, 5, 2, 10, -9, 4, -1, 3, 2, -4, 13, -5, 1, -4, 5, -3 }, - { -21, 8, 2, 16, -1, 2, 15, -16, 13, -12, -12, -7, -8, 2, -7, 11, + { -21, 8, 2, 16, -1, 2, 15, -16, 13, -12, -12, -7, -8, 2, -7, 11, -8, 5, 2, -7, 16, -4, 1, -7, 3, -15, 6, -5, -8, 2, -8, 5 }, - { -15, 17, -6, 3, -3, 3, 9, -7, 14, -23, 11, 1, -1, 4, 7, 6, + { -15, 17, -6, 3, -3, 3, 9, -7, 14, -23, 11, 1, -1, 4, 7, 6, -1, -14, 7, 6, -8, 5, 1, -15, 10, -9, 2, -3, -1, 4, -10, -4 }, - { -10, 18, 3, 11, 1, 4, 14, -14, 7, -4, 15, -10, 10, -11, 10, -4, + { -10, 18, 3, 11, 1, 4, 14, -14, 7, -4, 15, -10, 10, -11, 10, -4, 5, -14, 10, 4, 15, -12, 15, -13, 20, -15, 14, -15, 8, -11, 4, -6 }, - { -7, 23, 2, 20, 7, 8, 19, -5, 9, -16, -8, -17, -5, 1, 5, -6, + { -7, 23, 2, 20, 7, 8, 19, -5, 9, -16, -8, -17, -5, 1, 5, -6, -8, 1, -6, -4, 10, 6, 6, 2, -11, -4, 0, 2, 4, 7, 9, -4 }, - { -15, 20, -5, 22, 11, -8, 9, -5, 10, -13, -8, 8, 2, -2, -3, 7, + { -15, 20, -5, 22, 11, -8, 9, -5, 10, -13, -8, 8, 2, -2, -3, 7, 6, 10, 1, 2, -5, -9, 1, 10, 16, -22, -7, 0, 7, 7, 6, 1 }, - { -26, 19, -5, 3, 5, 25, 18, -5, 9, -14, -8, -6, -2, -6, 2, 3, + { -26, 19, -5, 3, 5, 25, 18, -5, 9, -14, -8, -6, -2, -6, 2, 3, -8, -2, -7, 7, -3, 7, 3, 4, -8, 0, 1, -8, -4, -2, -2, 1 }, - { -20, 14, -10, 6, -3, 7, 8, -32, -2, -7, -2, -10, 16, -12, -9, 15, + { -20, 14, -10, 6, -3, 7, 8, -32, -2, -7, -2, -10, 16, -12, -9, 15, -2, -5, -6, 2, -7, 5, 9, 1, 6, -7, -1, 0, -2, -4, -7, 3 }, - { -14, 16, 4, 11, -8, 1, 23, -4, 17, -13, -10, 1, 12, 9, 12, -4, + { -14, 16, 4, 11, -8, 1, 23, -4, 17, -13, -10, 1, 12, 9, 12, -4, 7, -1, -1, 5, -8, -6, 3, 3, -6, -3, -18, 0, 18, 20, 4, -2 }, - { -33, 19, -10, 30, 15, 2, -3, -1, -4, -14, 7, -7, -1, 7, -8, 9, + { -33, 19, -10, 30, 15, 2, -3, -1, -4, -14, 7, -7, -1, 7, -8, 9, -1, -3, -5, 2, 2, 4, 0, 5, 0, 0, 2, 3, 3, -3, -3, 4 }, - { -6, 20, 0, 5, 17, -10, 18, -17, 9, -16, 4, -13, -6, 2, -14, 14, + { -6, 20, 0, 5, 17, -10, 18, -17, 9, -16, 4, -13, -6, 2, -14, 14, -28, 9, -12, 25, -4, 7, 7, -8, 6, -6, -2, -10, 2, -11, -1, 2 }, - { -12, 14, 12, 52, -3, 5, -5, 4, 8, -13, 2, -5, -4, 2, -2, -1, + { -12, 14, 12, 52, -3, 5, -5, 4, 8, -13, 2, -5, -4, 2, -2, -1, -2, 3, 3, 5, 2, 3, 0, 1, -5, 2, -4, -3, 1, -5, -2, 0 }, - { -13, 6, 9, 24, 0, 8, 14, -15, 18, -9, -11, -8, 3, 15, -2, -4, + { -13, 6, 9, 24, 0, 8, 14, -15, 18, -9, -11, -8, 3, 15, -2, -4, -9, 4, -3, 12, 14, -13, 11, -4, 2, -4, 0, -6, -6, -6, -14, -1 }, - { -10, 28, 3, 12, 9, 3, 11, -28, 6, -11, -7, 4, 0, 7, 8, -9, + { -10, 28, 3, 12, 9, 3, 11, -28, 6, -11, -7, 4, 0, 7, 8, -9, 0, -6, 0, -16, 4, 7, 4, 4, 7, 3, 4, -7, 0, -3, -10, 6 }, - { -11, 14, -2, 19, -1, -1, 7, 9, -2, -27, 10, -14, 15, -4, 12, -4, + { -11, 14, -2, 19, -1, -1, 7, 9, -2, -27, 10, -14, 15, -4, 12, -4, 2, -2, -6, 12, -6, 0, -5, -4, -5, 1, 3, -11, 5, -9, 3, -8 }, - { -18, 7, 13, 16, -4, 3, 9, -10, 10, -10, -3, -22, -4, -12, 3, -16, + { -18, 7, 13, 16, -4, 3, 9, -10, 10, -10, -3, -22, -4, -12, 3, -16, 0, -3, -16, 8, -11, 1, 10, -7, 15, 3, 0, -1, -13, 8, 1, 6 }, - { -20, 10, -10, 10, 8, -1, 6, 0, 16, -12, 9, -10, -1, -5, -4, -13, + { -20, 10, -10, 10, 8, -1, 6, 0, 16, -12, 9, -10, -1, -5, -4, -13, 13, 16, -8, 12, -2, 14, 18, 13, 0, -16, 2, -5, -5, -5, -4, 3 }, - { -14, 5, -7, -17, 5, -13, 23, 20, -4, -1, 1, -6, 13, 5, -1, 4, + { -14, 5, -7, -17, 5, -13, 23, 20, -4, -1, 1, -6, 13, 5, -1, 4, -14, -2, -7, 8, 3, 2, 2, -7, 2, -1, 4, 7, 3, -9, -1, -5 }, - { -19, 3, -24, -28, -9, -7, 19, 3, 2, 19, 7, 5, -13, 8, -15, -17, + { -19, 3, -24, -28, -9, -7, 19, 3, 2, 19, 7, 5, -13, 8, -15, -17, 3, -11, 4, 13, 3, 2, -1, -3, -4, -4, 2, 0, -5, -6, 6, 2 }, - { -17, 18, -30, -20, -2, -3, 1, 15, -1, -11, 6, -4, 11, 11, -4, -5, + { -17, 18, -30, -20, -2, -3, 1, 15, -1, -11, 6, -4, 11, 11, -4, -5, -10, 0, 0, 1, 3, -7, 8, 2, 5, 1, 5, -5, 1, 6, 4, 1 }, - { -6, 1, -30, -25, -1, -8, -2, -9, -17, 16, 3, -1, -2, -9, -6, -7, + { -6, 1, -30, -25, -1, -8, -2, -9, -17, 16, 3, -1, -2, -9, -6, -7, -3, 12, 6, -4, -10, 0, 10, -8, -6, -5, -3, -11, -4, 0, -1, -3 }, - { -1, -1, -34, -28, 1, -10, 2, 9, 4, 16, 2, 6, 14, 17, 0, 7, + { -1, -1, -34, -28, 1, -10, 2, 9, 4, 16, 2, 6, 14, 17, 0, 7, -4, 4, 4, 4, 0, 1, -1, -5, 8, 1, -4, 1, -9, -2, 5, 6 }, - { -11, 14, 1, -31, -7, -24, 9, 7, 6, 5, -13, 1, -1, 3, 4, -1, + { -11, 14, 1, -31, -7, -24, 9, 7, 6, 5, -13, 1, -1, 3, 4, -1, -2, -8, -6, 3, 5, -4, -6, 7, -2, 5, 3, 3, 0, 0, -5, 2 }, - { -25, 8, -11, -18, 1, -4, 8, -3, -4, 15, 6, -5, 8, 2, 3, 4, + { -25, 8, -11, -18, 1, -4, 8, -3, -4, 15, 6, -5, 8, 2, 3, 4, -4, 5, 6, 8, -7, 6, 1, -11, -15, -13, 9, -4, -14, 10, 12, 7 }, - { -20, 11, -15, -25, 3, 4, 18, 13, -4, -5, -9, -1, -5, -2, -2, -7, + { -20, 11, -15, -25, 3, 4, 18, 13, -4, -5, -9, -1, -5, -2, -2, -7, 16, 5, -4, -5, -7, -2, -3, -9, 11, -2, 0, -7, -17, -6, -11, 6 }, - { -11, 18, -5, -20, -15, -3, 9, 11, -20, 12, 5, 5, 11, -3, 7, 1, + { -11, 18, -5, -20, -15, -3, 9, 11, -20, 12, 5, 5, 11, -3, 7, 1, 10, -6, -3, -3, 3, 3, 14, -7, 10, -17, 9, -11, -2, -6, 7, -12 }, - { -20, 8, -14, -17, -9, -13, -3, 0, -27, -14, -3, -14, 4, 3, 6, -6, + { -20, 8, -14, -17, -9, -13, -3, 0, -27, -14, -3, -14, 4, 3, 6, -6, 7, 4, 23, 9, 11, 9, 3, -4, 9, 2, 4, -1, -6, 1, -8, -11 }, - { -9, 14, 2, -37, -7, 13, 6, -11, -6, 9, 18, -11, -6, 2, 12, 4, + { -9, 14, 2, -37, -7, 13, 6, -11, -6, 9, 18, -11, -6, 2, 12, 4, -1, 3, 1, -2, -2, 1, -9, -4, -2, -3, 3, 5, -6, 0, -2, -8 }, - { -29, 8, -1, -13, -2, 8, 23, 2, -10, 7, 13, -6, -5, 11, 13, 0, + { -29, 8, -1, -13, -2, 8, 23, 2, -10, 7, 13, -6, -5, 11, 13, 0, -10, -13, 11, -12, -10, 6, 4, 6, 4, 3, 6, -5, -9, -2, -1, 3 }, - { -18, 6, -10, -55, -4, -11, -2, 0, 1, -3, -9, -6, 3, -2, -1, 6, + { -18, 6, -10, -55, -4, -11, -2, 0, 1, -3, -9, -6, 3, -2, -1, 6, 3, -1, 3, 1, -4, -7, -2, 6, 3, -2, -1, -3, -2, 0, 4, 1 }, - { -14, 5, 3, -21, -8, -16, -4, -2, -11, 27, 15, -20, 3, 0, 1, 1, + { -14, 5, 3, -21, -8, -16, -4, -2, -11, 27, 15, -20, 3, 0, 1, 1, 2, -5, -5, 4, 1, -9, 5, -3, 3, 0, -4, -2, -11, -4, -3, 7 }, - { -17, -1, -9, -17, -8, -18, 12, -13, -9, 13, -3, 3, 3, -3, 1, -2, + { -17, -1, -9, -17, -8, -18, 12, -13, -9, 13, -3, 3, 3, -3, 1, -2, 0, 16, -9, 6, 12, 9, 5, 11, 2, -15, 1, -4, -16, 7, -4, -12 }, - { -18, 8, -6, -11, -8, -7, 13, 7, 1, 6, 8, -1, 21, -4, 14, 15, + { -18, 8, -6, -11, -8, -7, 13, 7, 1, 6, 8, -1, 21, -4, 14, 15, 18, -4, -3, 15, 0, 9, 4, 7, 3, -1, 9, -2, 0, 7, -8, 2 }, - { -10, 7, -18, -29, 3, 12, 12, 9, 11, 4, -1, -15, 1, -1, 8, -2, + { -10, 7, -18, -29, 3, 12, 12, 9, 11, 4, -1, -15, 1, -1, 8, -2, -2, 10, -15, -1, 0, 6, 12, -6, -1, 10, -6, -3, -11, -4, 9, -6 }, - { -14, 14, -9, -21, -12, -2, -1, -7, -5, -10, 5, -8, 0, 6, 9, -11, + { -14, 14, -9, -21, -12, -2, -1, -7, -5, -10, 5, -8, 0, 6, 9, -11, 11, -3, -5, 3, 8, 15, -2, -4, -22, 4, -6, 12, 2, 13, 6, -7 }, - { -12, 11, -5, -29, -25, 4, 12, -13, -11, -7, 4, 2, 2, -5, 5, 8, + { -12, 11, -5, -29, -25, 4, 12, -13, -11, -7, 4, 2, 2, -5, 5, 8, 7, -5, -5, 6, 3, -10, 1, -6, 6, -6, -5, -1, -2, -4, 7, 6 }, - { -15, 11, -5, -16, 0, -13, 26, -23, -6, -3, 5, -2, -2, 21, -6, -3, + { -15, 11, -5, -16, 0, -13, 26, -23, -6, -3, 5, -2, -2, 21, -6, -3, -5, -1, 6, -1, 0, -13, 2, -3, -9, -1, -4, -3, 5, -4, 12, -16 }, - { -9, 9, -1, -17, -3, -6, 12, 6, -18, -2, 11, -14, -6, 3, 14, -12, + { -9, 9, -1, -17, -3, -6, 12, 6, -18, -2, 11, -14, -6, 3, 14, -12, -11, -5, 14, 2, 5, -8, -4, -11, 2, -5, 16, 6, -7, -4, 8, 13 }, - { -13, 5, 3, -28, -14, 0, 6, 23, 5, 4, -1, -17, 1, -3, 0, 0, + { -13, 5, 3, -28, -14, 0, 6, 23, 5, 4, -1, -17, 1, -3, 0, 0, 5, 4, 0, -18, 14, 10, 4, 2, 5, -2, 4, -3, 2, 0, 2, 0 }, - { -15, 4, -13, -16, -3, -12, -2, 2, 7, 10, 9, 3, 11, 4, 23, 14, + { -15, 4, -13, -16, -3, -12, -2, 2, 7, 10, 9, 3, 11, 4, 23, 14, 9, 16, 4, 1, -12, -3, 4, -7, -15, -7, -10, -14, -6, -8, -1, -6 }, - { -7, 10, -5, -10, -3, -13, 16, -1, -12, 7, -3, -12, 2, 13, 13, 2, + { -7, 10, -5, -10, -3, -13, 16, -1, -12, 7, -3, -12, 2, 13, 13, 2, 17, 15, -13, 1, -5, -2, 3, -1, 1, -3, 6, -3, -12, -16, 7, -7 }, - { -11, -5, -12, -30, -6, -22, 1, 4, -6, -3, 12, 6, 7, 0, 16, 6, + { -11, -5, -12, -30, -6, -22, 1, 4, -6, -3, 12, 6, 7, 0, 16, 6, -2, 0, -22, -2, -9, 2, -13, 8, 6, -8, 4, -7, -1, -6, 4, 6 }, - { -14, 5, 1, -27, -4, 2, 1, 14, -11, -7, -8, -4, 1, 8, 0, -6, + { -14, 5, 1, -27, -4, 2, 1, 14, -11, -7, -8, -4, 1, 8, 0, -6, -13, 11, -12, -7, -5, 1, 10, 7, 3, -2, 0, 6, -8, 2, 10, -1 }, - { -10, 10, -25, -13, -20, -4, 19, 3, 13, 5, 5, 7, -8, 2, 4, 2, + { -10, 10, -25, -13, -20, -4, 19, 3, 13, 5, 5, 7, -8, 2, 4, 2, 3, -1, -1, -9, 14, 10, 9, 14, 3, 3, -6, 0, -5, 4, 1, -1 }, - { -9, 15, -18, -17, 4, -11, 6, 7, -12, 8, -1, -11, 2, 3, 7, 16, + { -9, 15, -18, -17, 4, -11, 6, 7, -12, 8, -1, -11, 2, 3, 7, 16, -3, -9, 7, -12, 23, 0, 6, 7, -14, -9, 8, 1, -2, 6, -2, -1 }, - { -6, 9, -16, -26, -14, -11, 9, -6, 5, -2, 13, 17, 21, 7, 18, -19, + { -6, 9, -16, -26, -14, -11, 9, -6, 5, -2, 13, 17, 21, 7, 18, -19, 6, -23, -2, -15, -2, 2, -10, -8, 2, 1, -2, 4, -3, -4, -5, -4 }, - { 0, 6, -5, -28, -17, -32, 2, -10, 11, 3, -5, 9, 10, 3, 11, 11, + { 0, 6, -5, -28, -17, -32, 2, -10, 11, 3, -5, 9, 10, 3, 11, 11, -3, 12, -2, 2, 4, -6, 9, -4, -4, -4, -4, -9, 2, 0, 2, 4 }, - { 0, -8, -18, -34, -9, -7, -4, -11, 10, 15, 11, -1, -8, 15, 6, -13, + { 0, -8, -18, -34, -9, -7, -4, -11, 10, 15, 11, -1, -8, 15, 6, -13, 9, 2, -4, -12, 0, -1, 19, 12, 6, 5, 0, -3, -10, -12, 3, -5 }, - { -10, 6, -9, -17, -12, -11, 9, -6, 11, 11, 18, -7, 0, 16, 4, 2, + { -10, 6, -9, -17, -12, -11, 9, -6, 11, 11, 18, -7, 0, 16, 4, 2, -6, 3, -12, -1, 0, 1, -5, -22, -2, -12, 0, 6, 17, 5, 5, 6 }, - { 12, -5, 7, 1, -5, -2, -1, 2, 2, -4, -3, -3, -3, -2, -29, 11, + { 12, -5, 7, 1, -5, -2, -1, 2, 2, -4, -3, -3, -3, -2, -29, 11, 5, -13, -73, 24, 12, 4, -14, -10, 5, 1, 0, -11, -7, -7, 7, 3 }, - { 10, -3, -1, -3, 4, -11, -5, -2, -8, 7, 9, 2, -8, -6, 6, 7, + { 10, -3, -1, -3, 4, -11, -5, -2, -8, 7, 9, 2, -8, -6, 6, 7, 21, 17, -54, 47, -14, -10, 14, 19, 13, 21, -4, 3, 1, 2, -4, 2 }, - { -12, 4, -16, -12, 5, -9, -4, 19, -7, -22, -22, -17, 3, 0, -6, 8, + { -12, 4, -16, -12, 5, -9, -4, 19, -7, -22, -22, -17, 3, 0, -6, 8, 23, -4, -55, -28, 2, -26, 2, 1, 4, 0, -13, 6, 0, 10, -7, -11 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, -1, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, -1, 35, -1, -67, -35, -24, -24, -6, 2, 2, -2, 1, 3, 2, 0, -1, 1 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 5, 0, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 5, 0, 41, -4, -73, -15, 18, 4, 17, 8, -1, -16, -1, -2, 1, 0, 0, 0 }, - { -4, -4, 4, 6, -1, 2, -16, -10, -15, -10, 21, -2, -6, -2, 14, -7, + { -4, -4, 4, 6, -1, 2, -16, -10, -15, -10, 21, -2, -6, -2, 14, -7, 10, -5, -55, 34, -12, 11, -13, -2, 2, 28, -26, 0, 7, 4, 21, -7 }, - { 2, 1, 15, -22, 10, -3, 14, -6, -2, 15, -2, -7, 20, 6, -15, -7, + { 2, 1, 15, -22, 10, -3, 14, -6, -2, 15, -2, -7, 20, 6, -15, -7, 23, 10, -60, 8, -4, 29, -22, 2, -13, 9, -10, 12, -1, -3, 4, 7 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, -1, -2, 11, -5, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, -1, -2, 11, -5, -21, -11, -60, -27, -17, -39, 6, 36, 0, -8, 2, 2, 0, 0, -2, 3 }, - { 2, -5, 9, -17, -1, 2, -3, -6, 8, 12, 7, -6, -33, -11, -14, -40, + { 2, -5, 9, -17, -1, 2, -3, -6, 8, 12, 7, -6, -33, -11, -14, -40, 10, 36, -46, 0, -19, 5, 0, -10, 3, 12, -6, -8, 6, -12, -7, 1 }, - { 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, -1, 0, 1, 0, -2, 0, + { 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, -1, 0, 1, 0, -2, 0, 4, -2, -87, -3, -2, 2, -2, 20, 2, 6, -1, 6, 0, 0, 2, -1 }, - { 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 1, + { 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 1, 1, 7, -76, 41, -7, -24, 0, -6, 3, 6, 0, -2, -1, 1, 0, 0 }, - { 0, -3, 4, 2, 3, 2, 2, 0, 3, -1, 4, 0, -1, 4, -2, -4, + { 0, -3, 4, 2, 3, 2, 2, 0, 3, -1, 4, 0, -1, 4, -2, -4, -32, -11, -64, -29, -9, -43, 2, -11, -1, -7, 0, -4, -2, -2, -2, 2 }, - { 10, -20, 3, -3, 13, 13, 0, -4, 2, 7, -8, 7, -2, 2, -20, -20, + { 10, -20, 3, -3, 13, 13, 0, -4, 2, 7, -8, 7, -2, 2, -20, -20, -19, 3, -47, -18, -16, -6, -15, -42, -17, 14, -6, 8, 12, -10, 11, -12 }, - { -3, -2, -2, -1, -1, 4, -3, -1, -6, -2, 3, 2, -3, 6, -1, -9, + { -3, -2, -2, -1, -1, 4, -3, -1, -6, -2, 3, 2, -3, 6, -1, -9, 10, 13, -68, -9, 26, 3, 5, 3, -21, 10, -15, 21, -22, 19, 11, -14 }, - { 1, 5, 18, -19, -29, -13, -2, 18, -10, 20, 2, 10, -10, 11, 1, 8, + { 1, 5, 18, -19, -29, -13, -2, 18, -10, 20, 2, 10, -10, 11, 1, 8, -16, -17, -41, 10, -14, -25, 0, -14, -19, 17, 7, -12, 14, -11, 14, 5 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, -1, -43, 5, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, -1, -43, 5, 6, -12, -48, 19, 8, -38, -8, -3, 22, -21, -10, 15, 20, -9, -5, 8 }, - { 0, 0, 0, 0, -1, 1, -1, 0, 0, 0, 0, 0, 0, 0, 6, -3, + { 0, 0, 0, 0, -1, 1, -1, 0, 0, 0, 0, 0, 0, 0, 6, -3, 22, -14, -71, -24, -2, -33, 23, 7, -8, 7, -3, 2, -4, 1, -8, -2 }, - { 1, 0, -1, 2, 0, -2, 0, 0, -1, 0, 4, 0, 26, -1, 10, -11, + { 1, 0, -1, 2, 0, -2, 0, 0, -1, 0, 4, 0, 26, -1, 10, -11, -17, -32, -58, 14, -14, -11, -2, 15, 2, -8, 12, 10, -9, 13, -33, -14 }, - { 15, -17, -19, 7, -8, -15, -32, -22, 7, 12, 18, 0, 0, -15, -4, 16, + { 15, -17, -19, 7, -8, -15, -32, -22, 7, 12, 18, 0, 0, -15, -4, 16, 37, -2, -46, 11, 2, -8, -10, -8, 14, 9, -4, 5, 7, -17, 4, 3 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, -5, 3, -85, 23, -9, -17, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, -5, 3, -85, 23, -9, -17, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 1, + { 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 1, 1, 7, -76, 41, -7, -24, 0, -6, 3, 6, 0, -2, -1, 1, 0, 0 }, - { 0, -3, 4, 2, 3, 2, 2, 0, 3, -1, 4, 0, -1, 4, -2, -4, + { 0, -3, 4, 2, 3, 2, 2, 0, 3, -1, 4, 0, -1, 4, -2, -4, -32, -11, -64, -29, -9, -43, 2, -11, -1, -7, 0, -4, -2, -2, -2, 2 }, - { 10, -20, 3, -3, 13, 13, 0, -4, 2, 7, -8, 7, -2, 2, -20, -20, + { 10, -20, 3, -3, 13, 13, 0, -4, 2, 7, -8, 7, -2, 2, -20, -20, -19, 3, -47, -18, -16, -6, -15, -42, -17, 14, -6, 8, 12, -10, 11, -12 }, - { -3, -2, -2, -1, -1, 4, -3, -1, -6, -2, 3, 2, -3, 6, -1, -9, + { -3, -2, -2, -1, -1, 4, -3, -1, -6, -2, 3, 2, -3, 6, -1, -9, 10, 13, -68, -9, 26, 3, 5, 3, -21, 10, -15, 21, -22, 19, 11, -14 }, - { 1, 5, 18, -19, -29, -13, -2, 18, -10, 20, 2, 10, -10, 11, 1, 8, + { 1, 5, 18, -19, -29, -13, -2, 18, -10, 20, 2, 10, -10, 11, 1, 8, -16, -17, -41, 10, -14, -25, 0, -14, -19, 17, 7, -12, 14, -11, 14, 5 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, -1, -43, 5, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, -1, -43, 5, 6, -12, -48, 19, 8, -38, -8, -3, 22, -21, -10, 15, 20, -9, -5, 8 }, - { 0, 0, 0, 0, -1, 1, -1, 0, 0, 0, 0, 0, 0, 0, 6, -3, + { 0, 0, 0, 0, -1, 1, -1, 0, 0, 0, 0, 0, 0, 0, 6, -3, 22, -14, -71, -24, -2, -33, 23, 7, -8, 7, -3, 2, -4, 1, -8, -2 }, - { 1, 0, -1, 2, 0, -2, 0, 0, -1, 0, 4, 0, 26, -1, 10, -11, + { 1, 0, -1, 2, 0, -2, 0, 0, -1, 0, 4, 0, 26, -1, 10, -11, -17, -32, -58, 14, -14, -11, -2, 15, 2, -8, 12, 10, -9, 13, -33, -14 }, - { 15, -17, -19, 7, -8, -15, -32, -22, 7, 12, 18, 0, 0, -15, -4, 16, + { 15, -17, -19, 7, -8, -15, -32, -22, 7, 12, 18, 0, 0, -15, -4, 16, 37, -2, -46, 11, 2, -8, -10, -8, 14, 9, -4, 5, 7, -17, 4, 3 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, -5, 3, -85, 23, -9, -17, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, -5, 3, -85, 23, -9, -17, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 16, 65, -2, -2, 4, 3, 0, -7, 3, 1, 3, 1, 0, 5, 1, -5, + { 16, 65, -2, -2, 4, 3, 0, -7, 3, 1, 3, 1, 0, 5, 1, -5, 0, 2, -1, 3, 0, 0, -1, -2, 6, 0, -2, 0, 0, -1, 1, 1 }, - { 5, 37, -4, 8, -4, -1, 9, 17, 6, -7, 5, -1, 11, 6, -4, 7, + { 5, 37, -4, 8, -4, -1, 9, 17, 6, -7, 5, -1, 11, 6, -4, 7, -2, 4, 1, -3, 11, 3, 3, -9, 6, 0, -2, -4, -5, 4, -12, -11 }, - { 15, 24, -14, 2, 6, 17, 26, 5, 8, 11, -9, -7, -6, -8, 3, -5, + { 15, 24, -14, 2, 6, 17, 26, 5, 8, 11, -9, -7, -6, -8, 3, -5, 9, 10, -3, 10, 0, 1, 4, -9, 4, 9, 3, 0, 4, 0, -5, 3 }, - { 9, 36, -9, -8, 7, 7, 4, 3, -1, -16, -2, 7, -5, -6, 6, 12, + { 9, 36, -9, -8, 7, 7, 4, 3, -1, -16, -2, 7, -5, -6, 6, 12, -11, -12, 9, -1, -3, -9, 12, 6, -6, 2, 2, 5, 0, 5, 6, -6 }, - { 25, 39, -5, 24, 3, 10, 3, -6, 13, -8, 3, -7, 2, -10, -5, 2, + { 25, 39, -5, 24, 3, 10, 3, -6, 13, -8, 3, -7, 2, -10, -5, 2, -2, 3, 5, -2, 1, 5, -2, 3, -4, 1, -5, -4, 0, 1, -2, 0 }, - { 16, 27, -1, 0, -14, 6, 4, -5, 7, -2, -6, 0, -3, -5, 2, -1, + { 16, 27, -1, 0, -14, 6, 4, -5, 7, -2, -6, 0, -3, -5, 2, -1, -1, -19, 5, -8, 0, 11, 12, 5, 0, 3, 10, 6, -14, 14, -13, -15 }, - { 12, 23, -14, 2, 1, 4, -3, 16, 7, -8, 2, -8, 8, 6, -8, -7, + { 12, 23, -14, 2, 1, 4, -3, 16, 7, -8, 2, -8, 8, 6, -8, -7, -3, 0, 2, 8, -13, 7, 13, -6, -4, 6, -13, -16, 14, 11, -7, 5 }, - { 16, 28, -7, -1, 6, -3, 9, 0, -7, 3, 0, 3, -12, 20, 8, 9, + { 16, 28, -7, -1, 6, -3, 9, 0, -7, 3, 0, 3, -12, 20, 8, 9, 8, 23, 8, -13, -2, 4, 9, 3, -5, 13, 5, -2, 12, 14, 5, -1 }, - { 19, 37, 19, 5, 7, 5, 10, 5, 19, 10, 14, 0, 2, 5, 1, -4, + { 19, 37, 19, 5, 7, 5, 10, 5, 19, 10, 14, 0, 2, 5, 1, -4, -4, 2, 2, -5, -2, -1, 2, -6, -4, -4, -5, -3, 2, -2, -2, -2 }, - { 24, 21, 1, -11, -10, 17, -14, 14, 6, -1, -6, -1, 0, -13, -1, -12, + { 24, 21, 1, -11, -10, 17, -14, 14, 6, -1, -6, -1, 0, -13, -1, -12, -2, -5, 6, -4, -12, 14, 5, -2, -8, -8, 15, -7, -30, -12, 4, 0 }, - { 11, 26, -3, 3, 5, -1, -2, 3, -2, 10, 15, -4, 10, -28, 10, -17, + { 11, 26, -3, 3, 5, -1, -2, 3, -2, 10, 15, -4, 10, -28, 10, -17, -8, 1, 2, -7, -1, -6, -15, -1, 4, 5, -7, 9, 0, -5, -4, 4 }, - { 18, 32, 1, 2, -7, 4, 15, 2, -9, -2, 12, -11, 7, 11, 13, 2, + { 18, 32, 1, 2, -7, 4, 15, 2, -9, -2, 12, -11, 7, 11, 13, 2, 0, 5, 9, -10, 16, 3, -3, 5, -9, -23, 2, -2, -1, 5, 2, 11 }, - { 35, 24, -20, 2, 4, -1, 5, 14, -10, -9, 8, -7, 0, 5, -7, -7, + { 35, 24, -20, 2, 4, -1, 5, 14, -10, -9, 8, -7, 0, 5, -7, -7, 11, 1, 5, 3, 2, 0, -2, 3, 0, 1, 4, 0, -2, -8, 0, -4 }, - { 9, 35, -1, 2, -1, -19, -3, 12, -1, 8, 8, -13, -1, -2, 2, 5, + { 9, 35, -1, 2, -1, -19, -3, 12, -1, 8, 8, -13, -1, -2, 2, 5, -8, -1, 13, -2, 11, 1, 0, -10, 0, -3, -7, 2, 1, -12, 3, 12 }, - { 20, 27, -12, -12, 7, 4, -1, -13, -1, -9, 2, 13, -11, 5, 7, -9, + { 20, 27, -12, -12, 7, 4, -1, -13, -1, -9, 2, 13, -11, 5, 7, -9, 9, 1, 1, 8, -9, 0, -6, 7, 4, 2, -2, 7, 3, -2, 1, -9 }, - { 8, 37, -20, -5, 0, -21, 10, -8, 3, 19, -9, 7, -3, -8, 10, -2, + { 8, 37, -20, -5, 0, -21, 10, -8, 3, 19, -9, 7, -3, -8, 10, -2, 0, 5, 6, -4, -2, -1, 0, -7, 6, 1, 0, 4, -5, 6, -8, 2 }, - { 8, 27, 1, -3, -5, 1, 6, 0, 15, 2, 17, -1, 3, -17, 10, 5, + { 8, 27, 1, -3, -5, 1, 6, 0, 15, 2, 17, -1, 3, -17, 10, 5, 5, -6, -6, 6, -10, 18, -5, 0, 0, 13, 7, 10, -5, -6, -2, -4 }, - { 14, 29, -20, -4, -3, 1, -5, -1, 2, 12, -10, -3, 4, -18, 4, 14, + { 14, 29, -20, -4, -3, 1, -5, -1, 2, 12, -10, -3, 4, -18, 4, 14, -4, -1, -9, 15, -2, 2, -5, -3, 2, 9, -2, -14, -3, 4, -4, -7 }, - { 23, 23, -23, -11, 27, 4, 4, -1, 7, 0, -5, 9, 2, -11, 3, 7, + { 23, 23, -23, -11, 27, 4, 4, -1, 7, 0, -5, 9, 2, -11, 3, 7, -2, -5, 2, -7, -7, 13, -3, -6, 2, 3, 3, -4, -1, -8, 5, -2 }, - { 16, 26, -6, 8, -9, -1, -2, -1, -8, 4, -2, 0, -12, 9, -1, 0, + { 16, 26, -6, 8, -9, -1, -2, -1, -8, 4, -2, 0, -12, 9, -1, 0, -17, -9, 30, -5, -15, -16, -13, 0, 10, -11, -7, -3, -1, 0, -11, -2 }, - { 12, 32, -4, -5, 10, 19, -10, 4, -12, 5, -6, 9, -12, -6, -6, -8, + { 12, 32, -4, -5, 10, 19, -10, 4, -12, 5, -6, 9, -12, -6, -6, -8, 4, 1, 3, 0, 8, 0, -3, -4, -7, -4, 10, 8, 6, 5, -1, 4 }, - { 46, 42, -3, -14, -2, -6, 6, -2, -5, -1, -3, -3, 1, -1, 3, 1, + { 46, 42, -3, -14, -2, -6, 6, -2, -5, -1, -3, -3, 1, -1, 3, 1, 1, 4, -1, 2, 3, 1, -2, 6, 0, -1, -2, 4, -2, -1, 2, 2 }, - { 9, 33, -13, 4, -11, 3, -8, 22, 12, -2, 4, 0, -16, 5, 4, -1, + { 9, 33, -13, 4, -11, 3, -8, 22, 12, -2, 4, 0, -16, 5, 4, -1, 7, -6, -9, 1, 7, 5, 0, -5, 5, -1, 10, 3, -2, -1, 3, -2 }, - { 9, 30, 6, -3, 6, 1, -7, 5, 11, 14, 7, 1, 0, 2, 2, -1, + { 9, 30, 6, -3, 6, 1, -7, 5, 11, 14, 7, 1, 0, 2, 2, -1, 8, 7, -6, -13, -10, -2, 1, -6, 10, 7, 6, 5, -2, -5, -1, -16 }, - { 9, 28, -11, -10, 9, -10, 15, 8, 4, 9, -4, -7, 0, -5, 9, 8, + { 9, 28, -11, -10, 9, -10, 15, 8, 4, 9, -4, -7, 0, -5, 9, 8, -7, 2, -15, -23, 4, -4, 4, 16, -8, -3, 0, -8, 14, 5, -3, 15 }, - { 17, 26, -5, -5, -1, -8, 20, 18, -7, -2, 4, -7, -8, -5, -4, 16, + { 17, 26, -5, -5, -1, -8, 20, 18, -7, -2, 4, -7, -8, -5, -4, 16, 0, 0, -7, -2, -13, -5, -2, 3, 12, 1, 3, -5, 2, 2, 0, -1 }, - { 11, 37, 7, -23, 6, -1, 15, 13, 4, -9, 7, 5, 3, -3, -5, -8, + { 11, 37, 7, -23, 6, -1, 15, 13, 4, -9, 7, 5, 3, -3, -5, -8, -2, 3, -5, -1, -8, 7, 2, 13, 1, 3, 0, -3, -1, 2, 0, -2 }, - { 21, 33, 7, 20, 21, -10, 6, -5, -5, -6, -9, 2, 10, 0, 8, -4, + { 21, 33, 7, 20, 21, -10, 6, -5, -5, -6, -9, 2, 10, 0, 8, -4, 10, 2, -2, -2, 0, -10, -6, -2, 0, -5, 3, -11, 3, -9, -3, 1 }, - { 6, 30, -15, -8, 16, 1, 4, 6, 4, 5, 8, -3, 8, -9, -1, -6, + { 6, 30, -15, -8, 16, 1, 4, 6, 4, 5, 8, -3, 8, -9, -1, -6, 8, 2, -2, 4, -2, 5, 11, -21, 3, -10, 16, -11, 24, 10, 14, -6 }, - { 15, 36, -3, -9, -20, 12, 0, -7, -18, -4, -8, -9, 9, -7, -3, -1, + { 15, 36, -3, -9, -20, 12, 0, -7, -18, -4, -8, -9, 9, -7, -3, -1, 2, 7, -5, -8, 6, 2, 2, -1, 7, 1, 1, -3, 3, -4, -8, 1 }, - { 16, 34, 21, 3, -9, 10, 7, 9, -7, 1, -4, -9, -4, -5, -5, 3, + { 16, 34, 21, 3, -9, 10, 7, 9, -7, 1, -4, -9, -4, -5, -5, 3, 3, -19, 1, 5, 4, -2, -6, -5, -10, -11, -8, -2, 2, -5, -8, -7 }, - { 28, 29, -3, 18, -2, 0, -6, 12, -2, 10, -11, -4, -13, -12, -6, -4, + { 28, 29, -3, 18, -2, 0, -6, 12, -2, 10, -11, -4, -13, -12, -6, -4, 0, 4, -1, -8, 6, 4, 12, 11, 10, 10, -3, -6, 1, 2, 1, 7 }, - { 3, 8, 22, -8, 3, 36, -8, -1, 9, 6, -13, -14, 8, -1, 1, 2, + { 3, 8, 22, -8, 3, 36, -8, -1, 9, 6, -13, -14, 8, -1, 1, 2, -2, -8, 0, 3, 1, 2, -1, 5, -1, -8, 0, -2, 2, 2, -1, 1 }, - { 0, 6, 0, 0, 4, 13, -7, -16, -6, 15, -14, -21, -9, -10, -10, -6, + { 0, 6, 0, 0, 4, 13, -7, -16, -6, 15, -14, -21, -9, -10, -10, -6, -21, 5, 4, 2, 12, 4, 12, 11, -4, -6, -6, -10, -7, -18, 1, 4 }, - { -1, 3, 10, 1, -1, 15, 4, -7, -16, 3, 0, -22, 10, 2, -3, -2, + { -1, 3, 10, 1, -1, 15, 4, -7, -16, 3, 0, -22, 10, 2, -3, -2, 13, 5, -8, 16, -5, 4, 0, -11, -10, -22, 0, -4, -17, 5, 2, 1 }, - { 12, 8, -4, -9, 14, 40, -21, 0, 1, -15, -10, -12, 12, 6, -10, 2, + { 12, 8, -4, -9, 14, 40, -21, 0, 1, -15, -10, -12, 12, 6, -10, 2, 8, 6, -12, -10, -11, 1, 0, -11, 2, 1, 13, 0, 6, 3, 8, 4 }, - { -10, 3, 5, -4, -3, 3, 0, -9, 2, 8, -22, -23, 17, 8, -17, -3, + { -10, 3, 5, -4, -3, 3, 0, -9, 2, 8, -22, -23, 17, 8, -17, -3, 14, -8, -4, 1, -8, 3, 0, 5, -1, -3, -2, -4, 1, -10, 0, -2 }, - { 0, -1, 5, -7, 4, 12, -2, 0, -7, 2, -16, -15, 12, 21, -7, -4, + { 0, -1, 5, -7, 4, 12, -2, 0, -7, 2, -16, -15, 12, 21, -7, -4, 7, -7, -11, -15, -7, -9, -5, -8, 0, -6, 8, -3, -8, 22, -7, -9 }, - { 7, 19, 4, -9, 24, 22, 2, -6, 8, 13, -14, -20, -4, 11, 8, -4, + { 7, 19, 4, -9, 24, 22, 2, -6, 8, 13, -14, -20, -4, 11, 8, -4, -1, 2, 0, -7, 5, -17, -3, 3, -6, 5, 3, 4, -5, -7, -3, 14 }, - { -2, 6, 2, 8, -2, 5, -4, -2, -10, 3, -45, -30, -3, -3, -12, -4, + { -2, 6, 2, 8, -2, 5, -4, -2, -10, 3, -45, -30, -3, -3, -12, -4, -3, -3, -1, 9, -6, -6, 5, -4, 0, 5, -1, -2, -1, 0, -6, -1 }, - { -3, 14, -16, -10, 10, 0, -2, -40, -9, 12, 2, -19, 15, -4, 4, 3, + { -3, 14, -16, -10, 10, 0, -2, -40, -9, 12, 2, -19, 15, -4, 4, 3, 3, -4, 7, 1, -4, -5, 0, 4, -1, 0, -9, -2, -4, -1, -2, 0 }, - { 7, 16, 2, -7, 8, 2, 0, 1, 5, 21, -10, -26, 7, 2, -9, -7, + { 7, 16, 2, -7, 8, 2, 0, 1, 5, 21, -10, -26, 7, 2, -9, -7, -3, -16, 8, 5, 5, -6, 10, 4, -14, -6, 5, 3, -2, -2, -4, 1 }, - { -9, 14, -1, 3, 3, 11, 1, -5, -3, 13, -16, -18, 20, 6, -5, 0, + { -9, 14, -1, 3, 3, 11, 1, -5, -3, 13, -16, -18, 20, 6, -5, 0, -3, 2, 8, 4, -19, -9, 12, 0, -8, 2, 2, 1, 6, 13, -7, -11 }, - { 2, 5, 16, -4, 19, 15, 4, 0, -11, 7, -10, -10, -16, 18, -11, -12, + { 2, 5, 16, -4, 19, 15, 4, 0, -11, 7, -10, -10, -16, 18, -11, -12, -9, -4, 7, -4, -4, -17, 1, 1, -8, -3, -3, 5, -2, -6, -11, -5 }, - { 2, 12, 0, -9, -10, 14, 6, 2, -3, 2, -12, -28, 12, 1, -1, 2, + { 2, 12, 0, -9, -10, 14, 6, 2, -3, 2, -12, -28, 12, 1, -1, 2, 0, -3, -4, 7, 16, 5, -7, 8, -4, -3, -1, 3, -12, 4, -17, -5 }, - { -4, 7, 11, 6, 1, 14, -4, -6, 5, 5, -6, -24, 23, -9, -15, 13, + { -4, 7, 11, 6, 1, 14, -4, -6, 5, 5, -6, -24, 23, -9, -15, 13, -7, -9, -15, 10, -1, 8, -5, 1, 12, 6, 2, 0, 4, -2, 9, -10 }, - { 1, 5, 11, 3, 6, 12, -3, 8, -21, 5, -7, -20, 12, -2, -9, -3, + { 1, 5, 11, 3, 6, 12, -3, 8, -21, 5, -7, -20, 12, -2, -9, -3, 17, -7, -8, -9, -14, 3, -13, 18, -8, 9, 2, -8, 4, -8, -5, -2 }, - { -3, -3, -1, 5, -2, 15, 3, 2, 1, -8, 1, -39, -6, 13, -13, 0, + { -3, -3, -1, 5, -2, 15, 3, 2, 1, -8, 1, -39, -6, 13, -13, 0, -2, -5, -6, -3, 0, -5, -2, 15, -9, 5, -3, -6, -2, 7, 0, -13 }, - { 2, 8, 5, -12, -13, 22, 8, -16, 11, 5, -2, -32, -2, -4, 11, 5, + { 2, 8, 5, -12, -13, 22, 8, -16, 11, 5, -2, -32, -2, -4, 11, 5, 5, -6, 1, 3, 1, 5, 3, 6, -5, 4, 4, -8, 8, 4, 1, 3 }, - { 13, 9, 5, -4, 9, 18, -11, 2, -1, 15, -10, -19, -2, 14, 0, -10, + { 13, 9, 5, -4, 9, 18, -11, 2, -1, 15, -10, -19, -2, 14, 0, -10, 1, 1, -18, 3, 2, -6, -8, 20, 7, -8, 16, 9, 9, -13, -3, -2 }, - { -13, 11, 11, -9, -10, 13, -3, -18, 2, 10, 5, -21, 6, 15, -11, -21, + { -13, 11, 11, -9, -10, 13, -3, -18, 2, 10, 5, -21, 6, 15, -11, -21, 3, 14, 0, -12, 9, -1, -2, -4, 3, -3, -9, -8, -5, -2, -8, 2 }, - { 3, 3, 11, 4, 0, 13, 1, -8, 10, 13, -6, -26, 2, 12, -3, -5, + { 3, 3, 11, 4, 0, 13, 1, -8, 10, 13, -6, -26, 2, 12, -3, -5, 12, -2, 1, 8, -7, -17, -19, 5, 10, 7, -3, 2, -3, 0, 5, 0 }, - { 5, 0, 3, -3, -9, 5, -15, -5, -5, 17, -5, -31, 0, 13, 13, 5, + { 5, 0, 3, -3, -9, 5, -15, -5, -5, 17, -5, -31, 0, 13, 13, 5, -1, -6, -14, 7, -8, 9, -14, -2, -16, -4, -4, -6, 6, -6, -10, 6 }, - { 13, 3, 1, 7, -3, 4, -1, -2, -1, 4, -8, -32, -1, -4, 0, 3, + { 13, 3, 1, 7, -3, 4, -1, -2, -1, 4, -8, -32, -1, -4, 0, 3, -10, 7, 10, -10, 4, -1, 6, 2, -16, -9, 4, 3, 13, -23, -3, -4 }, - { 4, 11, -4, -9, 4, 11, -12, -12, -12, 6, 1, -28, -3, 14, 18, -2, + { 4, 11, -4, -9, 4, 11, -12, -12, -12, 6, 1, -28, -3, 14, 18, -2, -12, 7, 15, -3, -5, -7, -3, 2, -6, 4, 4, -2, -5, -3, 2, -13 }, - { 8, 7, -7, 0, 13, 7, -8, -7, 8, 36, -10, -22, 3, 23, -3, -10, + { 8, 7, -7, 0, 13, 7, -8, -7, 8, 36, -10, -22, 3, 23, -3, -10, -3, 11, 1, -7, 3, 3, -1, -7, -4, 2, 3, 2, 5, 3, -4, -1 }, - { -1, 1, 13, 1, -6, -1, -6, -9, -18, 17, -5, -37, -1, -1, -6, -4, + { -1, 1, 13, 1, -6, -1, -6, -9, -18, 17, -5, -37, -1, -1, -6, -4, 1, -6, -15, 2, 17, -9, 0, -3, 0, 4, 0, -5, 0, 4, 1, -5 }, - { 0, 14, 5, 0, -7, 2, -6, 17, -6, -9, 7, -16, -5, 23, -14, -13, + { 0, 14, 5, 0, -7, 2, -6, 17, -6, -9, 7, -16, -5, 23, -14, -13, 8, -15, 11, 10, -11, -13, -33, -5, -2, 1, 6, 8, 0, -13, -9, 5 }, - { 11, 7, -2, -8, 9, 11, 25, -14, 7, 3, -1, -33, 14, 8, -6, -19, + { 11, 7, -2, -8, 9, 11, 25, -14, 7, 3, -1, -33, 14, 8, -6, -19, 3, 3, 2, -1, -3, -1, -2, -10, -3, 1, 2, 1, 4, 2, -3, 4 }, - { -2, 8, 4, -2, 9, 13, -4, -2, -15, -3, 19, -37, 9, 25, -9, 2, + { -2, 8, 4, -2, 9, 13, -4, -2, -15, -3, 19, -37, 9, 25, -9, 2, -5, -2, -2, -4, 4, 2, 2, 0, 3, 3, 3, 5, -2, -3, -4, -3 }, - { 10, 13, -1, -15, 4, 6, -18, -4, 25, 1, -23, -17, 15, 13, -8, -8, + { 10, 13, -1, -15, 4, 6, -18, -4, 25, 1, -23, -17, 15, 13, -8, -8, 7, 4, -5, 3, 6, 9, -7, 6, 0, -5, 8, 0, -6, -1, -2, -2 }, - { 1, 3, 9, -5, 27, 15, -9, -31, -1, 23, -2, -9, 1, 8, -1, -7, + { 1, 3, 9, -5, 27, 15, -9, -31, -1, 23, -2, -9, 1, 8, -1, -7, -2, -8, -4, -4, -2, -1, 3, 5, 0, 0, -1, 1, -7, 7, -3, -3 }, - { -8, 7, 3, -6, 8, 3, -11, -2, 36, 14, 1, -30, 6, 10, -12, -6, + { -8, 7, 3, -6, 8, 3, -11, -2, 36, 14, 1, -30, 6, 10, -12, -6, -6, -2, -4, -3, -5, 0, 9, 4, -5, -5, -8, 12, 4, -3, 1, -8 }, - { -2, 9, 33, 0, 12, -3, -7, -4, -4, -1, 6, -25, 11, -6, -9, -11, + { -2, 9, 33, 0, 12, -3, -7, -4, -4, -1, 6, -25, 11, -6, -9, -11, -2, -4, -2, 6, -1, -3, -6, 15, -6, 3, 10, -4, 1, 0, 5, 8 }, - { -22, -21, -9, -19, -5, -7, -12, -15, -8, 9, -19, 14, -7, -4, 5, -8, + { -22, -21, -9, -19, -5, -7, -12, -15, -8, 9, -19, 14, -7, -4, 5, -8, -2, 7, 1, -3, 4, -4, 6, 11, 2, 6, -3, -5, 2, -2, 0, -3 }, - { -32, -13, 3, -24, 3, -8, 4, 1, -10, 14, -15, 0, 4, 6, -1, 6, + { -32, -13, 3, -24, 3, -8, 4, 1, -10, 14, -15, 0, 4, 6, -1, 6, 7, -1, 6, 4, -3, -17, 1, 4, -6, -1, 1, 0, 3, 3, -7, -4 }, - { -32, -11, 7, -8, -12, 13, -5, -22, -4, 12, -16, 2, 0, 4, 0, 1, + { -32, -11, 7, -8, -12, 13, -5, -22, -4, 12, -16, 2, 0, 4, 0, 1, 0, 6, -5, -8, 2, 6, 5, 0, -3, -6, 5, 6, 5, 5, 13, -4 }, - { -44, -33, 6, -4, 2, 0, -9, 10, 3, 4, 7, 0, -1, 7, 5, 1, + { -44, -33, 6, -4, 2, 0, -9, 10, 3, 4, 7, 0, -1, 7, 5, 1, 1, -3, 1, 6, -1, 0, 2, 3, -4, 0, 0, 1, 0, -1, -2, -1 }, - { -30, -18, -24, -8, 5, 0, -2, 14, 7, 0, 1, 12, 6, 4, -9, 7, + { -30, -18, -24, -8, 5, 0, -2, 14, 7, 0, 1, 12, 6, 4, -9, 7, 5, 7, -11, -5, 1, -8, -1, 2, 2, -9, 7, -1, 7, 5, 6, 6 }, - { -22, -20, -13, -9, 20, -3, 10, -8, 6, -4, 2, -7, 10, 8, 0, -1, + { -22, -20, -13, -9, 20, -3, 10, -8, 6, -4, 2, -7, 10, 8, 0, -1, 2, -3, 6, -19, 2, 4, 3, 3, -7, 2, -1, -6, 1, 1, 6, -2 }, - { -27, -8, -1, 3, -1, -11, 24, 4, -1, 1, -8, 8, 5, -11, 15, -3, + { -27, -8, -1, 3, -1, -11, 24, 4, -1, 1, -8, 8, 5, -11, 15, -3, -15, -1, -1, -13, -1, 1, -5, 5, 2, 3, -9, 0, 4, 3, -7, 6 }, - { -33, -16, -1, -8, 10, -23, 6, 13, -1, -3, -9, 0, 5, -7, -5, -12, + { -33, -16, -1, -8, 10, -23, 6, 13, -1, -3, -9, 0, 5, -7, -5, -12, -2, 3, 3, 6, -2, -3, 2, -3, 9, -6, -3, -2, 0, 5, -3, -4 }, - { -22, -17, 11, -3, 3, 1, -1, -5, 17, 2, -15, -2, 10, -9, 6, 14, + { -22, -17, 11, -3, 3, 1, -1, -5, 17, 2, -15, -2, 10, -9, 6, 14, -16, -12, 20, -1, -7, 6, -3, -12, 1, 10, -10, -1, 7, -3, -1, 10 }, - { -28, -13, 1, -3, -1, -1, 0, 3, 3, 5, 1, 10, -10, -3, 7, 2, + { -28, -13, 1, -3, -1, -1, 0, 3, 3, 5, 1, 10, -10, -3, 7, 2, 4, 19, -1, -1, 10, 5, -8, 1, 11, -15, -4, -3, -5, 4, -13, 3 }, - { -22, -13, 42, -20, 5, -13, 7, -11, 1, 1, -1, 1, 6, 3, 6, -11, + { -22, -13, 42, -20, 5, -13, 7, -11, 1, 1, -1, 1, 6, 3, 6, -11, 3, 3, -2, 0, -4, 4, -3, -1, -5, 2, 0, 0, -9, -1, 4, 4 }, - { -26, -15, -2, -6, -4, -2, 16, 8, 21, 8, 1, -3, -10, 7, -8, -12, + { -26, -15, -2, -6, -4, -2, 16, 8, 21, 8, 1, -3, -10, 7, -8, -12, -5, 12, -9, 3, -2, -3, 18, 1, -12, -15, -4, 5, -3, 0, 12, 7 }, - { -26, -16, 5, 6, 14, -3, 15, 6, 1, -7, -13, 16, -15, 5, 11, -2, + { -26, -16, 5, 6, 14, -3, 15, 6, 1, -7, -13, 16, -15, 5, 11, -2, 9, -7, -4, -2, 0, 0, -2, 7, -8, -6, -5, 2, 7, -3, 2, 12 }, - { -31, -17, -8, -30, 4, 14, 6, -6, 6, -11, 0, 3, -4, 0, 0, -4, + { -31, -17, -8, -30, 4, 14, 6, -6, 6, -11, 0, 3, -4, 0, 0, -4, 0, -4, 1, 4, 3, 4, 0, -5, 3, 2, 2, 0, 2, 1, 3, 5 }, - { -61, -10, 4, 10, 4, 7, 0, -3, 0, 1, 0, -3, 0, 1, 0, -2, + { -61, -10, 4, 10, 4, 7, 0, -3, 0, 1, 0, -3, 0, 1, 0, -2, -1, 1, 2, -2, 4, -3, 1, 1, -1, 1, -2, -4, -4, 4, 0, 0 }, - { -28, -13, -8, -4, 3, -3, 2, 1, 11, 14, 3, 9, 1, 13, 3, 5, + { -28, -13, -8, -4, 3, -3, 2, 1, 11, 14, 3, 9, 1, 13, 3, 5, -3, -2, -2, -12, -14, -9, -11, -15, -12, -5, -4, -12, 3, -3, 0, -5 }, - { -41, 0, 12, -24, 13, 4, 5, 16, -5, -4, 0, 0, 13, -4, 1, -9, + { -41, 0, 12, -24, 13, 4, 5, 16, -5, -4, 0, 0, 13, -4, 1, -9, 9, -6, -1, 6, -2, 5, 2, 9, 6, -9, -8, 8, -2, -3, -6, -4 }, - { -26, -19, -2, -15, 4, -14, 6, 0, 26, 20, 8, 9, 9, 3, -4, -5, + { -26, -19, -2, -15, 4, -14, 6, 0, 26, 20, 8, 9, 9, 3, -4, -5, -8, 1, 0, -1, 5, 9, 3, 4, 4, 7, 1, 3, -2, -2, -10, 0 }, - { -29, -18, 9, -4, 1, -5, -14, -12, 5, -10, -5, 4, -5, 0, -1, -1, + { -29, -18, 9, -4, 1, -5, -14, -12, 5, -10, -5, 4, -5, 0, -1, -1, 4, -5, 7, -16, -11, 2, 7, -15, 2, -4, 6, -4, -6, 7, -3, 7 }, - { -27, -16, 9, -14, 3, -8, 9, 0, 7, -4, -3, -7, 0, -10, -1, 2, + { -27, -16, 9, -14, 3, -8, 9, 0, 7, -4, -3, -7, 0, -10, -1, 2, 1, -2, 15, -10, 14, 7, 6, 17, 3, -4, 3, -10, 8, -8, 3, 11 }, - { -21, -20, -8, -8, 4, 5, -3, -2, 0, -5, 14, -10, 11, -4, 13, 0, + { -21, -20, -8, -8, 4, 5, -3, -2, 0, -5, 14, -10, 11, -4, 13, 0, 5, -11, 19, -18, 18, 3, -5, -3, -4, -8, 11, -10, 10, 3, 4, -9 }, - { -35, -15, 13, -12, 4, 0, -2, -4, -12, -3, -8, -24, -7, 1, 7, 8, + { -35, -15, 13, -12, 4, 0, -2, -4, -12, -3, -8, -24, -7, 1, 7, 8, -3, 0, -2, -1, 3, -2, -2, -6, 8, 1, 0, 1, -6, -1, 2, -6 }, - { -19, -14, 13, -10, 9, -1, 1, 3, -12, 5, -16, 7, 13, 9, 4, -4, + { -19, -14, 13, -10, 9, -1, 1, 3, -12, 5, -16, 7, 13, 9, 4, -4, 6, -5, 4, 9, -3, 17, -4, 12, -11, -6, -5, -6, 13, 2, 7, -9 }, - { -34, -8, -4, 1, 2, -1, 3, 6, -20, -11, 8, -1, 4, 2, -9, 4, + { -34, -8, -4, 1, 2, -1, 3, 6, -20, -11, 8, -1, 4, 2, -9, 4, -4, -5, 16, 10, -4, 14, -13, 1, -6, 0, 2, -10, 0, -3, -3, 7 }, - { -36, -10, -8, -3, 2, -2, 14, -4, -1, -7, -4, 10, -1, -3, 15, -11, + { -36, -10, -8, -3, 2, -2, 14, -4, -1, -7, -4, 10, -1, -3, 15, -11, 0, 2, 3, -1, 4, 0, 8, -1, 0, 18, -11, -5, 15, -5, 13, -12 }, - { -22, -13, 14, -20, 15, 25, 16, 10, 8, -2, -10, -5, -1, -8, 11, 8, + { -22, -13, 14, -20, 15, 25, 16, 10, 8, -2, -10, -5, -1, -8, 11, 8, -1, -2, -4, 1, 2, -1, -7, 0, 0, 0, -3, 0, 2, -1, 0, 2 }, - { -31, -22, 7, 6, -2, 5, -20, 14, -6, 7, 0, 14, 3, -7, 3, -6, + { -31, -22, 7, 6, -2, 5, -20, 14, -6, 7, 0, 14, 3, -7, 3, -6, -2, 1, -3, -5, 1, -10, 1, -24, 6, -2, 3, -7, 1, -7, 8, 7 }, - { -25, -20, -3, -9, 10, 6, 12, 7, 5, 4, -3, 6, -1, -5, -6, -8, + { -25, -20, -3, -9, 10, 6, 12, 7, 5, 4, -3, 6, -1, -5, -6, -8, 3, 5, 6, 5, -10, 10, -4, -15, -15, -2, -9, 2, 18, 1, 8, 12 }, - { -24, -19, -2, -4, -7, 11, 6, 9, 16, 2, -7, 18, 6, -7, 6, 6, + { -24, -19, -2, -4, -7, 11, 6, 9, 16, 2, -7, 18, 6, -7, 6, 6, -2, -9, 3, 12, -2, 3, -1, 6, 7, 8, 0, 8, -11, 8, 4, 2 }, - { -26, -20, -12, -12, -2, -3, 1, -5, -1, -2, 0, 3, 7, 9, -2, 2, + { -26, -20, -12, -12, -2, -3, 1, -5, -1, -2, 0, 3, 7, 9, -2, 2, 9, 22, 13, 4, -4, -1, -2, -14, 5, 15, -8, -5, -7, -11, -14, -6 }, - { -21, -18, -1, -4, 0, 3, 7, -2, 10, 8, -8, -1, 15, 1, -9, 3, + { -21, -18, -1, -4, 0, 3, 7, -2, 10, 8, -8, -1, 15, 1, -9, 3, 1, 3, -5, -2, 2, 4, 0, -1, 10, 2, -19, -8, 8, 30, -7, 8 }, - { -25, -6, 26, 4, -8, 4, -2, 21, 5, -4, -16, 5, 13, 4, -10, -1, + { -25, -6, 26, 4, -8, 4, -2, 21, 5, -4, -16, 5, 13, 4, -10, -1, -6, -2, 2, -10, -13, 1, 3, -3, -6, -8, 2, 11, 1, -7, 0, 5 }, - { 0, -1, -2, 19, -12, -48, -6, 11, 8, -2, -4, -2, -7, 5, -3, 2, + { 0, -1, -2, 19, -12, -48, -6, 11, 8, -2, -4, -2, -7, 5, -3, 2, -2, -1, -1, -7, 0, -3, -3, -4, -4, 4, 1, 3, -3, -1, -2, -5 }, - { -11, -8, -28, 18, 16, -24, -8, 19, 4, 8, -12, 9, -4, -2, 4, -7, + { -11, -8, -28, 18, 16, -24, -8, 19, 4, 8, -12, 9, -4, -2, 4, -7, 6, 2, 3, 3, -4, 0, 1, -6, -4, -2, 2, 6, 0, -3, 1, -16 }, - { -9, -5, -26, 7, -3, -37, -16, -2, 2, -7, 4, -13, 0, -4, -6, -5, + { -9, -5, -26, 7, -3, -37, -16, -2, 2, -7, 4, -13, 0, -4, -6, -5, -6, -4, 0, 3, 4, -3, -4, -4, 4, -3, 9, -4, -2, 2, 7, -4 }, - { 2, 9, -18, 7, 29, -24, -1, 7, 14, 10, 3, -3, -2, -5, 6, -10, + { 2, 9, -18, 7, 29, -24, -1, 7, 14, 10, 3, -3, -2, -5, 6, -10, -6, -3, -8, 0, 5, 1, 4, 3, -12, 2, 6, 1, 3, 4, 1, -3 }, - { -20, 2, 8, 20, -9, -24, -4, 18, 3, 11, -1, -11, 6, 9, -1, -3, + { -20, 2, 8, 20, -9, -24, -4, 18, 3, 11, -1, -11, 6, 9, -1, -3, 1, -1, -15, 3, 15, 9, 3, 2, -13, 2, -8, 8, 1, -1, 1, -8 }, - { -12, 5, -11, 6, 19, -26, -17, -6, 4, 14, 6, -8, 9, 5, -6, -5, + { -12, 5, -11, 6, 19, -26, -17, -6, 4, 14, 6, -8, 9, 5, -6, -5, 2, -1, 20, 1, -11, -10, -18, 20, -7, 0, -3, 4, 2, 0, 10, 4 }, - { -15, 1, -2, 13, -8, -21, -22, 4, 4, 3, 3, -7, -31, 4, -10, -14, + { -15, 1, -2, 13, -8, -21, -22, 4, 4, 3, 3, -7, -31, 4, -10, -14, 0, 8, 4, 5, 8, 11, 2, -8, 6, 7, 0, -2, 6, 8, 8, 7 }, - { -13, -10, -9, 12, 19, -16, -3, -2, 9, 2, 11, -29, -1, 9, 4, -3, + { -13, -10, -9, 12, 19, -16, -3, -2, 9, 2, 11, -29, -1, 9, 4, -3, 1, -10, -10, 16, 1, 7, -7, -6, -4, -1, -5, 3, 6, 0, 3, 1 }, - { -17, -1, -5, 19, 12, -9, -21, -5, 2, 12, -7, -7, -3, 8, 7, -2, + { -17, -1, -5, 19, 12, -9, -21, -5, 2, 12, -7, -7, -3, 8, 7, -2, 6, -9, -9, 1, -4, 1, 1, 3, -14, 2, -8, 0, 10, 1, -12, -6 }, - { -13, -5, 8, 15, 0, -20, -2, 20, 8, -8, 8, -19, 12, 10, 2, -11, + { -13, -5, 8, 15, 0, -20, -2, 20, 8, -8, 8, -19, 12, 10, 2, -11, 0, 12, 1, -11, 0, -11, -15, 5, -11, 2, 4, -4, -11, 5, -4, -5 }, - { 3, -11, -7, 8, 0, -17, -26, 15, 19, -7, 10, -9, -5, -5, 14, -25, + { 3, -11, -7, 8, 0, -17, -26, 15, 19, -7, 10, -9, -5, -5, 14, -25, 0, -8, 2, -9, -3, 9, 1, -6, 4, -4, 3, -9, -1, 6, 2, 2 }, - { -12, 5, 5, 9, 14, -18, -19, 4, 2, 16, 14, -21, -15, -9, -1, 16, + { -12, 5, 5, 9, 14, -18, -19, 4, 2, 16, 14, -21, -15, -9, -1, 16, 12, -11, -10, -5, -7, 4, 15, -8, -5, -1, 1, 14, 13, -7, -1, -4 }, - { -10, -5, -1, 8, 7, -23, -10, 14, 6, 11, 10, -16, -3, 16, 6, 0, + { -10, -5, -1, 8, 7, -23, -10, 14, 6, 11, 10, -16, -3, 16, 6, 0, 0, 9, 6, -2, -7, 1, 22, 5, 3, -8, 0, 3, -2, -10, 3, 0 }, - { -2, -14, 2, 16, 15, -17, -17, 6, 19, 4, -10, -15, -1, 15, 11, -14, + { -2, -14, 2, 16, 15, -17, -17, 6, 19, 4, -10, -15, -1, 15, 11, -14, -8, 5, 8, 8, -2, -8, -11, 10, 10, -8, -14, 2, 13, 4, -2, -12 }, - { -10, 3, 6, 4, 19, -23, -19, 1, 4, -9, -30, 3, -6, 18, 0, 2, + { -10, 3, 6, 4, 19, -23, -19, 1, 4, -9, -30, 3, -6, 18, 0, 2, 0, -11, 0, 3, 7, -2, 8, 5, 2, -3, 6, -9, 1, -4, 7, -6 }, - { 9, 5, -2, 21, 20, -33, -13, 7, -10, 8, 8, -15, -6, -4, 1, 5, + { 9, 5, -2, 21, 20, -33, -13, 7, -10, 8, 8, -15, -6, -4, 1, 5, 3, 7, -2, -9, -1, 4, -6, 1, 0, 9, -1, -5, 2, 1, -3, 3 }, - { -9, -3, 3, 15, -3, -30, -7, -7, -25, 6, 2, -6, 1, 19, 1, -12, + { -9, -3, 3, 15, -3, -30, -7, -7, -25, 6, 2, -6, 1, 19, 1, -12, 1, -8, -13, 9, 13, 1, 8, 2, 5, 15, -2, 3, -9, 0, -4, 4 }, - { -6, -12, -17, 25, 22, -13, -10, 9, 2, 11, -7, -16, 4, 6, 1, 0, + { -6, -12, -17, 25, 22, -13, -10, 9, 2, 11, -7, -16, 4, 6, 1, 0, 0, 18, -4, -5, 4, -2, -1, -5, 0, -4, 6, 1, 6, -1, 7, 0 }, - { -1, 0, -10, 8, 8, -27, 0, -2, 29, 16, -2, -4, 9, -1, 2, 0, + { -1, 0, -10, 8, 8, -27, 0, -2, 29, 16, -2, -4, 9, -1, 2, 0, 6, 10, 6, 4, 2, -7, 9, -18, 3, 3, 3, -10, 17, 10, 9, -6 }, - { -3, -12, -6, 11, 20, -32, 5, 21, 3, -4, -9, 2, -10, 1, 7, -4, + { -3, -12, -6, 11, 20, -32, 5, 21, 3, -4, -9, 2, -10, 1, 7, -4, 5, 0, 0, -1, -8, -9, -7, 4, -10, 5, 0, 2, -5, 4, 9, 1 }, - { -5, -1, -5, 1, 2, -19, -13, 1, 6, 12, 2, -16, -17, 11, 10, 13, + { -5, -1, -5, 1, 2, -19, -13, 1, 6, 12, 2, -16, -17, 11, 10, 13, 16, -12, -11, 3, -6, 0, 6, 4, -3, 1, 8, 2, 5, -11, 3, -14 }, - { -19, 5, 10, 11, 2, -23, -9, 16, -2, 7, 0, -11, -7, 10, 6, -7, + { -19, 5, 10, 11, 2, -23, -9, 16, -2, 7, 0, -11, -7, 10, 6, -7, 26, -15, -4, 8, 6, -4, 7, -9, -15, 1, 8, -4, 4, 2, -12, 16 }, - { -11, 1, 11, -4, 1, -31, -13, -1, 8, 5, 4, -2, 0, 13, 7, -17, + { -11, 1, 11, -4, 1, -31, -13, -1, 8, 5, 4, -2, 0, 13, 7, -17, 7, -10, -6, 1, 4, -1, 2, -9, -4, 9, 3, 3, -4, -5, 3, 4 }, - { -3, 1, 10, -1, 0, -15, -22, 4, 40, -11, -4, -3, -14, 9, 11, -1, + { -3, 1, 10, -1, 0, -15, -22, 4, 40, -11, -4, -3, -14, 9, 11, -1, 9, -1, -6, 6, 3, -6, 0, 0, -12, 7, -2, 0, 9, 3, 1, 3 }, - { -1, -1, -1, 14, 8, -24, -14, -8, 5, 8, 5, -12, -17, 8, 2, 7, + { -1, -1, -1, 14, 8, -24, -14, -8, 5, 8, 5, -12, -17, 8, 2, 7, 10, -8, 0, 4, -6, -6, -10, 8, 4, -12, 3, -9, -12, 5, 4, -3 }, - { -5, 1, -11, 8, 9, -24, 0, 2, 2, 14, -12, -13, 1, 6, 7, 0, + { -5, 1, -11, 8, 9, -24, 0, 2, 2, 14, -12, -13, 1, 6, 7, 0, 7, -6, 9, 26, 11, -14, 8, 10, 1, 9, 0, 11, -2, 6, 2, -10 }, - { -13, 1, 4, 34, 19, -17, -15, 0, 3, -2, -7, -1, 0, -3, -3, -1, + { -13, 1, 4, 34, 19, -17, -15, 0, 3, -2, -7, -1, 0, -3, -3, -1, 1, -1, -10, 8, 5, 0, -8, 4, -17, 9, -2, 0, 0, 6, 2, -3 }, - { -6, -4, 1, 2, 2, -14, -29, 0, 9, 34, -3, -5, -14, 6, -10, -9, + { -6, -4, 1, 2, 2, -14, -29, 0, 9, 34, -3, -5, -14, 6, -10, -9, -5, -1, 0, 3, 3, 0, 1, -1, -2, -1, -1, -3, -3, -4, 3, -3 }, - { -4, 6, 3, 14, 14, -8, -29, 31, 11, 14, -4, -5, -6, 10, 6, -9, + { -4, 6, 3, 14, 14, -8, -29, 31, 11, 14, -4, -5, -6, 10, 6, -9, -1, -11, -7, 1, 7, 4, 1, -6, 4, 0, 10, -7, -5, -1, 2, 4 }, - { -4, -4, -2, 14, 6, -32, -6, -14, 14, -5, -11, 10, -18, -4, 6, -8, + { -4, -4, -2, 14, 6, -32, -6, -14, 14, -5, -11, 10, -18, -4, 6, -8, 9, 5, -4, 1, -4, 5, -2, -9, 3, 5, 2, -10, -6, -17, 3, 17 }, - { -16, 9, 21, 19, 4, -20, -17, 14, 9, 15, -6, -17, -1, 1, 6, -3, + { -16, 9, 21, 19, 4, -20, -17, 14, 9, 15, -6, -17, -1, 1, 6, -3, 1, 1, 8, -3, -6, 6, 9, 4, 9, -9, -5, 1, -1, 0, -1, 2 }, - { -7, -5, 3, 19, 1, -20, -9, 14, 21, -7, -18, -9, 26, -7, -17, -7, + { -7, -5, 3, 19, 1, -20, -9, 14, 21, -7, -18, -9, 26, -7, -17, -7, 12, 6, 0, -9, -6, 14, 9, -9, -8, 4, 15, -7, -9, -1, 9, 1 }, - { -20, 30, -6, 11, 24, -4, 0, -6, -2, 8, -4, 12, -8, -17, 0, 5, + { -20, 30, -6, 11, 24, -4, 0, -6, -2, 8, -4, 12, -8, -17, 0, 5, -4, 1, -1, 3, -3, 5, 3, 3, 7, -2, -3, -2, 4, 0, 0, -1 }, - { -35, 17, 6, 1, -9, -1, -16, 3, -20, -13, 8, 7, -4, -7, -4, -20, + { -35, 17, 6, 1, -9, -1, -16, 3, -20, -13, 8, 7, -4, -7, -4, -20, 7, 12, -5, 5, -5, -11, 12, -1, 15, -9, -6, 16, -4, -9, -13, 4 }, - { -21, 36, -19, 9, 0, -7, -8, 9, -4, -3, 3, 0, 7, -8, -2, -2, + { -21, 36, -19, 9, 0, -7, -8, 9, -4, -3, 3, 0, 7, -8, -2, -2, -11, 13, -1, 5, -3, 7, 2, 3, -1, -2, -5, 1, -1, -2, -5, -3 }, - { -12, 33, -4, 1, -12, -9, 0, -13, -1, 2, -8, 4, -10, 6, -16, -7, + { -12, 33, -4, 1, -12, -9, 0, -13, -1, 2, -8, 4, -10, 6, -16, -7, -1, -4, -10, 15, -1, 0, -5, -8, 5, 5, -3, 0, 2, -7, 1, -7 }, - { -14, 32, 5, -7, -15, 3, -5, 8, 14, 5, 9, 13, 3, 18, -3, 7, + { -14, 32, 5, -7, -15, 3, -5, 8, 14, 5, 9, 13, 3, 18, -3, 7, 4, -10, -10, 10, -1, 2, 0, -2, -11, 5, -3, -4, 2, 2, 7, 4 }, - { -14, 34, 1, 20, -1, -12, 0, -3, -7, -4, 7, 18, 9, -3, 14, -7, + { -14, 34, 1, 20, -1, -12, 0, -3, -7, -4, 7, 18, 9, -3, 14, -7, -9, -20, -7, -4, -13, 12, 1, 12, 5, -6, 2, -4, 0, -15, 1, 3 }, - { -21, 23, 7, -8, 3, -13, -3, 0, -6, -2, -7, 6, -12, 9, -6, -2, + { -21, 23, 7, -8, 3, -13, -3, 0, -6, -2, -7, 6, -12, 9, -6, -2, -2, -4, -1, 6, 9, 5, -9, 15, 0, 8, -8, 7, 6, -15, 3, -5 }, - { -27, 32, -1, -4, -2, 4, -10, 12, -3, 8, 13, 7, 0, -15, 4, -2, + { -27, 32, -1, -4, -2, 4, -10, 12, -3, 8, 13, 7, 0, -15, 4, -2, 3, 5, 7, -4, 9, -12, -1, -2, -1, -4, 0, -4, 2, -5, 6, -6 }, - { -17, 29, 15, 0, -1, -4, -10, 13, 12, -1, -8, -10, -10, 4, 7, -2, + { -17, 29, 15, 0, -1, -4, -10, 13, 12, -1, -8, -10, -10, 4, 7, -2, 6, -5, -13, 19, 6, 1, -7, 2, -9, -2, 12, -4, -8, -3, 2, 4 }, - { -38, 27, 16, -15, -6, 3, -7, -4, 0, -1, 6, -2, -3, -6, 6, -6, + { -38, 27, 16, -15, -6, 3, -7, -4, 0, -1, 6, -2, -3, -6, 6, -6, -3, 0, 2, 0, -4, 6, 1, -1, 0, 4, -1, 3, 4, 1, -2, 5 }, - { -33, 40, -4, 2, 1, 0, 0, -10, -14, 0, -7, 4, -1, 3, -2, 5, + { -33, 40, -4, 2, 1, 0, 0, -10, -14, 0, -7, 4, -1, 3, -2, 5, 7, 6, -1, 4, 1, 3, 1, -7, 1, -4, 5, 7, 0, 4, 3, -4 }, - { -20, 25, 12, -4, 16, -4, 2, 2, -14, -2, -3, 29, -1, 1, 3, 1, + { -20, 25, 12, -4, 16, -4, 2, 2, -14, -2, -3, 29, -1, 1, 3, 1, 9, -5, 2, -8, -3, 1, -7, -2, -7, 1, 0, 4, 16, -2, -1, -1 }, - { -10, 30, 17, 3, -5, -2, 0, -5, -22, 4, 5, 5, -3, -18, -6, 10, + { -10, 30, 17, 3, -5, -2, 0, -5, -22, 4, 5, 5, -3, -18, -6, 10, -5, -7, 2, 8, 7, -7, -11, -2, 0, -3, 3, 2, 11, -4, 4, -4 }, - { -11, 30, 11, 4, -3, -8, 1, -2, 4, 18, 3, 1, -1, 0, -8, -4, + { -11, 30, 11, 4, -3, -8, 1, -2, 4, 18, 3, 1, -1, 0, -8, -4, -3, 10, 13, 14, 5, -5, 1, 1, -10, 2, 15, 4, 9, -1, -5, -3 }, - { -17, 32, 18, -18, -3, -5, 6, 10, 1, -15, -5, 9, 8, -12, -10, -6, + { -17, 32, 18, -18, -3, -5, 6, 10, 1, -15, -5, 9, 8, -12, -10, -6, 11, 9, -5, -8, -7, 10, 5, -10, -14, -4, -3, 1, 9, -11, 2, 1 }, - { -13, 28, -11, -1, 2, -16, -2, 7, -24, 0, 3, 6, 3, -1, -8, -7, + { -13, 28, -11, -1, 2, -16, -2, 7, -24, 0, 3, 6, 3, -1, -8, -7, -12, 2, 2, -20, 10, 4, 0, -13, -2, -2, 1, 8, -14, 0, 4, 1 }, - { -14, 23, 12, 8, 8, -26, 2, -4, -14, 13, -14, 15, 3, -9, -1, -13, + { -14, 23, 12, 8, 8, -26, 2, -4, -14, 13, -14, 15, 3, -9, -1, -13, -10, -2, -10, 6, -16, 12, 8, 0, 9, -10, -7, -4, -4, 7, -8, 8 }, - { -20, 45, 10, -14, 4, 16, 8, -9, 1, -8, 10, 5, -7, -2, 2, -5, + { -20, 45, 10, -14, 4, 16, 8, -9, 1, -8, 10, 5, -7, -2, 2, -5, -1, 0, -5, 4, -6, -2, 4, 1, 3, 4, -4, 2, -2, -2, 5, 1 }, - { -20, 26, -4, 1, 7, 4, -8, 1, -5, -13, 2, 13, -7, -3, 6, -6, + { -20, 26, -4, 1, 7, 4, -8, 1, -5, -13, 2, 13, -7, -3, 6, -6, 22, 0, 5, 11, -4, -11, 8, -9, 2, -2, -4, -2, 2, -13, -4, -8 }, - { -28, 18, 17, 3, -8, -23, -16, -6, 5, -10, 14, 10, 5, -1, -8, 4, + { -28, 18, 17, 3, -8, -23, -16, -6, 5, -10, 14, 10, 5, -1, -8, 4, -2, 13, -3, -2, 3, 4, 3, -2, -3, -4, 0, 1, 3, 4, 0, 4 }, - { -12, 32, -6, -16, 18, 12, -16, 0, 7, 13, -4, 5, -8, -1, -3, 4, + { -12, 32, -6, -16, 18, 12, -16, 0, 7, 13, -4, 5, -8, -1, -3, 4, 6, -2, -1, -13, 4, -1, 3, 12, -3, -10, 1, 6, 8, -11, -2, 4 }, - { -18, 26, 2, 5, 0, -9, -17, 14, 5, 1, 7, -3, -8, -3, 11, 7, + { -18, 26, 2, 5, 0, -9, -17, 14, 5, 1, 7, -3, -8, -3, 11, 7, -5, -12, -8, 7, 0, -7, 2, -12, -9, 13, -11, 9, 6, -11, -5, 11 }, - { -24, 22, -15, -9, 8, 1, -7, -12, -9, 3, 11, 15, 14, -11, 12, -15, + { -24, 22, -15, -9, 8, 1, -7, -12, -9, 3, 11, 15, 14, -11, 12, -15, -5, 7, -2, 0, -8, 3, 3, -1, 2, 11, -11, 14, -6, 13, 1, -6 }, - { -20, 28, 18, -4, -6, -5, 12, 14, 2, 10, -13, -6, -8, -6, -13, -1, + { -20, 28, 18, -4, -6, -5, 12, 14, 2, 10, -13, -6, -8, -6, -13, -1, -26, 22, -3, -14, 6, 0, 10, -15, -13, -9, 6, -7, 1, -5, -4, -1 }, - { -19, 26, -8, -3, -14, -6, -9, -4, -8, 15, -8, 3, -12, -4, -2, -7, + { -19, 26, -8, -3, -14, -6, -9, -4, -8, 15, -8, 3, -12, -4, -2, -7, -5, 3, 13, -3, -4, -25, 4, -1, 5, -12, -1, -13, 5, 2, 0, 6 }, - { -18, 43, 14, -8, 1, -23, -2, -2, 1, 3, -7, 0, 0, 8, -1, -3, + { -18, 43, 14, -8, 1, -23, -2, -2, 1, 3, -7, 0, 0, 8, -1, -3, -5, 1, 5, 2, 0, -2, -2, -2, 1, -1, -1, -7, 0, 3, -3, 9 }, - { -11, 30, 10, -14, 3, 1, 10, -11, 1, -7, -4, 14, 2, 1, -9, 1, + { -11, 30, 10, -14, 3, 1, 10, -11, 1, -7, -4, 14, 2, 1, -9, 1, -11, -2, -7, 5, -11, 1, 3, 14, 1, -16, -8, 3, -5, 7, -4, 4 }, - { -18, 24, 6, 3, 8, 7, -22, -7, -7, 3, -8, 4, 23, 9, 3, -1, + { -18, 24, 6, 3, 8, 7, -22, -7, -7, 3, -8, 4, 23, 9, 3, -1, 3, 6, 7, -1, -7, 6, 4, 1, -3, 1, -6, -1, 2, -7, 3, 3 }, - { -15, 38, -7, -1, -11, 2, -17, -24, 24, 8, 7, -4, -5, 2, 2, -7, + { -15, 38, -7, -1, -11, 2, -17, -24, 24, 8, 7, -4, -5, 2, 2, -7, 1, 4, 0, -9, 5, 0, -1, 1, -1, -5, -6, 3, 0, 7, 8, -3 }, - { -14, 22, 1, -5, 9, -12, -9, -5, -6, 5, 7, 8, -1, -4, -9, -3, + { -14, 22, 1, -5, 9, -12, -9, -5, -6, 5, 7, 8, -1, -4, -9, -3, -33, -16, -9, -1, 12, -11, 17, -7, -3, -1, -7, 3, 2, -3, 16, -4 }, - { -14, 20, 6, 4, -10, -4, -4, -4, 1, -7, 2, 6, 8, -12, 4, 1, + { -14, 20, 6, 4, -10, -4, -4, -4, 1, -7, 2, 6, 8, -12, 4, 1, -1, 12, 10, 3, -14, -10, -3, 18, -2, 33, -5, -17, 17, -5, 9, 7 }, - { -12, 23, 13, 0, -11, -8, -11, 12, -5, -9, -16, 11, 6, 4, 12, -5, + { -12, 23, 13, 0, -11, -8, -11, 12, -5, -9, -16, 11, 6, 4, 12, -5, 5, -13, 7, -12, -3, 1, 2, 12, 1, -4, -1, 5, 4, 11, -12, -3 }, - { 15, 2, 14, 7, 1, 2, 1, 12, 10, 23, 4, 6, -20, -10, 4, 26, + { 15, 2, 14, 7, 1, 2, 1, 12, 10, 23, 4, 6, -20, -10, 4, 26, -6, 13, 4, 3, 2, -11, 5, -7, -10, 4, 9, 1, 10, -4, 11, 4 }, - { 17, 15, 31, 17, 18, 16, 11, 24, 2, 4, 2, 3, -8, -3, 7, -3, + { 17, 15, 31, 17, 18, 16, 11, 24, 2, 4, 2, 3, -8, -3, 7, -3, -5, -7, -2, -6, -4, -5, -4, -1, -4, -2, -5, -6, 2, -1, 4, -2 }, - { 16, 8, 15, 14, 3, 7, 21, 9, 8, 15, 21, 6, 8, 12, 5, -5, + { 16, 8, 15, 14, 3, 7, 21, 9, 8, 15, 21, 6, 8, 12, 5, -5, 7, -3, 10, 2, -3, 8, 6, 0, 5, 5, 6, -3, 2, 4, 0, -5 }, - { 5, -4, 6, 12, 6, 13, 24, 17, -5, 17, -1, -6, -7, -10, -8, -18, + { 5, -4, 6, 12, 6, 13, 24, 17, -5, 17, -1, -6, -7, -10, -8, -18, 3, -2, 2, 7, -15, -11, 12, -3, -2, -2, -4, -7, 2, 0, 5, 5 }, - { 10, -6, 8, 11, 12, 20, 22, -11, -3, 15, -3, 15, -2, -2, 0, 2, + { 10, -6, 8, 11, 12, 20, 22, -11, -3, 15, -3, 15, -2, -2, 0, 2, 5, -8, 4, -5, -9, -4, -1, 2, -1, -3, 1, 3, 13, -1, 9, 7 }, - { -5, 8, 5, 11, 14, -5, 14, -9, 2, 35, 8, 15, 1, -2, 2, -2, + { -5, 8, 5, 11, 14, -5, 14, -9, 2, 35, 8, 15, 1, -2, 2, -2, 4, -9, -3, -14, -12, -2, -2, -4, -2, -8, -3, 1, -6, 3, 10, 0 }, - { 16, 0, -6, 15, -3, 4, 4, 3, 3, 20, 5, -4, 10, 9, -9, -3, + { 16, 0, -6, 15, -3, 4, 4, 3, 3, 20, 5, -4, 10, 9, -9, -3, -10, -2, -7, 11, -11, -10, 17, -1, 3, -15, 2, 9, -15, -10, 16, 10 }, - { 14, 4, -7, 19, 3, 0, 19, 8, 16, 34, -9, 6, -13, -1, 6, 5, + { 14, 4, -7, 19, 3, 0, 19, 8, 16, 34, -9, 6, -13, -1, 6, 5, -1, -2, 4, 3, 2, 1, 1, -1, 0, -7, 2, -1, 1, 0, 6, -1 }, - { 1, 6, 9, 13, 9, 10, 15, 16, 10, 18, 13, 17, 3, -1, -7, 2, + { 1, 6, 9, 13, 9, 10, 15, 16, 10, 18, 13, 17, 3, -1, -7, 2, -15, -11, -10, -4, -13, -6, -17, -13, -6, -14, 1, -10, 6, 4, -1, -1 }, - { 13, 1, 7, 10, 14, 13, -7, 5, 5, 28, 14, 14, -2, 2, 3, -3, + { 13, 1, 7, 10, 14, 13, -7, 5, 5, 28, 14, 14, -2, 2, 3, -3, -13, -4, 10, -9, 19, -4, -3, 4, -5, -5, 0, 5, -5, 0, 3, -4 }, - { 1, 0, 6, 22, 9, 18, 18, -3, 5, 10, 12, -2, 1, -3, -8, -12, + { 1, 0, 6, 22, 9, 18, 18, -3, 5, 10, 12, -2, 1, -3, -8, -12, 9, -10, -7, 1, -1, 19, 0, 2, -8, -11, -10, 9, 6, 11, 0, 3 }, - { 10, 11, 19, 44, 0, 14, 1, -7, 6, 22, 2, -1, 9, 2, 0, -4, + { 10, 11, 19, 44, 0, 14, 1, -7, 6, 22, 2, -1, 9, 2, 0, -4, 4, 0, -6, -6, 3, 0, 0, -2, 2, -5, 1, -2, 0, 1, 1, 1 }, - { 5, 7, 0, 32, 30, 26, 5, 4, -7, -3, 15, -6, 3, -10, 7, 6, + { 5, 7, 0, 32, 30, 26, 5, 4, -7, -3, 15, -6, 3, -10, 7, 6, -8, -7, 2, -13, -5, -1, -3, 7, 3, -2, -8, 0, 6, 4, 5, 0 }, - { 9, 8, -2, 4, 2, 11, 4, 29, -5, 14, 8, -5, -14, 8, 0, 9, + { 9, 8, -2, 4, 2, 11, 4, 29, -5, 14, 8, -5, -14, 8, 0, 9, 8, -10, 5, -15, -6, -9, 9, -1, 18, -16, 9, -21, -3, -13, -2, 8 }, - { 25, 7, -9, 23, 20, 18, 6, 16, -9, 8, 8, -5, 11, 13, -8, 7, + { 25, 7, -9, 23, 20, 18, 6, 16, -9, 8, 8, -5, 11, 13, -8, 7, 4, 10, -2, -1, -7, -9, -7, -9, -4, 1, 1, -5, -10, 8, 4, -5 }, - { 9, 2, 16, 14, -5, 14, 1, 0, -21, 17, -1, 9, 12, -3, -3, 4, + { 9, 2, 16, 14, -5, 14, 1, 0, -21, 17, -1, 9, 12, -3, -3, 4, -4, 14, 10, 3, 0, -10, 7, 4, 4, -11, 2, 4, -1, -3, 9, -1 }, - { 17, 8, 11, 26, 15, -3, 14, -1, 12, 9, 10, -8, 8, -18, -11, -3, + { 17, 8, 11, 26, 15, -3, 14, -1, 12, 9, 10, -8, 8, -18, -11, -3, -14, -7, 7, -3, -3, -4, 1, -7, -3, 2, -3, 16, 10, 0, 9, 6 }, - { 9, 8, 3, 8, 18, 14, 11, 1, 10, 6, 1, -4, -16, -2, 14, -2, + { 9, 8, 3, 8, 18, 14, 11, 1, 10, 6, 1, -4, -16, -2, 14, -2, 1, 8, 12, 14, 3, -3, 8, 8, 12, -15, 3, -3, 3, -2, 14, 10 }, - { 22, -3, -11, 13, -7, 11, 4, 11, 3, 14, 0, -6, -2, -9, 4, 2, + { 22, -3, -11, 13, -7, 11, 4, 11, 3, 14, 0, -6, -2, -9, 4, 2, -2, 0, -5, -27, -10, 3, -1, 5, 8, -24, -3, -11, -3, 2, 11, -1 }, - { 19, 2, 8, 36, 5, -6, 3, 15, -3, -4, -5, 14, -10, 1, -12, -10, + { 19, 2, 8, 36, 5, -6, 3, 15, -3, -4, -5, 14, -10, 1, -12, -10, -3, -4, 3, -2, 1, -8, 4, 3, 5, -3, 0, 4, 8, -2, 8, 4 }, - { 8, 14, 15, 9, -4, 10, 5, 11, 9, 10, 8, 9, -15, 15, 6, -8, + { 8, 14, 15, 9, -4, 10, 5, 11, 9, 10, 8, 9, -15, 15, 6, -8, -10, -13, 5, -8, -20, -13, -6, -11, -1, -3, -6, -4, -1, 0, 13, 15 }, - { -2, -1, 9, 12, 2, 2, 13, 3, -23, 33, 15, 2, -4, -1, 3, 8, + { -2, -1, 9, 12, 2, 2, 13, 3, -23, 33, 15, 2, -4, -1, 3, 8, 8, 6, 6, -7, 8, 6, 9, -1, 3, -8, 0, -4, 1, -8, 11, -1 }, - { 6, 5, -6, 16, 2, -3, 31, 21, -9, 12, 0, -1, -4, 1, -12, 3, + { 6, 5, -6, 16, 2, -3, 31, 21, -9, 12, 0, -1, -4, 1, -12, 3, -13, -18, 2, -11, -9, 2, -8, -6, 11, -3, -1, 0, -1, 0, 13, 5 }, - { 5, -1, 2, 0, 25, 5, 10, 16, -5, 21, 14, 12, 13, 2, -5, 5, + { 5, -1, 2, 0, 25, 5, 10, 16, -5, 21, 14, 12, 13, 2, -5, 5, 5, -3, -2, -14, 0, -12, 7, 11, -1, -7, 19, -1, -1, -1, 8, -1 }, - { 10, 7, 3, 11, 0, 8, 22, 3, 3, 19, -4, 12, 15, 9, 5, 15, + { 10, 7, 3, 11, 0, 8, 22, 3, 3, 19, -4, 12, 15, 9, 5, 15, 2, 1, 2, -10, -10, 0, 2, -1, 0, 1, -12, -1, 21, 16, 9, -7 }, - { 11, -4, -5, 24, -7, 11, 20, 11, -15, 18, 5, -13, -15, 0, -5, 9, + { 11, -4, -5, 24, -7, 11, 20, 11, -15, 18, 5, -13, -15, 0, -5, 9, 1, 0, -1, -9, 4, -8, 6, -8, 1, -2, -7, 20, 9, 3, 9, 3 }, - { 20, 0, -12, -6, 9, 31, 9, 12, 8, 27, 15, 7, -16, 5, -3, -7, + { 20, 0, -12, -6, 9, 31, 9, 12, 8, 27, 15, 7, -16, 5, -3, -7, -1, -9, -2, -7, -3, 4, -8, -3, 3, -6, -2, -2, -3, -6, -1, 2 }, - { 6, -6, 48, 8, -3, 19, 12, 11, -7, 2, 3, 0, -1, 1, 8, -4, + { 6, -6, 48, 8, -3, 19, 12, 11, -7, 2, 3, 0, -1, 1, 8, -4, 4, -6, 0, -4, -4, -3, 3, 6, 3, -13, -8, 5, -3, -7, 8, 5 }, - { 7, -2, 6, 11, 12, 2, 14, 4, -5, 12, 2, 9, 4, 2, 0, -1, + { 7, -2, 6, 11, 12, 2, 14, 4, -5, 12, 2, 9, 4, 2, 0, -1, 2, 0, -15, -9, -16, -2, 8, -17, -5, -22, -19, -5, -1, -10, 1, -2 }, - { 11, -9, 3, 12, 6, 6, 1, 17, -6, 19, 14, 7, -7, -1, -1, -9, + { 11, -9, 3, 12, 6, 6, 1, 17, -6, 19, 14, 7, -7, -1, -1, -9, 9, -11, -17, 0, -6, 16, 0, 1, 9, -24, 3, 3, -9, -3, 3, -2 }, - { 9, 0, 1, 8, 1, 7, 2, -5, -3, 8, -1, 7, 2, 6, -3, -6, + { 9, 0, 1, 8, 1, 7, 2, -5, -3, 8, -1, 7, 2, 6, -3, -6, 5, -2, 6, -2, -4, -3, 0, -3, 13, -50, 1, -2, 2, 4, 4, 3 }, - { 7, 0, 26, 21, -4, 2, 17, 8, 7, 11, -7, 1, -1, -15, -1, -15, + { 7, 0, 26, 21, -4, 2, 17, 8, 7, 11, -7, 1, -1, -15, -1, -15, -11, -4, -17, -4, 1, -7, 3, 6, 3, -9, 2, 3, 6, 10, 6, 12 }, - { 1, -2, 2, -1, -10, -4, 6, -3, -5, -2, -8, 2, 2, 2, 8, 0, + { 1, -2, 2, -1, -10, -4, 6, -3, -5, -2, -8, 2, 2, 2, 8, 0, 1, 1, 6, 0, 11, 13, 3, 4, 0, -12, 11, -5, 19, 20, 2, 5 }, - { 5, 3, -13, -2, 1, -12, 11, -7, -12, 7, 10, 0, 7, 0, -2, 4, + { 5, 3, -13, -2, 1, -12, 11, -7, -12, 7, 10, 0, 7, 0, -2, 4, -6, -9, -11, -12, -23, 12, 10, -3, 0, 6, 19, -1, 24, 18, 9, 12 }, - { 6, -3, 2, 5, 2, 2, -2, -5, -8, -11, -4, 3, -8, -4, 5, -3, + { 6, -3, 2, 5, 2, 2, -2, -5, -8, -11, -4, 3, -8, -4, 5, -3, -16, -4, 3, -12, -4, 3, 32, 7, 2, 8, 32, -18, -1, 12, 1, 7 }, - { 0, -8, -1, 0, -8, 7, -8, -1, -1, 4, -12, -1, 3, 0, 1, -18, + { 0, -8, -1, 0, -8, 7, -8, -1, -1, 4, -12, -1, 3, 0, 1, -18, 8, 8, -14, -10, -11, 19, 9, 5, -7, 6, 8, -4, 26, 12, -1, 6 }, - { 3, 5, -14, 7, 14, 8, 20, -13, -16, -10, -2, 17, -7, 4, -8, -9, + { 3, 5, -14, 7, 14, 8, 20, -13, -16, -10, -2, 17, -7, 4, -8, -9, 14, -5, 3, -4, -12, 7, 14, -10, -19, -20, 35, 8, 13, 14, -2, 9 }, - { -2, -4, -1, 1, -3, 0, -1, 1, 2, 2, 6, 0, 0, 4, 5, -2, + { -2, -4, -1, 1, -3, 0, -1, 1, 2, 2, 6, 0, 0, 4, 5, -2, 3, 3, 3, -2, -7, -3, -3, -1, 6, -2, 29, 22, 13, 34, 0, 14 }, - { -3, -9, 3, 1, 5, -4, 2, 0, 7, -9, 0, 2, -5, -3, 0, 6, + { -3, -9, 3, 1, 5, -4, 2, 0, 7, -9, 0, 2, -5, -3, 0, 6, -1, -1, -1, 2, 2, 4, 8, 7, 20, -6, 7, 16, 33, 20, 6, -1 }, - { -11, 1, -3, -3, -11, 3, -9, -25, -1, -16, 4, -8, 15, 1, -2, 7, + { -11, 1, -3, -3, -11, 3, -9, -25, -1, -16, 4, -8, 15, 1, -2, 7, 8, 23, 2, 18, -13, 16, 3, -7, 6, 3, 16, -8, 12, 16, 3, 4 }, - { 0, 5, 5, -5, 1, -1, 2, -3, -2, 1, -13, 2, 2, 10, 6, 7, + { 0, 5, 5, -5, 1, -1, 2, -3, -2, 1, -13, 2, 2, 10, 6, 7, 18, 18, 7, 9, 8, 9, 21, 14, 7, 12, 15, 14, 15, 12, 11, 5 }, - { 1, -5, 11, -2, 17, 8, 3, 0, -1, 6, 11, -7, 6, 6, 7, 5, + { 1, -5, 11, -2, 17, 8, 3, 0, -1, 6, 11, -7, 6, 6, 7, 5, -15, 14, 1, 11, 4, 10, 12, 1, 2, 4, 30, 1, 11, 1, 6, 13 }, - { 2, 4, 3, -7, 5, 8, -11, 7, -5, 9, -10, 6, 8, -10, -3, 10, + { 2, 4, 3, -7, 5, 8, -11, 7, -5, 9, -10, 6, 8, -10, -3, 10, 1, -29, -4, -26, 5, -8, 13, 4, 3, 6, 35, 1, 3, 6, 3, 0 }, - { -2, 1, 0, 0, -1, -3, -7, -3, -9, -3, -1, -6, 3, 4, 4, 0, + { -2, 1, 0, 0, -1, -3, -7, -3, -9, -3, -1, -6, 3, 4, 4, 0, 5, -1, -2, -2, -1, -4, -10, 8, 0, -6, 10, -4, 46, 12, 2, 28 }, - { 4, -1, 4, 1, 0, 4, -2, -2, -2, -1, 2, -4, 1, 5, 0, -3, + { 4, -1, 4, 1, 0, 4, -2, -2, -2, -1, 2, -4, 1, 5, 0, -3, 1, 1, -2, 0, 1, -2, -1, -1, 3, -6, 35, -11, 13, 53, -3, -1 }, - { -5, -2, 0, -13, -16, 5, -12, -11, 1, -30, 3, -18, -24, -8, -5, -19, + { -5, -2, 0, -13, -16, 5, -12, -11, 1, -30, 3, -18, -24, -8, -5, -19, 1, -3, -8, 7, -7, -8, 15, -19, 4, 10, 30, 24, 6, 1, -9, 10 }, - { -4, 8, -7, -4, -6, 12, -1, -9, -4, 2, -9, 3, 2, -2, 4, 2, + { -4, 8, -7, -4, -6, 12, -1, -9, -4, 2, -9, 3, 2, -2, 4, 2, 22, 9, 4, -5, 0, 5, -2, -9, -3, 1, 18, -12, 18, 16, 4, 16 }, - { -5, -8, -3, -5, -3, 6, -7, -3, -2, -5, -3, 1, 2, 2, 4, -6, + { -5, -8, -3, -5, -3, 6, -7, -3, -2, -5, -3, 1, 2, 2, 4, -6, 10, 3, 12, -3, 20, 0, 27, -4, 16, 5, 18, -3, 23, 4, 12, 11 }, - { 0, 1, 0, 1, -2, 1, 2, 1, -1, 0, -2, 2, -2, -4, 1, -2, + { 0, 1, 0, 1, -2, 1, 2, 1, -1, 0, -2, 2, -2, -4, 1, -2, -2, -1, -5, -2, 0, 0, -2, 2, 9, 7, 63, 5, 12, -1, 1, 0 }, - { 4, -3, -7, -5, -11, -5, -12, -10, -10, -12, -15, -12, -14, -14, 1, 1, + { 4, -3, -7, -5, -11, -5, -12, -10, -10, -12, -15, -12, -14, -14, 1, 1, 10, -10, 16, 6, 2, 9, 11, 9, 9, 8, 12, -1, 13, 12, 6, 3 }, - { 7, -3, -2, 4, 6, -8, 2, -3, -12, -5, -9, -8, -10, 15, -2, -4, + { 7, -3, -2, 4, 6, -8, 2, -3, -12, -5, -9, -8, -10, 15, -2, -4, 8, 9, 7, -13, -18, 34, -5, 7, 12, 22, 16, -11, 13, 25, -15, -11 }, - { -3, -2, 0, -4, 1, 0, -3, -13, -7, 13, 12, -7, -10, 13, 19, 6, + { -3, -2, 0, -4, 1, 0, -3, -13, -7, 13, 12, -7, -10, 13, 19, 6, 16, 15, -12, -15, -3, 34, 1, 5, 1, -9, 11, 21, 8, 17, -5, -6 }, - { 3, -5, 0, -4, 0, 4, -11, 4, -7, -3, -1, -8, 3, -2, 2, 1, + { 3, -5, 0, -4, 0, 4, -11, 4, -7, -3, -1, -8, 3, -2, 2, 1, 11, 5, 6, 14, -3, 2, -4, -7, 0, 31, 15, -2, 24, 11, 5, 4 }, - { -1, -4, -9, 5, -8, -18, -4, -9, -20, -18, 7, -14, -16, 3, 8, -3, + { -1, -4, -9, 5, -8, -18, -4, -9, -20, -18, 7, -14, -16, 3, 8, -3, 29, 11, -13, -13, 7, 1, 17, 6, 6, 21, 11, 1, 14, -8, 2, 5 }, - { -3, 8, -10, -6, 12, 2, 1, 3, 3, 3, 3, -6, -8, -14, 15, -5, + { -3, 8, -10, -6, 12, 2, 1, 3, 3, 3, 3, -6, -8, -14, 15, -5, 16, 4, 16, 0, 7, -1, 0, 16, 2, 1, 22, 4, 19, 13, -11, 1 }, - { 2, -3, 10, 20, -4, -1, -8, 5, -8, -9, -6, -2, -4, -7, 8, -10, + { 2, -3, 10, 20, -4, -1, -8, 5, -8, -9, -6, -2, -4, -7, 8, -10, 0, 8, -6, 1, -8, 14, 13, 5, 17, -6, 26, -1, 7, -1, 0, 12 }, - { -4, -7, -31, -2, -7, -1, 5, -5, -5, -12, 4, -7, -6, 3, 15, -2, + { -4, -7, -31, -2, -7, -1, 5, -5, -5, -12, 4, -7, -6, 3, 15, -2, 5, -2, 7, -1, 10, 7, 8, -1, 14, 20, 14, 9, 16, 16, 8, 24 }, - { -7, 0, -3, -6, 1, 3, -13, -6, -4, -4, -5, -9, -1, -10, -4, -8, + { -7, 0, -3, -6, 1, 3, -13, -6, -4, -4, -5, -9, -1, -10, -4, -8, 2, 0, -1, 1, 24, 24, 21, 31, 5, 2, 11, 12, 7, 4, 3, 6 }, - { -3, -5, 6, -4, -3, -1, 2, -1, -2, 1, 0, -8, -1, 2, 0, -4, + { -3, -5, 6, -4, -3, -1, 2, -1, -2, 1, 0, -8, -1, 2, 0, -4, 6, 22, -1, -5, 8, 12, -1, -2, 28, 27, 20, -27, 14, 1, 2, -3 }, - { 1, -5, -2, -2, 6, -2, 9, 1, -2, -5, 3, 4, 11, 5, 2, 8, + { 1, -5, -2, -2, 6, -2, 9, 1, -2, -5, 3, 4, 11, 5, 2, 8, -3, -1, 1, -2, -3, -5, 5, 8, 49, 12, 8, -3, 9, 20, 12, 17 }, - { -6, 0, 1, 7, 0, 9, -2, -4, 8, 0, -2, -10, 0, 7, 21, -1, + { -6, 0, 1, 7, 0, 9, -2, -4, 8, 0, -2, -10, 0, 7, 21, -1, 0, 1, 17, -7, -5, 2, 4, 16, -2, 17, 14, -20, 15, 14, 4, 15 }, - { 0, 3, -4, 9, -4, 0, 6, 4, -6, -6, -5, -7, 2, -9, -10, -2, + { 0, 3, -4, 9, -4, 0, 6, 4, -6, -6, -5, -7, 2, -9, -10, -2, -5, 0, -3, -21, 9, 14, -11, 13, 29, 2, 25, 4, 22, -1, 2, -3 }, - { 2, 12, -11, 2, 16, 9, -4, 7, 1, -10, -15, 11, -4, 3, -2, 4, + { 2, 12, -11, 2, 16, 9, -4, 7, 1, -10, -15, 11, -4, 3, -2, 4, 4, -5, -10, 1, 4, 19, -15, 6, -4, -2, 30, -7, 11, 21, -12, 5 }, - { -2, -3, -2, 4, -1, -5, -3, -7, -5, 1, 0, -6, 1, -6, 7, 0, + { -2, -3, -2, 4, -1, -5, -3, -7, -5, 1, 0, -6, 1, -6, 7, 0, 8, -7, -3, -2, 2, 14, 2, -3, -26, -1, 26, 22, 32, 1, -2, 6 }, - { 1, -38, -1, -20, -2, -3, -6, -4, 2, 2, 7, 0, 3, 5, 3, 10, + { 1, -38, -1, -20, -2, -3, -6, -4, 2, 2, 7, 0, 3, 5, 3, 10, 6, 1, -3, -5, 7, 5, -5, -4, 8, 3, 1, -14, -1, -9, -5, -4 }, - { -5, -26, -7, -19, -10, -5, -11, 5, -11, -25, -8, -14, -9, -16, -8, -6, + { -5, -26, -7, -19, -10, -5, -11, 5, -11, -25, -8, -14, -9, -16, -8, -6, -17, -14, -1, -1, 6, 2, 2, 2, 3, 0, 2, 8, -8, 3, 0, -3 }, - { 17, -49, -3, -23, -1, 11, 7, 3, 4, -4, 0, 0, -1, 4, 2, 4, + { 17, -49, -3, -23, -1, 11, 7, 3, 4, -4, 0, 0, -1, 4, 2, 4, -2, -4, 2, -2, -1, -2, 2, 0, 0, -1, 0, 0, 1, 2, 0, 0 }, - { 4, -34, -6, -9, 1, 21, -7, 3, -2, -1, -3, 18, 2, -16, 7, -3, + { 4, -34, -6, -9, 1, 21, -7, 3, -2, -1, -3, 18, 2, -16, 7, -3, 8, 7, -5, 7, 2, 4, 8, -6, -7, -2, -5, -1, 4, 1, 2, -4 }, - { 5, -29, 13, -2, -14, 3, 1, 18, -15, 4, -8, 8, -10, 8, 2, 1, + { 5, -29, 13, -2, -14, 3, 1, 18, -15, 4, -8, 8, -10, 8, 2, 1, -8, 15, 3, -10, -4, -4, -2, 0, -3, -4, 2, -3, -4, -3, 12, -6 }, - { 13, -20, 3, -18, -17, 4, -14, 13, 28, 11, -8, -6, 16, 6, 0, 10, + { 13, -20, 3, -18, -17, 4, -14, 13, 28, 11, -8, -6, 16, 6, 0, 10, 3, 4, -9, 13, 5, -7, 12, -5, 0, -7, 5, 1, 3, 3, 2, 1 }, - { 3, -27, -5, -11, -21, -11, -12, 0, -5, 7, -22, 1, 3, 5, 0, -5, + { 3, -27, -5, -11, -21, -11, -12, 0, -5, 7, -22, 1, 3, 5, 0, -5, 8, 7, 1, -5, -7, 2, -5, 4, 1, 3, -8, -2, 0, 4, -2, 6 }, - { 31, -45, 0, -1, -12, 1, 2, -6, 4, 3, -1, 3, 3, 0, 5, 3, + { 31, -45, 0, -1, -12, 1, 2, -6, 4, 3, -1, 3, 3, 0, 5, 3, -5, 12, 4, 6, 2, 1, -2, 1, 3, 2, 5, 2, 2, 2, 3, -1 }, - { 9, -45, 6, 5, -1, -17, -2, 18, -3, 2, 0, 1, 0, -1, 10, 8, + { 9, -45, 6, 5, -1, -17, -2, 18, -3, 2, 0, 1, 0, -1, 10, 8, -7, -2, -5, -8, 6, -1, 0, 4, 6, -3, 12, -1, -2, 0, 5, -7 }, - { 3, -26, -2, -12, -12, 2, -10, 16, -3, 12, 4, 5, 11, 8, -16, -17, + { 3, -26, -2, -12, -12, 2, -10, 16, -3, 12, 4, 5, 11, 8, -16, -17, -2, -3, -3, 2, 5, -9, 13, 1, 10, 11, 3, 5, -2, 2, 2, -7 }, - { 8, -26, 32, -7, -5, 22, 2, 14, -10, -8, -7, 3, 3, 7, 0, -5, + { 8, -26, 32, -7, -5, 22, 2, 14, -10, -8, -7, 3, 3, 7, 0, -5, 0, -1, -3, 0, 8, 4, -5, -7, 6, -1, 4, 8, 1, 1, 7, -6 }, - { 4, -31, 2, -14, 2, 0, 1, 8, -6, -1, 17, -3, 13, -6, 5, -10, + { 4, -31, 2, -14, 2, 0, 1, 8, -6, -1, 17, -3, 13, -6, 5, -10, -2, -10, -2, -10, -3, 7, 1, 5, -8, 8, -14, -3, -15, 7, -10, -6 }, - { 16, -27, 13, -4, -23, 7, -9, 6, -7, 5, 4, 2, -1, -3, 23, -18, + { 16, -27, 13, -4, -23, 7, -9, 6, -7, 5, 4, 2, -1, -3, 23, -18, 7, 0, -3, 4, -3, 9, -6, -2, -1, 8, -6, 2, 6, -3, 2, -2 }, - { -1, -35, -2, -8, 11, -1, -7, -3, -2, 11, 7, 6, -6, -10, 9, 6, + { -1, -35, -2, -8, 11, -1, -7, -3, -2, 11, 7, 6, -6, -10, 9, 6, -3, -5, -6, -3, 9, 16, -16, -9, -20, 12, 3, 5, -3, 1, -9, 4 }, - { 2, -24, 1, -12, -16, 5, -4, 3, -4, -1, -11, -11, -8, -14, 14, 10, + { 2, -24, 1, -12, -16, 5, -4, 3, -4, -1, -11, -11, -8, -14, 14, 10, -8, 20, 8, -3, -11, 1, 1, -4, -4, -7, -3, 15, 2, -6, -2, 7 }, - { 9, -21, 2, -19, -7, -5, -8, 25, 3, 17, 5, -3, 9, -12, 8, 2, + { 9, -21, 2, -19, -7, -5, -8, 25, 3, 17, 5, -3, 9, -12, 8, 2, -4, 3, 3, 1, 11, -9, -4, -3, 4, 3, -22, 6, 4, 6, 11, -5 }, - { 16, -23, 13, -17, -21, -12, 5, 9, -20, 7, 6, -6, 0, 2, -9, 6, + { 16, -23, 13, -17, -21, -12, 5, 9, -20, 7, 6, -6, 0, 2, -9, 6, -6, -13, -7, -1, 5, -3, 5, -7, -10, 1, 0, 8, -9, 11, 0, -8 }, - { 10, -26, -9, -7, -19, -4, 6, 16, -7, 5, -4, 4, 8, 0, 4, -1, + { 10, -26, -9, -7, -19, -4, 6, 16, -7, 5, -4, 4, 8, 0, 4, -1, 6, -7, 1, -8, -11, 10, -14, 0, -16, 6, -3, 5, -1, 14, 12, 1 }, - { 8, -27, 12, -14, -1, -1, -19, 10, -11, 21, -14, 9, -8, -3, 8, -1, + { 8, -27, 12, -14, -1, -1, -19, 10, -11, 21, -14, 9, -8, -3, 8, -1, 12, -13, 3, -4, -2, 0, -9, 0, -7, 2, -3, 12, 1, -3, 3, 1 }, - { 18, -20, -14, -14, -16, -3, -24, 6, -17, 2, -3, -11, 2, -3, 12, 10, + { 18, -20, -14, -14, -16, -3, -24, 6, -17, 2, -3, -11, 2, -3, 12, 10, 10, 1, 10, 7, 8, 5, 5, 4, -1, 7, 2, 2, 0, 4, 7, 0 }, - { 0, -30, 9, -16, -18, 15, 12, -3, 4, -4, -5, -11, -4, -12, -10, 0, + { 0, -30, 9, -16, -18, 15, 12, -3, 4, -4, -5, -11, -4, -12, -10, 0, 2, -2, -4, -1, 2, 0, -1, -6, 2, -3, 4, -5, 7, 3, 5, 7 }, - { 25, -24, -1, -6, -9, 6, -13, -2, 3, 15, -3, 11, 4, -8, -11, 2, + { 25, -24, -1, -6, -9, 6, -13, -2, 3, 15, -3, 11, 4, -8, -11, 2, 0, -9, -2, 7, 4, 8, 5, -8, 5, 6, -1, -11, -15, -5, 0, 11 }, - { 0, -34, -7, -11, -7, 9, -3, 19, 4, -8, 3, -11, 11, -3, -9, 12, + { 0, -34, -7, -11, -7, 9, -3, 19, 4, -8, 3, -11, 11, -3, -9, 12, 9, 9, 2, 1, -7, 1, -3, 0, -6, -2, -1, 3, 0, -7, -2, -5 }, - { 6, -34, -4, -5, -3, -9, 2, 9, -1, 9, -5, -3, -26, -12, 8, -6, + { 6, -34, -4, -5, -3, -9, 2, 9, -1, 9, -5, -3, -26, -12, 8, -6, -7, 11, -8, 4, 4, 1, -1, 0, 8, 9, -4, 7, -1, 1, -3, -1 }, - { 3, -30, 5, 6, -10, 3, -7, 6, 3, 3, -26, -19, -3, 1, 7, 5, + { 3, -30, 5, 6, -10, 3, -7, 6, 3, 3, -26, -19, -3, 1, 7, 5, -4, -5, 6, 10, 13, -10, 4, -7, -4, 5, -3, 9, -6, 3, 9, 5 }, - { 4, -24, 9, -19, 2, -4, -5, 8, -3, 2, 0, -15, -1, 9, -4, 22, + { 4, -24, 9, -19, 2, -4, -5, 8, -3, 2, 0, -15, -1, 9, -4, 22, 6, 9, 3, 7, 11, -9, 0, -3, 4, 5, -5, 10, -8, 5, -7, -3 }, - { 8, -27, 7, -3, -1, 2, -9, 13, 7, 12, -4, -6, -6, 5, 0, 7, + { 8, -27, 7, -3, -1, 2, -9, 13, 7, 12, -4, -6, -6, 5, 0, 7, 5, 1, 15, -3, -4, 0, -5, -2, 7, -5, -7, 1, -2, 13, -8, 13 }, - { 17, -22, -15, -11, -8, 16, -14, 18, 2, -1, 14, -7, 14, -6, -6, -7, + { 17, -22, -15, -11, -8, 16, -14, 18, 2, -1, 14, -7, 14, -6, -6, -7, -8, 17, 6, 4, 4, -7, -5, -9, -14, -6, -1, 9, -3, 1, 6, -5 }, - { 25, -30, 2, -12, -13, 18, -18, 16, 8, -3, 10, -8, -3, -1, -6, 3, + { 25, -30, 2, -12, -13, 18, -18, 16, 8, -3, 10, -8, -3, -1, -6, 3, -5, -7, 4, 6, 7, 1, 1, -11, -5, 6, 2, -4, 9, -1, -5, -2 }, - { 7, -23, 7, -15, -1, -3, -1, 0, -10, 12, 2, 5, -4, 0, 4, 6, + { 7, -23, 7, -15, -1, -3, -1, 0, -10, 12, 2, 5, -4, 0, 4, 6, -1, 5, -9, -1, -1, -7, 1, 17, 9, -17, -16, 8, 4, -14, 11, 14 }, - { 0, -31, 7, -13, 3, -11, -7, 6, 1, -11, 8, -7, 15, -3, 16, -11, + { 0, -31, 7, -13, 3, -11, -7, 6, 1, -11, 8, -7, 15, -3, 16, -11, -1, -15, 16, -3, 5, 0, -2, -2, -6, 11, 5, 6, 5, -5, 6, 3 }, - { 13, -24, -2, -20, -10, 7, -3, -1, 15, 2, 6, -5, -7, -10, -20, 1, + { 13, -24, -2, -20, -10, 7, -3, -1, 15, 2, 6, -5, -7, -10, -20, 1, -4, 14, 8, -2, 3, -13, -3, 1, -4, 1, -3, 2, 8, -7, 16, -4 }, - { 1, -2, -2, -3, -4, -7, 0, 3, 6, 7, 3, 2, 1, -2, -1, 0, + { 1, -2, -2, -3, -4, -7, 0, 3, 6, 7, 3, 2, 1, -2, -1, 0, -6, 4, 2, -4, -3, -4, 5, 9, 5, 0, -3, -3, -4, -7, -31, -50 }, - { -1, -3, 7, 2, -1, 2, 4, 6, 0, 10, -2, 0, -20, -6, -3, 9, + { -1, -3, 7, 2, -1, 2, 4, 6, 0, 10, -2, 0, -20, -6, -3, 9, -20, -22, -1, -1, 15, 9, -12, 10, -13, -20, 12, 3, 5, 6, -7, -26 }, - { 0, 4, -2, -14, -12, 6, -13, 11, -10, 3, 22, 6, 16, -2, -5, 1, + { 0, 4, -2, -14, -12, 6, -13, 11, -10, 3, 22, 6, 16, -2, -5, 1, -3, -11, 0, -7, 5, -5, 0, 1, -1, -6, 8, 8, 10, 9, -5, -27 }, - { -5, 10, -2, 7, 9, -9, 5, -9, 5, 4, -15, 14, 1, 3, -10, 5, + { -5, 10, -2, 7, 9, -9, 5, -9, 5, 4, -15, 14, 1, 3, -10, 5, 0, -2, 7, 3, -13, 6, 9, -6, 5, -14, -17, -1, 11, 14, -2, -26 }, - { 0, 6, -3, 0, -8, 6, 0, 1, 4, -8, 2, -5, 4, 7, 15, 11, + { 0, 6, -3, 0, -8, 6, 0, 1, 4, -8, 2, -5, 4, 7, 15, 11, 9, 19, -2, 14, -8, 7, -1, 3, -3, -3, -10, -2, 12, -2, -12, -29 }, - { -12, -5, 0, -3, -2, 6, 3, -3, 2, -2, 1, 11, 2, -7, 5, 1, + { -12, -5, 0, -3, -2, 6, 3, -3, 2, -2, 1, 11, 2, -7, 5, 1, 2, -2, -14, 0, -1, -5, 3, 8, -28, -26, 6, -6, 3, 8, -10, -27 }, - { -1, -3, 6, 2, 4, 15, 1, 0, 2, -2, -2, 13, 3, 6, 0, 6, + { -1, -3, 6, 2, 4, 15, 1, 0, 2, -2, -2, 13, 3, 6, 0, 6, -1, -4, -1, -5, 8, -1, 5, -5, -15, 11, -8, -5, 14, -6, -14, -29 }, - { -5, -6, 0, 1, 0, 6, -3, 2, -5, -1, 5, -3, 2, -10, 3, 4, + { -5, -6, 0, 1, 0, 6, -3, 2, -5, -1, 5, -3, 2, -10, 3, 4, 3, 0, 13, -3, -1, 4, -4, -6, 2, 9, 8, 2, -3, 28, -11, -31 }, - { 1, -4, -10, -9, -4, -3, -15, -6, 1, 5, -3, -6, 5, -6, -22, 27, + { 1, -4, -10, -9, -4, -3, -15, -6, 1, 5, -3, -6, 5, -6, -22, 27, -13, 5, 3, -7, -4, 20, -7, -12, -1, -24, -4, -13, -8, -11, -15, -21 }, - { -6, -4, 19, -6, 2, 11, -6, 1, -3, -10, 9, -9, 12, -10, 2, 1, + { -6, -4, 19, -6, 2, 11, -6, 1, -3, -10, 9, -9, 12, -10, 2, 1, -9, 1, 15, 7, -5, 5, -29, -35, 4, -30, 9, 9, 19, 17, 2, -17 }, - { -3, 3, -3, 1, 2, 5, -1, 5, -2, -3, 1, -3, -8, 3, -4, -2, + { -3, 3, -3, 1, 2, 5, -1, 5, -2, -3, 1, -3, -8, 3, -4, -2, -4, -1, 12, 0, 2, -8, -6, -4, 16, -1, -14, -2, 25, -6, -15, -36 }, - { 0, -1, 3, -4, -4, -1, 7, -4, 8, 0, 10, 9, -4, 1, 10, -1, + { 0, -1, 3, -4, -4, -1, 7, -4, 8, 0, 10, 9, -4, 1, 10, -1, -3, -13, -5, -4, -1, -4, 8, 11, 14, -7, -5, 16, 12, 13, -1, -28 }, - { 1, -2, 2, -3, -8, 10, 4, 9, 12, 3, 5, 0, 8, -3, -6, 2, + { 1, -2, 2, -3, -8, 10, 4, 9, 12, 3, 5, 0, 8, -3, -6, 2, 16, -11, 11, 0, 1, 6, 1, 18, -10, -16, -1, -4, 5, -14, -15, -20 }, - { 1, -12, 5, 4, -7, 8, -1, -17, -2, -9, -14, -11, 6, -9, 5, -4, + { 1, -12, 5, 4, -7, 8, -1, -17, -2, -9, -14, -11, 6, -9, 5, -4, 3, -2, 7, 18, -5, 5, 6, -1, -11, -2, -10, -3, 8, -3, -2, -32 }, - { -12, 5, 20, -5, -6, -11, -6, -6, -13, 4, -6, 19, -8, 2, 3, -9, + { -12, 5, 20, -5, -6, -11, -6, -6, -13, 4, -6, 19, -8, 2, 3, -9, -4, -4, -1, 9, -1, 21, -1, 7, 15, -10, -1, -3, 9, -3, 2, -24 }, - { 0, -3, 2, -6, 4, -1, -9, -2, -1, -3, 6, -1, -5, -6, -5, -8, + { 0, -3, 2, -6, 4, -1, -9, -2, -1, -3, 6, -1, -5, -6, -5, -8, 0, -2, -6, 9, -4, 3, 2, -13, 1, -7, 23, -13, 4, -3, -15, -33 }, - { -7, 2, -15, 11, -10, 14, 0, -11, 3, -1, 12, -4, -4, 9, 11, -13, + { -7, 2, -15, 11, -10, 14, 0, -11, 3, -1, 12, -4, -4, 9, 11, -13, -13, -3, -14, 1, 3, 6, -5, 8, 0, 5, 5, -10, 4, 5, -6, -30 }, - { -6, 4, 0, -5, 4, 1, -1, -1, 3, 6, 5, -2, -5, 0, -2, 5, + { -6, 4, 0, -5, 4, 1, -1, -1, 3, 6, 5, -2, -5, 0, -2, 5, -4, -2, -4, -2, 4, 7, -7, -1, 1, -4, -3, -19, 37, 12, 10, -40 }, - { -7, 2, -7, -12, 17, 11, -7, 2, 2, 3, 1, -1, 3, 4, -2, -5, + { -7, 2, -7, -12, 17, 11, -7, 2, 2, 3, 1, -1, 3, 4, -2, -5, 9, -9, 6, 4, 9, 12, 11, -5, 2, -1, 0, 9, 5, -7, -2, -24 }, - { -7, 6, 1, 3, 1, 0, 6, 0, 4, -12, -2, -2, 1, -9, 10, -2, + { -7, 6, 1, 3, 1, 0, 6, 0, 4, -12, -2, -2, 1, -9, 10, -2, 11, -1, 21, -12, 15, -5, 10, -5, 5, -5, 14, -6, 5, -7, -3, -29 }, - { -2, 0, -5, -2, -3, 1, -3, 0, 4, 2, 3, 0, 2, -2, 7, -2, + { -2, 0, -5, -2, -3, 1, -3, 0, 4, 2, 3, 0, 2, -2, 7, -2, 3, -5, 2, -1, 6, -4, 0, -3, 8, -11, 19, -8, 22, -34, 13, -35 }, - { -1, -3, -1, 9, 11, -3, -3, -1, 7, 18, 11, -5, 2, -12, -11, 18, + { -1, -3, -1, 9, 11, -3, -3, -1, 7, 18, 11, -5, 2, -12, -11, 18, 9, -5, 1, -6, -9, 12, 1, -3, -3, -9, -14, 9, 9, 8, -6, -26 }, - { 0, 5, -5, -1, -1, -2, 4, 6, 8, 2, -1, -2, 5, 1, -5, -4, + { 0, 5, -5, -1, -1, -2, 4, 6, 8, 2, -1, -2, 5, 1, -5, -4, 1, 1, 18, 1, 7, -10, 3, -2, 12, -1, -15, 9, 12, -14, 13, -38 }, - { 3, 0, -8, -1, 0, 8, -9, -3, -8, 16, 3, 16, -5, -9, 0, -1, + { 3, 0, -8, -1, 0, 8, -9, -3, -8, 16, 3, 16, -5, -9, 0, -1, -7, -1, -4, 13, 7, 0, 1, 2, -1, -16, 0, -2, 1, 8, -8, -28 }, - { 7, 9, -5, -3, -2, 2, 0, 3, 11, -6, -4, -2, -2, -5, 28, -18, + { 7, 9, -5, -3, -2, 2, 0, 3, 11, -6, -4, -2, -2, -5, 28, -18, -6, 2, 15, -10, -15, -10, -2, 0, -2, -2, 4, -3, 7, 11, 5, -30 }, - { 9, 0, -7, -1, -4, -7, 2, 2, 9, -2, 2, 3, -8, -6, -6, 3, + { 9, 0, -7, -1, -4, -7, 2, 2, 9, -2, 2, 3, -8, -6, -6, 3, -10, 4, 10, 5, 21, -4, 14, -18, 1, 3, -10, -2, 6, 14, -8, -26 }, - { -14, -1, 2, 3, -3, 7, 1, -22, -1, -1, 0, 1, 12, -14, 3, -5, + { -14, -1, 2, 3, -3, 7, 1, -22, -1, -1, 0, 1, 12, -14, 3, -5, 0, 10, -3, 1, -5, 12, -3, 10, -8, -22, -11, -13, -7, -10, -13, -25 }, - { -2, -5, -4, -4, -9, -18, 9, -3, -5, 17, 13, 5, 6, 11, 3, 8, + { -2, -5, -4, -4, -9, -18, 9, -3, -5, 17, 13, 5, 6, 11, 3, 8, 20, 4, 2, 9, 8, 5, 6, 1, 7, -7, -6, -2, -7, 0, -17, -23 }, - { -5, -5, 2, 0, 6, 2, -2, 2, -3, 4, 4, 0, -5, -2, -4, 6, + { -5, -5, 2, 0, 6, 2, -2, 2, -3, 4, 4, 0, -5, -2, -4, 6, 8, 10, -1, 1, -5, 5, -14, -2, -11, 8, 6, 25, 7, -1, 0, -43 }, - { -4, 0, 4, -2, 7, 0, 3, 17, 5, 2, -5, 1, 21, 3, -2, -10, + { -4, 0, 4, -2, 7, 0, 3, 17, 5, 2, -5, 1, 21, 3, -2, -10, -16, -9, 7, -12, 9, -8, 2, 5, -5, -10, -2, -11, -5, -1, -9, -30 }, - { -2, 3, 1, -4, -1, 0, 8, 1, 12, 4, -1, -1, 3, -17, 13, 9, + { -2, 3, 1, -4, -1, 0, 8, 1, 12, 4, -1, -1, 3, -17, 13, 9, 0, 7, -6, -5, 9, 1, 5, 4, -10, -18, 0, 14, 11, -4, -16, -28 }, - { -1, 0, 2, -1, 4, 1, -1, 1, -1, -2, -1, -2, 3, 0, 0, -1, + { -1, 0, 2, -1, 4, 1, -1, 1, -1, -2, -1, -2, 3, 0, 0, -1, -1, 1, 2, -2, 3, 3, -2, 4, -2, -1, -6, 1, -1, -1, 6, -70 }, - { 7, 3, -11, -1, 12, -4, -14, 4, 4, -4, 4, -2, 2, -12, -4, 15, + { 7, 3, -11, -1, 12, -4, -14, 4, 4, -4, 4, -2, 2, -12, -4, 15, -17, -4, -3, 6, 8, -5, 22, -22, 5, -11, 15, -4, 4, -1, -21, -1 }, - { 10, -2, -13, 11, 4, 14, 4, 9, 8, 8, 19, 15, 14, 15, 5, 10, + { 10, -2, -13, 11, 4, 14, 4, 9, 8, 8, 19, 15, 14, 15, 5, 10, 8, 15, -5, 4, 14, -8, 1, 1, 2, 1, -1, -3, 21, 8, -29, 13 }, - { -6, 0, -6, 6, -1, 2, 8, -4, -5, 4, -4, -5, 0, -2, -4, 0, + { -6, 0, -6, 6, -1, 2, 8, -4, -5, 4, -4, -5, 0, -2, -4, 0, 9, -2, 1, -2, 26, -19, 21, -10, 4, 1, -8, 5, 22, -10, -13, 15 }, - { 11, -5, 1, 0, 6, 3, 7, -2, -2, -3, -5, -1, -2, -6, 1, 1, + { 11, -5, 1, 0, 6, 3, 7, -2, -2, -3, -5, -1, -2, -6, 1, 1, -8, -5, -13, 13, -2, -3, -1, -9, -28, 4, 2, -11, 18, -20, -24, 9 }, - { 7, 4, -3, 6, 6, -6, -7, -5, -7, -4, -4, 0, -7, -5, -6, -5, + { 7, 4, -3, 6, 6, -6, -7, -5, -7, -4, -4, 0, -7, -5, -6, -5, 2, -13, -12, 2, 0, 5, 18, 15, -13, -7, 13, -20, 16, -10, -19, 6 }, - { 5, -8, -1, 5, 10, 2, -1, -10, -11, 23, 8, -5, -8, 4, -5, -4, + { 5, -8, -1, 5, 10, 2, -1, -10, -11, 23, 8, -5, -8, 4, -5, -4, -5, -5, -11, -8, 5, 1, 7, -9, -9, -6, 12, 14, 17, -12, -22, 3 }, - { -5, -8, -3, 3, 12, -1, 0, -4, -5, 1, 1, 6, 1, 5, -5, 7, + { -5, -8, -3, 3, 12, -1, 0, -4, -5, 1, 1, 6, 1, 5, -5, 7, -2, 7, 1, 6, 6, 2, 0, -5, 17, -4, -5, -24, 13, -20, -27, 14 }, - { -1, 2, -3, 1, -3, 1, -3, 0, -2, 3, -2, 1, 2, -1, -2, -1, + { -1, 2, -3, 1, -3, 1, -3, 0, -2, 3, -2, 1, 2, -1, -2, -1, -2, -5, 5, -2, 0, -7, 1, -6, 8, 8, 11, -5, 24, -43, -13, 2 }, - { -2, 4, 7, -3, -4, 4, 13, -4, 0, 0, -2, 9, 0, -3, -6, 1, + { -2, 4, 7, -3, -4, 4, 13, -4, 0, 0, -2, 9, 0, -3, -6, 1, -7, 1, -1, 10, 0, 5, -1, -24, 25, -15, 7, 2, 22, -10, -21, 0 }, - { -5, 2, 6, -2, 13, 3, 5, -12, -11, 16, 6, 10, -5, 0, -3, 6, + { -5, 2, 6, -2, 13, 3, 5, -12, -11, 16, 6, 10, -5, 0, -3, 6, 5, -5, -5, 10, 12, 10, 11, -7, 8, -14, 2, -15, 13, -14, -8, -3 }, - { 5, 6, -7, -5, 5, 2, 9, 5, 0, -1, -4, 2, 8, 0, 3, 5, + { 5, 6, -7, -5, 5, 2, 9, 5, 0, -1, -4, 2, 8, 0, 3, 5, -12, 3, -3, -6, 2, -1, -5, 14, 11, -20, -21, -25, 24, -1, -10, 6 }, - { -5, 5, -2, 9, 4, -4, -1, -6, 11, -6, 5, 0, 2, -3, 6, -1, + { -5, 5, -2, 9, 4, -4, -1, -6, 11, -6, 5, 0, 2, -3, 6, -1, -17, -18, -4, -13, 9, -1, 9, -7, -4, -8, 2, -3, 12, -31, -18, 5 }, - { -7, -11, 6, -8, 4, -3, -12, 0, -1, -6, -3, 0, 5, 9, 7, 2, + { -7, -11, 6, -8, 4, -3, -12, 0, -1, -6, -3, 0, 5, 9, 7, 2, 1, -8, -6, 8, 2, -5, 7, -1, 16, -10, 16, -12, 18, -1, -25, -12 }, - { 3, -12, 1, 2, -2, -18, -8, -15, -10, -9, 2, -7, 11, -11, 2, -1, + { 3, -12, 1, 2, -2, -18, -8, -15, -10, -9, 2, -7, 11, -11, 2, -1, -1, -1, -9, -6, 3, -14, -2, -1, 2, -13, -7, -9, 19, -5, -17, 2 }, - { 7, 1, -8, 7, 17, -13, -10, 5, 7, 1, -6, 4, 9, -4, 0, 3, + { 7, 1, -8, 7, 17, -13, -10, 5, 7, 1, -6, 4, 9, -4, 0, 3, 8, 1, -14, -9, 4, 7, -9, 0, 6, -5, -12, -2, 25, -2, -19, 1 }, - { 7, -3, 6, -3, 1, 6, -7, 0, 10, 0, 4, -5, -17, -4, 4, -1, + { 7, -3, 6, -3, 1, 6, -7, 0, 10, 0, 4, -5, -17, -4, 4, -1, 0, -3, -7, 19, 24, -1, 21, 8, 10, 9, 8, -1, 23, -2, -18, -2 }, - { 3, -3, 0, 5, 8, -2, -9, 2, 9, 6, 19, 8, 2, 6, -9, -2, + { 3, -3, 0, 5, 8, -2, -9, 2, 9, 6, 19, 8, 2, 6, -9, -2, -4, -3, -8, 7, -7, -8, 5, 4, 26, -6, 7, 18, 24, 0, -13, 4 }, - { 0, -13, -11, -1, 3, -9, 5, 4, -7, 3, 0, 2, -1, 4, -5, 2, + { 0, -13, -11, -1, 3, -9, 5, 4, -7, 3, 0, 2, -1, 4, -5, 2, 9, -2, -11, 15, 1, -21, 1, -1, 0, 4, -14, -4, 24, -16, -13, 1 }, - { 1, -9, -8, 0, 0, -4, 11, -1, 14, 16, 0, 17, -2, -9, -12, 0, + { 1, -9, -8, 0, 0, -4, 11, -1, 14, 16, 0, 17, -2, -9, -12, 0, -1, -14, -9, -14, 0, -2, 19, 4, 6, 4, 4, -11, 8, -17, -19, -5 }, - { -3, 1, 2, 12, -4, -18, -1, -4, -7, 14, -3, 2, 0, -7, -8, 12, + { -3, 1, 2, 12, -4, -18, -1, -4, -7, 14, -3, 2, 0, -7, -8, 12, -5, -9, 14, 12, -9, -2, 4, -6, 4, 18, -1, -25, 22, 2, -23, -5 }, - { -2, 0, 0, 0, 1, 3, 5, -1, 5, -2, -2, 2, -3, 0, 1, 2, + { -2, 0, 0, 0, 1, 3, 5, -1, 5, -2, -2, 2, -3, 0, 1, 2, 0, -1, 2, -1, -9, -6, -7, -4, -2, 4, -7, -5, 64, -3, -25, 4 }, - { 12, -2, -3, 0, 8, -9, 13, -7, 6, -3, -12, 12, 15, -9, -4, 2, + { 12, -2, -3, 0, 8, -9, 13, -7, 6, -3, -12, 12, 15, -9, -4, 2, 9, -4, -12, 3, 14, 1, 7, -15, 15, 0, -6, -12, 0, -3, -20, 6 }, - { 2, -1, -4, 5, 9, 6, -7, 2, -2, -7, -2, 0, -1, -18, -4, -6, + { 2, -1, -4, 5, 9, 6, -7, 2, -2, -7, -2, 0, -1, -18, -4, -6, -15, -5, 11, 5, -10, -1, 2, 7, 12, -19, -7, 8, 21, -4, -15, 4 }, - { 4, 2, 5, 5, -5, 1, 3, 2, -8, 13, 0, -5, -2, -14, -11, 6, + { 4, 2, 5, 5, -5, 1, 3, 2, -8, 13, 0, -5, -2, -14, -11, 6, 2, 17, 8, -13, 26, -2, 5, -15, -4, -14, 12, -9, 13, -21, -23, -4 }, - { 2, -3, -2, -3, 3, -2, 6, 9, -9, 13, 4, 2, 12, -3, -3, 1, + { 2, -3, -2, -3, 3, -2, 6, 9, -9, 13, 4, 2, 12, -3, -3, 1, -17, -22, -3, 4, 3, -2, 1, -9, 1, -6, 11, -13, 14, 0, -15, 6 }, - { -16, -4, 17, -2, -20, -11, 11, 10, 5, -8, 16, 2, -17, -14, 11, 11, + { -16, -4, 17, -2, -20, -11, 11, 10, 5, -8, 16, 2, -17, -14, 11, 11, -6, -11, -7, 12, 12, -10, -6, 5, 8, -4, -2, -5, 28, 3, -13, 4 }, - { 0, -3, 3, -7, 6, 8, -12, 20, -19, 18, -11, 10, -5, 0, -9, 11, + { 0, -3, 3, -7, 6, 8, -12, 20, -19, 18, -11, 10, -5, 0, -9, 11, 3, 0, -2, 9, -7, -5, 18, 3, -2, -16, 1, 6, 12, -7, -16, 1 }, - { 4, 1, 5, -5, 15, 2, -8, 3, 5, -11, 15, -3, 8, -8, -1, 7, + { 4, 1, 5, -5, 15, 2, -8, 3, 5, -11, 15, -3, 8, -8, -1, 7, 4, 7, -2, 6, -9, 5, 12, 2, 33, -2, -6, -18, 4, 0, -18, 11 }, - { 3, -1, 1, -1, 0, 1, 4, -1, -5, 0, 1, 0, 4, 2, -1, 4, + { 3, -1, 1, -1, 0, 1, 4, -1, -5, 0, 1, 0, 4, 2, -1, 4, -3, 2, 0, -2, 4, 6, -1, 6, 42, 19, -4, -37, 19, 1, -15, -4 }, - { 2, 0, -5, 0, 10, 0, 0, -5, 3, 0, 0, -3, -3, 0, 2, -4, + { 2, 0, -5, 0, 10, 0, 0, -5, 3, 0, 0, -3, -3, 0, 2, -4, -10, 2, -6, 4, 4, 1, 27, -7, 17, -34, 5, -9, 15, -16, -7, -5 }, - { -2, 7, 7, -2, 9, -2, -15, 11, 11, 7, 5, 1, 15, 1, -9, 31, + { -2, 7, 7, -2, 9, -2, -15, 11, 11, 7, 5, 1, 15, 1, -9, 31, 2, -15, 2, 4, 3, 4, -1, -8, 2, -7, 6, -17, 11, -14, -11, 2 }, - { 1, 1, -11, 9, 9, -6, -14, -11, -10, 8, -3, 11, 16, -9, -8, -13, + { 1, 1, -11, 9, 9, -6, -14, -11, -10, 8, -3, 11, 16, -9, -8, -13, -8, 9, 0, 6, 6, -2, 13, -8, -2, 3, 13, -3, 10, -6, -17, 4 }, - { 14, 5, 4, -6, -12, 10, -7, 8, 21, -8, -30, 15, -2, 1, 11, -9, + { 14, 5, 4, -6, -12, 10, -7, 8, 21, -8, -30, 15, -2, 1, 11, -9, -5, 1, 0, -1, -1, -6, -2, 3, -5, 7, 9, 5, -5, 2, 0, 1 }, - { -1, 2, 20, -17, -15, 3, 3, 7, 11, -17, -13, -6, -3, 18, 17, -15, + { -1, 2, 20, -17, -15, 3, 3, 7, 11, -17, -13, -6, -3, 18, 17, -15, -4, -4, -5, 22, 14, -14, -2, -10, -7, 11, 8, -7, -3, 0, -7, 11 }, - { 7, -11, -7, -8, -14, 22, 5, 2, 6, 13, -12, -2, 10, 3, 0, -21, + { 7, -11, -7, -8, -14, 22, 5, 2, 6, 13, -12, -2, 10, 3, 0, -21, -4, 20, 3, 10, 21, -10, -12, 8, 11, 2, -5, 2, 1, 3, -1, 15 }, - { -1, -2, -1, -2, -13, 8, -4, 0, 7, -2, -17, 8, 18, 5, 3, 8, + { -1, -2, -1, -2, -13, 8, -4, 0, 7, -2, -17, 8, 18, 5, 3, 8, -8, -2, 3, -4, 14, -18, -13, 14, 15, -13, -1, -2, 4, 11, 1, 12 }, - { 13, -6, -4, -16, -17, 16, 21, -2, 5, -11, -9, 19, 21, -17, -3, -17, + { 13, -6, -4, -16, -17, 16, 21, -2, 5, -11, -9, 19, 21, -17, -3, -17, 3, 12, 8, -12, -6, 1, -7, 9, 9, -7, -5, -1, -3, 5, -6, -4 }, - { 11, 5, 12, -20, -6, 10, 4, 12, 8, -5, -10, 15, 13, 14, 10, -15, + { 11, 5, 12, -20, -6, 10, 4, 12, 8, -5, -10, 15, 13, 14, 10, -15, -13, 1, 6, 14, 15, -17, -13, 4, -5, 10, 7, -6, -8, -3, -4, 12 }, - { 25, -1, 7, -5, -7, 11, 1, 17, 13, -15, -14, -4, 5, 3, 8, -3, + { 25, -1, 7, -5, -7, 11, 1, 17, 13, -15, -14, -4, 5, 3, 8, -3, -2, 2, 0, 6, 16, -12, -6, -4, 4, -3, 7, -10, -3, -7, -13, 7 }, - { -8, 10, -3, -13, 5, 2, 4, 9, 9, -17, -13, 2, 11, 1, 6, -4, + { -8, 10, -3, -13, 5, 2, 4, 9, 9, -17, -13, 2, 11, 1, 6, -4, 8, -10, 4, 1, 19, -15, -4, 12, 31, 7, -5, -17, -4, 9, -2, 7 }, - { 14, -6, -6, -6, -14, 13, 17, -5, 4, -14, -9, 7, 7, -9, 3, -16, + { 14, -6, -6, -6, -14, 13, 17, -5, 4, -14, -9, 7, 7, -9, 3, -16, -15, 11, 11, 6, 4, -11, -19, 3, 5, 8, 13, -14, -14, 3, -4, 12 }, - { -2, -4, 10, -4, -7, -1, 27, 5, 2, -16, -18, 4, 12, -2, -3, -2, + { -2, -4, 10, -4, -7, -1, 27, 5, 2, -16, -18, 4, 12, -2, -3, -2, -1, 1, -8, -12, 3, -4, 8, 15, 2, 4, 9, -13, -14, 9, -7, 5 }, - { 4, 2, -10, -5, -7, 2, 1, 4, -1, -6, -15, 6, 1, 10, 5, -10, + { 4, 2, -10, -5, -7, 2, 1, 4, -1, -6, -15, 6, 1, 10, 5, -10, -9, -1, 13, -3, 5, -21, -11, 8, 8, 5, 27, -21, -18, -5, -1, 15 }, - { 11, 1, -16, -8, -11, 0, 5, -8, -12, -13, -17, 22, 4, -6, -1, -18, + { 11, 1, -16, -8, -11, 0, 5, -8, -12, -13, -17, 22, 4, -6, -1, -18, -10, 0, 19, 2, -2, -8, -7, -3, 2, -2, -9, -17, -5, 4, 4, 10 }, - { 8, -6, -19, -5, -4, 12, 14, 15, 10, -9, -1, -9, 19, 12, 0, -1, + { 8, -6, -19, -5, -4, 12, 14, 15, 10, -9, -1, -9, 19, 12, 0, -1, 2, 4, 7, 9, 16, -16, -14, 9, -4, 3, 1, 0, -2, 10, -1, -1 }, - { 12, -8, 12, -9, 0, 25, 7, 9, 2, -31, -9, -4, 15, 4, -5, 1, + { 12, -8, 12, -9, 0, 25, 7, 9, 2, -31, -9, -4, 15, 4, -5, 1, -10, 11, 8, 10, 0, -6, 5, 11, -1, -6, 4, -10, -9, 6, 4, 5 }, - { 14, 6, -17, -2, 17, 12, -9, 2, 0, -25, -14, 5, 20, 14, 8, -20, + { 14, 6, -17, -2, 17, 12, -9, 2, 0, -25, -14, 5, 20, 14, 8, -20, 5, 2, -2, -3, 9, -13, -3, -1, -6, 3, 7, -6, 0, 2, 3, 1 }, - { 8, 4, -15, -3, 10, 18, -4, 13, 8, -22, -10, 9, 19, -15, 7, -5, + { 8, 4, -15, -3, 10, 18, -4, 13, 8, -22, -10, 9, 19, -15, 7, -5, -13, 12, -4, 9, 2, -9, -6, 0, 2, 1, -9, -6, 6, 1, -1, 11 }, - { 4, 1, 4, -5, -10, 18, 7, 2, -4, -9, -11, 0, 32, -7, 4, -16, + { 4, 1, 4, -5, -10, 18, 7, 2, -4, -9, -11, 0, 32, -7, 4, -16, -1, 0, 6, 3, 6, -3, -14, 16, 9, -2, 7, -1, 0, -5, 5, -3 }, - { -3, 2, 3, -8, -6, 4, 6, 2, 4, -12, -15, 2, 8, 8, 9, -3, + { -3, 2, 3, -8, -6, 4, 6, 2, 4, -12, -15, 2, 8, 8, 9, -3, -18, 6, 34, 11, 12, -15, -1, 2, 9, 2, -4, -4, 2, 4, 2, -3 }, - { 18, -6, -12, -8, -1, 15, 20, -4, -1, -11, -5, 6, 6, -11, -15, -7, + { 18, -6, -12, -8, -1, 15, 20, -4, -1, -11, -5, 6, 6, -11, -15, -7, 3, 7, 10, 2, 8, -10, -5, 8, 15, -5, 5, -17, -13, 13, 11, 7 }, - { 8, -4, -6, -1, -14, -3, 6, -2, 1, -5, -1, 10, 10, -15, 5, 0, + { 8, -4, -6, -1, -14, -3, 6, -2, 1, -5, -1, 10, 10, -15, 5, 0, -10, -4, -3, 7, -4, -19, -15, 27, 11, 18, 3, -19, -2, 6, 0, 12 }, - { 12, 0, -5, 0, 4, -5, 1, 5, 10, -7, -11, 21, 29, 1, -2, 1, + { 12, 0, -5, 0, 4, -5, 1, 5, 10, -7, -11, 21, 29, 1, -2, 1, -4, -11, -1, 13, 11, -20, -1, 4, 4, 4, -5, 6, -13, -2, 11, 9 }, - { 2, -7, -7, -3, -10, -1, 20, 12, 1, -19, -19, -1, 5, 4, -7, -25, + { 2, -7, -7, -3, -10, -1, 20, 12, 1, -19, -19, -1, 5, 4, -7, -25, 14, 1, -3, 2, 12, -4, -3, -3, -2, 6, 1, 0, 3, 2, 5, -1 }, - { 12, -8, 3, -12, -10, 10, 13, 0, 23, -14, -18, 10, 0, 15, 3, -12, + { 12, -8, 3, -12, -10, 10, 13, 0, 23, -14, -18, 10, 0, 15, 3, -12, -3, -5, 5, -4, 2, -14, -10, 8, 2, 9, -1, -11, -3, 5, 13, 2 }, - { 9, -6, 7, -7, -30, 17, 6, 13, 1, -14, 0, -1, 6, -9, 8, 3, + { 9, -6, 7, -7, -30, 17, 6, 13, 1, -14, 0, -1, 6, -9, 8, 3, -4, 0, -1, -7, -5, -13, -19, -3, -4, 4, -6, -2, -13, 1, -2, 3 }, - { 10, 1, 3, -18, -26, 17, 4, -16, 4, -3, -13, -4, -6, -11, -4, -21, + { 10, 1, 3, -18, -26, 17, 4, -16, 4, -3, -13, -4, -6, -11, -4, -21, 7, 8, 2, 5, 13, -6, 1, 5, 8, 7, 9, -6, -6, 1, -1, 2 }, - { -3, -1, 0, -2, -2, 0, -1, 3, 4, -14, -8, -9, 13, 2, 50, -23, + { -3, -1, 0, -2, -2, 0, -1, 3, 4, -14, -8, -9, 13, 2, 50, -23, -8, 8, 7, 11, 16, 3, -7, 0, -2, 6, 5, -1, 1, -2, 4, 3 }, - { 1, 3, 1, 1, -6, 3, 6, 6, 2, -2, -3, 10, 2, -8, -5, -5, + { 1, 3, 1, 1, -6, 3, 6, 6, 2, -2, -3, 10, 2, -8, -5, -5, 5, 4, 4, -2, 10, -8, -40, -1, 21, 8, 3, -4, -1, 13, 4, 7 }, - { 2, 0, -4, -8, 5, 2, 7, -5, 5, -8, -4, -1, 12, 2, 12, -13, + { 2, 0, -4, -8, 5, 2, 7, -5, 5, -8, -4, -1, 12, 2, 12, -13, -9, 0, 1, -12, 9, -43, 1, -5, 12, 1, 3, 6, 1, -1, 3, -2 }, - { 6, -2, -1, 1, 0, 4, 8, 14, 4, -7, -23, -5, 23, -17, -6, -15, + { 6, -2, -1, 1, 0, 4, 8, 14, 4, -7, -23, -5, 23, -17, -6, -15, -8, 7, 10, -1, 7, -16, 4, -6, 2, 3, -3, -3, -1, 8, -1, 4 }, - { 10, 4, -4, 1, 7, -3, 2, 11, 4, -6, -3, 8, 5, 4, 1, -45, + { 10, 4, -4, 1, 7, -3, 2, 11, 4, -6, -3, 8, 5, 4, 1, -45, -6, -4, 4, 2, 1, -14, -10, 1, 1, 6, 2, -8, -1, -3, 3, 3 }, - { 1, -1, 2, -3, -8, 9, 3, 3, -2, -5, -8, 8, 7, -7, -4, -6, + { 1, -1, 2, -3, -8, 9, 3, 3, -2, -5, -8, 8, 7, -7, -4, -6, 5, -9, 11, -2, 46, -5, -1, 9, -2, 0, 3, -5, -3, -5, 7, 0 }, - { -4, 1, -2, -1, -11, 11, 8, -3, -2, -10, 0, 4, 9, 9, -17, -17, + { -4, 1, -2, -1, -11, 11, 8, -3, -2, -10, 0, 4, 9, 9, -17, -17, -34, -4, -5, -7, -3, -12, -3, 11, 18, 3, -2, -5, -18, -5, -3, 6 }, - { 7, -5, -3, 1, -4, -3, -5, -1, 2, 5, -2, 3, -10, 12, -18, -5, + { 7, -5, -3, 1, -4, -3, -5, -1, 2, 5, -2, 3, -10, 12, -18, -5, -10, 12, -9, 4, -6, 2, 0, 16, -17, 15, 14, -12, -10, -2, -9, -1 }, - { 4, -5, -3, -5, -3, -1, 7, 18, -7, 12, 3, 5, -8, -4, -20, 1, + { 4, -5, -3, -5, -3, -1, 7, 18, -7, 12, 3, 5, -8, -4, -20, 1, -25, 1, -8, 13, -10, 8, -19, -1, -8, 10, 6, -9, -1, 0, 12, 4 }, - { -4, 5, 0, -1, 2, 5, -8, -2, -6, 4, -8, 9, 3, 2, -7, 4, + { -4, 5, 0, -1, 2, 5, -8, -2, -6, 4, -8, 9, 3, 2, -7, 4, -25, 13, -23, 10, 14, 15, -11, 3, -18, 4, 16, -4, 1, -10, -10, 3 }, - { 5, -3, -1, -3, 4, 1, -3, -4, -5, 1, -12, 14, -7, 11, -15, 6, + { 5, -3, -1, -3, 4, 1, -3, -4, -5, 1, -12, 14, -7, 11, -15, 6, -6, 24, -4, 13, -1, 15, -13, 8, 3, 7, -5, 2, 2, 0, 3, -7 }, - { -3, 1, 0, 8, 6, -1, 6, 5, -5, -2, -12, 4, 0, -2, -3, 5, + { -3, 1, 0, 8, 6, -1, 6, 5, -5, -2, -12, 4, 0, -2, -3, 5, -6, 0, -8, 9, -10, 4, -28, 12, -20, 11, -13, 7, -18, 1, -11, 1 }, - { 1, -4, -15, 5, 0, -13, -5, 13, -11, 4, -4, -5, 5, -14, -16, 0, + { 1, -4, -15, 5, 0, -13, -5, 13, -11, 4, -4, -5, 5, -14, -16, 0, -14, 5, -20, 12, 10, -7, -5, 6, 6, 22, 6, -4, -2, 3, 8, 11 }, - { 13, -11, -2, 16, 16, -7, 0, 20, -7, -1, 0, 5, -9, 12, -2, -5, + { 13, -11, -2, 16, 16, -7, 0, 20, -7, -1, 0, 5, -9, 12, -2, -5, -22, 5, -10, 12, -6, 11, 9, 21, -8, 15, 4, 0, -8, -4, -4, 10 }, - { 18, -4, -13, 0, 1, -15, -1, -3, 2, 10, -1, 6, 1, -4, -20, -5, + { 18, -4, -13, 0, 1, -15, -1, -3, 2, 10, -1, 6, 1, -4, -20, -5, -8, 6, -8, 17, -5, 5, -10, 8, -22, 6, -5, -2, 8, -17, 8, 2 }, - { 1, -2, -9, 6, -31, -8, -8, 8, 0, 5, -9, -4, 2, 3, -12, 11, + { 1, -2, -9, 6, -31, -8, -8, 8, 0, 5, -9, -4, 2, 3, -12, 11, -18, 10, -5, 3, -11, 13, -6, 11, -3, 12, -7, 3, -9, -1, 2, 11 }, - { -9, -6, 21, -8, -15, 4, -11, 12, -11, 17, -1, 2, -6, 0, -15, 13, + { -9, -6, 21, -8, -15, 4, -11, 12, -11, 17, -1, 2, -6, 0, -15, 13, -12, 19, 0, 2, -6, -3, -9, 10, 3, 17, -2, 5, -10, -3, 0, 1 }, - { 4, -6, 5, -10, 1, -5, 1, 0, 0, 0, 2, 7, -2, 2, -2, 0, + { 4, -6, 5, -10, 1, -5, 1, 0, 0, 0, 2, 7, -2, 2, -2, 0, -4, 3, -4, 1, -12, 6, -49, 16, -10, 13, 0, -2, 8, 6, 1, 8 }, - { 5, -8, -7, 9, 13, -5, 7, 0, 10, 11, -4, -3, -1, 13, -14, 6, + { 5, -8, -7, 9, 13, -5, 7, 0, 10, 11, -4, -3, -1, 13, -14, 6, -15, -6, -14, 16, 15, 1, -18, -4, -20, 20, -7, -1, -9, -2, -10, 10 }, - { -12, 4, 0, 10, 0, 3, 8, 4, -27, -1, -2, 19, -4, 2, -13, 3, + { -12, 4, 0, 10, 0, 3, 8, 4, -27, -1, -2, 19, -4, 2, -13, 3, 1, 9, -12, 1, -22, 19, -5, 4, -9, 12, 2, -9, -8, 11, -3, 7 }, - { 4, -5, 11, -6, 17, -17, 5, -4, -2, -6, 1, -5, 2, 4, -14, 6, + { 4, -5, 11, -6, 17, -17, 5, -4, -2, -6, 1, -5, 2, 4, -14, 6, -20, 19, -20, 12, -21, 5, -14, 13, -2, 11, 4, -3, 0, -10, -4, -2 }, - { -2, -1, -3, 8, -9, -7, -22, -3, -24, 13, -2, 10, -15, 5, -9, 4, + { -2, -1, -3, 8, -9, -7, -22, -3, -24, 13, -2, 10, -15, 5, -9, 4, -7, 0, -5, 15, -8, 11, -13, 6, -4, 19, -8, 12, -4, 6, 9, 7 }, - { 2, -3, 2, -1, 0, 3, 1, 2, 1, -4, -2, -3, 1, 5, -12, 6, + { 2, -3, 2, -1, 0, 3, 1, 2, 1, -4, -2, -3, 1, 5, -12, 6, -16, 14, -23, 10, -14, 17, -15, 16, -2, 9, -25, 9, -10, 16, 4, 9 }, - { -3, 7, -8, -3, 2, 2, -4, -8, -9, 10, 3, -11, 25, -10, -28, 27, + { -3, 7, -8, -3, 2, 2, -4, -8, -9, 10, 3, -11, 25, -10, -28, 27, -9, 7, -13, 9, -2, 4, -12, -8, -14, 6, 7, -10, 3, 3, -3, 5 }, - { -8, -3, 1, -10, 8, -3, -9, -4, 13, 7, 2, 4, -10, 4, 3, 7, + { -8, -3, 1, -10, 8, -3, -9, -4, 13, 7, 2, 4, -10, 4, 3, 7, -18, 2, -22, 15, 4, 20, -7, 5, -6, 13, -1, 4, -7, -6, 6, 13 }, - { -2, 3, 0, 2, -4, -2, 0, 0, 1, 2, -2, -5, 0, 1, -4, 0, + { -2, 3, 0, 2, -4, -2, 0, 0, 1, 2, -2, -5, 0, 1, -4, 0, -2, -3, 1, 2, -1, 2, -8, -1, -24, 68, -3, 8, 3, 3, -1, -1 }, - { -15, -2, -9, -7, -1, 8, -14, 8, 3, 6, 0, -1, -8, 8, -23, 2, + { -15, -2, -9, -7, -1, 8, -14, 8, 3, 6, 0, -1, -8, 8, -23, 2, -14, 17, -15, 8, -4, 7, -18, 0, -8, -3, -1, -4, -10, 4, -1, 4 }, - { 8, 0, 2, -7, 0, 5, 1, 3, -11, 4, -8, 14, 3, 20, 1, 26, + { 8, 0, 2, -7, 0, 5, 1, 3, -11, 4, -8, 14, 3, 20, 1, 26, -11, 13, -13, 20, -2, 0, -8, 2, -6, 6, -1, 9, 3, -6, -3, 10 }, - { 5, 0, -1, -7, 10, 1, -3, 5, 4, 7, -5, -1, -3, -1, 12, -3, + { 5, 0, -1, -7, 10, 1, -3, 5, 4, 7, -5, -1, -3, -1, 12, -3, -15, 7, -9, 22, -19, 8, -9, 4, -23, 13, -14, 6, -6, -14, -4, 7 }, - { 14, -5, -8, -10, 25, 3, -23, -7, -28, 0, -1, -9, 4, 1, -13, 20, + { 14, -5, -8, -10, 25, 3, -23, -7, -28, 0, -1, -9, 4, 1, -13, 20, -8, 10, -16, 8, 12, -13, -21, 5, -13, 11, -2, 1, 12, -7, 2, -10 }, - { -5, -4, 9, 5, -6, 35, -7, 8, 15, 2, -1, -9, -6, 2, -18, 7, + { -5, -4, 9, 5, -6, 35, -7, 8, 15, 2, -1, -9, -6, 2, -18, 7, -15, 6, -3, 2, 8, 12, -30, 7, -4, 20, 2, 6, 13, -6, -4, 0 }, - { 1, 8, -9, 9, -5, 12, -9, 16, -9, 16, -17, 14, -13, 15, -18, 14, + { 1, 8, -9, 9, -5, 12, -9, 16, -9, 16, -17, 14, -13, 15, -18, 14, -15, 17, -12, 14, -13, 7, -16, 13, -9, 5, -11, 10, -9, 6, -12, 13 }, - { -10, -4, 5, 3, 1, 6, 8, -14, -5, 15, 7, 4, 8, 7, -22, 8, + { -10, -4, 5, 3, 1, 6, 8, -14, -5, 15, 7, 4, 8, 7, -22, 8, -7, -8, -15, 26, 1, 13, -3, 17, -5, 9, -2, 4, -6, 3, -8, 9 }, - { 8, -3, 2, 3, 3, 1, -2, -1, -11, 8, -4, 0, -6, -5, -1, 13, + { 8, -3, 2, 3, 3, 1, -2, -1, -11, 8, -4, 0, -6, -5, -1, 13, -37, 9, 1, -6, -10, -2, -10, 11, 8, 13, -3, -2, -6, 8, -4, 13 }, - { 3, 2, -3, -4, -4, 7, -8, 9, -8, 9, -20, 12, -19, 15, -18, 17, + { 3, 2, -3, -4, -4, 7, -8, 9, -8, 9, -20, 12, -19, 15, -18, 17, -15, 7, -1, 20, -11, 6, -6, 3, 1, 9, 2, -14, -2, -2, 2, 1 }, - { -7, 1, -1, -3, -6, 4, 4, -3, 3, -1, 5, -4, 3, 2, -1, 9, + { -7, 1, -1, -3, -6, 4, 4, -3, 3, -1, 5, -4, 3, 2, -1, 9, -59, 5, -4, 30, 3, 3, -2, -3, -1, 2, 2, 1, -1, -1, -2, 1 }, - { 0, -3, 2, 0, -1, -8, 0, 2, -3, 4, -4, 1, 10, 6, -6, 8, + { 0, -3, 2, 0, -1, -8, 0, 2, -3, 4, -4, 1, 10, 6, -6, 8, -7, 4, 10, 11, -41, 27, -20, 3, -3, 8, 1, 11, -5, -8, 0, 4 }, - { 5, 1, 4, -2, 1, 2, -1, 6, -7, 2, 11, 4, 0, 0, -8, 7, + { 5, 1, 4, -2, 1, 2, -1, 6, -7, 2, 11, 4, 0, 0, -8, 7, -10, 0, 0, 8, 2, 10, -1, 1, -2, 44, -2, -21, -12, -3, -1, 2 }, - { -4, 4, -2, -2, 6, -8, 2, 1, -10, 14, 8, 6, 5, 1, -2, 4, + { -4, 4, -2, -2, 6, -8, 2, 1, -10, 14, 8, 6, 5, 1, -2, 4, -13, 4, 2, 5, 10, -2, -21, 32, -3, 18, 9, -6, -9, -9, 10, 2 }, - { 9, -16, -6, -2, 1, 4, 22, 2, -2, 1, -3, -2, -9, 3, 16, 19, + { 9, -16, -6, -2, 1, 4, 22, 2, -2, 1, -3, -2, -9, 3, 16, 19, -24, -6, -6, -5, -8, -7, 8, -7, -1, -12, 5, -3, 0, 4, 2, -3 }, - { 10, 3, -16, -4, -1, 13, 4, 4, 1, -3, 1, -6, -14, 18, 3, 8, + { 10, 3, -16, -4, -1, 13, 4, 4, 1, -3, 1, -6, -14, 18, 3, 8, -8, -28, -16, 4, 4, 2, 12, 7, 9, -4, -4, 5, -1, -1, 2, 2 }, - { -5, -13, -22, -3, -8, 21, -2, -9, 21, -4, -9, 5, -8, 15, 5, 1, + { -5, -13, -22, -3, -8, 21, -2, -9, 21, -4, -9, 5, -8, 15, 5, 1, -5, -9, -7, -2, -5, -5, -1, -5, -5, -5, 3, 10, -4, 0, -7, -2 }, - { 5, -10, -18, 2, 20, 4, 13, -10, 8, -15, -11, -3, -1, 16, 10, 9, + { 5, -10, -18, 2, 20, 4, 13, -10, 8, -15, -11, -3, -1, 16, 10, 9, -8, 6, 7, -5, 6, 11, 5, 17, -4, 7, -11, 5, -3, -6, 2, 1 }, - { 3, -5, -19, 1, 1, -3, -2, -25, -11, -17, 0, -13, -4, 10, 10, 2, + { 3, -5, -19, 1, 1, -3, -2, -25, -11, -17, 0, -13, -4, 10, 10, 2, -5, 4, 0, 3, -3, -5, -10, -2, 13, -22, 0, 3, -11, -5, 7, -1 }, - { 12, -14, -29, 6, -1, 10, 7, -17, -12, 14, 3, 9, -9, 9, 7, 6, + { 12, -14, -29, 6, -1, 10, 7, -17, -12, 14, 3, 9, -9, 9, 7, 6, -3, -13, 0, 5, 3, -1, -6, -1, 0, 2, 4, -12, -5, -1, 2, 11 }, - { 12, -15, -7, -2, -12, 17, 20, -16, -2, -12, -6, 15, -6, 12, 11, 9, + { 12, -15, -7, -2, -12, 17, 20, -16, -2, -12, -6, 15, -6, 12, 11, 9, 7, -6, 7, -4, -19, 6, 2, 2, 3, -11, -10, -4, -5, -3, 3, 2 }, - { 11, -22, -6, 0, 8, 18, 3, -11, -4, -7, -15, -17, -12, 6, 16, 4, + { 11, -22, -6, 0, 8, 18, 3, -11, -4, -7, -15, -17, -12, 6, 16, 4, -9, 4, -5, 3, 6, -16, 10, -7, -7, -3, 5, 0, 1, -15, -4, 5 }, - { 12, -22, -16, 5, -6, 8, 12, -4, -9, -17, -11, 3, 5, 8, -17, 0, + { 12, -22, -16, 5, -6, 8, 12, -4, -9, -17, -11, 3, 5, 8, -17, 0, 11, -4, -13, -6, 2, -1, -1, 3, 3, -11, -12, -1, 1, 1, 12, -2 }, - { 8, -10, -33, -5, -3, -6, 1, -7, -8, -4, -6, -1, 5, -4, -6, -12, + { 8, -10, -33, -5, -3, -6, 1, -7, -8, -4, -6, -1, 5, -4, -6, -12, -16, -8, 11, 8, -14, 7, 12, 11, 4, -14, -3, 6, -7, -5, -3, 3 }, - { 0, -8, -7, 2, -4, 24, 2, -9, -11, -3, -7, 11, -12, 17, 1, -1, + { 0, -8, -7, 2, -4, 24, 2, -9, -11, -3, -7, 11, -12, 17, 1, -1, 3, -5, -7, 12, 4, 11, 0, 3, 2, -18, -3, 4, 7, -6, 3, 15 }, - { 10, -15, -16, -2, -4, -9, 7, -15, -6, 2, -16, 13, -8, 7, 19, -21, + { 10, -15, -16, -2, -4, -9, 7, -15, -6, 2, -16, 13, -8, 7, 19, -21, -4, -12, -9, -3, -3, 6, 11, -3, -1, -19, 3, -7, -9, -4, 3, -6 }, - { -5, -10, -21, 0, -3, -7, 18, -21, 15, -5, -12, -4, -13, 2, 6, -9, + { -5, -10, -21, 0, -3, -7, 18, -21, 15, -5, -12, -4, -13, 2, 6, -9, -9, -11, -4, 13, -3, 6, 4, -1, 7, -9, -4, 9, 5, 2, 6, 3 }, - { 15, -1, -27, -2, 10, 3, 7, -8, 9, -2, 7, 1, -2, -5, 18, 9, + { 15, -1, -27, -2, 10, 3, 7, -8, 9, -2, 7, 1, -2, -5, 18, 9, -11, -17, -2, 7, -9, 11, 10, 0, -8, 6, -16, -3, 2, -7, 3, 11 }, - { 4, -9, -39, 19, 6, -13, 13, -5, -5, -15, -2, 9, 0, 4, 14, 6, + { 4, -9, -39, 19, 6, -13, 13, -5, -5, -15, -2, 9, 0, 4, 14, 6, -10, -4, -5, 2, -4, -2, 5, -11, 3, 3, -2, -2, -7, 9, 7, -10 }, - { 5, -11, -8, 10, -2, 12, 16, 0, 12, -2, -6, 8, 14, 8, 7, 1, + { 5, -11, -8, 10, -2, 12, 16, 0, 12, -2, -6, 8, 14, 8, 7, 1, 18, -30, 4, 10, -4, -6, 2, -11, 9, -10, -8, 5, 0, 0, -7, 6 }, - { -1, -16, -10, 11, 0, 13, 12, -4, -4, -5, -21, 12, 4, 13, 14, -7, + { -1, -16, -10, 11, 0, 13, 12, -4, -4, -5, -21, 12, 4, 13, 14, -7, 6, -16, -13, 8, 2, 9, 15, -12, 1, -9, -22, 10, -9, 9, 9, -7 }, - { 4, -12, -27, 1, -2, 11, 15, 3, 14, -14, -9, 0, -9, 16, 22, 10, + { 4, -12, -27, 1, -2, 11, 15, 3, 14, -14, -9, 0, -9, 16, 22, 10, 16, -10, 5, -5, -9, 1, 1, 6, 6, -4, 2, -17, -5, -6, -15, -1 }, - { 7, -12, -17, 1, -9, 5, 20, -7, 3, 23, -8, -8, -8, -1, 13, 17, + { 7, -12, -17, 1, -9, 5, 20, -7, 3, 23, -8, -8, -8, -1, 13, 17, -7, -13, 4, -4, 7, 14, 8, 11, -3, -3, 4, 0, 4, 6, -1, -9 }, - { 7, -15, -15, -4, 10, 12, 3, -13, 6, 14, 9, -8, -15, 14, 23, -5, + { 7, -15, -15, -4, 10, 12, 3, -13, 6, 14, 9, -8, -15, 14, 23, -5, -10, -5, 1, 15, -10, -7, 1, 9, 4, -13, -10, 10, 7, -3, 2, 3 }, - { 4, -10, -14, 0, 3, 4, 0, -9, -3, -4, -11, 2, -17, 8, 2, 15, + { 4, -10, -14, 0, 3, 4, 0, -9, -3, -4, -11, 2, -17, 8, 2, 15, 6, -12, -12, 15, -5, 17, 18, 3, -3, -3, -4, -6, -8, 13, 4, 10 }, - { -2, -18, -26, 10, -4, 10, 13, 4, -4, -16, -7, -17, -3, 5, -4, 2, + { -2, -18, -26, 10, -4, 10, 13, 4, -4, -16, -7, -17, -3, 5, -4, 2, -15, -10, -1, -8, -7, -3, 2, 2, 8, -10, -7, 2, 2, -4, 4, -1 }, - { 4, -19, -5, -1, -1, -6, 2, -8, 10, -16, -28, -6, 8, -1, 11, 28, + { 4, -19, -5, -1, -1, -6, 2, -8, 10, -16, -28, -6, 8, -1, 11, 28, 2, -10, -4, 6, -6, 6, 11, 15, -4, -2, 7, 3, 7, -7, 4, 1 }, - { -3, -6, -10, -5, 13, 18, 10, -15, -5, -3, -13, 5, 1, 2, 18, -5, + { -3, -6, -10, -5, 13, 18, 10, -15, -5, -3, -13, 5, 1, 2, 18, -5, -10, -10, -7, 4, 2, 1, 5, 4, 2, 5, 4, 8, -9, -17, 7, 7 }, - { 20, -12, -2, -4, 5, 14, 7, -11, -1, -16, -6, -4, -11, 17, 14, 0, + { 20, -12, -2, -4, 5, 14, 7, -11, -1, -16, -6, -4, -11, 17, 14, 0, -8, -10, -8, 10, 3, 5, 10, -16, 3, -8, -14, 10, 3, 9, 0, 3 }, - { 12, -10, -36, 0, 7, 15, 2, -16, 2, -1, 0, -1, 5, 4, 5, -3, + { 12, -10, -36, 0, 7, 15, 2, -16, 2, -1, 0, -1, 5, 4, 5, -3, 1, -10, 5, -1, -15, -3, -12, 12, 2, 5, -1, 5, 6, -3, -2, 2 }, - { 17, -15, -31, 23, -4, 15, -2, -3, 6, -7, -5, 1, -12, 4, 6, 8, + { 17, -15, -31, 23, -4, 15, -2, -3, 6, -7, -5, 1, -12, 4, 6, 8, -10, 8, 3, 5, -4, 1, 5, 3, -1, -4, -3, 1, 10, -4, -2, -2 }, - { 6, -18, -5, 12, 10, 12, 14, -11, 15, 2, -9, -6, -5, -2, -9, 4, + { 6, -18, -5, 12, 10, 12, 14, -11, 15, 2, -9, -6, -5, -2, -9, 4, -5, -28, -4, 14, 0, -16, 9, 14, -1, 3, -4, -4, 2, 1, 0, 4 }, - { -5, -14, -31, 8, 16, 7, 13, -13, 5, 6, -16, 10, -5, 2, -2, 2, + { -5, -14, -31, 8, 16, 7, 13, -13, 5, 6, -16, 10, -5, 2, -2, 2, 14, -5, 8, -5, 7, -16, 6, -13, -5, 0, -5, 8, -3, -1, 4, 3 }, - { 1, -2, -1, 0, 6, 5, 2, -4, -3, -1, 0, 1, 4, 2, 43, 28, + { 1, -2, -1, 0, 6, 5, 2, -4, -3, -1, 0, 1, 4, 2, 43, 28, -12, -35, -2, -2, -7, -1, 0, 2, -1, -2, -2, 1, -4, 0, -2, 3 }, - { 2, -9, -22, 12, 3, 3, -7, -4, -19, -22, -14, -4, -1, 21, 9, -3, + { 2, -9, -22, 12, 3, 3, -7, -4, -19, -22, -14, -4, -1, 21, 9, -3, -15, -16, -13, 1, -11, 4, -9, 1, -7, -1, -1, 0, -2, 9, -13, -3 }, - { -1, -3, -23, 0, 2, 12, 3, -9, -4, 7, 3, 9, -10, 1, 27, 28, + { -1, -3, -23, 0, 2, 12, 3, -9, -4, 7, 3, 9, -10, 1, 27, 28, 0, 9, -15, -2, -2, 1, 6, 8, -8, 7, -3, 20, 0, 0, -1, -6 }, - { -1, 11, 8, -2, 1, 5, -6, -1, 4, 2, -4, 0, -1, -5, 4, -6, + { -1, 11, 8, -2, 1, 5, -6, -1, 4, 2, -4, 0, -1, -5, 4, -6, -10, -12, 19, 1, -7, 9, -8, -9, -16, -11, -2, 12, 14, 4, 4, 34 }, - { 17, 7, -6, 1, 4, -10, -5, 4, -11, 3, -18, 4, 14, -13, -3, 1, + { 17, 7, -6, 1, 4, -10, -5, 4, -11, 3, -18, 4, 14, -13, -3, 1, 0, 0, -11, 0, 7, -17, -4, 4, -11, -6, -8, 18, 0, 0, 0, 26 }, - { -6, -7, -1, -1, 11, -8, 1, 3, 2, 11, -6, -6, 10, -3, 1, -3, + { -6, -7, -1, -1, 11, -8, 1, 3, 2, 11, -6, -6, 10, -3, 1, -3, 7, 4, -12, -8, 0, -9, 8, -22, -5, 0, -6, 22, -2, 11, -13, 24 }, - { -3, 4, 0, 3, 9, 10, -1, 3, -9, -12, 1, -5, 18, 0, -3, 8, + { -3, 4, 0, 3, 9, 10, -1, 3, -9, -12, 1, -5, 18, 0, -3, 8, 25, 15, -8, 2, 2, -2, 4, 8, 9, -1, -5, 10, -3, 1, -1, 23 }, - { -5, 2, -9, -1, -3, 0, 3, -1, -10, -4, 0, -13, 16, 9, -1, -14, + { -5, 2, -9, -1, -3, 0, 3, -1, -10, -4, 0, -13, 16, 9, -1, -14, 2, 6, -2, -6, -5, -2, -7, 7, 5, 3, 11, -2, -14, 0, -9, 30 }, - { 4, 6, 6, 5, -3, -1, 4, 5, 10, 0, 5, -4, 7, -11, 14, 14, + { 4, 6, 6, 5, -3, -1, 4, 5, 10, 0, 5, -4, 7, -11, 14, 14, 7, 34, -9, 0, -10, 22, -7, -1, 7, -9, 2, -8, 0, -7, -5, 29 }, - { -4, 3, -1, -4, -3, 5, 1, -4, 0, 2, 4, 2, 1, -1, -10, 1, + { -4, 3, -1, -4, -3, 5, 1, -4, 0, 2, 4, 2, 1, -1, -10, 1, 6, -6, -4, 1, 4, -3, -3, -5, 0, 3, 7, -12, 0, -2, -10, 55 }, - { 5, 9, -1, 0, 4, 9, -21, -9, 4, 2, 6, -7, 11, -7, 1, -5, + { 5, 9, -1, 0, 4, 9, -21, -9, 4, 2, 6, -7, 11, -7, 1, -5, 0, -4, 2, -3, -13, -8, 0, -9, -4, 2, 16, -2, -15, -7, -11, 31 }, - { 8, 2, -1, 0, 3, -5, -5, 5, 1, -1, -9, 1, 0, -6, -2, -1, + { 8, 2, -1, 0, 3, -5, -5, 5, 1, -1, -9, 1, 0, -6, -2, -1, 5, 2, 0, 0, 12, 20, -19, 1, 8, -12, -11, 0, 6, -5, 2, 31 }, - { -1, -1, -2, 1, -1, 3, -9, -5, 8, -2, 5, -1, 0, -2, 4, -2, + { -1, -1, -2, 1, -1, 3, -9, -5, 8, -2, 5, -1, 0, -2, 4, -2, -3, -12, 0, -2, 3, 0, 9, 4, -1, 21, -8, 3, -4, 9, -6, 30 }, - { -4, 0, -7, 17, 10, -12, -2, -10, -12, -3, 10, 0, 11, -4, -13, -3, + { -4, 0, -7, 17, 10, -12, -2, -10, -12, -3, 10, 0, 11, -4, -13, -3, 5, 6, 10, 7, -8, 0, -7, -13, 1, 0, -2, 7, -12, 4, -3, 24 }, - { -13, 9, 4, -2, 2, -4, -14, -1, -3, -5, -10, 4, 13, -2, 5, 13, + { -13, 9, 4, -2, 2, -4, -14, -1, -3, -5, -10, 4, 13, -2, 5, 13, 8, 3, -2, 1, 5, -6, 7, -18, -10, 1, -1, 5, 4, 1, 0, 25 }, - { -5, -1, 18, 12, 8, 8, -16, -1, 1, 1, 1, -4, -5, 3, 3, 4, + { -5, -1, 18, 12, 8, 8, -16, -1, 1, 1, 1, -4, -5, 3, 3, 4, 4, -11, -12, -16, -6, 2, 12, -13, 0, 9, 7, 9, -9, 0, -10, 24 }, - { -4, 1, -3, 0, 2, -4, 4, 1, 5, 0, -3, 2, -3, -2, 2, -1, + { -4, 1, -3, 0, 2, -4, 4, 1, 5, 0, -3, 2, -3, -2, 2, -1, 1, 4, -1, -2, -2, 1, -1, -1, -4, -1, -4, -2, -6, 6, 12, 69 }, - { 8, 5, 11, 0, -15, -4, 13, 6, 0, -4, 9, 1, -5, -3, 15, 0, + { 8, 5, 11, 0, -15, -4, 13, 6, 0, -4, 9, 1, -5, -3, 15, 0, 1, 6, -5, 0, 1, 6, 5, 8, 0, 7, 1, -1, -4, -11, -9, 41 }, - { -4, -9, 32, -6, 0, 7, -4, 6, -6, 1, -6, -2, 4, -8, -5, -3, + { -4, -9, 32, -6, 0, 7, -4, 6, -6, 1, -6, -2, 4, -8, -5, -3, -16, -1, -2, -6, 1, 15, 0, 21, 3, -3, -4, 3, -12, 16, 2, 27 }, - { -6, -5, 1, -9, -5, 3, 7, -3, 5, 5, 14, 13, 20, -7, -1, 12, + { -6, -5, 1, -9, -5, 3, 7, -3, 5, 5, 14, 13, 20, -7, -1, 12, -1, 10, -11, -11, -7, -4, -14, 7, -14, 13, 22, 18, -1, 0, 14, 28 }, - { -8, 3, -2, 0, 5, 6, -1, -4, 1, 3, -7, 3, 1, -15, 4, -9, + { -8, 3, -2, 0, 5, 6, -1, -4, 1, 3, -7, 3, 1, -15, 4, -9, 22, -10, -9, -4, 1, 8, -4, 9, -15, 2, -6, -4, -16, 12, -10, 23 }, - { 0, 0, 2, 0, -1, 3, -3, -1, 3, -5, 7, 1, 5, -5, -8, 1, + { 0, 0, 2, 0, -1, 3, -3, -1, 3, -5, 7, 1, 5, -5, -8, 1, 13, -15, -5, -7, 12, -6, -2, 3, 10, -5, -8, 17, -5, -11, -14, 23 }, - { -7, -4, 6, -4, 5, -6, -5, 2, -4, 11, 9, -4, 2, -2, -4, 6, + { -7, -4, 6, -4, 5, -6, -5, 2, -4, 11, 9, -4, 2, -2, -4, 6, 15, 3, -3, 18, -15, -2, -6, 3, 3, -20, 17, 11, -4, 2, 3, 29 }, - { 6, 1, -6, 2, 3, 0, 0, -3, 3, 3, -1, 3, -4, -6, -6, -7, + { 6, 1, -6, 2, 3, 0, 0, -3, 3, 3, -1, 3, -4, -6, -6, -7, -3, -2, -7, -2, -4, 5, 3, -5, -20, -13, -4, 10, -14, -29, 14, 37 }, - { 3, 4, 3, -6, -4, 5, 0, 3, 2, 3, 0, -2, 4, 0, -3, -5, + { 3, 4, 3, -6, -4, 5, 0, 3, 2, 3, 0, -2, 4, 0, -3, -5, -4, 4, -4, 4, 4, 3, 1, -4, -4, -9, -14, 20, -30, 3, -18, 33 }, - { 0, 2, 5, -2, -4, -2, -1, 2, -6, -3, -2, -2, 2, -5, -1, 4, + { 0, 2, 5, -2, -4, -2, -1, 2, -6, -3, -2, -2, 2, -5, -1, 4, 3, 2, -3, 0, -1, -1, -10, -7, 2, -4, -18, 2, -37, -1, 12, 40 }, - { -7, 2, -1, 0, -2, 4, -8, 1, -4, 12, 7, 4, 15, -7, 1, -9, + { -7, 2, -1, 0, -2, 4, -8, 1, -4, 12, 7, 4, 15, -7, 1, -9, 18, 0, 12, -17, -3, -1, 0, 0, 0, 2, -6, 0, -4, -3, -1, 26 }, - { -6, 4, 8, -5, -6, -2, 2, -1, 1, -1, -15, 8, 7, -1, -17, -4, + { -6, 4, 8, -5, -6, -2, 2, -1, 1, -1, -15, 8, 7, -1, -17, -4, 1, 5, 6, -11, -6, 14, 17, -5, -15, 11, 8, 0, -3, -15, -6, 28 }, - { -1, 0, 0, 0, 1, 0, -1, 0, 1, 3, 2, -2, 3, -1, -1, 2, + { -1, 0, 0, 0, 1, 0, -1, 0, 1, 3, 2, -2, 3, -1, -1, 2, 2, -1, -1, -7, 1, 2, -9, 0, -1, -4, -18, 7, -10, 49, -13, 32 }, - { -1, -3, 4, 1, 2, -5, 1, -7, -1, 5, -9, 4, 4, 25, 1, -1, + { -1, -3, 4, 1, 2, -5, 1, -7, -1, 5, -9, 4, 4, 25, 1, -1, 2, -5, 2, -7, 17, -2, 10, -5, 0, 2, -15, 3, -9, 7, -9, 30 }, - { -5, -1, 0, 2, 1, -1, 2, 5, -33, 3, -5, 14, 11, 7, 5, -3, + { -5, -1, 0, 2, 1, -1, 2, 5, -33, 3, -5, 14, 11, 7, 5, -3, 2, -8, -4, -2, -7, -6, 4, -8, -1, -8, 2, -2, -8, -1, -4, 27 }, - { -1, 0, -1, -2, 1, -1, -2, -1, 2, 0, 1, 2, 2, 4, 1, 3, + { -1, 0, -1, -2, 1, -1, -2, -1, 2, 0, 1, 2, 2, 4, 1, 3, 4, 2, 1, -7, -4, 1, -3, -4, -35, -25, 17, 10, -3, -26, -7, 32 }, - { -5, 1, 6, -2, 6, 6, -9, 3, -1, -4, 5, -4, -2, -2, -9, 2, + { -5, 1, 6, -2, 6, 6, -9, 3, -1, -4, 5, -4, -2, -2, -9, 2, -5, 2, 2, 4, 3, 5, -5, -16, -31, -12, -11, 2, -19, 20, -2, 21 }, - { -5, 2, 7, -7, -7, 5, -7, 2, 0, 0, -4, 3, -1, 0, -1, -2, + { -5, 2, 7, -7, -7, 5, -7, 2, 0, 0, -4, 3, -1, 0, -1, -2, 0, -3, 5, -11, -8, -3, -7, -7, 28, -11, -7, 0, -16, -11, -4, 29 }, - { 2, 1, -3, -2, -1, 3, 4, 0, 1, 0, -1, -5, 4, -5, -12, 2, + { 2, 1, -3, -2, -1, 3, 4, 0, 1, 0, -1, -5, 4, -5, -12, 2, -2, -5, -22, -2, -1, 11, 8, -7, -12, 0, -34, 6, -5, 11, -8, 19 }, - { -1, -3, 5, 11, 18, -2, -2, -5, -2, 4, -1, 8, 5, -6, 1, -1, + { -1, -3, 5, 11, 18, -2, -2, -5, -2, 4, -1, 8, 5, -6, 1, -1, 2, 8, 4, -5, -8, -2, 5, -18, 7, 12, 7, 19, -18, 2, -6, -13 }, - { 9, 0, 0, 5, 4, 3, -6, 4, 1, -4, 5, -1, -4, 8, 8, 6, + { 9, 0, 0, 5, 4, 3, -6, 4, 1, -4, 5, -1, -4, 8, 8, 6, -8, -6, 0, 6, -3, 3, 5, -3, 17, 31, 16, 10, -13, 0, -9, -19 }, - { 12, -10, 2, -2, -2, -1, -3, 6, -12, -5, -2, 14, -16, 4, 12, 12, + { 12, -10, 2, -2, -2, -1, -3, 6, -12, -5, -2, 14, -16, 4, 12, 12, 17, 4, 7, -16, 7, -6, 11, 7, 7, 2, -25, 23, -24, 5, -7, -9 }, - { 10, 4, 13, 10, 10, 3, -6, 3, 3, 2, -1, -6, 8, 4, 10, 0, + { 10, 4, 13, 10, 10, 3, -6, 3, 3, 2, -1, -6, 8, 4, 10, 0, 1, 2, -4, 2, -3, -8, 0, -1, 9, 9, -10, -3, -29, 1, -1, -27 }, - { 2, 2, 0, 7, 9, -2, -10, -1, -1, 1, -9, -5, 8, 4, 1, 2, + { 2, 2, 0, 7, 9, -2, -10, -1, -1, 1, -9, -5, 8, 4, 1, 2, -10, 1, 13, 12, -3, 15, -9, 2, -7, 1, -10, 23, -20, -18, -9, -15 }, - { -3, -5, -1, 8, 0, -5, -1, 4, 7, -1, -7, 2, -8, -5, 11, 7, + { -3, -5, -1, 8, 0, -5, -1, 4, 7, -1, -7, 2, -8, -5, 11, 7, -6, 3, -3, -9, 7, 9, -22, 1, 6, -4, 14, 27, -25, -14, 3, -5 }, - { 1, 3, 8, 4, 7, 6, 12, -17, -15, 1, -8, -10, 7, -14, -8, 6, + { 1, 3, 8, 4, 7, 6, 12, -17, -15, 1, -8, -10, 7, -14, -8, 6, -2, -2, -11, -11, -7, 13, -2, -2, 4, 5, -5, 13, -23, -6, -17, -8 }, - { -5, 4, -14, -5, -4, -5, 6, 5, -8, -5, -2, -11, -7, -12, 3, -11, + { -5, 4, -14, -5, -4, -5, 6, 5, -8, -5, -2, -11, -7, -12, 3, -11, 2, -6, 4, -10, -5, -7, 14, 5, 23, 11, 7, 12, -16, -6, -4, -16 }, - { 5, 6, 2, 5, -2, -5, -5, -6, -5, -19, -13, -1, -3, -13, 5, 0, + { 5, 6, 2, 5, -2, -5, -5, -6, -5, -19, -13, -1, -3, -13, 5, 0, 6, -2, -2, -6, -7, -7, -1, -9, 4, 14, 17, -12, -27, 3, 0, -1 }, - { 7, -1, 9, -10, 8, 2, -7, -2, 5, 2, -3, -7, 3, 0, 6, 4, + { 7, -1, 9, -10, 8, 2, -7, -2, 5, 2, -3, -7, 3, 0, 6, 4, 12, 5, 11, 14, -13, -1, 8, 1, 13, 9, 12, 12, -18, -14, -11, -16 }, - { -7, -5, -6, -5, 0, -1, -3, 2, 2, 1, 4, 9, 2, 3, 5, -2, + { -7, -5, -6, -5, 0, -1, -3, 2, 2, 1, 4, 9, 2, 3, 5, -2, 2, 1, 8, 0, 3, 0, -2, 2, 1, 7, 29, 0, -36, -5, -9, -21 }, - { 14, -6, -9, 0, -1, -8, -8, -11, 2, 2, -9, -12, 12, -4, 5, 3, + { 14, -6, -9, 0, -1, -8, -8, -11, 2, 2, -9, -12, 12, -4, 5, 3, -5, -9, 11, -1, -3, 12, -21, -3, 12, 5, 3, 11, -18, -15, 1, -2 }, - { -1, 3, -9, -3, 7, -7, -18, 2, 4, 12, -10, 2, 8, -3, -14, 13, + { -1, 3, -9, -3, 7, -7, -18, 2, 4, 12, -10, 2, 8, -3, -14, 13, 17, -5, 5, -9, 13, -3, -7, -18, 17, -2, 5, 7, -20, -3, -6, -11 }, - { -3, 3, 3, -1, 1, -6, -5, 1, 5, -3, -14, -6, -5, -8, 14, -6, + { -3, 3, 3, -1, 1, -6, -5, 1, 5, -3, -14, -6, -5, -8, 14, -6, 7, -1, 5, 1, 15, -1, -7, -4, 6, -11, 9, -2, -37, 16, -7, -3 }, - { -1, 0, 6, 1, -3, -9, 0, 11, -8, 2, -2, 0, 5, 2, 12, -10, + { -1, 0, 6, 1, -3, -9, 0, 11, -8, 2, -2, 0, 5, 2, 12, -10, 10, 13, 2, 7, -6, 2, -10, -10, 21, -5, 5, 5, -12, -23, 3, -14 }, - { 6, 0, -2, 1, 0, 1, 0, -4, 1, 1, 8, -2, 2, -5, -2, 1, + { 6, 0, -2, 1, 0, 1, 0, -4, 1, 1, 8, -2, 2, -5, -2, 1, 8, -4, -1, -1, 4, -1, 2, 6, 32, 1, -5, -20, -40, -4, -18, -14 }, - { 2, 2, -7, -2, 4, 4, -1, 2, 0, -2, -4, -7, 3, 5, 0, -5, + { 2, 2, -7, -2, 4, 4, -1, 2, 0, -2, -4, -7, 3, 5, 0, -5, 1, 2, -6, 4, -1, -2, -1, -15, 8, 3, 9, 46, -7, -18, 6, -11 }, - { 5, 5, 16, 21, 3, -11, -4, 11, -12, 2, 4, -12, -1, 11, 8, 1, + { 5, 5, 16, 21, 3, -11, -4, 11, -12, 2, 4, -12, -1, 11, 8, 1, -4, 11, -11, -21, 1, 1, -11, 3, 13, 1, 5, 12, -25, 1, -3, -2 }, - { 1, 6, -7, 4, 2, 3, 1, -5, 8, 9, -15, 3, -3, -14, 17, 4, + { 1, 6, -7, 4, 2, 3, 1, -5, 8, 9, -15, 3, -3, -14, 17, 4, -8, 14, -2, -8, -4, 5, 8, -7, 8, 9, 7, 6, -29, -17, 8, 4 }, - { -7, -7, 4, 0, 13, 1, 0, 4, 4, -16, -10, -7, 5, 9, -15, -10, + { -7, -7, 4, 0, 13, 1, 0, 4, 4, -16, -10, -7, 5, 9, -15, -10, -10, 8, -4, -1, -11, -1, -10, -15, 3, 3, 14, 10, -19, 2, -18, -12 }, - { -4, 0, 2, 0, 5, -2, -9, 0, 4, -4, 2, -1, -2, 2, -4, 9, + { -4, 0, 2, 0, 5, -2, -9, 0, 4, -4, 2, -1, -2, 2, -4, 9, 2, -6, -4, -2, -1, -3, -3, -1, 2, 5, -1, 11, -24, -44, -9, -15 }, - { -1, -10, 6, 21, 11, 15, -7, 10, -14, -9, -8, -8, 4, 6, 19, 1, + { -1, -10, 6, 21, 11, 15, -7, 10, -14, -9, -8, -8, 4, 6, 19, 1, -6, 1, -5, -17, -8, -10, 9, 5, 11, 18, -1, 10, -16, -7, -9, -8 }, - { 3, -5, 0, 0, -2, -2, -6, 4, -4, 1, -1, 0, 7, -3, 4, -4, + { 3, -5, 0, 0, -2, -2, -6, 4, -4, 1, -1, 0, 7, -3, 4, -4, -7, 7, 17, -20, 6, 4, 1, -6, -12, 31, 13, 19, -14, -10, -7, -2 }, - { -2, 6, -10, 3, 9, 6, -14, 15, 2, -5, 2, -11, 9, -8, 4, 6, + { -2, 6, -10, 3, 9, 6, -14, 15, 2, -5, 2, -11, 9, -8, 4, 6, 20, -15, -3, -3, -1, 32, -21, 6, 1, 9, 11, 17, -19, 6, -1, -3 }, - { 8, 10, -2, 0, -8, -16, 7, 7, 6, 10, 4, -14, 7, -6, 21, -7, + { 8, 10, -2, 0, -8, -16, 7, 7, 6, 10, 4, -14, 7, -6, 21, -7, 10, 5, 5, 0, -7, 2, -6, 0, -7, 11, -9, 15, -20, -7, -11, 2 }, - { 0, -7, 5, 2, 0, -3, -6, -4, -2, -1, -4, -5, -13, -1, 27, -9, + { 0, -7, 5, 2, 0, -3, -6, -4, -2, -1, -4, -5, -13, -1, 27, -9, -6, -11, -7, 1, 11, -4, -4, -14, -2, 11, 6, 10, -19, -6, -15, 2 }, - { 0, 7, -1, 2, -7, -15, -2, -3, 13, -5, -5, 12, 3, 0, 5, -5, + { 0, 7, -1, 2, -7, -15, -2, -3, 13, -5, -5, 12, 3, 0, 5, -5, -22, 2, 7, 22, 13, 0, -1, 2, 3, 2, -7, 7, -27, -4, -4, -12 }, - { 11, 1, -16, 6, -15, 1, 3, 2, 0, 2, -3, 2, 5, -2, -5, 9, + { 11, 1, -16, 6, -15, 1, 3, 2, 0, 2, -3, 2, 5, -2, -5, 9, 5, -3, 3, -2, -11, 3, 9, 6, 9, 3, -1, 12, -41, 8, -6, 9 }, - { 3, -7, 3, 2, 5, 5, 0, -1, 1, 3, -5, -2, -13, 7, -1, -2, + { 3, -7, 3, 2, 5, 5, 0, -1, 1, 3, -5, -2, -13, 7, -1, -2, -2, -6, 4, -6, 0, 2, -2, 2, 4, 1, -4, 1, -47, -21, 7, -6 }, - { 3, 16, -7, 13, -4, -2, 10, -3, -1, 18, -13, 7, -13, -4, 8, 4, + { 3, 16, -7, 13, -4, -2, 10, -3, -1, 18, -13, 7, -13, -4, 8, 4, 8, 9, -5, 13, 8, -5, 3, -6, 7, 18, -8, 10, -25, -3, -12, -12 }, - { 1, -1, -1, 0, 2, 5, -5, -3, 0, -5, -1, 0, -4, -8, -2, 3, + { 1, -1, -1, 0, 2, 5, -5, -3, 0, -5, -1, 0, -4, -8, -2, 3, 2, -2, -17, -6, -4, 1, 33, -6, -20, -6, 8, 31, -26, -8, -1, -4 }, - { 3, -3, -3, 5, -3, -2, 1, 7, 0, 3, 6, 3, 6, -2, 9, 15, + { 3, -3, -3, 5, -3, -2, 1, 7, 0, 3, 6, 3, 6, -2, 9, 15, -10, -3, -15, -5, -3, -4, -6, -30, 17, -8, -2, 2, -20, 0, -8, -2 }, - { -2, -1, -1, -1, 3, -5, -2, -3, 4, -2, 0, 5, 8, -3, 1, -4, + { -2, -1, -1, -1, 3, -5, -2, -3, 4, -2, 0, 5, 8, -3, 1, -4, 1, 1, -3, 4, 4, -14, 3, 11, -5, 3, -3, 7, -3, 13, 23, -16 }, - { 2, -6, 1, -3, 5, 0, -6, -11, -7, -4, -1, 2, -7, -1, -1, 7, + { 2, -6, 1, -3, 5, 0, -6, -11, -7, -4, -1, 2, -7, -1, -1, 7, 1, -2, 6, 12, -6, 8, -13, 17, 25, -23, -19, -7, -12, 9, 16, -17 }, - { 9, 4, 4, 4, -3, -1, 6, -2, -3, 0, 13, -4, -7, 14, 1, -7, + { 9, 4, 4, 4, -3, -1, 6, -2, -3, 0, 13, -4, -7, 14, 1, -7, 0, -5, 3, -19, -3, 5, 3, 9, -1, 9, -13, 13, -17, 4, 21, -26 }, - { 0, -5, 0, 0, -4, -5, 2, -6, -4, 5, -7, 10, 0, 2, 0, -2, + { 0, -5, 0, 0, -4, -5, 2, -6, -4, 5, -7, 10, 0, 2, 0, -2, -2, 0, 4, -6, 7, -2, 6, 5, -5, 2, -12, 1, -29, 29, 27, 12 }, - { 9, -10, -22, 6, -1, -1, 9, -14, -12, -2, 1, -1, 10, -11, -16, 0, + { 9, -10, -22, 6, -1, -1, 9, -14, -12, -2, 1, -1, 10, -11, -16, 0, 3, 11, 13, -14, -9, -2, -1, 6, 4, -14, 0, -10, -2, 16, 17, -11 }, - { 2, 0, -1, -2, 4, 3, -6, -2, 1, -1, 1, 3, -4, 1, 3, -4, + { 2, 0, -1, -2, 4, 3, -6, -2, 1, -1, 1, 3, -4, 1, 3, -4, -1, -1, 4, -1, 1, 0, 1, 6, -5, -7, 2, 1, -47, -3, 50, -17 }, - { 8, -4, -11, -7, 11, 11, 14, -7, 12, -7, 6, 2, 13, -6, -3, -2, + { 8, -4, -11, -7, 11, 11, 14, -7, 12, -7, 6, 2, 13, -6, -3, -2, -14, 6, 6, 6, 0, 2, -1, 5, -20, 2, -1, 4, -5, 6, 21, -11 }, - { -2, -9, 3, 0, -6, 7, 8, -8, 1, -3, 4, 1, 5, -2, -3, -7, + { -2, -9, 3, 0, -6, 7, 8, -8, 1, -3, 4, 1, 5, -2, -3, -7, 4, 7, -12, -9, -2, 10, -6, 13, 6, 5, 20, 2, -15, 9, 28, -7 }, - { 0, -5, -6, -6, -6, 1, -6, 6, -2, 4, 8, -3, 12, -1, -4, -2, + { 0, -5, -6, -6, -6, 1, -6, 6, -2, 4, 8, -3, 12, -1, -4, -2, 6, 16, -14, 9, -14, -2, -8, -27, -3, 18, -1, -7, -3, 8, 23, -23 }, - { 1, 4, -9, -1, -5, 10, -2, 1, -11, 1, -9, 4, 7, 14, -9, -2, + { 1, 4, -9, -1, -5, 10, -2, 1, -11, 1, -9, 4, 7, 14, -9, -2, -3, 2, -5, -1, -6, -10, -7, 11, 20, 2, 3, -19, 3, 15, 30, -9 }, - { 7, 2, -14, -4, 0, -2, 5, 2, 5, -2, 8, -3, -7, 6, 6, -11, + { 7, 2, -14, -4, 0, -2, 5, 2, 5, -2, 8, -3, -7, 6, 6, -11, -14, 1, 10, -1, -7, -8, 1, 10, 3, -6, -15, -12, -17, 4, 30, -6 }, - { 4, 2, 1, -2, 3, 0, 1, 0, 2, 0, 1, 6, -7, 0, 3, 4, + { 4, 2, 1, -2, 3, 0, 1, 0, 2, 0, 1, 6, -7, 0, 3, 4, 4, -4, -2, -5, -2, 2, -1, -2, 0, -2, -11, -7, -3, 42, 24, -14 }, - { 4, 1, 3, 2, 0, -2, -3, -2, 2, -1, 4, 11, -2, 2, 3, -4, + { 4, 1, 3, 2, 0, -2, -3, -2, 2, -1, 4, 11, -2, 2, 3, -4, -5, 9, 2, -4, -9, 5, 8, -1, -7, 1, 24, -13, -28, 20, 15, -22 }, - { -3, 7, 6, 3, -2, -5, -10, -2, -2, -1, -6, -6, -2, -14, -16, -6, + { -3, 7, 6, 3, -2, -5, -10, -2, -2, -1, -6, -6, -2, -14, -16, -6, -5, 0, 18, 0, 9, 1, 7, -13, -5, -6, -9, 11, -15, 9, 22, -11 }, - { 9, -2, 6, 5, 2, 9, -10, 1, 1, 5, -4, 12, 2, 2, -10, -7, + { 9, -2, 6, 5, 2, 9, -10, 1, 1, 5, -4, 12, 2, 2, -10, -7, -4, -6, 7, 9, 6, 15, 6, 6, -10, 10, 5, -13, -5, 6, 24, -12 }, - { 1, 3, -3, -3, 8, 1, -6, 2, -5, -3, 7, 2, 14, 6, 9, -6, + { 1, 3, -3, -3, 8, 1, -6, 2, -5, -3, 7, 2, 14, 6, 9, -6, -5, -4, 27, 7, -3, 8, -6, 3, -8, 8, 22, -5, -6, -2, 22, -17 }, - { -2, -2, 3, 10, 9, 9, 12, -15, -1, -11, -13, 3, -2, 1, -3, -11, + { -2, -2, 3, 10, 9, 9, 12, -15, -1, -11, -13, 3, -2, 1, -3, -11, 7, 9, 16, -3, -10, -5, -5, 1, 8, -3, 9, 9, -5, 3, 31, -12 }, - { 7, -5, 10, -4, -8, 2, 16, -2, 10, 10, -3, -2, 3, -8, -3, 3, + { 7, -5, 10, -4, -8, 2, 16, -2, 10, 10, -3, -2, 3, -8, -3, 3, -13, -6, 15, 20, -9, -3, -12, 1, -2, -16, 8, 8, -1, 16, 22, -5 }, - { 5, -3, -15, -2, 12, -8, 8, -5, 2, -8, 20, -18, 14, -4, 3, 3, + { 5, -3, -15, -2, 12, -8, 8, -5, 2, -8, 20, -18, 14, -4, 3, 3, 7, -13, -16, 1, -10, 7, 16, 7, 4, -14, -4, -5, -9, 8, 23, -6 }, - { 5, -4, -5, -4, 1, 8, 4, -7, -5, 8, 10, 6, -6, -10, -2, 6, + { 5, -4, -5, -4, 1, 8, 4, -7, -5, 8, 10, 6, -6, -10, -2, 6, 9, -17, -14, 11, 12, -3, -13, -7, 2, 18, 3, -25, -16, 18, 22, -5 }, - { 5, 6, -7, -20, -4, 2, 8, 4, -24, -4, 1, 4, -5, -2, 1, -10, + { 5, 6, -7, -20, -4, 2, 8, 4, -24, -4, 1, 4, -5, -2, 1, -10, -2, 9, 3, -4, -3, -4, -4, -4, 10, 10, 3, 0, -6, 25, 21, -11 }, - { 0, 7, -1, 14, -6, -4, -10, 5, 4, 4, 4, -5, 3, 4, -1, -7, + { 0, 7, -1, 14, -6, -4, -10, 5, 4, 4, 4, -5, 3, 4, -1, -7, 8, -19, 0, 6, 2, 3, -18, -3, -6, 2, 8, 14, -26, 22, 27, -13 }, - { -2, -6, 7, -5, 12, -7, 8, -1, 3, -2, 4, 1, 8, -2, 0, 14, + { -2, -6, 7, -5, 12, -7, 8, -1, 3, -2, 4, 1, 8, -2, 0, 14, 6, -5, 6, -4, -7, 7, -21, 8, 1, 8, -9, -4, -3, 11, 25, -13 }, - { 4, 4, -1, -6, 4, 9, -8, 1, -3, -10, -2, 0, 15, -9, -16, 11, + { 4, 4, -1, -6, 4, 9, -8, 1, -3, -10, -2, 0, 15, -9, -16, 11, 1, 1, 6, 3, -9, -5, 16, 26, 1, -14, 1, -3, -14, 7, 15, -9 }, - { -12, -2, -9, -13, 2, 6, 14, 0, 1, 0, -1, -13, 0, 10, -1, 6, + { -12, -2, -9, -13, 2, 6, 14, 0, 1, 0, -1, -13, 0, 10, -1, 6, 9, -7, 8, 8, 19, 6, -1, 9, 10, -4, 1, -7, -22, -2, 29, -7 }, - { 2, 4, 13, -12, -8, -4, -5, 13, 12, -5, -3, -3, -4, 1, -1, 10, + { 2, 4, 13, -12, -8, -4, -5, 13, 12, -5, -3, -3, -4, 1, -1, 10, 15, -6, -1, -11, -30, 4, 15, -1, 9, -7, 0, -2, -7, 10, 25, -16 }, - { 7, -15, -7, -7, -1, -5, -5, -11, -20, 10, 3, -10, -3, 5, 20, -4, + { 7, -15, -7, -7, -1, -5, -5, -11, -20, 10, 3, -10, -3, 5, 20, -4, 0, -2, -2, 17, 2, 0, -3, 3, 6, 5, -1, -12, -3, 15, 22, -16 }, - { 4, -1, 3, 4, -5, 0, -1, -5, -24, -29, 4, -9, 1, -3, 0, 0, + { 4, -1, 3, 4, -5, 0, -1, -5, -24, -29, 4, -9, 1, -3, 0, 0, 0, -4, 7, -4, -4, -4, 3, 1, -6, 5, -3, -5, -10, 3, 25, -10 }, - { -2, -1, -1, 4, 4, -1, 2, 0, -4, -4, 2, -1, -3, -1, -2, -2, + { -2, -1, -1, 4, 4, -1, 2, 0, -4, -4, 2, -1, -3, -1, -2, -2, 1, -3, -5, -1, 2, -3, -4, -4, -3, 5, -9, 1, -11, 7, 46, -46 }, - { 0, -9, 3, 4, 4, 3, -5, -6, 5, -4, 4, -2, 1, 7, -4, -10, + { 0, -9, 3, 4, 4, 3, -5, -6, 5, -4, 4, -2, 1, 7, -4, -10, 13, 1, 3, -6, 4, -4, 7, 2, -19, -25, -3, -16, -12, 16, 20, -1 }, - { 18, 6, 4, -12, 0, -14, 9, -6, -1, -4, -5, 2, 1, 12, 4, 2, + { 18, 6, 4, -12, 0, -14, 9, -6, -1, -4, -5, 2, 1, 12, 4, 2, 7, 0, 2, 5, -11, -5, -2, 2, -4, 10, 0, -9, -7, 9, 25, -8 }, - { 5, 0, -6, 5, 6, 3, 3, -10, -5, 1, -1, 4, 3, -11, -8, 5, + { 5, 0, -6, 5, 6, 3, 3, -10, -5, 1, -1, 4, 3, -11, -8, 5, 4, -5, 5, -5, -7, -5, 11, 5, 20, -8, -16, 21, -4, 27, 23, -5 } }; diff --git a/src/libdts/xine_dts_decoder.c b/src/libdts/xine_dts_decoder.c index eba750110..4c452c06d 100644 --- a/src/libdts/xine_dts_decoder.c +++ b/src/libdts/xine_dts_decoder.c @@ -1,23 +1,23 @@ -/* +/* * Copyright (C) 2000-2005 the xine project - * + * * This file is part of xine, a unix video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * - * 04-09-2001 DTS passtrough (C) Joachim Koenig + * 04-09-2001 DTS passtrough (C) Joachim Koenig * 09-12-2001 DTS passthrough inprovements (C) James Courtier-Dutton */ @@ -72,7 +72,7 @@ typedef struct { dts_state_t *dts_state; int64_t pts; - int audio_caps; + int audio_caps; int sync_state; int ac5_length, ac5_pcm_length, frame_todo; uint32_t syncdword; @@ -80,7 +80,7 @@ typedef struct { uint8_t *frame_ptr; int output_open; - + int bypass_mode; int dts_flags; int dts_sample_rate; @@ -88,8 +88,8 @@ typedef struct { int dts_flags_map[11]; /* Convert from stream dts_flags to the dts_flags we want from the dts downmixer */ int ao_flags_map[11]; /* Convert from the xine AO_CAP's to dts_flags. */ int have_lfe; - - + + } dts_decoder_t; static void dts_reset (audio_decoder_t *this_gen); @@ -138,7 +138,7 @@ static inline void float_to_int (float * _f, int16_t * s16, int num_channels) { static inline void mute_channel (int16_t * s16, int num_channels) { int i; - + for (i = 0; i < 256; i++) { s16[num_channels*i] = 0; } @@ -151,7 +151,7 @@ static void dts_decode_frame (dts_decoder_t *this, int64_t pts, int preview_mode int output_mode = AO_CAP_MODE_STEREO; uint8_t *data_out; uint8_t *data_in = this->frame_buffer; - + lprintf("decode_frame\n"); audio_buffer = this->stream->audio_out->get_buffer (this->stream->audio_out); audio_buffer->vpts = pts; @@ -160,13 +160,13 @@ static void dts_decode_frame (dts_decoder_t *this, int64_t pts, int preview_mode /* SPDIF digital output */ if (!this->output_open) { this->output_open = ((this->stream->audio_out->open) (this->stream->audio_out, this->stream, - 16, this->dts_sample_rate, + 16, this->dts_sample_rate, AO_CAP_MODE_AC5)); } - - if (!this->output_open) + + if (!this->output_open) return; - + data_out=(uint8_t *) audio_buffer->mem; if (this->ac5_length > 8191) { xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "libdts: ac5_length too long\n"); @@ -184,7 +184,7 @@ static void dts_decode_frame (dts_decoder_t *this, int64_t pts, int preview_mode ac5_spdif_type = 0x0d; /* DTS-1 (2048-sample bursts) */ break; default: - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "libdts: DTS %i-sample bursts not supported\n", this->ac5_pcm_length); return; } @@ -264,17 +264,17 @@ static void dts_decode_frame (dts_decoder_t *this, int64_t pts, int preview_mode if (!this->output_open) { this->output_open = (this->stream->audio_out->open) (this->stream->audio_out, this->stream, - 16, this->dts_sample_rate, + 16, this->dts_sample_rate, output_mode); } - - if (!this->output_open) + + if (!this->output_open) return; - number_of_dts_blocks = dts_blocks_num (this->dts_state); + number_of_dts_blocks = dts_blocks_num (this->dts_state); audio_buffer->num_frames = 256*number_of_dts_blocks; for(i = 0; i < number_of_dts_blocks; i++) { if(dts_block(this->dts_state)) { - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "libdts: dts_block error on audio channel %d\n", i); audio_buffer->num_frames = 0; break; @@ -328,10 +328,10 @@ static void dts_decode_frame (dts_decoder_t *this, int64_t pts, int preview_mode } } } - + this->stream->audio_out->put_buffer (this->stream->audio_out, audio_buffer, this->stream); - - + + } static void dts_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { @@ -340,7 +340,7 @@ static void dts_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { uint8_t *current = (uint8_t *)buf->content; uint8_t *sync_start=current + 1; uint8_t *end = buf->content + buf->size; - + lprintf("decode_data\n"); if (buf->decoder_flags & BUF_FLAG_PREVIEW) @@ -453,14 +453,14 @@ static void dts_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { } } break; - + case 2: /* Filling frame_buffer with sync_info bytes */ *this->frame_ptr++ = *current++; this->frame_todo--; if (this->frame_todo < 1) { this->sync_state = 3; } else break; - + case 3: /* Ready for decode */ #if 0 dtsdec_decode_frame (this, this->pts_list[0], buf->decoder_flags & BUF_FLAG_PREVIEW); @@ -472,19 +472,19 @@ static void dts_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { this->syncdword = 0; this->sync_state = 0; break; - default: /* No come here */ + default: /* No come here */ break; } } } static void dts_dispose (audio_decoder_t *this_gen) { - dts_decoder_t *this = (dts_decoder_t *) this_gen; - - if (this->output_open) + dts_decoder_t *this = (dts_decoder_t *) this_gen; + + if (this->output_open) this->stream->audio_out->close (this->stream->audio_out, this->stream); this->output_open = 0; - + free (this); } @@ -531,7 +531,7 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, xine_stre this->dts_flags_map[DTS_3F2R] = DTS_3F2R | DTS_LFE; this->ao_flags_map[DTS_2F2R] = AO_CAP_MODE_4CHANNEL; this->ao_flags_map[DTS_3F2R] = AO_CAP_MODE_5CHANNEL; - + } else if (this->audio_caps & AO_CAP_MODE_5CHANNEL) { this->dts_flags_map[DTS_2F2R] = DTS_2F2R; @@ -612,7 +612,7 @@ static void *init_plugin (xine_t *xine, void *data) { return this; } -static uint32_t audio_types[] = { +static uint32_t audio_types[] = { BUF_AUDIO_DTS, 0 }; @@ -622,7 +622,7 @@ static const decoder_info_t dec_info_audio = { }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_AUDIO_DECODER, 15, "dts", XINE_VERSION_CODE, &dec_info_audio, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libfaad/codebook/Makefile.am b/src/libfaad/codebook/Makefile.am index e4691f4b9..63d225b2d 100644 --- a/src/libfaad/codebook/Makefile.am +++ b/src/libfaad/codebook/Makefile.am @@ -12,4 +12,4 @@ EXTRA_DIST = hcb.h \ hcb_9.h \ hcb_10.h \ hcb_11.h \ - hcb_sf.h + hcb_sf.h diff --git a/src/libfaad/xine_faad_decoder.c b/src/libfaad/xine_faad_decoder.c index b90bc701f..086c1daf5 100644 --- a/src/libfaad/xine_faad_decoder.c +++ b/src/libfaad/xine_faad_decoder.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2005 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -58,30 +58,30 @@ typedef struct faad_decoder_s { audio_decoder_t audio_decoder; xine_stream_t *stream; - + /* faad2 stuff */ NeAACDecHandle faac_dec; NeAACDecConfigurationPtr faac_cfg; NeAACDecFrameInfo faac_finfo; int faac_failed; - + int raw_mode; - + unsigned char *buf; int size; int rec_audio_src_size; int max_audio_src_size; int pts; - + unsigned char *dec_config; int dec_config_size; - + uint32_t rate; - int bits_per_sample; - unsigned char num_channels; + int bits_per_sample; + unsigned char num_channels; int sbr; - uint32_t ao_cap_mode; - + uint32_t ao_cap_mode; + int output_open; unsigned long total_time; @@ -139,7 +139,7 @@ static int faad_open_dec( faad_decoder_t *this ) { if( this->dec_config ) { used = NeAACDecInit2(this->faac_dec, this->dec_config, this->dec_config_size, &this->rate, &this->num_channels); - + if( used < 0 ) { xprintf( this->stream->xine, XINE_VERBOSITY_LOG, _("libfaad: libfaad NeAACDecInit2 failed.\n")); @@ -150,7 +150,7 @@ static int faad_open_dec( faad_decoder_t *this ) { } else { used = NeAACDecInit(this->faac_dec, this->buf, this->size, &this->rate, &this->num_channels); - + if( used < 0 ) { xprintf ( this->stream->xine, XINE_VERBOSITY_LOG, _("libfaad: libfaad NeAACDecInit failed.\n")); @@ -158,16 +158,16 @@ static int faad_open_dec( faad_decoder_t *this ) { } else { lprintf( "NeAACDecInit() returned rate=%"PRId32" channels=%d (used=%d)\n", this->rate, this->num_channels, used); - + this->size -= used; memmove( this->buf, &this->buf[used], this->size ); } } } - + if( !this->bits_per_sample ) this->bits_per_sample = 16; - + if( this->faac_failed ) { if( this->faac_dec ) { NeAACDecClose( this->faac_dec ); @@ -177,16 +177,16 @@ static int faad_open_dec( faad_decoder_t *this ) { } else { faad_meta_info_set(this); } - + return this->faac_failed; } static int faad_open_output( faad_decoder_t *this ) { this->rec_audio_src_size = this->num_channels * FAAD_MIN_STREAMSIZE; - + switch( this->num_channels ) { case 1: - this->ao_cap_mode=AO_CAP_MODE_MONO; + this->ao_cap_mode=AO_CAP_MODE_MONO; break; case 6: if(this->stream->audio_out->get_capabilities(this->stream->audio_out) & @@ -201,11 +201,11 @@ static int faad_open_output( faad_decoder_t *this ) { } case 2: this->ao_cap_mode=AO_CAP_MODE_STEREO; - break; + break; default: return 0; } - + this->output_open = (this->stream->audio_out->open) (this->stream->audio_out, this->stream, this->bits_per_sample, @@ -220,48 +220,48 @@ static void faad_decode_audio ( faad_decoder_t *this, int end_frame ) { uint8_t *inbuf; audio_buffer_t *audio_buffer; int sample_size = this->size; - + if( !this->faac_dec ) return; inbuf = this->buf; while( (!this->raw_mode && end_frame && this->size >= 10) || (this->raw_mode && this->size >= this->rec_audio_src_size) ) { - - sample_buffer = NeAACDecDecode(this->faac_dec, + + sample_buffer = NeAACDecDecode(this->faac_dec, &this->faac_finfo, inbuf, sample_size); - + if( !sample_buffer ) { xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "libfaad: %s\n", NeAACDecGetErrorMessage(this->faac_finfo.error)); - used = 1; + used = 1; } else { used = this->faac_finfo.bytesconsumed; - + /* raw AAC parameters might only be known after decoding the first frame */ if( !this->dec_config && (this->num_channels != this->faac_finfo.channels || this->rate != this->faac_finfo.samplerate) ) { - + this->num_channels = this->faac_finfo.channels; this->rate = this->faac_finfo.samplerate; - + lprintf("faacDecDecode() returned rate=%"PRId32" channels=%d used=%d\n", this->rate, this->num_channels, used); - + this->stream->audio_out->close (this->stream->audio_out, this->stream); this->output_open = 0; faad_open_output( this ); faad_meta_info_set( this ); } - + /* faad doesn't tell us about sbr until after the first frame */ if (this->sbr != this->faac_finfo.sbr) { this->sbr = this->faac_finfo.sbr; faad_meta_info_set( this ); } - + /* estimate bitrate */ this->total_time += (1000*this->faac_finfo.samples/(this->rate*this->num_channels)); this->total_data += 8*used; @@ -307,25 +307,25 @@ static void faad_decode_audio ( faad_decoder_t *this, int end_frame ) { while( decoded ) { audio_buffer = this->stream->audio_out->get_buffer (this->stream->audio_out); - + if( decoded < audio_buffer->mem_size ) - outsize = decoded; + outsize = decoded; else outsize = audio_buffer->mem_size; - + xine_fast_memcpy( audio_buffer->mem, sample_buffer, outsize ); audio_buffer->num_frames = outsize / (this->num_channels*2); audio_buffer->vpts = this->pts; this->stream->audio_out->put_buffer (this->stream->audio_out, audio_buffer, this->stream); - + this->pts = 0; decoded -= outsize; sample_buffer += outsize; } } - + if(used >= this->size){ this->size = 0; } else { @@ -334,7 +334,7 @@ static void faad_decode_audio ( faad_decoder_t *this, int end_frame ) { } if( !this->raw_mode ) - this->size = 0; + this->size = 0; } if( this->size ) @@ -345,31 +345,31 @@ static void faad_decode_audio ( faad_decoder_t *this, int end_frame ) { static void faad_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { faad_decoder_t *this = (faad_decoder_t *) this_gen; - + if (buf->decoder_flags & BUF_FLAG_PREVIEW) return; /* store config information from ESDS mp4/qt atom */ if( !this->faac_dec && (buf->decoder_flags & BUF_FLAG_SPECIAL) && buf->decoder_info[1] == BUF_SPECIAL_DECODER_CONFIG ) { - + this->dec_config = malloc(buf->decoder_info[2]); this->dec_config_size = buf->decoder_info[2]; memcpy(this->dec_config, buf->decoder_info_ptr[2], buf->decoder_info[2]); - + if( faad_open_dec(this) ) return; this->raw_mode = 0; } - /* get audio parameters from file header - (may be overwritten by libfaad returned parameters) */ + /* get audio parameters from file header + (may be overwritten by libfaad returned parameters) */ if (buf->decoder_flags & BUF_FLAG_STDHEADER) { this->rate=buf->decoder_info[1]; - this->bits_per_sample=buf->decoder_info[2] ; - this->num_channels=buf->decoder_info[3] ; - + this->bits_per_sample=buf->decoder_info[2] ; + this->num_channels=buf->decoder_info[3] ; + if( buf->size > sizeof(xine_waveformatex) ) { xine_waveformatex *wavex = (xine_waveformatex *) buf->content; @@ -378,7 +378,7 @@ static void faad_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { this->dec_config_size = wavex->cbSize; memcpy(this->dec_config, buf->content + sizeof(xine_waveformatex), wavex->cbSize); - + if( faad_open_dec(this) ) return; @@ -394,15 +394,15 @@ static void faad_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { if( !this->size ) this->pts = buf->pts; - + if( this->size + buf->size > this->max_audio_src_size ) { this->max_audio_src_size = this->size + 2 * buf->size; this->buf = realloc( this->buf, this->max_audio_src_size ); } - + memcpy (&this->buf[this->size], buf->content, buf->size); this->size += buf->size; - + if( !this->faac_dec && faad_open_dec(this) ) return; @@ -420,23 +420,23 @@ static void faad_discontinuity (audio_decoder_t *this_gen) { static void faad_dispose (audio_decoder_t *this_gen) { - faad_decoder_t *this = (faad_decoder_t *) this_gen; + faad_decoder_t *this = (faad_decoder_t *) this_gen; - if (this->output_open) + if (this->output_open) this->stream->audio_out->close (this->stream->audio_out, this->stream); this->output_open = 0; - + if( this->buf ) free(this->buf); this->buf = NULL; this->size = 0; this->max_audio_src_size = 0; - + if( this->dec_config ) free(this->dec_config); this->dec_config = NULL; this->dec_config_size = 0; - + if( this->faac_dec ) NeAACDecClose(this->faac_dec); this->faac_dec = NULL; @@ -460,7 +460,7 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, xine_stre this->stream = stream; this->output_open = 0; this->raw_mode = 1; - this->faac_dec = NULL; + this->faac_dec = NULL; this->faac_failed = 0; this->buf = NULL; this->size = 0; @@ -501,7 +501,7 @@ static void *init_plugin (xine_t *xine, void *data) { return this; } -static uint32_t audio_types[] = { +static uint32_t audio_types[] = { BUF_AUDIO_AAC, 0 }; diff --git a/src/libffmpeg/libavcodec/Makefile.am b/src/libffmpeg/libavcodec/Makefile.am index a5e6cd650..09c539b62 100644 --- a/src/libffmpeg/libavcodec/Makefile.am +++ b/src/libffmpeg/libavcodec/Makefile.am @@ -123,7 +123,7 @@ libavcodec_la_SOURCES = \ wnv1.c \ xan.c \ xl.c \ - zmbv.c + zmbv.c libavcodec_la_LDFLAGS = \ $(top_builddir)/src/libffmpeg/libavcodec/armv4l/libavcodec_armv4l.la \ diff --git a/src/libffmpeg/libavcodec/armv4l/Makefile.am b/src/libffmpeg/libavcodec/armv4l/Makefile.am index 33e0882c9..38979bc95 100644 --- a/src/libffmpeg/libavcodec/armv4l/Makefile.am +++ b/src/libffmpeg/libavcodec/armv4l/Makefile.am @@ -18,6 +18,6 @@ EXTRA_DIST = $(libavcodec_armv4l_src) $(libavcodec_armv4l_dummy) #if HAVE_ARMV4L #armv4l_modules = $(libavcodec_armv4l_src) #endif -armv4l_modules = +armv4l_modules = libavcodec_armv4l_la_SOURCES = $(armv4l_modules) $(libavcodec_armv4l_dummy) diff --git a/src/libffmpeg/libavcodec/i386/dsputil_mmx.c b/src/libffmpeg/libavcodec/i386/dsputil_mmx.c index 673e749c4..27c0c678c 100644 --- a/src/libffmpeg/libavcodec/i386/dsputil_mmx.c +++ b/src/libffmpeg/libavcodec/i386/dsputil_mmx.c @@ -2566,17 +2566,17 @@ static void gmc_mmx(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int o "psrlw %5, %%mm0 \n\t" "packuswb %%mm0, %%mm0 \n\t" - : + : : "m"(src[0]), "m"(src[1]), "m"(src[stride]), "m"(src[stride+1]), "m"(*r4), "m"(shift2) ); - + asm volatile( "movd %%mm0, %0 \n\t" : "=m"(dst[x+y*stride]) - : + : ); src += stride; } diff --git a/src/libffmpeg/libavcodec/libpostproc/Makefile.am b/src/libffmpeg/libavcodec/libpostproc/Makefile.am index 66bd17e53..a047bb8cd 100644 --- a/src/libffmpeg/libavcodec/libpostproc/Makefile.am +++ b/src/libffmpeg/libavcodec/libpostproc/Makefile.am @@ -3,7 +3,7 @@ include $(top_srcdir)/misc/Makefile.common # -fomit-frame-pointer is always needed. it might cause debug to not # work, but at least it compiles. AM_CFLAGS = -fomit-frame-pointer -fno-strict-aliasing -AM_CPPFLAGS = $(LIBFFMPEG_CPPFLAGS) -I$(top_srcdir)/src/libffmpeg/libavcodec +AM_CPPFLAGS = $(LIBFFMPEG_CPPFLAGS) -I$(top_srcdir)/src/libffmpeg/libavcodec # Avoid errors with -O0 postprocess.o postprocess.lo: CFLAGS=`echo @CFLAGS@ | sed -e 's/-O0\?\s/-Os /g'` diff --git a/src/libffmpeg/libavcodec/swscale.h b/src/libffmpeg/libavcodec/swscale.h index 06088b8e4..d3b430f84 100644 --- a/src/libffmpeg/libavcodec/swscale.h +++ b/src/libffmpeg/libavcodec/swscale.h @@ -23,7 +23,7 @@ /** * @file swscale.h - * @brief + * @brief * external api for the swscale stuff */ @@ -76,12 +76,12 @@ extern "C" { #define SWS_MAX_REDUCE_CUTOFF 0.002 #define SWS_CS_ITU709 1 -#define SWS_CS_FCC 4 +#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 +#define SWS_CS_SMPTE170M 5 +#define SWS_CS_SMPTE240M 7 +#define SWS_CS_DEFAULT 5 @@ -128,7 +128,7 @@ SwsVector *sws_cloneVec(SwsVector *a); void sws_printVec(SwsVector *a); void sws_freeVec(SwsVector *a); -SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur, +SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur, float lumaSarpen, float chromaSharpen, float chromaHShift, float chromaVShift, int verbose); diff --git a/src/libmad/fixed.h b/src/libmad/fixed.h index 658b3399e..d1465fd57 100644 --- a/src/libmad/fixed.h +++ b/src/libmad/fixed.h @@ -241,7 +241,7 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) # elif defined(FPM_ARM) -/* +/* * This ARM V4 version is as accurate as FPM_64BIT but much faster. The * least significant bit is properly rounded at no CPU cycle cost! */ diff --git a/src/libmad/synth.h b/src/libmad/synth.h index d5a63589e..64a8278d7 100644 --- a/src/libmad/synth.h +++ b/src/libmad/synth.h @@ -34,7 +34,7 @@ struct mad_pcm { struct mad_synth { mad_fixed_t filter[2][2][2][16][8]; /* polyphase filterbank outputs */ - /* [ch][eo][peo][s][v] */ + /* [ch][eo][peo][s][v] */ unsigned int phase; /* current processing phase */ diff --git a/src/libmad/xine_mad_decoder.c b/src/libmad/xine_mad_decoder.c index cb8c52831..c9067a676 100644 --- a/src/libmad/xine_mad_decoder.c +++ b/src/libmad/xine_mad_decoder.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA @@ -73,7 +73,7 @@ typedef struct mad_decoder_s { int64_t pts; - struct mad_synth synth; + struct mad_synth synth; struct mad_stream stream; struct mad_frame frame; @@ -115,7 +115,7 @@ static void mad_reset (audio_decoder_t *this_gen) { static void mad_discontinuity (audio_decoder_t *this_gen) { mad_decoder_t *this = (mad_decoder_t *) this_gen; - + this->pts = 0; } @@ -165,7 +165,7 @@ static void mad_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { buf->size, INPUT_BUF_SIZE-this->bytes_in_buffer); buf->size = INPUT_BUF_SIZE-this->bytes_in_buffer; } - + if ((buf->decoder_flags & BUF_FLAG_HEADER) == 0) { /* reset decoder on leaving preview mode */ @@ -179,15 +179,15 @@ static void mad_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { bytes_in_buffer_at_pts = this->bytes_in_buffer; - xine_fast_memcpy (&this->buffer[this->bytes_in_buffer], + xine_fast_memcpy (&this->buffer[this->bytes_in_buffer], buf->content, buf->size); this->bytes_in_buffer += buf->size; - + /* printf ("libmad: decode data - doing it\n"); */ - mad_stream_buffer (&this->stream, this->buffer, + mad_stream_buffer (&this->stream, this->buffer, this->bytes_in_buffer); if (this->bytes_in_buffer < MAD_MIN_SIZE) @@ -211,7 +211,7 @@ static void mad_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { if (this->stream.next_frame) { int num_bytes = this->buffer + this->bytes_in_buffer - this->stream.next_frame; - + /* printf("libmad: MAD_ERROR_BUFLEN\n"); */ memmove(this->buffer, this->stream.next_frame, num_bytes); @@ -225,16 +225,16 @@ static void mad_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { this->needs_more_data = 1; return; - default: + default: lprintf ("error 0x%04X, mad_stream_buffer %d bytes\n", this->stream.error, this->bytes_in_buffer); - mad_stream_buffer (&this->stream, this->buffer, + mad_stream_buffer (&this->stream, this->buffer, this->bytes_in_buffer); } } else { int mode = (this->frame.header.mode == MAD_MODE_SINGLE_CHANNEL) ? AO_CAP_MODE_MONO : AO_CAP_MODE_STEREO; - if (!this->output_open + if (!this->output_open || (this->output_sampling_rate != this->frame.header.samplerate) || (this->output_mode != mode)) { @@ -250,23 +250,23 @@ static void mad_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { if (! _x_meta_info_get(this->xstream, XINE_META_INFO_AUDIOCODEC)) { switch (this->frame.header.layer) { case MAD_LAYER_I: - _x_meta_info_set_utf8(this->xstream, XINE_META_INFO_AUDIOCODEC, + _x_meta_info_set_utf8(this->xstream, XINE_META_INFO_AUDIOCODEC, "MPEG audio layer 1 (lib: MAD)"); break; case MAD_LAYER_II: - _x_meta_info_set_utf8(this->xstream, XINE_META_INFO_AUDIOCODEC, + _x_meta_info_set_utf8(this->xstream, XINE_META_INFO_AUDIOCODEC, "MPEG audio layer 2 (lib: MAD)"); break; case MAD_LAYER_III: - _x_meta_info_set_utf8(this->xstream, XINE_META_INFO_AUDIOCODEC, + _x_meta_info_set_utf8(this->xstream, XINE_META_INFO_AUDIOCODEC, "MPEG audio layer 3 (lib: MAD)"); break; default: - _x_meta_info_set_utf8(this->xstream, XINE_META_INFO_AUDIOCODEC, + _x_meta_info_set_utf8(this->xstream, XINE_META_INFO_AUDIOCODEC, "MPEG audio (lib: MAD)"); } } - + if (this->output_open) { this->xstream->audio_out->close (this->xstream->audio_out, this->xstream); this->output_open = 0; @@ -274,7 +274,7 @@ static void mad_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { if (!this->output_open) { this->output_open = (this->xstream->audio_out->open) (this->xstream->audio_out, this->xstream, 16, - this->frame.header.samplerate, + this->frame.header.samplerate, mode) ; } if (!this->output_open) { @@ -287,7 +287,7 @@ static void mad_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { mad_synth_frame (&this->synth, &this->frame); if ( (buf->decoder_flags & BUF_FLAG_PREVIEW) == 0 ) { - + unsigned int nchannels, nsamples; mad_fixed_t const *left_ch, *right_ch; struct mad_pcm *pcm = &this->synth.pcm; @@ -323,10 +323,10 @@ static void mad_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { while (nsamples--) { /* output sample(s) in 16-bit signed little-endian PCM */ - + *output++ = scale(*left_ch++); - - if (nchannels == 2) + + if (nchannels == 2) *output++ = scale(*right_ch++); } @@ -371,13 +371,13 @@ static void mad_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { static void mad_dispose (audio_decoder_t *this_gen) { - mad_decoder_t *this = (mad_decoder_t *) this_gen; + mad_decoder_t *this = (mad_decoder_t *) this_gen; mad_synth_finish (&this->synth); mad_frame_finish (&this->frame); mad_stream_finish(&this->stream); - if (this->output_open) { + if (this->output_open) { this->xstream->audio_out->close (this->xstream->audio_out, this->xstream); this->output_open = 0; } @@ -408,7 +408,7 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, xine_stre this->stream.options = MAD_OPTION_IGNORECRC; - lprintf ("init\n"); + lprintf ("init\n"); return &this->audio_decoder; } @@ -432,7 +432,7 @@ static void dispose_class (audio_decoder_class_t *this) { static void *init_plugin (xine_t *xine, void *data) { mad_class_t *this; - + this = (mad_class_t *) calloc(1, sizeof(mad_class_t)); this->decoder_class.open_plugin = open_plugin; @@ -443,7 +443,7 @@ static void *init_plugin (xine_t *xine, void *data) { return this; } -static uint32_t audio_types[] = { +static uint32_t audio_types[] = { BUF_AUDIO_MPEG, 0 }; @@ -453,7 +453,7 @@ static const decoder_info_t dec_info_audio = { }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_AUDIO_DECODER, 15, "mad", XINE_VERSION_CODE, &dec_info_audio, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libmpeg2/xine_mpeg2_decoder.c b/src/libmpeg2/xine_mpeg2_decoder.c index b136ee861..75bc829c9 100644 --- a/src/libmpeg2/xine_mpeg2_decoder.c +++ b/src/libmpeg2/xine_mpeg2_decoder.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -73,11 +73,11 @@ static void mpeg2dec_decode_data (video_decoder_t *this_gen, buf_element_t *buf) } return; } - + if (buf->decoder_flags & BUF_FLAG_PREVIEW) { mpeg2_find_sequence_header (&this->mpeg2, buf->content, buf->content + buf->size); } else { - + mpeg2_decode_data (&this->mpeg2, buf->content, buf->content + buf->size, buf->pts); } @@ -180,7 +180,7 @@ static const decoder_info_t dec_info_mpeg2 = { }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_VIDEO_DECODER, 18, "mpeg2", XINE_VERSION_CODE, &dec_info_mpeg2, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libmpeg2new/Makefile.am b/src/libmpeg2new/Makefile.am index 8b05a5444..924a9c661 100644 --- a/src/libmpeg2new/Makefile.am +++ b/src/libmpeg2new/Makefile.am @@ -13,6 +13,6 @@ xineplug_decode_mpeg2new_la_SOURCES = \ xine_mpeg2new_decoder.c xineplug_decode_mpeg2new_la_CFLAGS = $(VISIBILITY_FLAG) $(LIBMPEG2_CFLAGS) -xineplug_decode_mpeg2new_la_LIBADD = $(XINE_LIB) libmpeg2/libmpeg2.la +xineplug_decode_mpeg2new_la_LIBADD = $(XINE_LIB) libmpeg2/libmpeg2.la xineplug_decode_mpeg2new_la_LDFLAGS = $(xineplug_ldflags) diff --git a/src/libmpeg2new/xine_mpeg2new_decoder.c b/src/libmpeg2new/xine_mpeg2new_decoder.c index 8c16c441b..252cfcc54 100644 --- a/src/libmpeg2new/xine_mpeg2new_decoder.c +++ b/src/libmpeg2new/xine_mpeg2new_decoder.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA @@ -68,7 +68,7 @@ typedef struct mpeg2_video_decoder_s { img_state_t img_state[30]; uint32_t frame_number; uint32_t rff_pattern; - + } mpeg2_video_decoder_t; #ifndef LOG_FRAME_ALLOC_FREE @@ -85,7 +85,7 @@ static void mpeg2_video_print_bad_state(img_state_t * img_state) { } if (m > 3) _x_abort(); if (m == 0) printf("NO FRAMES\n"); -} +} #endif static void mpeg2_video_free_all(img_state_t * img_state) { @@ -99,7 +99,7 @@ static void mpeg2_video_free_all(img_state_t * img_state) { img_state[n].id = 0; } } -} +} static void mpeg2_video_print_fbuf(const mpeg2_fbuf_t * fbuf) { @@ -138,7 +138,7 @@ static void mpeg2_video_decode_data (video_decoder_t *this_gen, buf_element_t *b else this->force_pan_scan = 0; } - + return; } @@ -151,7 +151,7 @@ static void mpeg2_video_decode_data (video_decoder_t *this_gen, buf_element_t *b mpeg2_buffer (this->mpeg2dec, current, end); info = mpeg2_info (this->mpeg2dec); - + while ((state = mpeg2_parse (this->mpeg2dec)) != STATE_BUFFER) { switch (state) { case STATE_SEQUENCE: @@ -194,7 +194,7 @@ static void mpeg2_video_decode_data (video_decoder_t *this_gen, buf_element_t *b } else { picture_structure = VO_BOTH_FIELDS; } - + img = this->stream->video_out->get_frame (this->stream->video_out, info->sequence->picture_width, info->sequence->picture_height, @@ -214,7 +214,7 @@ static void mpeg2_video_decode_data (video_decoder_t *this_gen, buf_element_t *b img->duration += img->duration/4; } else { if( img->repeat_first_field ) { - img->duration = (img->duration * info->current_picture->nb_fields) / 2; + img->duration = (img->duration * info->current_picture->nb_fields) / 2; } } @@ -224,7 +224,7 @@ static void mpeg2_video_decode_data (video_decoder_t *this_gen, buf_element_t *b img->pts=0; } - + #ifdef LOG_FRAME_ALLOC_FREE printf ("libmpeg2:decode_data:get_frame xine=%p (id=%d)\n", img,img->id); #endif @@ -519,7 +519,7 @@ static const decoder_info_t dec_info_mpeg2 = { }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_VIDEO_DECODER, 18, "mpeg2new", XINE_VERSION_CODE, &dec_info_mpeg2, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libmusepack/Makefile.am b/src/libmusepack/Makefile.am index 11344c3c2..252e3d6ad 100644 --- a/src/libmusepack/Makefile.am +++ b/src/libmusepack/Makefile.am @@ -10,7 +10,7 @@ xineplug_LTLIBRARIES = xineplug_decode_mpc.la endif if EXTERNAL_MPCDEC -internal_sources = +internal_sources = else internal_sources = huffsv46.c huffsv7.c idtag.c mpc_decoder.c \ mpc_reader.c requant.c streaminfo.c synth_filter.c diff --git a/src/libmusepack/xine_musepack_decoder.c b/src/libmusepack/xine_musepack_decoder.c index 5977abd63..41b90b080 100644 --- a/src/libmusepack/xine_musepack_decoder.c +++ b/src/libmusepack/xine_musepack_decoder.c @@ -85,10 +85,10 @@ typedef struct mpc_decoder_s { #else mpc_demux *decoder; #endif - + int decoder_ok; unsigned int current_frame; - + int32_t file_size; } mpc_decoder_t; @@ -97,7 +97,7 @@ typedef struct mpc_decoder_s { /************************************************************************** * musepack specific functions *************************************************************************/ - + /* Reads size bytes of data into buffer at ptr. */ #ifndef HAVE_MPC_MPCDEC_H static int32_t mpc_reader_read(void *data, void *ptr, int size) { @@ -106,22 +106,22 @@ static int32_t mpc_reader_read(void *data, void *ptr, int size) { static int32_t mpc_reader_read(mpc_reader *data, void *ptr, int size) { mpc_decoder_t *this = (mpc_decoder_t *) data->data; #endif - + lprintf("mpc_reader_read: size=%d\n", size); - + /* Don't try to read more data than we have */ if (size > (this->size - this->read)) size = this->size - this->read; /* Copy the data */ xine_fast_memcpy(ptr, &this->buf[this->read], size); - + /* Update our position in the data buffer */ this->read += size; - + return size; } - + /* Seeks to byte position offset. */ #ifndef HAVE_MPC_MPCDEC_H static mpc_bool_t mpc_reader_seek(void *data, int32_t offset) { @@ -130,13 +130,13 @@ static mpc_bool_t mpc_reader_seek(void *data, int32_t offset) { static mpc_bool_t mpc_reader_seek(mpc_reader *data, int32_t offset) { mpc_decoder_t *this = (mpc_decoder_t *) data->data; #endif - + lprintf("mpc_reader_seek: offset=%d\n", offset); - + /* seek is only called when reading the header so we can assume * that the buffer starts at the start of the file */ this->read = offset; - + #ifndef HAVE_MPC_MPCDEC_H return TRUE; #else @@ -151,7 +151,7 @@ static int32_t mpc_reader_tell(void *data) { static int32_t mpc_reader_tell(mpc_reader *data) { #endif lprintf("mpc_reader_tell\n"); - + /* Tell isn't used so just return 0 */ return 0; } @@ -164,9 +164,9 @@ static int32_t mpc_reader_get_size(void *data) { static int32_t mpc_reader_get_size(mpc_reader *data) { mpc_decoder_t *this = (mpc_decoder_t *) data->data; #endif - + lprintf("mpc_reader_get_size\n"); - + return this->file_size; } @@ -174,7 +174,7 @@ static int32_t mpc_reader_get_size(mpc_reader *data) { #ifndef HAVE_MPC_MPCDEC_H static mpc_bool_t mpc_reader_canseek(void *data) { lprintf("mpc_reader_canseek\n"); - + return TRUE; #else static mpc_bool_t mpc_reader_canseek(mpc_reader *data) { @@ -204,9 +204,9 @@ static int mpc_decode_frame (mpc_decoder_t *this) { #ifdef HAVE_MPC_MPCDEC_H mpc_frame_info frame; #endif - + lprintf("mpd_decode_frame\n"); - + #ifndef HAVE_MPC_MPCDEC_H frames = mpc_decoder_decode(&this->decoder, buffer, 0, 0); #else @@ -214,26 +214,26 @@ static int mpc_decode_frame (mpc_decoder_t *this) { mpc_demux_decode(this->decoder, &frame); frames = frame.samples; #endif - + if (frames > 0) { - audio_buffer_t *audio_buffer; + audio_buffer_t *audio_buffer; int16_t *int_samples; - + lprintf("got %d samples\n", frames); - + /* Get audio buffer */ audio_buffer = this->stream->audio_out->get_buffer (this->stream->audio_out); audio_buffer->vpts = 0; audio_buffer->num_frames = frames; - + /* Convert samples */ int_samples = (int16_t *) audio_buffer->mem; float_to_int(buffer, int_samples, frames*this->channels); - + /* Output converted samples */ this->stream->audio_out->put_buffer (this->stream->audio_out, audio_buffer, this->stream); } - + return frames; } @@ -246,28 +246,28 @@ static void mpc_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { int err; lprintf("mpc_decode_data\n"); - + if (!_x_stream_info_get(this->stream, XINE_STREAM_INFO_AUDIO_HANDLED)) return; - + /* We don't handle special buffers */ if (buf->decoder_flags & BUF_FLAG_SPECIAL) return; - + /* Read header */ if (buf->decoder_flags & BUF_FLAG_HEADER) { - + lprintf("header\n"); - + /* File size is in decoder_info[0] */ this->file_size = buf->decoder_info[0]; - + /* Initialise the data accumulation buffer */ this->buf = calloc(1, INIT_BUFSIZE); this->buf_max = INIT_BUFSIZE; this->read = 0; this->size = 0; - + /* Initialise the reader */ this->reader.read = mpc_reader_read; this->reader.seek = mpc_reader_seek; @@ -275,11 +275,11 @@ static void mpc_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { this->reader.get_size = mpc_reader_get_size; this->reader.canseek = mpc_reader_canseek; this->reader.data = this; - + /* Copy header to buffer */ xine_fast_memcpy(this->buf, buf->content, buf->size); this->size = buf->size; - + #ifdef HAVE_MPC_MPCDEC_H this->decoder = mpc_demux_init(&this->reader); if (!this->decoder) { @@ -292,28 +292,28 @@ static void mpc_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { #else /* Initialise and read stream info */ mpc_streaminfo_init(&this->streaminfo); - + if ((err = mpc_streaminfo_read(&this->streaminfo, &this->reader))) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("libmusepack: mpc_streaminfo_read failed: %d\n"), err); - + _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_HANDLED, 0); return; } #endif - + this->sample_rate = this->streaminfo.sample_freq; this->channels = this->streaminfo.channels; this->bits_per_sample = 16; - + /* After the header the demuxer starts sending data from an offset * of 28 bytes */ this->size = 28; - + /* We need to keep track of the current frame so we now when we've * reached the end of the stream */ this->current_frame = 0; - + /* Setup the decoder */ #ifndef HAVE_MPC_MPCDEC_H mpc_decoder_setup(&this->decoder, &this->reader); @@ -321,16 +321,16 @@ static void mpc_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { this->decoder_ok = 0; /* Take this opportunity to initialize stream/meta information */ - _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, + _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, "Musepack (libmusepack)"); - _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_BITRATE, + _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_BITRATE, (int) this->streaminfo.average_bitrate); return; } lprintf("data: %u size=%u read=%u\n", buf->size, this->size, this->read); - + /* if the audio output is not open yet, open the audio output */ if (!this->output_open) { this->output_open = (this->stream->audio_out->open) ( @@ -344,7 +344,7 @@ static void mpc_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { /* if the audio still isn't open, do not go any further with the decode */ if (!this->output_open) return; - + /* If we run out of space in our internal buffer we discard what's * already been read */ if (((this->size + buf->size) > this->buf_max) && this->read) { @@ -353,7 +353,7 @@ static void mpc_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { memmove(this->buf, &this->buf[this->read], this->size); this->read = 0; } - + /* If there still isn't space we have to increase the size of the * internal buffer */ if ((this->size + buf->size) > this->buf_max) { @@ -362,11 +362,11 @@ static void mpc_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { this->buf_max += 2*buf->size; this->buf = realloc(this->buf, this->buf_max); } - + /* Copy data */ xine_fast_memcpy(&this->buf[this->size], buf->content, buf->size); this->size += buf->size; - + /* Time to decode */ if (buf->decoder_flags & BUF_FLAG_FRAME_END) { /* Increment frame count */ @@ -379,45 +379,45 @@ static void mpc_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { _("libmusepack: data after last frame ignored\n")); return; } - + if (!this->decoder_ok) { /* We require MPC_DECODER_MEMSIZE bytes to initialise the decoder */ if ((this->size - this->read) >= MPC_DECODER_MEMSIZE) { lprintf("initialise"); - + #ifndef HAVE_MPC_MPCDEC_H if (!mpc_decoder_initialize(&this->decoder, &this->streaminfo)) { #else if (!this->decoder) { #endif xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - _("libmusepack: mpc_decoder_initialise failed\n")); - + _("libmusepack: mpc_decoder_initialise failed\n")); + _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_HANDLED, 0); return; } - + this->decoder_ok = 1; } else { /* Not enough data yet */ return; } } - + /* mpc_decoder_decode may cause a read of MPC_DECODER_MEMSIZE/2 bytes so * make sure we have enough data available */ if ((this->size - this->read) >= MPC_DECODER_MEMSIZE2) { lprintf("decoding\n"); - + if ((err = mpc_decode_frame(this)) < 0) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - _("libmusepack: mpc_decoder_decode failed: %d\n"), err); - + _("libmusepack: mpc_decoder_decode failed: %d\n"), err); + _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_HANDLED, 0); return; } } - + /* If we are at the end of the stream we decode the remaining frames as we * know we'll have enough data */ #ifndef HAVE_MPC_MPCDEC_H @@ -426,14 +426,14 @@ static void mpc_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { if (this->current_frame == this->streaminfo.samples) { #endif lprintf("flushing buffers\n"); - + do { if ((err = mpc_decode_frame(this)) < 0) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("libmusepack: mpc_decoder_decode failed: %d\n"), err); } } while (err > 0); - + lprintf("buffers flushed\n"); } } @@ -466,7 +466,7 @@ static void mpc_dispose (audio_decoder_t *this_gen) { if (this->decoder) mpc_demux_exit(this->decoder); #endif - + free(this); } @@ -487,7 +487,7 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, xine_stre /* audio output is not open at the start */ this->output_open = 0; - + /* no buffer yet */ this->buf = NULL; @@ -529,7 +529,7 @@ static void *init_plugin (xine_t *xine, void *data) { return this; } -static uint32_t audio_types[] = { +static uint32_t audio_types[] = { BUF_AUDIO_MPC, 0 }; diff --git a/src/libreal/real_common.c b/src/libreal/real_common.c index 6fda4ddbe..6eedb009a 100644 --- a/src/libreal/real_common.c +++ b/src/libreal/real_common.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2007 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -132,8 +132,8 @@ void _x_real_codecs_init(xine_t *const xine) { #endif - real_codecs_path = - xine->config->register_filename (xine->config, "decoder.external.real_codecs_path", + real_codecs_path = + xine->config->register_filename (xine->config, "decoder.external.real_codecs_path", default_real_codecs_path, XINE_CONFIG_STRING_IS_DIRECTORY_NAME, _("path to RealPlayer codecs"), @@ -154,7 +154,7 @@ void *_x_real_codec_open(xine_stream_t *const stream, const char *const path, const char *const codec_alternate) { char *codecpath = NULL; void *codecmodule = NULL; - + asprintf(&codecpath, "%s/%s", path, codec_name); if ( (codecmodule = dlopen(codecpath, RTLD_NOW)) ) { free(codecpath); @@ -178,12 +178,12 @@ void *_x_real_codec_open(xine_stream_t *const stream, const char *const path, } _x_message(stream, XINE_MSG_LIBRARY_LOAD_ERROR, codec_name, NULL); - + return NULL; } const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_VIDEO_DECODER | PLUGIN_MUST_PRELOAD, 18, "realvdec", XINE_VERSION_CODE, &dec_info_realvideo, init_realvdec }, { PLUGIN_AUDIO_DECODER | PLUGIN_MUST_PRELOAD, 15, "realadec", XINE_VERSION_CODE, &dec_info_realaudio, init_realadec }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } diff --git a/src/libreal/real_common.h b/src/libreal/real_common.h index 1e3d8c264..3c77eda5f 100644 --- a/src/libreal/real_common.h +++ b/src/libreal/real_common.h @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2007 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -26,7 +26,7 @@ #include "xine_internal.h" /* - * some fake functions to make real codecs happy + * some fake functions to make real codecs happy * These are, on current date (20070316) needed only for Alpha * codecs. * As they are far from being proper replacements, define them only there diff --git a/src/libreal/xine_real_audio_decoder.c b/src/libreal/xine_real_audio_decoder.c index 4187477e1..aa53bbb8d 100644 --- a/src/libreal/xine_real_audio_decoder.c +++ b/src/libreal/xine_real_audio_decoder.c @@ -1,25 +1,25 @@ -/* +/* * Copyright (C) 2000-2008 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * thin layer to use real binary-only codecs in xine * - * code inspired by work from Florian Schneider for the MPlayer Project + * code inspired by work from Florian Schneider for the MPlayer Project */ #ifdef HAVE_CONFIG_H @@ -92,7 +92,7 @@ typedef struct realdec_decoder_s { uint64_t pts; int output_open; - + int decoder_ok; } realdec_decoder_t; @@ -130,7 +130,7 @@ static int load_syms_linux (realdec_decoder_t *this, const char *const codec_nam if (!this->raCloseCodec || !this->raDecode || !this->raFlush || !this->raFreeDecoder || !this->raGetFlavorProperty || !this->raOpenCodec2 || !this->raSetFlavor || /*!raSetDLLAccessPath ||*/ !this->raInitDecoder){ - xprintf (this->stream->xine, XINE_VERBOSITY_LOG, + xprintf (this->stream->xine, XINE_VERBOSITY_LOG, _("libareal: (audio) Cannot resolve symbols - incompatible dll: %s\n"), codec_name); return 0; } @@ -162,7 +162,7 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { int coded_frame_size2, data_len, flavor; int mode; void *extras; - + /* * extract header data */ @@ -173,13 +173,13 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { #ifdef LOG xine_hexdump (buf->content, buf->size); #endif - + flavor = _X_BE_16 (buf->content+22); coded_frame_size = _X_BE_32 (buf->content+24); codec_data_length= _X_BE_16 (buf->content+40); coded_frame_size2= _X_BE_16 (buf->content+42); subpacket_size = _X_BE_16 (buf->content+44); - + this->sps = subpacket_size; this->w = coded_frame_size2; this->h = codec_data_length; @@ -191,8 +191,8 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { /* FIXME: */ if (buf->type==BUF_AUDIO_COOK) { - - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "libareal: audio header version 4 for COOK audio not supported.\n"); return 0; } @@ -210,7 +210,7 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { this->block_align= coded_frame_size2; lprintf ("0x%04x 0x%04x 0x%04x 0x%04x data_len 0x%04x\n", - subpacket_size, coded_frame_size, codec_data_length, + subpacket_size, coded_frame_size, codec_data_length, coded_frame_size2, data_len); lprintf ("%d samples/sec, %d bits/sample, %d channels\n", samples_per_sec, bits_per_sample, num_channels); @@ -224,7 +224,7 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { return 0; this->block_align = subpacket_size; break; - + case BUF_AUDIO_ATRK: _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, "Atrac"); if (!load_syms_linux (this, "atrc.so", "atrc.so.6.0")) @@ -252,7 +252,7 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { break; default: - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "libareal: error, i don't handle buf type 0x%08x\n", buf->type); return 0; } @@ -267,7 +267,7 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { return 0; } - { + { ra_init_t init_data; init_data.samplerate = samples_per_sec; @@ -285,10 +285,10 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { printf ("libareal: extras :\n"); xine_hexdump (init_data.extras, data_len); #endif - + result = this->raInitDecoder (this->context, &init_data); if(result){ - xprintf (this->stream->xine, XINE_VERBOSITY_LOG, + xprintf (this->stream->xine, XINE_VERBOSITY_LOG, _("libareal: decoder init failed, error code: 0x%x\n"), result); return 0; } @@ -344,7 +344,7 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { return 0; } - (this->stream->audio_out->open) (this->stream->audio_out, + (this->stream->audio_out->open) (this->stream->audio_out, this->stream, bits_per_sample, samples_per_sec, @@ -360,7 +360,7 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { static void realdec_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { realdec_decoder_t *this = (realdec_decoder_t *) this_gen; - lprintf ("decode_data %d bytes, flags=0x%08x, pts=%"PRId64" ...\n", + lprintf ("decode_data %d bytes, flags=0x%08x, pts=%"PRId64" ...\n", buf->size, buf->decoder_flags, buf->pts); if (buf->decoder_flags & BUF_FLAG_PREVIEW) { @@ -407,20 +407,20 @@ static void realdec_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) audio_buffer = this->stream->audio_out->get_buffer (this->stream->audio_out); - result = this->raDecode (this->context, + result = this->raDecode (this->context, this->frame_buffer + n, this->block_align, (char *) audio_buffer->mem, &len, -1); lprintf ("raDecode result %d, len=%d\n", result, len); - audio_buffer->vpts = this->pts; + audio_buffer->vpts = this->pts; this->pts = 0; audio_buffer->num_frames = len/this->sample_size;; - - this->stream->audio_out->put_buffer (this->stream->audio_out, + + this->stream->audio_out->put_buffer (this->stream->audio_out, audio_buffer, this->stream); n += this->block_align; } @@ -433,13 +433,13 @@ static void realdec_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) static void realdec_reset (audio_decoder_t *this_gen) { realdec_decoder_t *this = (realdec_decoder_t *) this_gen; - + this->frame_num_bytes = 0; } static void realdec_discontinuity (audio_decoder_t *this_gen) { realdec_decoder_t *this = (realdec_decoder_t *) this_gen; - + this->pts = 0; } @@ -475,7 +475,7 @@ static void realdec_dispose (audio_decoder_t *this_gen) { lprintf ("dispose done\n"); } -static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, +static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, xine_stream_t *stream) { real_class_t *cls = (real_class_t *) class_gen; @@ -531,7 +531,7 @@ void *init_realadec (xine_t *xine, void *data) { * exported plugin catalog entry */ -static uint32_t audio_types[] = { +static uint32_t audio_types[] = { BUF_AUDIO_COOK, BUF_AUDIO_ATRK, /* BUF_AUDIO_14_4, BUF_AUDIO_28_8, */ BUF_AUDIO_SIPRO, 0 }; diff --git a/src/libreal/xine_real_video_decoder.c b/src/libreal/xine_real_video_decoder.c index 314edc489..4977ee889 100644 --- a/src/libreal/xine_real_video_decoder.c +++ b/src/libreal/xine_real_video_decoder.c @@ -1,25 +1,25 @@ /* * Copyright (C) 2000-2008 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * thin layer to use real binary-only codecs in xine * - * code inspired by work from Florian Schneider for the MPlayer Project + * code inspired by work from Florian Schneider for the MPlayer Project */ #ifdef HAVE_CONFIG_H @@ -149,12 +149,12 @@ static int load_syms_linux (realdec_decoder_t *this, const char *codec_name, con this->rvyuv_hive_message = dlsym (this->rv_handle, "RV20toYUV420HiveMessage"); this->rvyuv_init = dlsym (this->rv_handle, "RV20toYUV420Init"); this->rvyuv_transform = dlsym (this->rv_handle, "RV20toYUV420Transform"); - + if (this->rvyuv_custom_message && this->rvyuv_free && this->rvyuv_hive_message && this->rvyuv_init && - this->rvyuv_transform) + this->rvyuv_transform) return 1; this->rvyuv_custom_message = dlsym (this->rv_handle, "RV40toYUV420CustomMessage"); @@ -162,15 +162,15 @@ static int load_syms_linux (realdec_decoder_t *this, const char *codec_name, con this->rvyuv_hive_message = dlsym (this->rv_handle, "RV40toYUV420HiveMessage"); this->rvyuv_init = dlsym (this->rv_handle, "RV40toYUV420Init"); this->rvyuv_transform = dlsym (this->rv_handle, "RV40toYUV420Transform"); - + if (this->rvyuv_custom_message && this->rvyuv_free && this->rvyuv_hive_message && this->rvyuv_init && - this->rvyuv_transform) + this->rvyuv_transform) return 1; - xprintf (this->stream->xine, XINE_VERBOSITY_LOG, + xprintf (this->stream->xine, XINE_VERBOSITY_LOG, _("libreal: Error resolving symbols! (version incompatibility?)\n")); return 0; } @@ -198,17 +198,17 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { return 0; break; default: - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "libreal: error, i don't handle buf type 0x%08x\n", buf->type); _x_abort(); } init_data.w = _X_BE_16(&buf->content[12]); init_data.h = _X_BE_16(&buf->content[14]); - + this->width = (init_data.w + 1) & (~1); this->height = (init_data.h + 1) & (~1); - + if(buf->decoder_flags & BUF_FLAG_ASPECT) this->ratio = (double)buf->decoder_info[1] / (double)buf->decoder_info[2]; else @@ -216,15 +216,15 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { /* While the framerate is stored in the header it sometimes doesn't bear * much resemblence to the actual frequency of frames in the file. Hence - * it's better to just let the engine estimate the frame duration for us */ + * it's better to just let the engine estimate the frame duration for us */ #if 0 - this->fps = (double) _X_BE_16(&buf->content[22]) + + this->fps = (double) _X_BE_16(&buf->content[22]) + ((double) _X_BE_16(&buf->content[24]) / 65536.0); this->duration = 90000.0 / this->fps; #endif - + lprintf("this->ratio=%f\n", this->ratio); - + lprintf ("init_data.w=%d(0x%x), init_data.h=%d(0x%x)," "this->width=%d(0x%x), this->height=%d(0x%x)\n", init_data.w, init_data.w, @@ -238,22 +238,22 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { init_data.subformat = _X_BE_32(&buf->content[26]); init_data.format = _X_BE_32(&buf->content[30]); - + #ifdef LOG printf ("libreal: init_data for rvyuv_init:\n"); xine_hexdump ((char *) &init_data, sizeof (init_data)); - + printf ("libreal: buf->content\n"); xine_hexdump (buf->content, buf->size); -#endif - lprintf ("init codec %dx%d... %x %x\n", +#endif + lprintf ("init codec %dx%d... %x %x\n", init_data.w, init_data.h, init_data.subformat, init_data.format ); - + this->context = NULL; - - result = this->rvyuv_init (&init_data, &this->context); - + + result = this->rvyuv_init (&init_data, &this->context); + lprintf ("init result: %d\n", result); /* setup rv30 codec (codec sub-type and image dimensions): */ @@ -266,42 +266,42 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { cmsg24[1] = this->height; for(i = 2, j = 34; j < buf->size; i++, j++) cmsg24[i] = 4 * buf->content[j]; - + #ifdef LOG printf ("libreal: CustomMessage cmsg_data:\n"); xine_hexdump ((uint8_t *) &cmsg_data, sizeof (cmsg_data)); printf ("libreal: cmsg24:\n"); xine_hexdump ((uint8_t *) cmsg24, (buf->size - 34 + 2) * sizeof(uint32_t)); #endif - + this->rvyuv_custom_message (&cmsg_data, this->context); } - + (this->stream->video_out->open) (this->stream->video_out, this->stream); - + this->frame_size = this->width * this->height; this->frame_buffer = xine_xmalloc (this->width * this->height * 3 / 2); - + this->chunk_buffer = calloc(1, BUF_SIZE); this->chunk_buffer_max = BUF_SIZE; - + return 1; } static void realdec_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { realdec_decoder_t *this = (realdec_decoder_t *) this_gen; - lprintf ("decode_data, flags=0x%08x, len=%d, pts=%"PRId64" ...\n", + lprintf ("decode_data, flags=0x%08x, len=%d, pts=%"PRId64" ...\n", buf->decoder_flags, buf->size, buf->pts); if (buf->decoder_flags & BUF_FLAG_PREVIEW) { /* real_find_sequence_header (&this->real, buf->content, buf->content + buf->size);*/ return; } - + if (buf->decoder_flags & BUF_FLAG_FRAMERATE) { this->duration = buf->decoder_info[0]; - _x_stream_info_set(this->stream, XINE_STREAM_INFO_FRAME_DURATION, + _x_stream_info_set(this->stream, XINE_STREAM_INFO_FRAME_DURATION, this->duration); } @@ -312,14 +312,14 @@ static void realdec_decode_data (video_decoder_t *this_gen, buf_element_t *buf) _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_HANDLED, 0); } else if (this->decoder_ok && this->context) { - + /* Each frame starts with BUF_FLAG_FRAME_START and ends with * BUF_FLAG_FRAME_END. * The last buffer contains the chunk offset table. */ if (!(buf->decoder_flags & BUF_FLAG_SPECIAL)) { - + lprintf ("buffer (%d bytes)\n", buf->size); if (buf->decoder_flags & BUF_FLAG_FRAME_START) { @@ -329,10 +329,10 @@ static void realdec_decode_data (video_decoder_t *this_gen, buf_element_t *buf) this->pts = buf->pts; lprintf ("new frame starting, pts=%"PRId64"\n", this->pts); } - + if ((this->chunk_buffer_size + buf->size) > this->chunk_buffer_max) { lprintf("increasing chunk buffer size\n"); - + this->chunk_buffer_max *= 2; this->chunk_buffer = realloc(this->chunk_buffer, this->chunk_buffer_max); } @@ -345,9 +345,9 @@ static void realdec_decode_data (video_decoder_t *this_gen, buf_element_t *buf) } else { /* end of frame, chunk table */ - + lprintf ("special buffer (%d bytes)\n", buf->size); - + if (buf->decoder_info[1] == BUF_SPECIAL_RV_CHUNK_TABLE) { int result; @@ -383,7 +383,7 @@ static void realdec_decode_data (video_decoder_t *this_gen, buf_element_t *buf) xine_hexdump ((uint8_t *) &transform_in, sizeof(rv_xform_in_t)); printf ("libreal: chunk_table:\n"); - xine_hexdump ((uint8_t *) buf->decoder_info_ptr[2], + xine_hexdump ((uint8_t *) buf->decoder_info_ptr[2], 2*(buf->decoder_info[2]+1)*sizeof(uint32_t)); #endif @@ -458,13 +458,13 @@ static void realdec_flush (video_decoder_t *this_gen) { static void realdec_reset (video_decoder_t *this_gen) { realdec_decoder_t *this = (realdec_decoder_t *) this_gen; - + this->chunk_buffer_size = 0; } static void realdec_discontinuity (video_decoder_t *this_gen) { realdec_decoder_t *this = (realdec_decoder_t *) this_gen; - + this->pts = 0; } @@ -480,21 +480,21 @@ static void realdec_dispose (video_decoder_t *this_gen) { if (this->rvyuv_free && this->context) this->rvyuv_free (this->context); - if (this->rv_handle) + if (this->rv_handle) dlclose (this->rv_handle); if (this->frame_buffer) free (this->frame_buffer); - + if (this->chunk_buffer) free (this->chunk_buffer); - + free (this); lprintf ("dispose done\n"); } -static video_decoder_t *open_plugin (video_decoder_class_t *class_gen, +static video_decoder_t *open_plugin (video_decoder_class_t *class_gen, xine_stream_t *stream) { real_class_t *cls = (real_class_t *) class_gen; diff --git a/src/libspucc/cc_decoder.c b/src/libspucc/cc_decoder.c index 98c7319b6..00300adc2 100644 --- a/src/libspucc/cc_decoder.c +++ b/src/libspucc/cc_decoder.c @@ -1,21 +1,21 @@ /* * Copyright (C) 2000-2003 the xine project - * - * Copyright (C) Christian Vogler + * + * Copyright (C) Christian Vogler * cvogler@gradient.cis.upenn.edu - December 2001 * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -83,7 +83,7 @@ static const int text_colormap[NUM_FG_COL] = { /* FIXME: The colors look fine on an XShm display, but they look *terrible* with the Xv display on the NVidia driver on a GeForce 3. The colors bleed into each other more than I'd expect from the downsampling into YUV - colorspace. + colorspace. At this moment, it looks like a problem in the Xv YUV blending functions. */ typedef struct colorinfo_s { @@ -217,14 +217,14 @@ static const uint8_t *const cc_alpha_palettes[NUM_CC_PALETTES] = { /* --------------------- misc. EIA 608 definitions -------------------*/ -#define TRANSP_SPACE 0x19 /* code for transparent space, essentially +#define TRANSP_SPACE 0x19 /* code for transparent space, essentially arbitrary */ /* mapping from PAC row code to actual CC row */ static const int rowdata[] = {10, -1, 0, 1, 2, 3, 11, 12, 13, 14, 4, 5, 6, 7, 8, 9}; /* FIXME: do real â„¢ (U+2122) */ -/* Code 182 must be mapped as a musical note ('♪', U+266A) in the caption font */ +/* Code 182 must be mapped as a musical note ('♪', U+266A) in the caption font */ static const char specialchar[] = { 174 /* ® */, 176 /* ° */, 189 /* ½ */, 191 /* ¿ */, 'T' /* â„¢ */, 162 /* ¢ */, 163 /* £ */, 182 /* ¶ => ♪ */, @@ -271,11 +271,11 @@ struct cc_renderer_s { If this happens, the vpts of a hide caption event can actually be slightly higher than the vpts of the following show caption event. For this reason, we remember the vpts of the hide event and force - the next show event's vpts to be at least equal to the hide event's + the next show event's vpts to be at least equal to the hide event's vpts. */ int64_t last_hide_vpts; - + /* caption palette and alpha channel */ uint32_t cc_palette[OVL_PALETTE_SIZE]; uint8_t cc_trans[OVL_PALETTE_SIZE]; @@ -361,7 +361,7 @@ struct cc_decoder_s { /*---------------- general utility functions ---------------------*/ -static void get_font_metrics(osd_renderer_t *renderer, +static void get_font_metrics(osd_renderer_t *renderer, const char *fontname, int font_size, int *maxw, int *maxh) { @@ -375,7 +375,7 @@ static void get_font_metrics(osd_renderer_t *renderer, renderer->set_encoding(testc, "iso-8859-1"); for (c = 32; c < 256; c++) { int tw, th; - char buf[2]; + char buf[2]; buf[0] = (char)c; buf[1] = '\0'; @@ -530,8 +530,8 @@ static void ccrow_set_attributes(cc_renderer_t *renderer, cc_row_t *this, fontname = cap_info->italic_font; else fontname = cap_info->font; - renderer->osd_renderer->set_font(renderer->cap_display, (char *) fontname, - cap_info->font_size); + renderer->osd_renderer->set_font(renderer->cap_display, (char *) fontname, + cap_info->font_size); } @@ -610,7 +610,7 @@ static void ccrow_render(cc_renderer_t *renderer, cc_row_t *this, int rownum) x = renderer->width * pos / CC_COLUMNS; y = base_y; } - + #ifdef LOG_DEBUG printf("text_w, text_h = %d, %d\n", text_w, text_h); printf("cc from %d to %d; text plotting from %d, %d (basey = %d)\n", pos, endpos, x, y, base_y); @@ -621,7 +621,7 @@ static void ccrow_render(cc_renderer_t *renderer, cc_row_t *this, int rownum) int textcol = text_colormap[this->cells[seg_attr[seg]].attributes.foreground]; int box_x1 = x + cumulative_seg_width[seg]; int box_x2 = x + cumulative_seg_width[seg + 1]; - + #ifdef LOG_DEBUG printf("ccrow_render: rendering segment %d from %d to %d / %d to %d\n", seg, seg_pos[seg], seg_pos[seg + 1], @@ -646,7 +646,7 @@ static void ccrow_render(cc_renderer_t *renderer, cc_row_t *this, int rownum) /* text is already mapped from EIA-608 into iso-8859-1 */ osd_renderer->render_text(renderer->cap_display, - x + cumulative_seg_width[seg], y, buf, + x + cumulative_seg_width[seg], y, buf, textcol); } @@ -712,7 +712,7 @@ static void ccbuf_add_char(cc_buffer_t *this, uint8_t c) } -static void ccbuf_set_cursor(cc_buffer_t *this, int row, int column, +static void ccbuf_set_cursor(cc_buffer_t *this, int row, int column, int underline, int italics, int color) { cc_row_t *rowbuf = &this->rows[row]; @@ -726,7 +726,7 @@ static void ccbuf_set_cursor(cc_buffer_t *this, int row, int column, rowbuf->pac_attr = attr; rowbuf->pac_attr_chg = 1; - this->rowpos = row; + this->rowpos = row; rowbuf->pos = column; rowbuf->attr_chg = 0; } @@ -736,7 +736,7 @@ static void ccbuf_apply_attribute(cc_buffer_t *this, cc_attribute_t *attr) { cc_row_t *rowbuf = &this->rows[this->rowpos]; int pos = rowbuf->pos; - + rowbuf->attr_chg = 1; rowbuf->cells[pos].attributes = *attr; /* A midrow attribute always counts as a space */ @@ -804,7 +804,7 @@ static void cc_renderer_build_palette(cc_renderer_t *this) int i, j; const colorinfo_t *cc_text = cc_text_palettes[this->cc_state->cc_cfg->cc_scheme]; const uint8_t *cc_alpha = cc_alpha_palettes[this->cc_state->cc_cfg->cc_scheme]; - + memset(this->cc_palette, 0, sizeof (this->cc_palette)); memset(this->cc_trans, 0, sizeof (this->cc_trans)); for (i = 0; i < NUM_FG_COL; i++) { @@ -879,12 +879,12 @@ static void cc_renderer_show_caption(cc_renderer_t *this, cc_buffer_t *buf, this->osd_renderer->clear(this->cap_display); ccbuf_render(this, buf); - this->osd_renderer->set_position(this->cap_display, + this->osd_renderer->set_position(this->cap_display, this->x, this->y); vpts = MAX(vpts, this->last_hide_vpts); this->osd_renderer->show(this->cap_display, vpts); - + this->displayed = 1; this->display_vpts = vpts; } @@ -932,7 +932,7 @@ cc_renderer_t *cc_renderer_open(osd_renderer_t *osd_renderer, cc_renderer_update_cfg(this, video_width, video_height); #ifdef LOG_DEBUG printf("spucc: cc_renderer: open\n"); -#endif +#endif return this; } @@ -944,7 +944,7 @@ void cc_renderer_close(cc_renderer_t *this_obj) #ifdef LOG_DEBUG printf("spucc: cc_renderer: close\n"); -#endif +#endif } @@ -979,7 +979,7 @@ void cc_renderer_update_cfg(cc_renderer_t *this_obj, int video_width, #ifdef LOG_DEBUG printf("spucc: cc_renderer: update config: max text extents: %d, %d\n", this_obj->max_char_width, this_obj->max_char_height); -#endif +#endif /* need to adjust captioning area to accommodate font? */ required_w = CC_COLUMNS * (this_obj->max_char_width + 1); @@ -1001,7 +1001,7 @@ void cc_renderer_update_cfg(cc_renderer_t *this_obj, int video_width, this_obj->y = (this_obj->video_height - required_h) / 2; } - if (required_w <= this_obj->video_width && + if (required_w <= this_obj->video_width && required_h <= this_obj->video_height) { this_obj->cc_state->can_cc = 1; cc_renderer_adjust_osd_object(this_obj); @@ -1012,7 +1012,7 @@ void cc_renderer_update_cfg(cc_renderer_t *this_obj, int video_width, printf("spucc: required captioning area %dx%d exceeds screen %dx%d!\n" " Captions disabled. Perhaps you should choose a smaller" " font?\n", - required_w, required_h, this_obj->video_width, + required_w, required_h, this_obj->video_width, this_obj->video_height); } } @@ -1050,10 +1050,10 @@ static void cc_hide_displayed(cc_decoder_t *this) if (cc_renderer_on_display(this->cc_state->renderer)) { int64_t vpts = cc_renderer_calc_vpts(this->cc_state->renderer, this->pts, - this->f_offset); + this->f_offset); #ifdef LOG_DEBUG printf("cc_decoder: cc_hide_displayed: hiding caption %u at vpts %u\n", this->capid, vpts); -#endif +#endif cc_renderer_hide_caption(this->cc_state->renderer, vpts); } } @@ -1070,7 +1070,7 @@ static void cc_show_displayed(cc_decoder_t *this) this->f_offset); #ifdef LOG_DEBUG printf("cc_decoder: cc_show_displayed: showing caption %u at vpts %u\n", this->capid, vpts); -#endif +#endif this->capid++; cc_renderer_show_caption(this->cc_state->renderer, &this->on_buf->channel[this->on_buf->channel_no], @@ -1293,7 +1293,7 @@ static void cc_decode_EIA608(cc_decoder_t *this, uint16_t data) } else { switch (c1) { - + case 0x10: /* extended background attribute code */ cc_decode_ext_attribute(this, channel, c1, c2); break; @@ -1321,7 +1321,7 @@ static void cc_decode_EIA608(cc_decoder_t *this, uint16_t data) } } } - + this->lastcode = data; } @@ -1347,13 +1347,13 @@ void decode_cc(cc_decoder_t *this, uint8_t *buffer, uint32_t buf_len, * 0x00 is padding, followed by 2 more 0x00. * * 0x01 always seems to appear at the beginning, always seems to - * be followed by 0xf8, 8-bit number. + * be followed by 0xf8, 8-bit number. * The lower 7 bits of this 8-bit number seem to denote the * number of code triplets that follow. - * The most significant bit denotes whether the Line 21 field 1 + * The most significant bit denotes whether the Line 21 field 1 * captioning information is at odd or even triplet offsets from this * beginning triplet. 1 denotes odd offsets, 0 denotes even offsets. - * + * * Most captions are encoded with odd offsets, so this is what we * will assume. * @@ -1378,31 +1378,31 @@ void decode_cc(cc_decoder_t *this, uint8_t *buffer, uint32_t buf_len, } printf("\n"); } -#endif +#endif while (curbytes < buf_len) { int skip = 2; cc_code = *current++; curbytes++; - + if (buf_len - curbytes < 2) { #ifdef LOG_DEBUG fprintf(stderr, "Not enough data for 2-byte CC encoding\n"); #endif break; } - + data1 = *current; data2 = *(current + 1); - + switch (cc_code) { case 0xfe: /* expect 2 byte encoding (perhaps CC3, CC4?) */ /* ignore for time being */ skip = 2; break; - + case 0xff: /* expect EIA-608 CC1/CC2 encoding */ if (good_parity(data1 | (data2 << 8))) { @@ -1411,12 +1411,12 @@ void decode_cc(cc_decoder_t *this, uint8_t *buffer, uint32_t buf_len, } skip = 5; break; - + case 0x00: /* This seems to be just padding */ skip = 2; break; - + case 0x01: odd_offset = data2 & 0x80; if (odd_offset) @@ -1424,7 +1424,7 @@ void decode_cc(cc_decoder_t *this, uint8_t *buffer, uint32_t buf_len, else skip = 5; break; - + default: #ifdef LOG_DEBUG fprintf(stderr, "Unknown CC encoding: %x\n", cc_code); diff --git a/src/libspucc/cc_decoder.h b/src/libspucc/cc_decoder.h index 47703b6d1..6ee6d860b 100644 --- a/src/libspucc/cc_decoder.h +++ b/src/libspucc/cc_decoder.h @@ -1,21 +1,21 @@ /* * Copyright (C) 2000-2008 the xine project - * - * Copyright (C) Christian Vogler + * + * Copyright (C) Christian Vogler * cvogler@gradient.cis.upenn.edu - December 2001 * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -43,7 +43,7 @@ typedef struct cc_config_s { int center; /* true if captions should be centered */ /* according to text width */ int cc_scheme; /* which captioning scheme to use */ - + int config_version; /* the decoder should be updated when this is increased */ } cc_config_t; diff --git a/src/libspucc/xine_cc_decoder.c b/src/libspucc/xine_cc_decoder.c index 12a5e7132..47c1d1f2f 100644 --- a/src/libspucc/xine_cc_decoder.c +++ b/src/libspucc/xine_cc_decoder.c @@ -1,23 +1,23 @@ /* * Copyright (C) 2000-2008 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * - * closed caption spu decoder. receive data by events. + * closed caption spu decoder. receive data by events. */ #ifdef HAVE_CONFIG_H @@ -47,7 +47,7 @@ typedef struct spucc_decoder_s { spu_decoder_t spu_decoder; xine_stream_t *stream; - + /* closed captioning decoder state */ cc_decoder_t *ccdec; /* true if ccdec has been initialized */ @@ -64,7 +64,7 @@ typedef struct spucc_decoder_s { /* events will be sent here */ xine_event_queue_t *queue; - + } spucc_decoder_t; @@ -157,7 +157,7 @@ static void spucc_font_change(void *this_gen, xine_cfg_entry_t *value) spucc_class_t *this = (spucc_class_t *) this_gen; cc_config_t *cc_cfg = &this->cc_cfg; char *font; - + if (strcmp(value->key, "subtitles.closedcaption.font") == 0) font = cc_cfg->font; else @@ -176,7 +176,7 @@ static void spucc_num_change(void *this_gen, xine_cfg_entry_t *value) spucc_class_t *this = (spucc_class_t *) this_gen; cc_config_t *cc_cfg = &this->cc_cfg; int *num; - + if (strcmp(value->key, "subtitles.closedcaption.font_size") == 0) num = &cc_cfg->font_size; else @@ -200,7 +200,7 @@ static void spucc_register_cfg_vars(spucc_class_t *this, _("Closed Captions are subtitles mostly meant " "to help the hearing impaired."), 0, spucc_cfg_enable_change, this); - + cc_vars->cc_scheme = xine_cfg->register_enum(xine_cfg, "subtitles.closedcaption.scheme", 0, (char **)cc_schemes, @@ -208,27 +208,27 @@ static void spucc_register_cfg_vars(spucc_class_t *this, _("Choose your favourite rendering of the closed " "captions."), 10, spucc_cfg_scheme_change, this); - - copy_str(cc_vars->font, + + copy_str(cc_vars->font, xine_cfg->register_string(xine_cfg, "subtitles.closedcaption.font", "cc", _("standard closed captioning font"), _("Choose the font for standard closed captions text."), 20, spucc_font_change, this), CC_FONT_MAX); - + copy_str(cc_vars->italic_font, xine_cfg->register_string(xine_cfg, "subtitles.closedcaption.italic_font", "cci", _("italic closed captioning font"), _("Choose the font for italic closed captions text."), 20, spucc_font_change, this), CC_FONT_MAX); - + cc_vars->font_size = xine_cfg->register_num(xine_cfg, "subtitles.closedcaption.font_size", 24, _("closed captioning font size"), _("Choose the font size for closed captions text."), 10, spucc_num_change, this); - + cc_vars->center = xine_cfg->register_bool(xine_cfg, "subtitles.closedcaption.center", 1, _("center-adjust closed captions"), _("When enabled, closed captions will be positioned " @@ -238,7 +238,7 @@ static void spucc_register_cfg_vars(spucc_class_t *this, /* called when the video frame size changes */ -static void spucc_notify_frame_change(spucc_decoder_t *this, +static void spucc_notify_frame_change(spucc_decoder_t *this, int width, int height) { #ifdef LOG_DEBUG printf("spucc: new frame size: %dx%d\n", width, height); @@ -255,14 +255,14 @@ static void spucc_notify_frame_change(spucc_decoder_t *this, static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { spucc_decoder_t *this = (spucc_decoder_t *) this_gen; xine_event_t *event; - + while ((event = xine_event_get(this->queue))) { switch (event->type) { case XINE_EVENT_FRAME_FORMAT_CHANGE: { - xine_format_change_data_t *frame_change = + xine_format_change_data_t *frame_change = (xine_format_change_data_t *)event->data; - + spucc_notify_frame_change(this, frame_change->width, frame_change->height); } @@ -270,17 +270,17 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { } xine_event_free(event); } - + if (buf->decoder_flags & BUF_FLAG_PREVIEW) { } else { - + if (this->cc_state.cc_cfg->config_version > this->config_version) { spucc_update_intrinsics(this); if (!this->cc_state.cc_cfg->cc_enabled) spucc_do_close(this); this->config_version = this->cc_state.cc_cfg->config_version; } - + if (this->cc_state.cc_cfg->cc_enabled) { if( !this->cc_open ) spucc_do_init (this); @@ -290,7 +290,7 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { } } } -} +} static void spudec_reset (spu_decoder_t *this_gen) { } @@ -327,7 +327,7 @@ static spu_decoder_t *spudec_open_plugin (spu_decoder_class_t *class, xine_strea this->cc_open = 0; cc_decoder_init(); - + return &this->spu_decoder; } @@ -357,7 +357,7 @@ static void *init_spu_decoder_plugin (xine_t *xine, void *data) { spucc_register_cfg_vars(this, xine->config); this->cc_cfg.config_version = 0; - + return &this->spu_class; } @@ -370,7 +370,7 @@ static const decoder_info_t spudec_info = { }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_SPU_DECODER, 16, "spucc", XINE_VERSION_CODE, &spudec_info, &init_spu_decoder_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libspucmml/xine_cmml_decoder.c b/src/libspucmml/xine_cmml_decoder.c index 9cd446988..ed7e99ae1 100644 --- a/src/libspucmml/xine_cmml_decoder.c +++ b/src/libspucmml/xine_cmml_decoder.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2008 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -104,11 +104,11 @@ static void update_font_size (spucmml_decoder_t *this) { this->font_size = vec[1]; else this->font_size = vec[0]; - + this->line_height = this->font_size + 10; int y = this->cached_height - (SUB_MAX_TEXT * this->line_height) - 5; - + if(((y - this->vertical_offset) >= 0) && ((y - this->vertical_offset) <= this->cached_height)) y -= this->vertical_offset; @@ -124,7 +124,7 @@ static void update_font_size (spucmml_decoder_t *this) { this->cached_width, SUB_MAX_TEXT * this->line_height); - this->osd = this->stream->osd_renderer->new_object (this->stream->osd_renderer, + this->osd = this->stream->osd_renderer->new_object (this->stream->osd_renderer, this->cached_width, SUB_MAX_TEXT * this->line_height); llprintf (LOG_OSD, "post new_object: osd is %p\n", this->osd); @@ -137,7 +137,7 @@ static void update_font_size (spucmml_decoder_t *this) { static int get_width(spucmml_decoder_t *this, char* text) { int width=0; - + while (1) switch (*text) { case '\0': @@ -153,7 +153,7 @@ static int get_width(spucmml_decoder_t *this, char* text) { /*Do somethink to disable BOLD typeface*/ text += 4; break; - } else if (!strncmp("<i>", text, 3)) { + } else if (!strncmp("<i>", text, 3)) { /*Do somethink to enable italics typeface*/ text += 3; break; @@ -161,7 +161,7 @@ static int get_width(spucmml_decoder_t *this, char* text) { /*Do somethink to disable italics typeface*/ text += 4; break; - } else if (!strncmp("<font>", text, 3)) { + } else if (!strncmp("<font>", text, 3)) { /*Do somethink to disable typing fixme - no teststreams*/ text += 6; @@ -171,7 +171,7 @@ static int get_width(spucmml_decoder_t *this, char* text) { fixme - no teststreams*/ text += 7; break; - } + } default: { int w, dummy; @@ -224,11 +224,11 @@ static void draw_subtitle(spucmml_decoder_t *this, int64_t sub_start) { if( font_size != this->font_size ) this->stream->osd_renderer->set_font (this->osd, this->font, this->font_size); - + this->stream->osd_renderer->set_text_palette (this->osd, -1, OSD_TEXT1); this->stream->osd_renderer->show (this->osd, sub_start); - + llprintf (LOG_SCHEDULING, "spucmml: scheduling subtitle >%s< at %"PRId64", current time is %"PRId64"\n", this->text[0], sub_start, @@ -399,7 +399,7 @@ static void video_frame_format_change_callback (void *user_data, const xine_even static void spudec_reset (spu_decoder_t *this_gen) { spucmml_decoder_t *this = (spucmml_decoder_t *) this_gen; - + this->cached_width = this->cached_height = 0; } @@ -461,16 +461,16 @@ static spu_decoder_t *spucmml_class_open_plugin (spu_decoder_class_t *class_gen, this->font_size = 24; this->subtitle_size = 1; - this->font = class->xine->config->register_string(class->xine->config, - "subtitles.separate.font", - "sans", - _("font for external subtitles"), + this->font = class->xine->config->register_string(class->xine->config, + "subtitles.separate.font", + "sans", + _("font for external subtitles"), NULL, 0, update_osd_font, this); this->vertical_offset = class->xine->config->register_num(class->xine->config, - "subtitles.separate.vertical_offset", + "subtitles.separate.vertical_offset", 0, - _("subtitle vertical offset (relative window size)"), + _("subtitle vertical offset (relative window size)"), NULL, 0, update_vertical_offset, this); this->current_anchor.href = NULL; @@ -510,10 +510,10 @@ static void *init_spu_decoder_plugin (xine_t *xine, void *data) { this->xine = xine; - this->src_encoding = xine->config->register_string(xine->config, - "subtitles.separate.src_encoding", - "iso-8859-1", - _("encoding of subtitles"), + this->src_encoding = xine->config->register_string(xine->config, + "subtitles.separate.src_encoding", + "iso-8859-1", + _("encoding of subtitles"), NULL, 10, update_src_encoding, this); return &this->class; @@ -529,7 +529,7 @@ static const decoder_info_t spudec_info = { }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_SPU_DECODER, 16, "spucmml", XINE_VERSION_CODE, &spudec_info, &init_spu_decoder_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libspudec/spu.c b/src/libspudec/spu.c index e91cafbc1..a9319f103 100644 --- a/src/libspudec/spu.c +++ b/src/libspudec/spu.c @@ -17,13 +17,13 @@ * cleaner implementation of SPU are saving * overlaying (proof of concept for now) * ... and yes, it works now with oms - * added tranparency (provided by the SPU hdr) + * added tranparency (provided by the SPU hdr) * changed structures for easy porting to MGAs DVD mode * This file is part of xine * This file was originally part of the OMS program. * * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * 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. * @@ -89,7 +89,7 @@ void spudec_decode_nav(spudec_decoder_t *this, buf_element_t *buf) { p = buf->content; if (p[0] || p[1] || (p[2] != 1)) { - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "libspudec:spudec_decode_nav:nav demux error! %02x %02x %02x (should be 0x000001) \n",p[0],p[1],p[2]); return; } @@ -126,7 +126,7 @@ void spudec_decode_nav(spudec_decoder_t *this, buf_element_t *buf) { printf("btngr%d_dsp_ty 0x%02x\n", 1, pci.hli.hl_gi.btngr1_dsp_ty); printf("btngr%d_dsp_ty 0x%02x\n", 2, pci.hli.hl_gi.btngr2_dsp_ty); printf("btngr%d_dsp_ty 0x%02x\n", 3, pci.hli.hl_gi.btngr3_dsp_ty); - //navPrint_PCI(&pci); + //navPrint_PCI(&pci); //navPrint_PCI_GI(&pci.pci_gi); //navPrint_NSML_AGLI(&pci.nsml_agli); //navPrint_HLI(&pci.hli); @@ -142,7 +142,7 @@ void spudec_decode_nav(spudec_decoder_t *this, buf_element_t *buf) { packet_len = p[4] << 8 | p[5]; p += 6; #ifdef LOG_NAV - printf("NAV DSI packet\n"); + printf("NAV DSI packet\n"); #endif navRead_DSI(&dsi, p+1); @@ -150,7 +150,7 @@ void spudec_decode_nav(spudec_decoder_t *this, buf_element_t *buf) { // self->vobu_length = self->dsi.dsi_gi.vobu_ea; } } - + /* NAV packets contain start and end presentation timestamps, which tell the * application, when the highlight information in the NAV is supposed to be valid. * We handle these timestamps only in a very stripped-down way: We keep a list @@ -192,18 +192,18 @@ void spudec_decode_nav(spudec_decoder_t *this, buf_element_t *buf) { /* we possibly had buttons before, so we update the UI info */ xine_event_t event; xine_ui_data_t data; - + event.type = XINE_EVENT_UI_NUM_BUTTONS; event.data = &data; event.data_length = sizeof(data); data.num_buttons = 0; - + xine_event_send(this->stream, &event); } this->button_filter=0; break; - case 1: + case 1: /* All New Highlight information for this VOBU */ if (this->pci_cur.pci.hli.hl_gi.hli_ss != 0 && pci.hli.hl_gi.hli_s_ptm > this->pci_cur.pci.hli.hl_gi.hli_s_ptm) { @@ -259,7 +259,7 @@ void spudec_decode_nav(spudec_decoder_t *this, buf_element_t *buf) { } break; default: - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "libspudec: unknown pci.hli.hl_gi.hli_ss = %d\n", pci.hli.hl_gi.hli_ss ); break; } @@ -281,7 +281,7 @@ void spudec_clear_nav_list(spudec_decoder_t *this) void spudec_update_nav(spudec_decoder_t *this) { metronom_clock_t *clock = this->stream->xine->clock; - + if (this->pci_cur.next && this->pci_cur.next->vpts <= clock->get_current_time(clock)) { pci_node_t *node = this->pci_cur.next; xine_fast_memcpy(&this->pci_cur, this->pci_cur.next, sizeof(pci_node_t)); @@ -298,12 +298,12 @@ void spudec_process_nav(spudec_decoder_t *this) /* we possibly entered a menu, so we update the UI button info */ xine_event_t event; xine_ui_data_t data; - + event.type = XINE_EVENT_UI_NUM_BUTTONS; event.data = &data; event.data_length = sizeof(data); data.num_buttons = this->pci_cur.pci.hli.hl_gi.btn_ns; - + xine_event_send(this->stream, &event); } this->button_filter=1; @@ -322,7 +322,7 @@ void spudec_reassembly (xine_t *xine, spudec_seq_t *seq, uint8_t *pkt_data, u_in if (seq->complete) { seq->seq_len = (((uint32_t)pkt_data[0])<<8) | pkt_data[1]; seq->cmd_offs = (((uint32_t)pkt_data[2])<<8) | pkt_data[3]; - if (seq->cmd_offs >= seq->seq_len) { + if (seq->cmd_offs >= seq->seq_len) { xprintf(xine, XINE_VERBOSITY_DEBUG, "libspudec:faulty stream\n"); seq->broken = 1; } @@ -342,7 +342,7 @@ void spudec_reassembly (xine_t *xine, spudec_seq_t *seq, uint8_t *pkt_data, u_in } seq->ra_offs = 0; - + #ifdef LOG_DEBUG printf ("spu: buf_len: %d\n", seq->buf_len); printf ("spu: cmd_off: %d\n", seq->cmd_offs); @@ -364,7 +364,7 @@ void spudec_reassembly (xine_t *xine, spudec_seq_t *seq, uint8_t *pkt_data, u_in } else { xprintf(xine, XINE_VERBOSITY_DEBUG, "libspudec:faulty stream\n"); seq->broken = 1; - } + } if (seq->ra_offs == seq->seq_len) { seq->finished = 0; @@ -382,9 +382,9 @@ void spudec_process (spudec_decoder_t *this, int stream_id) { cur_seq = &this->spudec_stream_state[stream_id].ra_seq; #ifdef LOG_DEBUG - printf ("spu: Found SPU from stream %d pts=%lli vpts=%lli\n",stream_id, + printf ("spu: Found SPU from stream %d pts=%lli vpts=%lli\n",stream_id, this->spudec_stream_state[stream_id].pts, - this->spudec_stream_state[stream_id].vpts); + this->spudec_stream_state[stream_id].vpts); #endif this->state.cmd_ptr = cur_seq->buf + cur_seq->cmd_offs; this->state.modified = 1; /* Only draw picture if = 1 on first event of SPU */ @@ -392,14 +392,14 @@ void spudec_process (spudec_decoder_t *this, int stream_id) { this->state.forced_display = 0; /* 0 - No value, 1 - Forced Display. */ this->state.delay = 0; cur_seq->finished=0; - + do { if (!(cur_seq->finished) ) { pci_node_t *node; - + /* spu_channel is now set based on whether we are in the menu or not. */ /* Bit 7 is set if only forced display SPUs should be shown */ - if ( (this->stream->spu_channel & 0x1f) != stream_id ) { + if ( (this->stream->spu_channel & 0x1f) != stream_id ) { #ifdef LOG_DEBUG printf ("spu: Dropping SPU channel %d. Not selected stream_id\n", stream_id); #endif @@ -417,7 +417,7 @@ void spudec_process (spudec_decoder_t *this, int stream_id) { cur_seq->broken = 0; return; } - if ( (this->state.forced_display == 0) && (this->stream->spu_channel & 0x80) ) { + if ( (this->state.forced_display == 0) && (this->stream->spu_channel & 0x80) ) { #ifdef LOG_DEBUG printf ("spu: Dropping SPU channel %d. Only allow forced display SPUs\n", stream_id); #endif @@ -426,7 +426,7 @@ void spudec_process (spudec_decoder_t *this, int stream_id) { #ifdef LOG_DEBUG spudec_print_overlay( &this->overlay ); - printf ("spu: forced display:%s\n", this->state.forced_display ? "Yes" : "No" ); + printf ("spu: forced display:%s\n", this->state.forced_display ? "Yes" : "No" ); #endif pthread_mutex_lock(&this->nav_pci_lock); /* search for a PCI that matches this SPU's PTS */ @@ -444,7 +444,7 @@ void spudec_process (spudec_decoder_t *this, int stream_id) { } if (node->pci.hli.hl_gi.fosl_btnn > 0) { xine_event_t event; - + this->buttonN = node->pci.hli.hl_gi.fosl_btnn; event.type = XINE_EVENT_INPUT_BUTTON_FORCE; event.stream = this->stream; @@ -455,12 +455,12 @@ void spudec_process (spudec_decoder_t *this, int stream_id) { #ifdef LOG_BUTTON fprintf(stderr, "libspudec:Full Overlay\n"); #endif - if (!spudec_copy_nav_to_overlay(this->stream->xine, - &node->pci, this->state.clut, + if (!spudec_copy_nav_to_overlay(this->stream->xine, + &node->pci, this->state.clut, this->buttonN, 0, &this->overlay, &this->overlay)) { /* current button does not exist -> use another one */ xine_event_t event; - + if (this->buttonN > node->pci.hli.hl_gi.btn_ns) this->buttonN = node->pci.hli.hl_gi.btn_ns; else @@ -470,8 +470,8 @@ void spudec_process (spudec_decoder_t *this, int stream_id) { event.data = &this->buttonN; event.data_length = sizeof(this->buttonN); xine_event_send(this->stream, &event); - spudec_copy_nav_to_overlay(this->stream->xine, - &node->pci, this->state.clut, + spudec_copy_nav_to_overlay(this->stream->xine, + &node->pci, this->state.clut, this->buttonN, 0, &this->overlay, &this->overlay); } } else { @@ -484,44 +484,44 @@ void spudec_process (spudec_decoder_t *this, int stream_id) { } pthread_mutex_unlock(&this->nav_pci_lock); - if ((this->state.modified) ) { + if ((this->state.modified) ) { spudec_draw_picture(this->stream->xine, &this->state, cur_seq, &this->overlay); } - + if (this->state.need_clut) { spudec_discover_clut(this->stream->xine, &this->state, &this->overlay); } - + if (this->state.vobsub) { int width, height; int64_t duration; - + /* * vobsubs are usually played with a scaled-down stream (not full DVD * resolution), therefore we should try to realign it. */ - + this->stream->video_out->status(this->stream->video_out, NULL, &width, &height, &duration ); this->overlay.x = (width - this->overlay.width) / 2; this->overlay.y = height - this->overlay.height; } - + /* Subtitle */ if( this->menu_handle < 0 ) { this->menu_handle = ovl_manager->get_handle(ovl_manager,1); } - + if( this->menu_handle < 0 ) { - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "libspudec: No video_overlay handles left for menu\n"); return; } this->event.object.handle = this->menu_handle; this->event.object.pts = this->spudec_stream_state[stream_id].pts; - xine_fast_memcpy(this->event.object.overlay, + xine_fast_memcpy(this->event.object.overlay, &this->overlay, sizeof(vo_overlay_t)); this->overlay.rle=NULL; @@ -529,15 +529,15 @@ void spudec_process (spudec_decoder_t *this, int stream_id) { //if ( !(this->state.visible) ) { // this->state.visible = OVERLAY_EVENT_SHOW; //} - + this->event.event_type = this->state.visible; /* printf("spu event %d handle: %d vpts: %lli\n", this->event.event_type, - this->event.object.handle, this->event.vpts ); + this->event.object.handle, this->event.vpts ); */ - - this->event.vpts = this->spudec_stream_state[stream_id].vpts+(this->state.delay*1000); - + + this->event.vpts = this->spudec_stream_state[stream_id].vpts+(this->state.delay*1000); + /* Keep all the events in the correct order. */ /* This corrects for errors during estimation around discontinuity */ if( this->event.vpts < this->last_event_vpts ) { @@ -550,7 +550,7 @@ void spudec_process (spudec_decoder_t *this, int stream_id) { this->event.event_type, this->stream->xine->clock->get_current_time(this->stream->xine->clock), this->event.vpts); -#endif +#endif ovl_manager->add_event(ovl_manager, (void *)&this->event); } else { pending = 0; @@ -578,7 +578,7 @@ static void spudec_do_commands(xine_t *xine, spudec_state_t *state, spudec_seq_t #ifdef LOG_DEBUG printf ("spu: SPU DO COMMANDS\n"); #endif - + state->delay = (buf[0] << 8) + buf[1]; #ifdef LOG_DEBUG printf ("spu: \tdelay=%d\n",state->delay); @@ -595,7 +595,7 @@ static void spudec_do_commands(xine_t *xine, spudec_state_t *state, spudec_seq_t next_seq = seq->buf + seq->seq_len; /* allow to run until end */ state->cmd_ptr = next_seq; - + while (buf < next_seq && *buf != CMD_SPU_EOF) { switch (*buf) { case CMD_SPU_SHOW: /* show subpicture */ @@ -605,7 +605,7 @@ static void spudec_do_commands(xine_t *xine, spudec_state_t *state, spudec_seq_t state->visible = OVERLAY_EVENT_SHOW; buf++; break; - + case CMD_SPU_HIDE: /* hide subpicture */ #ifdef LOG_DEBUG printf ("spu: \thide subpicture\n"); @@ -613,17 +613,17 @@ static void spudec_do_commands(xine_t *xine, spudec_state_t *state, spudec_seq_t state->visible = OVERLAY_EVENT_HIDE; buf++; break; - + case CMD_SPU_SET_PALETTE: { /* CLUT */ spudec_clut_t *clut = (spudec_clut_t *) (buf+1); - + state->cur_colors[3] = clut->entry0; state->cur_colors[2] = clut->entry1; state->cur_colors[1] = clut->entry2; state->cur_colors[0] = clut->entry3; /* This is a bit out of context for now */ - ovl->color[3] = state->clut[clut->entry0]; + ovl->color[3] = state->clut[clut->entry0]; ovl->color[2] = state->clut[clut->entry1]; ovl->color[1] = state->clut[clut->entry2]; ovl->color[0] = state->clut[clut->entry3]; @@ -637,11 +637,11 @@ static void spudec_do_commands(xine_t *xine, spudec_state_t *state, spudec_seq_t state->modified = 1; buf += 3; break; - } + } case CMD_SPU_SET_ALPHA: { /* transparency palette */ spudec_clut_t *trans = (spudec_clut_t *) (buf+1); /* This should go into state for now */ - + ovl->trans[3] = trans->entry0; ovl->trans[2] = trans->entry1; ovl->trans[1] = trans->entry2; @@ -655,7 +655,7 @@ static void spudec_do_commands(xine_t *xine, spudec_state_t *state, spudec_seq_t buf += 3; break; } - + case CMD_SPU_SET_SIZE: /* image coordinates */ /* state->o_left = (buf[1] << 4) | (buf[2] >> 4); state->o_right = (((buf[2] & 0x0f) << 8) | buf[3]); @@ -665,7 +665,7 @@ static void spudec_do_commands(xine_t *xine, spudec_state_t *state, spudec_seq_t */ ovl->x = (buf[1] << 4) | (buf[2] >> 4); ovl->y = (buf[4] << 4) | (buf[5] >> 4); - ovl->width = (((buf[2] & 0x0f) << 8) | buf[3]) - ovl->x + 1; + ovl->width = (((buf[2] & 0x0f) << 8) | buf[3]) - ovl->x + 1; ovl->height = (((buf[5] & 0x0f) << 8) | buf[6]) - ovl->y + 1; ovl->hili_top = -1; ovl->hili_bottom = -1; @@ -679,7 +679,7 @@ static void spudec_do_commands(xine_t *xine, spudec_state_t *state, spudec_seq_t state->modified = 1; buf += 7; break; - + case CMD_SPU_SET_PXD_OFFSET: /* image top[0] field / image bottom[1] field*/ state->field_offs[0] = (((u_int)buf[1]) << 8) | buf[2]; state->field_offs[1] = (((u_int)buf[3]) << 8) | buf[4]; @@ -697,13 +697,13 @@ static void spudec_do_commands(xine_t *xine, spudec_state_t *state, spudec_seq_t state->modified = 1; buf += 5; break; - + case CMD_SPU_WIPE: #ifdef LOG_DEBUG printf ("libspudec: \tSPU_WIPE not implemented yet\n"); #endif param_length = (buf[1] << 8) | (buf[2]); - buf += 1 + param_length; + buf += 1 + param_length; break; case CMD_SPU_FORCE_DISPLAY: @@ -722,7 +722,7 @@ static void spudec_do_commands(xine_t *xine, spudec_state_t *state, spudec_seq_t break; } } - + if (next_seq >= seq->buf + seq->seq_len) seq->finished = 1; /* last sub-sequence */ } @@ -763,11 +763,11 @@ static u_int get_bits (u_int bits) static int spudec_next_line (vo_overlay_t *spu) { get_bits (0); // byte align rle data - + put_x = 0; put_y++; field ^= 1; // Toggle fields - + if (put_y >= spu->height) { #ifdef LOG_DEBUG printf ("spu: put_y >= spu->height\n"); @@ -801,11 +801,11 @@ static void spudec_draw_picture (xine_t *xine, spudec_state_t *state, spudec_seq * - both fields running to the very end * - 2 RLE elements per byte meaning single pixel RLE */ - ovl->data_size = ((seq->cmd_offs - state->field_offs[0]) + + ovl->data_size = ((seq->cmd_offs - state->field_offs[0]) + (seq->cmd_offs - state->field_offs[1])) * 2 * sizeof(rle_elem_t); if (ovl->rle) { - xprintf (xine, XINE_VERBOSITY_DEBUG, + xprintf (xine, XINE_VERBOSITY_DEBUG, "libspudec: spudec_draw_picture: ovl->rle is not empty!!!! It should be!!! " "You should never see this message.\n"); free(ovl->rle); @@ -890,7 +890,7 @@ static void spudec_discover_clut(xine_t *xine, spudec_state_t *state, vo_overlay why rle is null? */ if( !rle ) return; - + /* suppose the first and last pixels are bg */ if( rle[0].color != rle[ovl->num_rle-1].color ) return; @@ -976,9 +976,9 @@ int spudec_copy_nav_to_overlay(xine_t *xine, pci_t* nav_pci, uint32_t* clut, if((button <= 0) || (button > nav_pci->hli.hl_gi.btn_ns)) return 0; - + btns_per_group = 36 / nav_pci->hli.hl_gi.btngr_ns; - + /* choose button group: we can always use a normal 4:3 or widescreen button group * as long as xine blends the overlay before scaling the image to its aspect */ if (!button_ptr && nav_pci->hli.hl_gi.btngr_ns >= 1 && !(nav_pci->hli.hl_gi.btngr1_dsp_ty & 6)) @@ -988,11 +988,11 @@ int spudec_copy_nav_to_overlay(xine_t *xine, pci_t* nav_pci, uint32_t* clut, if (!button_ptr && nav_pci->hli.hl_gi.btngr_ns >= 3 && !(nav_pci->hli.hl_gi.btngr3_dsp_ty & 6)) button_ptr = &nav_pci->hli.btnit[2 * btns_per_group + button - 1]; if (!button_ptr) { - xprintf(xine, XINE_VERBOSITY_DEBUG, + xprintf(xine, XINE_VERBOSITY_DEBUG, "libspudec: No suitable menu button group found, using group 1.\n"); button_ptr = &nav_pci->hli.btnit[button - 1]; } - + /* button areas in the nav packet are in screen coordinates, * overlay clipping areas are in overlay coordinates; * therefore we must subtract the display coordinates of the underlying overlay */ @@ -1025,6 +1025,6 @@ int spudec_copy_nav_to_overlay(xine_t *xine, pci_t* nav_pci, uint32_t* clut, #ifdef LOG_BUTTON printf("libspudec:xine_decoder.c:NAV to SPU pts match!\n"); #endif - + return 1; } diff --git a/src/libspudec/spu.h b/src/libspudec/spu.h index 464f77438..54efe1968 100644 --- a/src/libspudec/spu.h +++ b/src/libspudec/spu.h @@ -4,17 +4,17 @@ * Copyright (C) James Courtier-Dutton James@superbug.demon.co.uk - July 2001 * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -112,11 +112,11 @@ typedef struct spudec_decoder_s { spudec_class_t *class; xine_stream_t *stream; spudec_stream_state_t spudec_stream_state[MAX_STREAMS]; - + video_overlay_event_t event; - video_overlay_object_t object; + video_overlay_object_t object; int32_t menu_handle; - + spudec_state_t state; vo_overlay_t overlay; diff --git a/src/libspudec/xine_spu_decoder.c b/src/libspudec/xine_spu_decoder.c index b6c06ca05..1f40dbb27 100644 --- a/src/libspudec/xine_spu_decoder.c +++ b/src/libspudec/xine_spu_decoder.c @@ -1,20 +1,20 @@ /* * Copyright (C) 2000-2008 the xine project - * + * * Copyright (C) James Courtier-Dutton James@superbug.demon.co.uk - July 2001 * * This file is part of xine, a unix video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -85,7 +85,7 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { pthread_mutex_unlock(&this->nav_pci_lock); if ( (buf->type & 0xffff0000) != BUF_SPU_DVD || - !(buf->decoder_flags & BUF_FLAG_SPECIAL) || + !(buf->decoder_flags & BUF_FLAG_SPECIAL) || buf->decoder_info[1] != BUF_SPECIAL_SPU_DVD_SUBTYPE ) return; @@ -104,7 +104,7 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { this->state.need_clut = 0; return; } - + if ( buf->decoder_info[2] == SPU_DVD_SUBTYPE_NAV ) { #ifdef LOG_DEBUG printf("libspudec:got nav packet 1\n"); @@ -112,11 +112,11 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { spudec_decode_nav(this,buf); return; } - + if ( buf->decoder_info[2] == SPU_DVD_SUBTYPE_VOBSUB_PACKAGE ) { this->state.vobsub = 1; } - + #ifdef LOG_DEBUG printf("libspudec:got buffer type = %x\n", buf->type); #endif @@ -126,14 +126,14 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { if (buf->pts) { metronom_t *metronom = this->stream->metronom; int64_t vpts = metronom->got_spu_packet(metronom, buf->pts); - + this->spudec_stream_state[stream_id].vpts = vpts; /* Show timer */ this->spudec_stream_state[stream_id].pts = buf->pts; /* Required to match up with NAV packets */ } spudec_reassembly(this->stream->xine, &this->spudec_stream_state[stream_id].ra_seq, buf->content, buf->size); - if(this->spudec_stream_state[stream_id].ra_seq.complete == 1) { + if(this->spudec_stream_state[stream_id].ra_seq.complete == 1) { if(this->spudec_stream_state[stream_id].ra_seq.broken) { xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "libspudec: dropping broken SPU\n"); this->spudec_stream_state[stream_id].ra_seq.broken = 0; @@ -146,12 +146,12 @@ static void spudec_reset (spu_decoder_t *this_gen) { spudec_decoder_t *this = (spudec_decoder_t *) this_gen; video_overlay_manager_t *ovl_manager = this->stream->video_out->get_overlay_manager (this->stream->video_out); int i; - + if( this->menu_handle >= 0 ) ovl_manager->free_handle(ovl_manager, this->menu_handle); this->menu_handle = -1; - + for (i=0; i < MAX_STREAMS; i++) { if( this->spudec_stream_state[i].overlay_handle >= 0 ) ovl_manager->free_handle(ovl_manager, @@ -160,7 +160,7 @@ static void spudec_reset (spu_decoder_t *this_gen) { this->spudec_stream_state[i].ra_seq.complete = 1; this->spudec_stream_state[i].ra_seq.broken = 0; } - + pthread_mutex_lock(&this->nav_pci_lock); spudec_clear_nav_list(this); pthread_mutex_unlock(&this->nav_pci_lock); @@ -168,7 +168,7 @@ static void spudec_reset (spu_decoder_t *this_gen) { static void spudec_discontinuity (spu_decoder_t *this_gen) { spudec_decoder_t *this = (spudec_decoder_t *) this_gen; - + pthread_mutex_lock(&this->nav_pci_lock); spudec_clear_nav_list(this); pthread_mutex_unlock(&this->nav_pci_lock); @@ -193,7 +193,7 @@ static void spudec_dispose (spu_decoder_t *this_gen) { this->spudec_stream_state[i].overlay_handle = -1; free (this->spudec_stream_state[i].ra_seq.buf); } - + spudec_clear_nav_list(this); pthread_mutex_destroy(&this->nav_pci_lock); @@ -208,9 +208,9 @@ static void spudec_dispose (spu_decoder_t *this_gen) { static int spudec_get_interact_info (spu_decoder_t *this_gen, void *data) { spudec_decoder_t *this = (spudec_decoder_t *) this_gen; /*printf("get_interact_info() called\n");*/ - if (!this || !data) + if (!this || !data) return 0; - + /*printf("get_interact_info() coping nav_pci\n");*/ pthread_mutex_lock(&this->nav_pci_lock); spudec_update_nav(this); @@ -243,14 +243,14 @@ static void spudec_set_button (spu_decoder_t *this_gen, int32_t button, int32_t printf ("libspudec:xine_decoder.c:spudec_event_listener:this->menu_handle=%d\n",this->menu_handle); #endif if(this->menu_handle < 0) { - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "Menu handle alloc failed. No more overlays objects available. Only %d at once please.", MAX_OBJECTS); free(overlay_event); free(overlay); return; } - + if (show > 0) { #ifdef LOG_NAV fprintf (stderr,"libspudec:xine_decoder.c:spudec_event_listener:buttonN = %u show=%d\n", @@ -283,7 +283,7 @@ static void spudec_set_button (spu_decoder_t *this_gen, int32_t button, int32_t this->buttonN, show-1, overlay, &this->overlay ); pthread_mutex_unlock(&this->nav_pci_lock); } else { - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "libspudec:xine_decoder.c:spudec_event_listener:HIDE ????\n"); printf("We dropped out here for some reason"); _x_abort(); @@ -327,7 +327,7 @@ static spu_decoder_t *open_plugin (spu_decoder_class_t *class_gen, xine_stream_t this->menu_handle = -1; this->buttonN = 1; this->event.object.overlay = calloc(1, sizeof(vo_overlay_t)); - + pthread_mutex_init(&this->nav_pci_lock, NULL); this->pci_cur.pci.hli.hl_gi.hli_ss = 0; this->pci_cur.next = NULL; @@ -396,7 +396,7 @@ static const decoder_info_t dec_info_data = { }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_SPU_DECODER, 16, "spudec", XINE_VERSION_CODE, &dec_info_data, &init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libspudvb/xine_spudvb_decoder.c b/src/libspudvb/xine_spudvb_decoder.c index bcb0cbf96..694227122 100644 --- a/src/libspudvb/xine_spudvb_decoder.c +++ b/src/libspudvb/xine_spudvb_decoder.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2008 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -35,54 +35,54 @@ /*#define LOG 1*/ typedef struct { - int x, y; - unsigned char is_visible; + int x, y; + unsigned char is_visible; } visible_region_t; typedef struct { int page_time_out; - int page_version_number; - int page_state; - int page_id; - visible_region_t regions[MAX_REGIONS]; + int page_version_number; + int page_state; + int page_id; + visible_region_t regions[MAX_REGIONS]; } page_t; typedef struct { int version_number; - int width, height; + int width, height; int empty; - int depth; - int CLUT_id; - int objects_start; + int depth; + int CLUT_id; + int objects_start; int objects_end; - unsigned int object_pos[65536]; - unsigned char *img; + unsigned int object_pos[65536]; + unsigned char *img; osd_object_t *osd; } region_t; typedef struct { /* dvbsub stuff */ - int x; - int y; - unsigned int curr_obj; - unsigned int curr_reg[64]; - uint8_t *buf; - int i; - int nibble_flag; - int in_scanline; - page_t page; - region_t regions[MAX_REGIONS]; + int x; + int y; + unsigned int curr_obj; + unsigned int curr_reg[64]; + uint8_t *buf; + int i; + int nibble_flag; + int in_scanline; + page_t page; + region_t regions[MAX_REGIONS]; clut_t colours[MAX_REGIONS*256]; unsigned char trans[MAX_REGIONS*256]; } dvbsub_func_t; -typedef struct dvb_spu_class_s { - spu_decoder_class_t class; - xine_t *xine; +typedef struct dvb_spu_class_s { + spu_decoder_class_t class; + xine_t *xine; } dvb_spu_class_t; typedef struct dvb_spu_decoder_s { - spu_decoder_t spu_decoder; + spu_decoder_t spu_decoder; dvb_spu_class_t *class; xine_stream_t *stream; @@ -91,21 +91,21 @@ typedef struct dvb_spu_decoder_s { /* dvbsub_osd_mutex should be locked around all calls to this->osd_renderer->show() and this->osd_renderer->hide() */ - pthread_mutex_t dvbsub_osd_mutex; - - char *pes_pkt; + pthread_mutex_t dvbsub_osd_mutex; + + char *pes_pkt; char *pes_pkt_wrptr; - unsigned int pes_pkt_size; - - uint64_t pts; - uint64_t vpts; + unsigned int pes_pkt_size; + + uint64_t pts; + uint64_t vpts; uint64_t end_vpts; - pthread_t dvbsub_timer_thread; + pthread_t dvbsub_timer_thread; struct timespec dvbsub_hide_timeout; pthread_cond_t dvbsub_restart_timeout; dvbsub_func_t *dvbsub; - int show; + int show; } dvb_spu_decoder_t; @@ -168,7 +168,7 @@ static void update_region (dvb_spu_decoder_t * this, int region_id, int region_w } fill = 1; } - + if ( fill ) { memset( reg->img, fill_color, region_width*region_height ); reg->empty = 1; @@ -304,7 +304,7 @@ static void decode_4bit_pixel_code_string (dvb_spu_decoder_t * this, int r, int static void set_clut(dvb_spu_decoder_t *this,int CLUT_id,int CLUT_entry_id,int Y_value, int Cr_value, int Cb_value, int T_value) { - + dvbsub_func_t *dvbsub = this->dvbsub; if ((CLUT_id>=MAX_REGIONS) || (CLUT_entry_id>15)) { @@ -482,7 +482,7 @@ static void process_region_composition_segment (dvb_spu_decoder_t * this) return; dvbsub->regions[region_id].version_number = region_version_number; - + /* Check if region size has changed and fill background. */ update_region (this, region_id, region_width, region_height, region_fill_flag, region_4_bit_pixel_code); if ( CLUT_id<MAX_REGIONS ) @@ -554,17 +554,17 @@ static void process_object_data_segment (dvb_spu_decoder_t * this) /* If this object is in this region... */ if (!dvbsub->regions[r].img) continue; - + if (dvbsub->regions[r].object_pos[object_id] == 0xffffffff) continue; - + dvbsub->i = old_i; const uint16_t top_field_data_block_length = _X_BE_16(&dvbsub->buf[dvbsub->i]); dvbsub->i += 2; const uint16_t bottom_field_data_block_length = _X_BE_16(&dvbsub->buf[dvbsub->i]); dvbsub->i += 2; - + process_pixel_data_sub_block (this, r, object_id, 0, top_field_data_block_length); process_pixel_data_sub_block (this, r, object_id, 1, bottom_field_data_block_length); } @@ -667,14 +667,14 @@ static void draw_subtitles (dvb_spu_decoder_t * this) int r; for (r = 0; r < MAX_REGIONS; r++) { - if (this->dvbsub->regions[r].img) { + if (this->dvbsub->regions[r].img) { if (this->dvbsub->page.regions[r].is_visible && !this->dvbsub->regions[r].empty) { update_osd( this, r ); if ( !this->dvbsub->regions[r].osd ) continue; /* clear osd */ this->stream->osd_renderer->clear( this->dvbsub->regions[r].osd ); - + uint8_t *reg; int reg_width; uint8_t tmp[dest_width*576]; @@ -730,9 +730,9 @@ static void draw_subtitles (dvb_spu_decoder_t * this) static void spudec_decode_data (spu_decoder_t * this_gen, buf_element_t * buf) { dvb_spu_decoder_t *this = (dvb_spu_decoder_t *) this_gen; - + if((buf->type & 0xffff0000)!=BUF_SPU_DVB) - return; + return; if (buf->decoder_flags & BUF_FLAG_SPECIAL) { if (buf->decoder_info[1] == BUF_SPECIAL_SPU_DVB_DESCRIPTOR) { @@ -793,7 +793,7 @@ static void spudec_decode_data (spu_decoder_t * this_gen, buf_element_t * buf) this->vpts = 0; /* process the pes section */ - + const int PES_packet_length = this->pes_pkt_size; this->dvbsub->buf = this->pes_pkt; @@ -810,7 +810,7 @@ static void spudec_decode_data (spu_decoder_t * this_gen, buf_element_t * buf) /* SUBTITLING SEGMENT */ this->dvbsub->i++; const uint8_t segment_type = this->dvbsub->buf[this->dvbsub->i++]; - + this->dvbsub->page.page_id = (this->dvbsub->buf[this->dvbsub->i] << 8) | this->dvbsub->buf[this->dvbsub->i + 1]; const uint16_t segment_length = _X_BE_16(&this->dvbsub->buf[this->dvbsub->i + 2]); const int new_i = this->dvbsub->i + segment_length + 4; @@ -829,17 +829,17 @@ static void spudec_decode_data (spu_decoder_t * this_gen, buf_element_t * buf) case 0x11: process_region_composition_segment(this); break; - case 0x12: + case 0x12: process_CLUT_definition_segment(this); break; case 0x13: process_object_data_segment (this); break; - case 0x80: + case 0x80: draw_subtitles( this ); /* Page is now completely rendered */ break; default: - return; + return; break; } } @@ -910,7 +910,7 @@ static spu_decoder_t *dvb_spu_class_open_plugin (spu_decoder_class_t * class_gen this->pes_pkt = calloc(65, 1024); this->spu_descriptor = calloc(1, sizeof(spu_dvb_descriptor_t)); - + this->dvbsub = calloc(1, sizeof (dvbsub_func_t)); pthread_mutex_init(&this->dvbsub_osd_mutex, NULL); diff --git a/src/libsputext/Makefile.am b/src/libsputext/Makefile.am index 62258933d..ad6c1b776 100644 --- a/src/libsputext/Makefile.am +++ b/src/libsputext/Makefile.am @@ -9,6 +9,6 @@ xineplug_dmx_sputext_la_SOURCES = demux_sputext.c xineplug_dmx_sputext_la_LIBADD = $(XINE_LIB) $(LTLIBINTL) xineplug_dmx_sputext_la_CFLAGS = $(VISIBILITY_FLAG) -xineplug_decode_sputext_la_SOURCES = xine_sputext_decoder.c +xineplug_decode_sputext_la_SOURCES = xine_sputext_decoder.c xineplug_decode_sputext_la_LIBADD = $(XINE_LIB) $(LTLIBINTL) xineplug_decode_sputext_la_CFLAGS = $(VISIBILITY_FLAG) diff --git a/src/libsputext/demux_sputext.c b/src/libsputext/demux_sputext.c index 198c30498..b0e1299d9 100644 --- a/src/libsputext/demux_sputext.c +++ b/src/libsputext/demux_sputext.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -67,7 +67,7 @@ typedef struct { long start; /* csecs */ long end; /* csecs */ - + char *text[SUB_MAX_TEXT]; } subtitle_t; @@ -84,10 +84,10 @@ typedef struct { char buf[SUB_BUFSIZE]; off_t buflen; - float mpsub_position; + float mpsub_position; - int uses_time; - int errs; + int uses_time; + int errs; subtitle_t *subtitles; int num; /* number of subtitle structs */ int cur; /* current subtitle */ @@ -117,8 +117,8 @@ typedef struct demux_sputext_class_s { #define FORMAT_RT 5 #define FORMAT_SSA 6 /* Sub Station Alpha */ #define FORMAT_PJS 7 -#define FORMAT_MPSUB 8 -#define FORMAT_AQTITLE 9 +#define FORMAT_MPSUB 8 +#define FORMAT_AQTITLE 9 #define FORMAT_JACOBSUB 10 #define FORMAT_SUBVIEWER2 11 #define FORMAT_SUBRIP09 12 @@ -137,7 +137,7 @@ static inline void trail_space(char *s) { } while(*copy); } size_t i = strlen(s) - 1; - while (i > 0 && isspace(s[i])) + while (i > 0 && isspace(s[i])) s[i--] = '\0'; } @@ -146,24 +146,24 @@ static inline void trail_space(char *s) { */ static char *read_line_from_input(demux_sputext_t *this, char *line, off_t len) { off_t nread = 0; - + if ((len - this->buflen) > 512 && len < SUB_BUFSIZE) { - if((nread = this->input->read(this->input, + if((nread = this->input->read(this->input, &this->buf[this->buflen], len - this->buflen)) < 0) { xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "read failed.\n"); return NULL; } } - + this->buflen += nread; this->buf[this->buflen] = '\0'; char *s = strchr(this->buf, '\n'); if (line && (s || this->buflen)) { - + size_t linelen = s ? (s - this->buf) + 1 : this->buflen; - + memcpy(line, this->buf, linelen); line[linelen] = '\0'; @@ -187,14 +187,14 @@ static subtitle_t *sub_read_line_sami(demux_sputext_t *this, subtitle_t *current current->lines = current->start = 0; current->end = -1; int state = 0; - + /* read the first line */ if (!s) if (!(s = read_line_from_input(this, line, LINE_LEN))) return 0; - + do { switch (state) { - + case 0: /* find "START=" */ s = strstr (s, "Start="); if (s) { @@ -202,15 +202,15 @@ static subtitle_t *sub_read_line_sami(demux_sputext_t *this, subtitle_t *current state = 1; continue; } break; - + case 1: /* find "<P" */ if ((s = strstr (s, "<P"))) { s += 2; state = 2; continue; } break; - + case 2: /* find ">" */ if ((s = strchr (s, '>'))) { s++; state = 3; p = text; continue; } break; - + case 3: /* get all text until '<' appears */ if (*s == '\0') { break; } else if (*s == '<') { state = 4; } @@ -224,7 +224,7 @@ static subtitle_t *sub_read_line_sami(demux_sputext_t *this, subtitle_t *current } else *p++ = *s++; continue; - + case 4: /* get current->end or skip <TAG> */ { char *q = strstr (s, "Start="); @@ -241,13 +241,13 @@ static subtitle_t *sub_read_line_sami(demux_sputext_t *this, subtitle_t *current if (s) { s++; state = 3; continue; } break; } - + /* read next line */ - if (state != 99 && !(s = read_line_from_input (this, line, LINE_LEN))) + if (state != 99 && !(s = read_line_from_input (this, line, LINE_LEN))) return 0; - + } while (state != 99); - + return current; } @@ -255,16 +255,16 @@ static subtitle_t *sub_read_line_sami(demux_sputext_t *this, subtitle_t *current static char *sub_readtext(char *source, char **dest) { size_t len=0; char *p=source; - + while ( !eol(*p) && *p!= '|' ) { p++,len++; } - + *dest = strndup(source, len); - + while (*p=='\r' || *p=='\n' || *p=='|') p++; - + if (*p) return p; /* not-last text field */ else return NULL; /* last text field */ } @@ -273,39 +273,39 @@ static subtitle_t *sub_read_line_microdvd(demux_sputext_t *this, subtitle_t *cur char line[LINE_LEN + 1]; char line2[LINE_LEN + 1]; - + memset (current, 0, sizeof(subtitle_t)); - + current->end=-1; do { if (!read_line_from_input (this, line, LINE_LEN)) return NULL; } while ((sscanf (line, "{%ld}{}%" LINE_LEN_QUOT "[^\r\n]", &(current->start), line2) !=2) && (sscanf (line, "{%ld}{%ld}%" LINE_LEN_QUOT "[^\r\n]", &(current->start), &(current->end),line2) !=3) ); - + char *p=line2; - + char *next=p; size_t i=0; while ((next =sub_readtext (next, &(current->text[i])))) { if (current->text[i]==ERR) return ERR; i++; - if (i>=SUB_MAX_TEXT) { + if (i>=SUB_MAX_TEXT) { xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "Too many lines in a subtitle\n"); current->lines=i; return current; } } current->lines= ++i; - + return current; } static subtitle_t *sub_read_line_subviewer(demux_sputext_t *this, subtitle_t *current) { char line[LINE_LEN + 1]; - + memset (current, 0, sizeof(subtitle_t)); - + while (1) { if (!read_line_from_input(this, line, LINE_LEN)) return NULL; @@ -322,7 +322,7 @@ static subtitle_t *sub_read_line_subviewer(demux_sputext_t *this, subtitle_t *cu if (!read_line_from_input(this, line, LINE_LEN)) return NULL; - + char *p = line, *q = line; for (current->lines=1; current->lines <= SUB_MAX_TEXT; current->lines++) { size_t len; @@ -410,9 +410,9 @@ static subtitle_t *sub_read_line_subrip(demux_sputext_t *this,subtitle_t *curren static subtitle_t *sub_read_line_vplayer(demux_sputext_t *this,subtitle_t *current) { char line[LINE_LEN + 1]; - + memset (current, 0, sizeof(subtitle_t)); - + while (!current->text[0]) { if( this->next_line[0] == '\0' ) { /* if the buffer is empty.... */ if( !read_line_from_input(this, line, LINE_LEN) ) return NULL; @@ -437,27 +437,27 @@ static subtitle_t *sub_read_line_vplayer(demux_sputext_t *this,subtitle_t *curre current->end = b1*360000+b2*6000+b3*100; } - if ((current->end - current->start) > LINE_LEN) + if ((current->end - current->start) > LINE_LEN) current->end = current->start + LINE_LEN; /* not too long though. */ /* teraz czas na wkopiowanie stringu */ char *p=line; /* finds the body of the subtitle_t */ { int i; - for (i=0; i<3; i++){ + for (i=0; i<3; i++){ char *p2=strchr( p, ':'); if( p2 == NULL ) break; p=p2+1; } } - + char *next=p; int i=0; while( (next = sub_readtext( next, &(current->text[i]))) ) { - if (current->text[i]==ERR) + if (current->text[i]==ERR) return ERR; i++; - if (i>=SUB_MAX_TEXT) { + if (i>=SUB_MAX_TEXT) { xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "Too many lines in a subtitle\n"); current->lines=i; return current; @@ -470,12 +470,12 @@ static subtitle_t *sub_read_line_vplayer(demux_sputext_t *this,subtitle_t *curre static subtitle_t *sub_read_line_rt(demux_sputext_t *this,subtitle_t *current) { /* - * TODO: This format uses quite rich (sub/super)set of xhtml + * TODO: This format uses quite rich (sub/super)set of xhtml * I couldn't check it since DTD is not included. - * WARNING: full XML parses can be required for proper parsing + * WARNING: full XML parses can be required for proper parsing */ memset (current, 0, sizeof(subtitle_t)); - + while (!current->text[0]) { char line[LINE_LEN + 1]; if (!read_line_from_input(this, line, LINE_LEN)) return NULL; @@ -488,20 +488,20 @@ static subtitle_t *sub_read_line_rt(demux_sputext_t *this,subtitle_t *current) { { int a1,a2,a3,a4,b1,b2,b3,b4,len,plen; if ((len=sscanf (line, "<Time Begin=\"%d:%d:%d.%d\" End=\"%d:%d:%d.%d\"",&a1,&a2,&a3,&a4,&b1,&b2,&b3,&b4)) < 8) - + a1=a2=a3=a4=b1=b2=b3=b4=0; if ( ((len=sscanf (line, "<%*[tT]ime %*[bB]egin=\"%d:%d\" %*[Ee]nd=\"%d:%d\"%*[^<]<clear/>%n",&a2,&a3,&b2,&b3,&plen)) < 4) && ((len=sscanf (line, "<%*[tT]ime %*[bB]egin=\"%d:%d\" %*[Ee]nd=\"%d:%d.%d\"%*[^<]<clear/>%n",&a2,&a3,&b2,&b3,&b4,&plen)) < 5) && /* ((len=sscanf (line, "<%*[tT]ime %*[bB]egin=\"%d:%d.%d\" %*[Ee]nd=\"%d:%d\"%*[^<]<clear/>%n",&a2,&a3,&a4,&b2,&b3,&plen)) < 5) && */ ((len=sscanf (line, "<%*[tT]ime %*[bB]egin=\"%d:%d.%d\" %*[Ee]nd=\"%d:%d.%d\"%*[^<]<clear/>%n",&a2,&a3,&a4,&b2,&b3,&b4,&plen)) < 6) && - ((len=sscanf (line, "<%*[tT]ime %*[bB]egin=\"%d:%d:%d.%d\" %*[Ee]nd=\"%d:%d:%d.%d\"%*[^<]<clear/>%n",&a1,&a2,&a3,&a4,&b1,&b2,&b3,&b4,&plen)) < 8) + ((len=sscanf (line, "<%*[tT]ime %*[bB]egin=\"%d:%d:%d.%d\" %*[Ee]nd=\"%d:%d:%d.%d\"%*[^<]<clear/>%n",&a1,&a2,&a3,&a4,&b1,&b2,&b3,&b4,&plen)) < 8) ) continue; - + current->start = a1*360000+a2*6000+a3*100+a4/10; current->end = b1*360000+b2*6000+b3*100+b4/10; - + p += plen; } @@ -509,10 +509,10 @@ static subtitle_t *sub_read_line_rt(demux_sputext_t *this,subtitle_t *current) { /* TODO: I don't know what kind of convention is here for marking multiline subs, maybe <br/> like in xml? */ char *next = strstr(line,"<clear/>")+8;i=0; while ((next =sub_readtext (next, &(current->text[i])))) { - if (current->text[i]==ERR) + if (current->text[i]==ERR) return ERR; i++; - if (i>=SUB_MAX_TEXT) { + if (i>=SUB_MAX_TEXT) { xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "Too many lines in a subtitle\n"); current->lines=i; return current; @@ -526,48 +526,48 @@ static subtitle_t *sub_read_line_rt(demux_sputext_t *this,subtitle_t *current) { static subtitle_t *sub_read_line_ssa(demux_sputext_t *this,subtitle_t *current) { static int max_comma = 32; /* let's use 32 for the case that the */ /* amount of commas increase with newer SSA versions */ - + int hour1, min1, sec1, hunsec1, hour2, min2, sec2, hunsec2, nothing; char line3[LINE_LEN + 1]; - + { char line[LINE_LEN + 1]; do { if (!read_line_from_input(this, line, LINE_LEN)) return NULL; } while (sscanf (line, "Dialogue: Marked=%d,%d:%d:%d.%d,%d:%d:%d.%d," "%[^\n\r]", ¬hing, - &hour1, &min1, &sec1, &hunsec1, + &hour1, &min1, &sec1, &hunsec1, &hour2, &min2, &sec2, &hunsec2, line3) < 9 && sscanf (line, "Dialogue: %d,%d:%d:%d.%d,%d:%d:%d.%d," "%[^\n\r]", ¬hing, - &hour1, &min1, &sec1, &hunsec1, + &hour1, &min1, &sec1, &hunsec1, &hour2, &min2, &sec2, &hunsec2, line3) < 9 ); } - + char *line2=strchr(line3, ','); if (!line2) return NULL; - + int comma; for (comma = 4; comma < max_comma; comma ++) { char *tmp = line2; if(!(tmp=strchr(++tmp, ','))) break; - if(*(++tmp) == ' ') break; + if(*(++tmp) == ' ') break; /* a space after a comma means we're already in a sentence */ line2 = tmp; } - + if(comma < max_comma)max_comma = comma; /* eliminate the trailing comma */ if(*line2 == ',') line2++; - + current->lines=0; current->start = 360000*hour1 + 6000*min1 + 100*sec1 + hunsec1; current->end = 360000*hour2 + 6000*min2 + 100*sec2 + hunsec2; - + int num=0; char *tmp; while (((tmp=strstr(line2, "\\n")) != NULL) || ((tmp=strstr(line2, "\\N")) != NULL) ){ @@ -577,10 +577,10 @@ static subtitle_t *sub_read_line_ssa(demux_sputext_t *this,subtitle_t *current) current->lines++; if (current->lines >= SUB_MAX_TEXT) return current; } - + current->text[num]=strdup(line2); current->lines++; - + return current; } @@ -598,9 +598,9 @@ static subtitle_t *sub_read_line_ssa(demux_sputext_t *this,subtitle_t *current) static subtitle_t *sub_read_line_pjs (demux_sputext_t *this, subtitle_t *current) { char line[LINE_LEN + 1]; char *s; - + memset (current, 0, sizeof(subtitle_t)); - + if (!read_line_from_input(this, line, LINE_LEN)) return NULL; for (s = line; *s && isspace(*s); s++); @@ -612,7 +612,7 @@ static subtitle_t *sub_read_line_pjs (demux_sputext_t *this, subtitle_t *current /* the files I have are in tenths of second */ current->start *= 10; current->end *= 10; - + /* walk to the beggining of the string */ for (; *s; s++) if (*s==',') break; if (*s) { @@ -630,41 +630,41 @@ static subtitle_t *sub_read_line_pjs (demux_sputext_t *this, subtitle_t *current *d=0; current->text[0] = strdup(text); current->lines = 1; - + return current; } static subtitle_t *sub_read_line_mpsub (demux_sputext_t *this, subtitle_t *current) { char line[LINE_LEN + 1]; - + { float a,b; do { - if (!read_line_from_input(this, line, LINE_LEN)) + if (!read_line_from_input(this, line, LINE_LEN)) return NULL; } while (sscanf (line, "%f %f", &a, &b) !=2); - + this->mpsub_position += (a*100.0); current->start = (int) this->mpsub_position; this->mpsub_position += (b*100.0); current->end = (int) this->mpsub_position; } - + int num = 0; while (num < SUB_MAX_TEXT) { - if (!read_line_from_input(this, line, LINE_LEN)) + if (!read_line_from_input(this, line, LINE_LEN)) return NULL; char *p=line; - while (isspace(*p)) + while (isspace(*p)) p++; - if (eol(*p) && num > 0) + if (eol(*p) && num > 0) return current; - if (eol(*p)) + if (eol(*p)) return NULL; - + char *q; for (q=p; !eol(*q); q++); *q='\0'; @@ -691,25 +691,25 @@ static subtitle_t *sub_read_line_aqt (demux_sputext_t *this, subtitle_t *current if (!(sscanf (line, "-->> %ld", &(current->start)) <1)) break; } - + char line[LINE_LEN + 1]; if (!read_line_from_input(this, line, LINE_LEN)) return NULL; - + sub_readtext((char *) &line,¤t->text[0]); current->lines = 1; current->end = -1; - + if (!read_line_from_input(this, line, LINE_LEN)) return current;; - + sub_readtext((char *) &line,¤t->text[1]); current->lines = 2; - + if ((current->text[0][0]==0) && (current->text[1][0]==0)) { return NULL; } - + return current; } @@ -865,13 +865,13 @@ static subtitle_t *sub_read_line_jacobsub(demux_sputext_t *this, subtitle_t *cur ++p,++p; break; } - if ((*(p + 1) == 'B') || (*(p + 1) == 'b') || + if ((*(p + 1) == 'B') || (*(p + 1) == 'b') || /* actually this means "insert current date here" */ - (*(p + 1) == 'D') || - (*(p + 1) == 'I') || (*(p + 1) == 'i') || - (*(p + 1) == 'N') || + (*(p + 1) == 'D') || + (*(p + 1) == 'I') || (*(p + 1) == 'i') || + (*(p + 1) == 'N') || /* actually this means "insert current time here" */ - (*(p + 1) == 'T') || + (*(p + 1) == 'T') || (*(p + 1) == 'U') || (*(p + 1) == 'u')) { ++p; break; @@ -945,7 +945,7 @@ static subtitle_t *sub_read_line_subrip09 (demux_sputext_t *this, subtitle_t *cu memset (current, 0, sizeof(subtitle_t)); int h, m, s; - { + { char line[LINE_LEN + 1]; do { if (!read_line_from_input (this, line, LINE_LEN)) return NULL; @@ -963,14 +963,14 @@ static subtitle_t *sub_read_line_subrip09 (demux_sputext_t *this, subtitle_t *cu while ((next = sub_readtext (next, &(current->text[i])))) { if (current->text[i]==ERR) return ERR; i++; - if (i>=SUB_MAX_TEXT) { + if (i>=SUB_MAX_TEXT) { xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "Too many lines in a subtitle\n"); current->lines=i; return current; } } current->lines= ++i; - + return current; } @@ -986,7 +986,7 @@ static subtitle_t *sub_read_line_mpl2(demux_sputext_t *this, subtitle_t *current { char line[LINE_LEN+1]; long start, end; - + do { if (!read_line_from_input (this, line, LINE_LEN)) return NULL; } while ((sscanf (line, @@ -1050,7 +1050,7 @@ static int sub_autodetect (demux_sputext_t *this) { } if (strstr (line, "<SAMI>")) { - this->uses_time=1; + this->uses_time=1; xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "sami subtitle format detected\n"); return FORMAT_SAMI; } @@ -1069,7 +1069,7 @@ static int sub_autodetect (demux_sputext_t *this) { return FORMAT_RT; } if ((!memcmp(line, "Dialogue: Marked", 16)) || (!memcmp(line, "Dialogue: ", 10))) { - this->uses_time=1; + this->uses_time=1; xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "ssa subtitle format detected\n"); return FORMAT_SSA; } @@ -1079,20 +1079,20 @@ static int sub_autodetect (demux_sputext_t *this) { return FORMAT_PJS; } if (sscanf (line, "FORMAT=%d", &i) == 1) { - this->uses_time=0; + this->uses_time=0; xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "mpsub subtitle format detected\n"); return FORMAT_MPSUB; } char p; if (sscanf (line, "FORMAT=TIM%c", &p)==1 && p=='E') { - this->uses_time=1; + this->uses_time=1; xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "mpsub subtitle format detected\n"); return FORMAT_MPSUB; } if (strstr (line, "-->>")) { - this->uses_time=0; + this->uses_time=0; xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "aqtitle subtitle format detected\n"); return FORMAT_AQTITLE; } @@ -1112,7 +1112,7 @@ static int sub_autodetect (demux_sputext_t *this) { xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "subrip 0.9 subtitle format detected\n"); return FORMAT_SUBRIP09; } - + if (sscanf (line, "[%d][%d]", &i, &i) == 2) { this->uses_time = 1; xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "mpl2 subtitle format detected\n"); @@ -1156,7 +1156,7 @@ static subtitle_t *sub_read_file (demux_sputext_t *this) { } xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "Detected subtitle file format: %d\n",this->format); - + /* Rewind */ if(this->input->seek(this->input, 0, SEEK_SET) == -1) { xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "seek failed.\n"); @@ -1169,7 +1169,7 @@ static subtitle_t *sub_read_file (demux_sputext_t *this) { subtitle_t *first = calloc(n_max, sizeof(subtitle_t)); if(!first) return NULL; - const int timeout = + const int timeout = (((demux_sputext_class_t *) (this->demux_plugin.demux_class))->max_timeout) * (this->uses_time ? 100 : 10); @@ -1182,15 +1182,15 @@ static subtitle_t *sub_read_file (demux_sputext_t *this) { subtitle_t *sub = func[this->format] (this, &first[this->num]); - if (!sub) + if (!sub) break; /* EOF */ - if (sub==ERR) - ++this->errs; + if (sub==ERR) + ++this->errs; else { if (this->num > 0 && first[this->num-1].end == -1) { /* end time not defined in the subtitle */ - if (timeout > 0) { + if (timeout > 0) { /* timeout */ if (timeout > sub->start - first[this->num-1].start) { first[this->num-1].end = sub->start; @@ -1215,25 +1215,25 @@ static subtitle_t *sub_read_file (demux_sputext_t *this) { sprintf(buffer, "Read %i subtitles", this->num); - if(this->errs) + if(this->errs) sprintf(buffer + strlen(buffer), ", %i bad line(s).\n", this->errs); else strcat(buffer, "\n"); - + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "%s", buffer); } - + return first; } static int demux_sputext_next (demux_sputext_t *this_gen) { demux_sputext_t *this = (demux_sputext_t *) this_gen; - + if (this->cur >= this->num) return 0; subtitle_t *sub = &this->subtitles[this->cur]; - + buf_element_t *buf = this->stream->video_fifo->buffer_pool_alloc(this->stream->video_fifo); buf->type = BUF_SPU_TEXT; buf->pts = 0; @@ -1252,10 +1252,10 @@ static int demux_sputext_next (demux_sputext_t *this_gen) { strncpy(str, sub->text[line], SUB_BUFSIZE-1); str[SUB_BUFSIZE-1] = '\0'; } - + this->stream->video_fifo->put(this->stream->video_fifo, buf); this->cur++; - + return 1; } @@ -1280,14 +1280,14 @@ static int demux_sputext_get_status (demux_plugin_t *this_gen) { static int demux_sputext_get_stream_length (demux_plugin_t *this_gen) { demux_sputext_t *this = (demux_sputext_t *) this_gen; - return ( this->uses_time && this->num ) ? + return ( this->uses_time && this->num ) ? this->subtitles[this->num-1].end * 10 : 0; } static int demux_sputext_send_chunk (demux_plugin_t *this_gen) { demux_sputext_t *this = (demux_sputext_t *) this_gen; - + if (!demux_sputext_next (this)) { this->status = DEMUX_FINISHED; } @@ -1301,15 +1301,15 @@ static int demux_sputext_seek (demux_plugin_t *this_gen, lprintf("seek() called\n"); - /* simple seeking approach: just go back to start. + /* simple seeking approach: just go back to start. * decoder will discard subtitles until the desired position. */ this->cur = 0; this->status = DEMUX_OK; - + _x_demux_flush_engine (this->stream); _x_demux_control_newpts(this->stream, 0, 0); - + return this->status; } @@ -1317,7 +1317,7 @@ static void demux_sputext_send_headers(demux_plugin_t *this_gen) { demux_sputext_t *this = (demux_sputext_t*)this_gen; lprintf("send_headers() called\n"); - + _x_demux_control_start(this->stream); _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_VIDEO, 0); _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_AUDIO, 0); @@ -1327,7 +1327,7 @@ static void demux_sputext_send_headers(demux_plugin_t *this_gen) { buf->type = BUF_CONTROL_SPU_CHANNEL; buf->decoder_info[0] = buf->decoder_info[1] = buf->decoder_info[2] = 0; this->stream->video_fifo->put(this->stream->video_fifo, buf); - + this->status = DEMUX_OK; } @@ -1357,7 +1357,7 @@ static demux_plugin_t *open_demux_plugin (demux_class_t *class_gen, xine_stream_ demux_sputext_t *this; lprintf("open_plugin() called\n"); - + this = calloc(1, sizeof (demux_sputext_t)); this->stream = stream; this->input = input; @@ -1392,26 +1392,26 @@ static demux_plugin_t *open_demux_plugin (demux_class_t *class_gen, xine_stream_ } } /* falling through is intended */ - + case METHOD_EXPLICIT: /* case METHOD_BY_CONTENT: */ - + /* FIXME: for now this demuxer only works when requested explicitly * to make sure it does not interfere with others; * If this is found too inconvenient, this may be changed after making * sure the content detection does not produce any false positives. */ - + if ((input->get_capabilities(input) & INPUT_CAP_SEEKABLE) != 0) { - + this->subtitles = sub_read_file (this); this->cur = 0; if (this->subtitles) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "subtitle format %s time.\n", + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "subtitle format %s time.\n", this->uses_time ? "uses" : "doesn't use"); - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "read %i subtitles, %i errors.\n", this->num, this->errs); return &this->demux_plugin; } @@ -1422,7 +1422,7 @@ static demux_plugin_t *open_demux_plugin (demux_class_t *class_gen, xine_stream_ free (this); return NULL; } - + static const char *get_demux_description (demux_class_t *this_gen) { return "sputext demuxer plugin"; } @@ -1469,13 +1469,13 @@ static void *init_sputext_demux_class (xine_t *xine, void *data) { this->demux_class.get_extensions = get_demux_extensions; this->demux_class.dispose = demux_class_dispose; - /* + /* * Some subtitling formats, namely AQT and Subrip09, define the end of a - * subtitle as the beginning of the following. From end-user view it's + * subtitle as the beginning of the following. From end-user view it's * better define timeout of hidding. Setting to zero means "no timeout". */ - this->max_timeout = xine->config->register_num(xine->config, - "subtitles.separate.timeout", 4, + this->max_timeout = xine->config->register_num(xine->config, + "subtitles.separate.timeout", 4, _("default duration of subtitle display in seconds"), _("Some subtitle formats do not explicitly give a duration for each subtitle. " "For these, you can set a default duration here. Setting to zero will result " @@ -1486,7 +1486,7 @@ static void *init_sputext_demux_class (xine_t *xine, void *data) { } const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_DEMUX, 26, "sputext", XINE_VERSION_CODE, NULL, &init_sputext_demux_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libsputext/xine_sputext_decoder.c b/src/libsputext/xine_sputext_decoder.c index 7d5e73ce9..cda8a5983 100644 --- a/src/libsputext/xine_sputext_decoder.c +++ b/src/libsputext/xine_sputext_decoder.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -173,7 +173,7 @@ typedef struct sputext_decoder_s { int64_t img_duration; int64_t last_subtitle_end; /* no new subtitle before this vpts */ int unscaled; /* use unscaled OSD */ - + int last_y; /* location of the previous subtitle */ int last_lines; /* number of lines of the previous subtitle */ video2wnd_t video2wnd; @@ -194,7 +194,7 @@ static void update_font_size (sputext_decoder_t *this, int force_update) { if ((this->subtitle_size != this->class->subtitle_size) || (this->vertical_offset != this->class->vertical_offset) || force_update) { - + this->subtitle_size = this->class->subtitle_size; this->vertical_offset = this->class->vertical_offset; this->last_lines = 0; @@ -207,7 +207,7 @@ static void update_font_size (sputext_decoder_t *this, int force_update) { if( this->osd ) this->renderer->free_object (this->osd); - this->osd = this->renderer->new_object (this->renderer, + this->osd = this->renderer->new_object (this->renderer, this->width, this->height); @@ -229,14 +229,14 @@ static void update_output_size (sputext_decoder_t *this) { /* initialize decoder if needed */ if( this->unscaled ) { - if( this->width != this->stream->video_out->get_property(this->stream->video_out, + if( this->width != this->stream->video_out->get_property(this->stream->video_out, VO_PROP_WINDOW_WIDTH) || - this->height != this->stream->video_out->get_property(this->stream->video_out, + this->height != this->stream->video_out->get_property(this->stream->video_out, VO_PROP_WINDOW_HEIGHT) || !this->img_duration || !this->osd ) { int width = 0, height = 0; - + this->stream->video_out->status(this->stream->video_out, NULL, &width, &height, &this->img_duration ); if( width && height ) { @@ -253,13 +253,13 @@ static void update_output_size (sputext_decoder_t *this) { /* and a displacement factor because video may have blacks lines. */ int output_width, output_height, output_xoffset, output_yoffset; - output_width = this->stream->video_out->get_property(this->stream->video_out, + output_width = this->stream->video_out->get_property(this->stream->video_out, VO_PROP_OUTPUT_WIDTH); - output_height = this->stream->video_out->get_property(this->stream->video_out, + output_height = this->stream->video_out->get_property(this->stream->video_out, VO_PROP_OUTPUT_HEIGHT); - output_xoffset = this->stream->video_out->get_property(this->stream->video_out, + output_xoffset = this->stream->video_out->get_property(this->stream->video_out, VO_PROP_OUTPUT_XOFFSET); - output_yoffset = this->stream->video_out->get_property(this->stream->video_out, + output_yoffset = this->stream->video_out->get_property(this->stream->video_out, VO_PROP_OUTPUT_YOFFSET); /* driver don't seen to be capable to give us those values */ @@ -283,16 +283,16 @@ static void update_output_size (sputext_decoder_t *this) { } } else { if( !this->width || !this->height || !this->img_duration || !this->osd ) { - + this->width = 0; this->height = 0; - + this->stream->video_out->status(this->stream->video_out, NULL, &this->width, &this->height, &this->img_duration ); - + if(!this->osd || ( this->width && this->height)) { this->renderer = this->stream->osd_renderer; - + /* in scaled mode, we have to convert subtitle position in film coordinates. */ this->video2wnd.x = 0; this->video2wnd.y = 0; @@ -309,14 +309,14 @@ static int parse_utf8_size(const uint8_t *c) { if ( c[0]<0x80 ) return 1; - + if( c[1]==0 ) return 1; if ( (c[0]>=0xC2 && c[0]<=0xDF) && (c[1]>=0x80 && c[1]<=0xBF) ) return 2; - + if( c[2]==0 ) - return 2; + return 2; else if ( c[0]==0xE0 && (c[1]>=0xA0 && c[1]<=0xBF) && (c[2]>=0x80 && c[1]<=0xBF) ) return 3; else if ( (c[0]>=0xE1 && c[0]<=0xEC) && (c[1]>=0x80 && c[1]<=0xBF) && (c[2]>=0x80 && c[1]<=0xBF) ) @@ -349,7 +349,7 @@ static int ogm_render_line_internal(sputext_decoder_t *this, int x, int y, const this->current_osd_text = OSD_TEXT1; i=i+4; continue; - } else if (!strncmp("<i>", text+i, 3)) { + } else if (!strncmp("<i>", text+i, 3)) { /* enable italics color */ if (render) this->current_osd_text = OSD_TEXT3; @@ -361,7 +361,7 @@ static int ogm_render_line_internal(sputext_decoder_t *this, int x, int y, const this->current_osd_text = OSD_TEXT1; i=i+4; continue; - } else if (!strncmp("<font>", text+i, 6)) { + } else if (!strncmp("<font>", text+i, 6)) { /*Do somethink to disable typing fixme - no teststreams*/ i=i+6; @@ -407,7 +407,7 @@ static int ogm_render_line_internal(sputext_decoder_t *this, int x, int y, const const size_t shift = isutf8 ? parse_utf8_size (&text[i]) : 1; memcpy(letter,&text[i],shift); letter[shift]=0; - + if (render) this->renderer->render_text(this->osd, x, y, letter, this->current_osd_text); @@ -432,7 +432,7 @@ static inline void ogm_render_line(sputext_decoder_t *this, int x, int y, char* /* \a : alignment in SSA code (see #defines) */ /* \an : alignment in 'numpad code' */ /* \pos : absolute position of subtitles. Alignment define origin. */ -static void read_ssa_tag(sputext_decoder_t *this, const char* text, +static void read_ssa_tag(sputext_decoder_t *this, const char* text, int* alignment, int* sub_x, int* sub_y, int* max_width) { int in_tag = 0; @@ -468,7 +468,7 @@ static void read_ssa_tag(sputext_decoder_t *this, const char* text, if (*text == '}') in_tag = 0; } - + text++; } @@ -482,7 +482,7 @@ static void read_ssa_tag(sputext_decoder_t *this, const char* text, if ((*sub_x) >= 0 && (*sub_y) >= 0) { (*sub_x) = this->video2wnd.x + this->video2wnd.dx * (*sub_x); (*sub_y) = this->video2wnd.y + this->video2wnd.dy * (*sub_y); - } + } /* check validity, compute max width */ if ( (*sub_x) < 0 || (*sub_x) >= this->width || @@ -549,7 +549,7 @@ static int is_cjk_encoding(const char *enc) { } static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t sub_end ) { - + int y; int sub_x, sub_y, max_width; int alignment; @@ -561,7 +561,7 @@ static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t su read_ssa_tag(this, this->text[0], &alignment, &sub_x, &sub_y, &max_width); update_font_size(this, 0); - + const char *const font = get_font (this->class); if( strcmp(this->font, font) ) { strncpy(this->font, font, FILENAME_MAX); @@ -584,13 +584,13 @@ static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t su char *current_cut, *best_cut; int a; - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, - "libsputext: Line too long: %d > %d, split at max size.\n", + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "libsputext: Line too long: %d > %d, split at max size.\n", line_width, max_width); /* can't fit with keeping existing lines */ if (this->lines + 1 > SUB_MAX_TEXT) { - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "libsputext: Can't fit with keeping existing line, we have to rebuild all the subtitle\n"); rebuild_all = 1; break; @@ -614,7 +614,7 @@ static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t su } if (best_cut == NULL) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "libsputext: Can't wrap line: a word is too long, abort.\n"); break; } @@ -651,7 +651,7 @@ static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t su do { if (this->lines + 1 < SUB_MAX_TEXT) { - + /* find the longest sequence witch fit */ int line_width = 0; current_cut = stream; @@ -671,7 +671,7 @@ static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t su } } } - + /* line maybe too long, but we have reached last subtitle line */ else { best_cut = current_cut = stream + strlen(stream); @@ -684,7 +684,7 @@ static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t su stream = best_cut + 1; - } while (best_cut != current_cut); + } while (best_cut != current_cut); } @@ -692,7 +692,7 @@ static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t su /* Erase subtitle : use last_y and last_lines saved last turn. */ if (this->last_lines) { this->renderer->filled_rect (this->osd, 0, this->last_y, - this->width - 1, this->last_y + this->last_lines * this->line_height, + this->width - 1, this->last_y + this->last_lines * this->line_height, 0); } @@ -706,23 +706,23 @@ static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t su if (sub_y >= 0) y = sub_y - (this->lines * this->line_height) / 2; else y = (this->height - this->lines * this->line_height) / 2; break; - + case ALIGN_BOTTOM: default: if (sub_y >= 0) y = sub_y - this->lines * this->line_height; else y = this->height - this->lines * this->line_height - this->class->vertical_offset; break; } - if (y < 0 || y >= this->height) + if (y < 0 || y >= this->height) y = this->height - this->line_height * this->lines; - this->last_lines = this->lines; - this->last_y = y; + this->last_lines = this->lines; + this->last_y = y; for (line = 0; line < this->lines; line++) { int w, x; - + while(1) { w = ogm_get_width( this, this->text[line]); @@ -736,7 +736,7 @@ static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t su if (sub_x >= 0) x = sub_x - w; else x = max_width - w - 5; break; - + case ALIGN_CENTER: default: if (sub_x >= 0) x = sub_x - w / 2; @@ -752,7 +752,7 @@ static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t su break; } } - + if( is_cjk_encoding(encoding) ) { this->renderer->render_text (this->osd, x, y + line * this->line_height, this->text[line], OSD_TEXT1); @@ -760,31 +760,31 @@ static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t su ogm_render_line(this, x, y + line*this->line_height, this->text[line]); } } - + if( font_size != this->font_size ) this->renderer->set_font (this->osd, get_font (this->class), this->font_size); - + if( this->last_subtitle_end && sub_start < this->last_subtitle_end ) { sub_start = this->last_subtitle_end; } this->last_subtitle_end = sub_end; - + this->renderer->set_text_palette (this->osd, -1, OSD_TEXT1); this->renderer->get_palette(this->osd, this->spu_palette, this->spu_trans); /* append some colors for colored typeface tag */ memcpy(this->spu_palette+OSD_TEXT2, sub_palette, sizeof(sub_palette)); memcpy(this->spu_trans+OSD_TEXT2, sub_trans, sizeof(sub_trans)); this->renderer->set_palette(this->osd, this->spu_palette, this->spu_trans); - + if (this->unscaled) this->renderer->show_unscaled (this->osd, sub_start); else this->renderer->show (this->osd, sub_start); - + this->renderer->hide (this->osd, sub_end); - + lprintf ("scheduling subtitle >%s< at %"PRId64" until %"PRId64", current time is %"PRId64"\n", - this->text[0], sub_start, sub_end, + this->text[0], sub_start, sub_end, this->stream->xine->clock->get_current_time (this->stream->xine->clock)); } @@ -809,7 +809,7 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { } if (buf->decoder_flags & BUF_FLAG_PREVIEW) return; - + if ((this->stream->spu_channel & 0x1f) != (buf->type & 0x1f)) return; @@ -832,9 +832,9 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { if (!*str) return; /* Empty ogm packets (as created by ogmmux) clears out old messages. We already respect the end time. */ - + this->lines = 0; - + i = 0; while (*str && (this->lines < SUB_MAX_TEXT) && (i < SUB_BUFSIZE)) { if (*str == '\r' || *str == '\n') { @@ -852,7 +852,7 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { } if (i == SUB_BUFSIZE) i--; - + if (i) { this->text[ this->lines ][i] = 0; this->lines++; @@ -862,7 +862,7 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { this->ogm = 0; val = (uint32_t * )buf->content; - + this->lines = *val++; uses_time = *val++; start = *val++; @@ -874,7 +874,7 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { } } - + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "libsputext: decoder data [%s]\n", this->text[0]); xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, @@ -885,7 +885,7 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { "libsputext: discarding subtitle with invalid timing\n"); return; } - + spu_offset = this->stream->master->metronom->get_option (this->stream->master->metronom, METRONOM_SPU_OFFSET); if( uses_time ) { @@ -897,17 +897,17 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { end += spu_offset / this->img_duration; } } - + while( !this->finished ) { - + master_status = xine_get_status (this->stream->master); slave_status = xine_get_status (this->stream); - vo_discard = this->stream->video_out->get_property(this->stream->video_out, + vo_discard = this->stream->video_out->get_property(this->stream->video_out, VO_PROP_DISCARD_FRAMES); _x_get_current_info (this->stream->master, &extra_info, sizeof(extra_info) ); - - lprintf("master: %d slave: %d input_normpos: %d vo_discard: %d\n", + + lprintf("master: %d slave: %d input_normpos: %d vo_discard: %d\n", master_status, slave_status, extra_info.input_normpos, vo_discard); if( !this->started && (master_status == XINE_STATUS_PLAY && @@ -925,63 +925,63 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { if( this->started ) { - if( master_status != XINE_STATUS_PLAY || + if( master_status != XINE_STATUS_PLAY || slave_status != XINE_STATUS_PLAY || vo_discard ) { lprintf("finished\n"); - + this->width = this->height = 0; this->finished = 1; return; } if( this->osd ) { - + /* try to use frame number mode */ if( !uses_time && extra_info.frame_number ) { - + diff = end - extra_info.frame_number; - + /* discard old subtitles */ if( diff < 0 ) { - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "libsputext: discarding old subtitle\n"); return; } - + diff = start - extra_info.frame_number; - + start_vpts = extra_info.vpts + diff * this->img_duration; end_vpts = start_vpts + (end-start) * this->img_duration; - + } else { - + if( !uses_time ) { start = start * this->img_duration / 90; end = end * this->img_duration / 90; uses_time = 1; } - + diff = end - extra_info.input_time; - + /* discard old subtitles */ if( diff < 0 ) { xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "libsputext: discarding old subtitle\n"); return; } - + diff = start - extra_info.input_time; - + start_vpts = extra_info.vpts + diff * 90; end_vpts = start_vpts + (end-start) * 90; } - + _x_spu_decoder_sleep(this->stream, start_vpts); update_output_size( this ); draw_subtitle(this, start_vpts, end_vpts); - - return; + + return; } } @@ -990,12 +990,12 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { else return; } -} +} static void spudec_reset (spu_decoder_t *this_gen) { sputext_decoder_t *this = (sputext_decoder_t *) this_gen; - + lprintf("i guess we just seeked\n"); this->width = this->height = 0; this->started = this->finished = 0; @@ -1009,7 +1009,7 @@ static void spudec_discontinuity (spu_decoder_t *this_gen) { static void spudec_dispose (spu_decoder_t *this_gen) { sputext_decoder_t *this = (sputext_decoder_t *) this_gen; - + if (this->osd) { this->renderer->free_object (this->osd); this->osd = NULL; @@ -1030,7 +1030,7 @@ static void update_osd_font(void *class_gen, xine_cfg_entry_t *entry) strncpy(class->font, entry->str_value, FONTNAME_SIZE); class->font[FONTNAME_SIZE - 1] = '\0'; - + xprintf(class->xine, XINE_VERBOSITY_DEBUG, "libsputext: spu_font = %s\n", class->font ); } @@ -1041,7 +1041,7 @@ static void update_osd_font_ft(void *class_gen, xine_cfg_entry_t *entry) strncpy(class->font_ft, entry->str_value, FILENAME_MAX); class->font_ft[FILENAME_MAX - 1] = '\0'; - + xprintf(class->xine, XINE_VERBOSITY_DEBUG, "libsputext: spu_font_ft = %s\n", class->font_ft); } @@ -1050,7 +1050,7 @@ static void update_osd_use_font_ft(void *class_gen, xine_cfg_entry_t *entry) sputext_class_t *class = (sputext_class_t *)class_gen; class->use_font_ft = entry->num_value; - + xprintf(class->xine, XINE_VERBOSITY_DEBUG, "libsputext: spu_use_font_ft = %d\n", class->use_font_ft); } #endif @@ -1121,13 +1121,13 @@ static void update_src_encoding(void *class_gen, xine_cfg_entry_t *entry) static void *init_spu_decoder_plugin (xine_t *xine, void *data) { - static const char *subtitle_size_strings[] = { - "tiny", "small", "normal", "large", "very large", "huge", NULL + static const char *subtitle_size_strings[] = { + "tiny", "small", "normal", "large", "very large", "huge", NULL }; sputext_class_t *this ; lprintf("init class\n"); - + this = (sputext_class_t *) calloc(1, sizeof(sputext_class_t)); this->class.open_plugin = sputext_class_open_plugin; @@ -1137,8 +1137,8 @@ static void *init_spu_decoder_plugin (xine_t *xine, void *data) { this->xine = xine; - this->subtitle_size = xine->config->register_enum(xine->config, - "subtitles.separate.subtitle_size", + this->subtitle_size = xine->config->register_enum(xine->config, + "subtitles.separate.subtitle_size", 1, subtitle_size_strings, _("subtitle size"), @@ -1146,7 +1146,7 @@ static void *init_spu_decoder_plugin (xine_t *xine, void *data) { "be evaluated relative to the window size."), 0, update_subtitle_size, this); this->vertical_offset = xine->config->register_num(xine->config, - "subtitles.separate.vertical_offset", + "subtitles.separate.vertical_offset", 0, _("subtitle vertical offset"), _("You can adjust the vertical position of the subtitle. " @@ -1175,8 +1175,8 @@ static void *init_spu_decoder_plugin (xine_t *xine, void *data) { NULL, 10, update_osd_use_font_ft, this); #endif - this->src_encoding = xine->config->register_string(xine->config, - "subtitles.separate.src_encoding", + this->src_encoding = xine->config->register_string(xine->config, + "subtitles.separate.src_encoding", xine_guess_spu_encoding(), _("encoding of the subtitles"), _("The encoding of the subtitle text in the stream. This setting " @@ -1209,7 +1209,7 @@ static const decoder_info_t spudec_info = { }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_SPU_DECODER | PLUGIN_MUST_PRELOAD, 16, "sputext", XINE_VERSION_CODE, &spudec_info, &init_spu_decoder_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libw32dll/DirectShow/DS_AudioDecoder.c b/src/libw32dll/DirectShow/DS_AudioDecoder.c index 2dcf21f9e..84e84747e 100644 --- a/src/libw32dll/DirectShow/DS_AudioDecoder.c +++ b/src/libw32dll/DirectShow/DS_AudioDecoder.c @@ -15,7 +15,7 @@ #include "DS_Filter.h" struct _DS_AudioDecoder -{ +{ WAVEFORMATEX in_fmt; AM_MEDIA_TYPE m_sOurType, m_sDestType; DS_Filter* m_pDS_Filter; @@ -46,20 +46,20 @@ DS_AudioDecoder * DS_AudioDecoder_Open(char* dllname, GUID* guid, WAVEFORMATEX* #endif this = malloc(sizeof(DS_AudioDecoder)); - + sz = 18 + wf->cbSize; this->m_sVhdr = malloc(sz); memcpy(this->m_sVhdr, wf, sz); this->m_sVhdr2 = malloc(18); memcpy(this->m_sVhdr2, this->m_sVhdr, 18); - + pWF = (WAVEFORMATEX*)this->m_sVhdr2; pWF->wFormatTag = 1; pWF->wBitsPerSample = 16; pWF->nBlockAlign = pWF->nChannels * (pWF->wBitsPerSample + 7) / 8; pWF->cbSize = 0; pWF->nAvgBytesPerSec = pWF->nBlockAlign * pWF->nSamplesPerSec; - + memcpy(&this->in_fmt,wf,sizeof(WAVEFORMATEX)); memset(&this->m_sOurType, 0, sizeof(this->m_sOurType)); @@ -105,7 +105,7 @@ print_wave_header(this->m_sVhdr2); free(this); return NULL; } - + this->m_pDS_Filter->Start(this->m_pDS_Filter); props.cBuffers=1; @@ -141,7 +141,7 @@ int DS_AudioDecoder_Convert(DS_AudioDecoder *this, const void* in_data, unsigned { unsigned int written = 0; unsigned int read = 0; - + if (!in_data || !out_data) return -1; @@ -157,7 +157,7 @@ int DS_AudioDecoder_Convert(DS_AudioDecoder *this, const void* in_data, unsigned IMediaSample* sample=0; char* ptr; int result; - + // this->m_pOurOutput->SetFramePointer(out_data+written); this->m_pDS_Filter->m_pOurOutput->SetFramePointer(this->m_pDS_Filter->m_pOurOutput,&frame_pointer); this->m_pDS_Filter->m_pOurOutput->SetFrameSizePointer(this->m_pDS_Filter->m_pOurOutput,(long*)&frame_size); @@ -198,7 +198,7 @@ int DS_AudioDecoder_GetSrcSize(DS_AudioDecoder *this, int dest_size) double efficiency =(double) this->in_fmt.nAvgBytesPerSec / (this->in_fmt.nSamplesPerSec*this->in_fmt.nBlockAlign); int frames = (int)(dest_size*efficiency);; - + if (frames < 1) frames = 1; return frames * this->in_fmt.nBlockAlign; diff --git a/src/libw32dll/DirectShow/DS_VideoDecoder.c b/src/libw32dll/DirectShow/DS_VideoDecoder.c index c0a08d5e3..f88e480e3 100644 --- a/src/libw32dll/DirectShow/DS_VideoDecoder.c +++ b/src/libw32dll/DirectShow/DS_VideoDecoder.c @@ -18,7 +18,7 @@ struct _DS_VideoDecoder { IVideoDecoder iv; - + DS_Filter* m_pDS_Filter; AM_MEDIA_TYPE m_sOurType, m_sDestType; VIDEOINFOHEADER* m_sVhdr; @@ -59,7 +59,7 @@ struct _DS_VideoDecoder int DS_VideoDecoder_GetCapabilities(DS_VideoDecoder *this) {return this->m_Caps;} - + typedef struct _ct ct; struct _ct { @@ -68,7 +68,7 @@ struct _ct { const GUID *subtype; int cap; }; - + static ct check[] = { {16, fccYUY2, &MEDIASUBTYPE_YUY2, CAP_YUY2}, {12, fccIYUV, &MEDIASUBTYPE_IYUV, CAP_IYUV}, @@ -87,10 +87,10 @@ DS_VideoDecoder * DS_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHEAD DS_VideoDecoder *this; HRESULT result; ct* c; - + this = malloc(sizeof(DS_VideoDecoder)); memset( this, 0, sizeof(DS_VideoDecoder)); - + this->m_sVhdr2 = 0; this->m_iLastQuality = -1; this->m_iMaxAuto = maxauto; @@ -104,10 +104,10 @@ DS_VideoDecoder * DS_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHEAD /*try*/ { unsigned int bihs; - + bihs = (format->biSize < (int) sizeof(BITMAPINFOHEADER)) ? sizeof(BITMAPINFOHEADER) : format->biSize; - + this->iv.m_bh = (BITMAPINFOHEADER*)malloc(bihs); memcpy(this->iv.m_bh, format, bihs); this->iv.m_bh->biSize = bihs; @@ -119,7 +119,7 @@ DS_VideoDecoder * DS_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHEAD this->iv.m_iPlaypos = -1; this->iv.m_fQuality = 0.0f; this->iv.m_bCapable16b = true; - + bihs += sizeof(VIDEOINFOHEADER) - sizeof(BITMAPINFOHEADER); this->m_sVhdr = (VIDEOINFOHEADER*)malloc(bihs); memset(this->m_sVhdr, 0, bihs); @@ -159,7 +159,7 @@ DS_VideoDecoder * DS_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHEAD this->m_sDestType.pUnk = 0; this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER); this->m_sDestType.pbFormat = (char*)this->m_sVhdr2; - + memset(&this->iv.m_obh, 0, sizeof(this->iv.m_obh)); memcpy(&this->iv.m_obh, this->iv.m_bh, sizeof(this->iv.m_obh) < (unsigned) this->iv.m_bh->biSize ? sizeof(this->iv.m_obh) : (unsigned) this->iv.m_bh->biSize); @@ -172,7 +172,7 @@ DS_VideoDecoder * DS_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHEAD this->m_pDS_Filter = DS_FilterCreate(dllname, guid, &this->m_sOurType, &this->m_sDestType); - + if (!this->m_pDS_Filter) { printf("Failed to create DirectShow filter\n"); @@ -216,7 +216,7 @@ DS_VideoDecoder * DS_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHEAD break; #endif default: - + this->m_Caps = CAP_NONE; printf("Decoder supports the following YUV formats: "); @@ -278,7 +278,7 @@ void DS_VideoDecoder_StartInternal(DS_VideoDecoder *this) Debug printf("DS_VideoDecoder_StartInternal\n"); //cout << "DSSTART" << endl; this->m_pDS_Filter->Start(this->m_pDS_Filter); - + props.cBuffers = 1; props.cbBuffer = this->m_sDestType.lSampleSize; @@ -286,7 +286,7 @@ void DS_VideoDecoder_StartInternal(DS_VideoDecoder *this) props.cbAlign = props.cbPrefix = 0; this->m_pDS_Filter->m_pAll->vt->SetProperties(this->m_pDS_Filter->m_pAll, &props, &props1); this->m_pDS_Filter->m_pAll->vt->Commit(this->m_pDS_Filter->m_pAll); - + this->iv.m_State = START; } @@ -301,17 +301,17 @@ int DS_VideoDecoder_DecodeInternal(DS_VideoDecoder *this, const void* src, int s IMediaSample* sample = 0; char* ptr; int result; - + Debug printf("DS_VideoDecoder_DecodeInternal(%p,%p,%d,%d,%p)\n",this,src,size,is_keyframe,pImage); - + this->m_pDS_Filter->m_pAll->vt->GetBuffer(this->m_pDS_Filter->m_pAll, &sample, 0, 0, 0); - + if (!sample) { Debug printf("ERROR: null sample\n"); return -1; } - + //cout << "DECODE " << (void*) pImage << " d: " << (void*) pImage->Data() << endl; if (pImage) { @@ -425,15 +425,15 @@ int DS_VideoDecoder_SetDestFmt(DS_VideoDecoder *this, int bits, unsigned int csp { HRESULT result; int should_test=1; - int stoped = 0; - + int stoped = 0; + Debug printf("DS_VideoDecoder_SetDestFmt (%p, %d, %d)\n",this,bits,(int)csp); - + /* if (!CImage::Supported(csp, bits)) return -1; */ // BitmapInfo temp = m_obh; - + if (!csp) // RGB { int ok = true; @@ -442,7 +442,7 @@ int DS_VideoDecoder_SetDestFmt(DS_VideoDecoder *this, int bits, unsigned int csp { case 15: this->m_sDestType.subtype = MEDIASUBTYPE_RGB555; - break; + break; case 16: this->m_sDestType.subtype = MEDIASUBTYPE_RGB565; break; @@ -464,7 +464,7 @@ int DS_VideoDecoder_SetDestFmt(DS_VideoDecoder *this, int bits, unsigned int csp this->iv.m_obh.biCompression=3;//BI_BITFIELDS this->iv.m_obh.biSizeImage=abs((int)(2*this->iv.m_obh.biWidth*this->iv.m_obh.biHeight)); } - + if( bits == 16 ) { this->iv.m_obh.colors[0]=0xF800; this->iv.m_obh.colors[1]=0x07E0; @@ -514,7 +514,7 @@ int DS_VideoDecoder_SetDestFmt(DS_VideoDecoder *this, int bits, unsigned int csp if (ok) { if (csp != 0 && csp != 3 && this->iv.m_obh.biHeight > 0) - this->iv.m_obh.biHeight *= -1; // YUV formats uses should have height < 0 + this->iv.m_obh.biHeight *= -1; // YUV formats uses should have height < 0 this->iv.m_obh.biSize = sizeof(BITMAPINFOHEADER); this->iv.m_obh.biCompression=csp; this->iv.m_obh.biBitCount=bits; @@ -578,9 +578,9 @@ int DS_VideoDecoder_SetDestFmt(DS_VideoDecoder *this, int bits, unsigned int csp memcpy(&(this->m_sVhdr2->bmiHeader), &this->iv.m_decoder, sizeof(this->iv.m_decoder)); this->m_sVhdr2->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); if (this->m_sVhdr2->bmiHeader.biCompression == 3) - this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER) + 12; + this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER) + 12; else - this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER); + this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER); return -1; } @@ -624,7 +624,7 @@ int DS_VideoDecoder_SetDestFmt(DS_VideoDecoder *this, int bits, unsigned int csp if (stoped) { DS_VideoDecoder_StartInternal(this); - this->iv.m_State = START; + this->iv.m_State = START; } return 0; @@ -789,7 +789,7 @@ int DS_VideoDecoder_SetValue(DS_VideoDecoder *this, const char* name, int value) // get4=set3 73 // get5=set4 19 // get6=set5 23 - hidden = (IHidden*)((int)this->m_pDS_Filter->m_pFilter + 0xb8); + hidden = (IHidden*)((int)this->m_pDS_Filter->m_pFilter + 0xb8); // printf("DS_SetValue for DIVX, name=%s value=%d\n",name,value); if (strcmp(name, "Quality") == 0) { @@ -810,7 +810,7 @@ int DS_VideoDecoder_SetValue(DS_VideoDecoder *this, const char* name, int value) } return 0; } -#if 0 +#if 0 if (strcmp((const char*)record.dll, "ir50_32.dll") == 0) { IHidden2* hidden = 0; @@ -844,7 +844,7 @@ int DS_VideoDecoder_SetValue(DS_VideoDecoder *this, const char* name, int value) if(!recordpar[5]) { hidden->vt->Release((IUnknown*)hidden); - return -1; + return -1; } HRESULT result = hidden->vt->DecodeSet(hidden, recordpar); hidden->vt->Release((IUnknown*)hidden); @@ -865,28 +865,28 @@ int DS_SetAttr_DivX(char* attribute, int value){ int result, status, newkey, count; if(strcmp(attribute, "Quality")==0){ char* keyname="SOFTWARE\\Microsoft\\Scrunch"; - result=RegCreateKeyExA(HKEY_CURRENT_USER, keyname, 0, 0, 0, 0, 0, &newkey, &status); + result=RegCreateKeyExA(HKEY_CURRENT_USER, keyname, 0, 0, 0, 0, 0, &newkey, &status); if(result!=0) { printf("VideoDecoder::SetExtAttr: registry failure\n"); return -1; - } + } result=RegSetValueExA(newkey, "Current Post Process Mode", 0, REG_DWORD, &value, 4); if(result!=0) { printf("VideoDecoder::SetExtAttr: error writing value\n"); return -1; - } + } value=-1; result=RegSetValueExA(newkey, "Force Post Process Mode", 0, REG_DWORD, &value, 4); if(result!=0) { printf("VideoDecoder::SetExtAttr: error writing value\n"); - return -1; - } - RegCloseKey(newkey); - return 0; - } + return -1; + } + RegCloseKey(newkey); + return 0; + } if( (strcmp(attribute, "Saturation")==0) || @@ -896,21 +896,21 @@ int DS_SetAttr_DivX(char* attribute, int value){ ) { char* keyname="SOFTWARE\\Microsoft\\Scrunch\\Video"; - result=RegCreateKeyExA(HKEY_CURRENT_USER, keyname, 0, 0, 0, 0, 0, &newkey, &status); + result=RegCreateKeyExA(HKEY_CURRENT_USER, keyname, 0, 0, 0, 0, 0, &newkey, &status); if(result!=0) { printf("VideoDecoder::SetExtAttr: registry failure\n"); return -1; - } + } result=RegSetValueExA(newkey, attribute, 0, REG_DWORD, &value, 4); if(result!=0) { printf("VideoDecoder::SetExtAttr: error writing value\n"); return -1; - } - RegCloseKey(newkey); - return 0; - } + } + RegCloseKey(newkey); + return 0; + } printf("Unknown attribute!\n"); return -200; diff --git a/src/libw32dll/DirectShow/iunk.h b/src/libw32dll/DirectShow/iunk.h index 7998011cd..e571176df 100644 --- a/src/libw32dll/DirectShow/iunk.h +++ b/src/libw32dll/DirectShow/iunk.h @@ -11,39 +11,39 @@ #define DECLARE_IUNKNOWN() \ int refcount; -#define IMPLEMENT_IUNKNOWN(CLASSNAME) \ +#define IMPLEMENT_IUNKNOWN(CLASSNAME) \ static long STDCALL CLASSNAME ## _QueryInterface(IUnknown * This, \ const GUID* riid, void **ppvObject) \ { \ CLASSNAME * me = (CLASSNAME *)This; \ const GUID* r; unsigned int i = 0; \ Debug printf(#CLASSNAME "_QueryInterface(%p) called\n", This);\ - if (!ppvObject) return E_POINTER; \ + if (!ppvObject) return E_POINTER; \ for(r=me->interfaces; i<sizeof(me->interfaces)/sizeof(me->interfaces[0]); r++, i++) \ if(!memcmp(r, riid, sizeof(*r))) \ - { \ - me->vt->AddRef((IUnknown*)This); \ - *ppvObject=This; \ - return 0; \ - } \ + { \ + me->vt->AddRef((IUnknown*)This); \ + *ppvObject=This; \ + return 0; \ + } \ Debug printf("Query failed! (GUID: 0x%x)\n", *(const unsigned int*)riid); \ return E_NOINTERFACE; \ -} \ +} \ \ static long STDCALL CLASSNAME ## _AddRef(IUnknown * This) \ { \ CLASSNAME * me=( CLASSNAME *)This; \ Debug printf(#CLASSNAME "_AddRef(%p) called (ref:%d)\n", This, me->refcount); \ - return ++(me->refcount); \ -} \ + return ++(me->refcount); \ +} \ \ static long STDCALL CLASSNAME ## _Release(IUnknown * This) \ -{ \ - CLASSNAME* me=( CLASSNAME *)This; \ +{ \ + CLASSNAME* me=( CLASSNAME *)This; \ Debug printf(#CLASSNAME "_Release(%p) called (new ref:%d)\n", This, me->refcount - 1); \ if(--(me->refcount) == 0) \ - CLASSNAME ## _Destroy(me); \ - return 0; \ + CLASSNAME ## _Destroy(me); \ + return 0; \ } #endif /* DS_IUNK_H */ diff --git a/src/libw32dll/common.c b/src/libw32dll/common.c index 35fe41941..76c114bca 100644 --- a/src/libw32dll/common.c +++ b/src/libw32dll/common.c @@ -6,7 +6,7 @@ static char *get_win32_codecs_path(config_values_t *cfg) { DIR *dir; char *path, *cfgpath; char *listpath[] = { "", - "/usr/lib/codecs", + "/usr/lib/codecs", "/usr/local/lib/codecs", "/usr/lib/win32", "/usr/local/lib/win32", @@ -35,5 +35,5 @@ static char *get_win32_codecs_path(config_values_t *cfg) { i++; } - return NULL; + return NULL; } diff --git a/src/libw32dll/dmo/DMO_AudioDecoder.c b/src/libw32dll/dmo/DMO_AudioDecoder.c index faf49e266..f2a1bfb5c 100644 --- a/src/libw32dll/dmo/DMO_AudioDecoder.c +++ b/src/libw32dll/dmo/DMO_AudioDecoder.c @@ -19,7 +19,7 @@ #include "DMO_AudioDecoder.h" struct _DMO_AudioDecoder -{ +{ DMO_MEDIA_TYPE m_sOurType, m_sDestType; DMO_Filter* m_pDMO_Filter; char* m_sVhdr; @@ -49,17 +49,17 @@ DMO_AudioDecoder * DMO_AudioDecoder_Open(char* dllname, GUID* guid, WAVEFORMATEX Setup_LDT_Keeper(); Setup_FS_Segment(); #endif - + this = malloc(sizeof(DMO_AudioDecoder)); - + this->m_iFlushed=1; - + sz = 18 + wf->cbSize; this->m_sVhdr = malloc(sz); memcpy(this->m_sVhdr, wf, sz); this->m_sVhdr2 = malloc(18); memcpy(this->m_sVhdr2, this->m_sVhdr, 18); - + pWF = (WAVEFORMATEX*)this->m_sVhdr2; pWF->wFormatTag = 1; pWF->wBitsPerSample = 16; @@ -67,7 +67,7 @@ DMO_AudioDecoder * DMO_AudioDecoder_Open(char* dllname, GUID* guid, WAVEFORMATEX pWF->nBlockAlign = 2*pWF->nChannels; //pWF->nChannels * (pWF->wBitsPerSample + 7) / 8; pWF->nAvgBytesPerSec = pWF->nBlockAlign * pWF->nSamplesPerSec; pWF->cbSize = 0; - + memset(&this->m_sOurType, 0, sizeof(this->m_sOurType)); this->m_sOurType.majortype=MEDIATYPE_Audio; this->m_sOurType.subtype=MEDIASUBTYPE_PCM; @@ -101,7 +101,7 @@ print_wave_header((WAVEFORMATEX *)this->m_sVhdr2); free(this); return NULL; } - + return this; } @@ -129,7 +129,7 @@ int DMO_AudioDecoder_Convert(DMO_AudioDecoder *this, const void* in_data, unsign #ifdef LDT_paranoia Setup_FS_Segment(); #endif - + //m_pDMO_Filter->m_pMedia->vt->Lock(m_pDMO_Filter->m_pMedia, 1); bufferin = CMediaBufferCreate(in_size, (void*)in_data, in_size, 1); r = this->m_pDMO_Filter->m_pMedia->vt->ProcessInput(this->m_pDMO_Filter->m_pMedia, 0, @@ -157,7 +157,7 @@ int DMO_AudioDecoder_Convert(DMO_AudioDecoder *this, const void* in_data, unsign ((IMediaBuffer*)db.pBuffer)->vt->GetBufferAndLength((IMediaBuffer*)db.pBuffer, 0, &written); ((IMediaBuffer*)db.pBuffer)->vt->Release((IUnknown*)db.pBuffer); - + //printf("RESULTB: %d 0x%x %ld\n", r, r, written); //printf("Converted %d -> %d\n", in_size, out_size); } diff --git a/src/libw32dll/dmo/DMO_VideoDecoder.c b/src/libw32dll/dmo/DMO_VideoDecoder.c index 7b25085f0..64b0ef78c 100644 --- a/src/libw32dll/dmo/DMO_VideoDecoder.c +++ b/src/libw32dll/dmo/DMO_VideoDecoder.c @@ -24,7 +24,7 @@ struct _DMO_VideoDecoder { IVideoDecoder iv; - + DMO_Filter* m_pDMO_Filter; AM_MEDIA_TYPE m_sOurType, m_sDestType; VIDEOINFOHEADER* m_sVhdr; @@ -72,7 +72,7 @@ struct _ct { const GUID* subtype; int cap; }; - + static ct check[] = { { fccI420, 12, &MEDIASUBTYPE_I420, CAP_I420 }, { fccYV12, 12, &MEDIASUBTYPE_YV12, CAP_YV12 }, @@ -95,10 +95,10 @@ DMO_VideoDecoder * DMO_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHE DMO_VideoDecoder *this; HRESULT result; ct* c; - + this = malloc(sizeof(DMO_VideoDecoder)); memset( this, 0, sizeof(DMO_VideoDecoder)); - + this->m_sVhdr2 = 0; this->m_iLastQuality = -1; this->m_iMaxAuto = maxauto; @@ -112,10 +112,10 @@ DMO_VideoDecoder * DMO_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHE /*try*/ { unsigned int bihs; - + bihs = (format->biSize < (int) sizeof(BITMAPINFOHEADER)) ? sizeof(BITMAPINFOHEADER) : format->biSize; - + this->iv.m_bh = (BITMAPINFOHEADER*)malloc(bihs); memcpy(this->iv.m_bh, format, bihs); this->iv.m_bh->biSize = bihs; @@ -127,7 +127,7 @@ DMO_VideoDecoder * DMO_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHE this->iv.m_iPlaypos = -1; this->iv.m_fQuality = 0.0f; this->iv.m_bCapable16b = true; - + bihs += sizeof(VIDEOINFOHEADER) - sizeof(BITMAPINFOHEADER); this->m_sVhdr = (VIDEOINFOHEADER*)malloc(bihs); memset(this->m_sVhdr, 0, bihs); @@ -171,7 +171,7 @@ DMO_VideoDecoder * DMO_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHE this->m_sDestType.pUnk = 0; this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER); this->m_sDestType.pbFormat = (char*)this->m_sVhdr2; - + memset(&this->iv.m_obh, 0, sizeof(this->iv.m_obh)); memcpy(&this->iv.m_obh, this->iv.m_bh, sizeof(this->iv.m_obh) < (unsigned) this->iv.m_bh->biSize ? sizeof(this->iv.m_obh) : (unsigned) this->iv.m_bh->biSize); @@ -184,7 +184,7 @@ DMO_VideoDecoder * DMO_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHE this->m_pDMO_Filter = DMO_FilterCreate(dllname, guid, &this->m_sOurType, &this->m_sDestType); - + if (!this->m_pDMO_Filter) { printf("Failed to create DMO filter\n"); @@ -229,7 +229,7 @@ DMO_VideoDecoder * DMO_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHE break; #endif default: - + this->m_Caps = CAP_NONE; printf("Decoder supports the following YUV formats: "); @@ -284,7 +284,7 @@ void DMO_VideoDecoder_StartInternal(DMO_VideoDecoder *this) Debug printf("DMO_VideoDecoder_StartInternal\n"); //cout << "DSSTART" << endl; this->m_pDMO_Filter->Start(this->m_pDMO_Filter); - + props.cBuffers = 1; props.cbBuffer = this->m_sDestType.lSampleSize; @@ -292,7 +292,7 @@ void DMO_VideoDecoder_StartInternal(DMO_VideoDecoder *this) props.cbAlign = props.cbPrefix = 0; this->m_pDMO_Filter->m_pAll->vt->SetProperties(this->m_pDMO_Filter->m_pAll, &props, &props1); this->m_pDMO_Filter->m_pAll->vt->Commit(this->m_pDMO_Filter->m_pAll); -#endif +#endif this->iv.m_State = START; } @@ -310,7 +310,7 @@ int DMO_VideoDecoder_DecodeInternal(DMO_VideoDecoder *this, const void* src, int DMO_OUTPUT_DATA_BUFFER db; CMediaBuffer* bufferin; //+ uint8_t* imdata = dest ? dest->Data() : 0; - + Debug printf("DMO_VideoDecoder_DecodeInternal(%p,%p,%d,%d,%p)\n",this,src,size,is_keyframe,imdata); // this->m_pDMO_Filter->m_pAll->vt->GetBuffer(this->m_pDMO_Filter->m_pAll, &sample, 0, 0, 0); @@ -371,14 +371,14 @@ int DMO_VideoDecoder_SetDestFmt(DMO_VideoDecoder *this, int bits, unsigned int c { HRESULT result; int should_test=1; - + Debug printf("DMO_VideoDecoder_SetDestFmt (%p, %d, %d)\n",this,bits,(int)csp); - + /* if (!CImage::Supported(csp, bits)) return -1; */ // BitmapInfo temp = m_obh; - + if (!csp) // RGB { int ok = true; @@ -387,7 +387,7 @@ int DMO_VideoDecoder_SetDestFmt(DMO_VideoDecoder *this, int bits, unsigned int c { case 15: this->m_sDestType.subtype = MEDIASUBTYPE_RGB555; - break; + break; case 16: this->m_sDestType.subtype = MEDIASUBTYPE_RGB565; break; @@ -409,7 +409,7 @@ int DMO_VideoDecoder_SetDestFmt(DMO_VideoDecoder *this, int bits, unsigned int c this->iv.m_obh.biCompression=3;//BI_BITFIELDS this->iv.m_obh.biSizeImage=abs((int)(2*this->iv.m_obh.biWidth*this->iv.m_obh.biHeight)); } - + if( bits == 16 ) { this->iv.m_obh.colors[0]=0xF800; this->iv.m_obh.colors[1]=0x07E0; @@ -459,7 +459,7 @@ int DMO_VideoDecoder_SetDestFmt(DMO_VideoDecoder *this, int bits, unsigned int c if (ok) { if (csp != 0 && csp != 3 && this->iv.m_obh.biHeight > 0) - this->iv.m_obh.biHeight *= -1; // YUV formats uses should have height < 0 + this->iv.m_obh.biHeight *= -1; // YUV formats uses should have height < 0 this->iv.m_obh.biSize = sizeof(BITMAPINFOHEADER); this->iv.m_obh.biCompression=csp; this->iv.m_obh.biBitCount=bits; @@ -532,9 +532,9 @@ int DMO_VideoDecoder_SetDestFmt(DMO_VideoDecoder *this, int bits, unsigned int c memcpy(&(this->m_sVhdr2->bmiHeader), &this->iv.m_decoder, sizeof(this->iv.m_decoder)); this->m_sVhdr2->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); if (this->m_sVhdr2->bmiHeader.biCompression == 3) - this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER) + 12; + this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER) + 12; else - this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER); + this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER); return -1; } diff --git a/src/libw32dll/dmo/Makefile.am b/src/libw32dll/dmo/Makefile.am index 2b7cd3e37..ad77447c2 100644 --- a/src/libw32dll/dmo/Makefile.am +++ b/src/libw32dll/dmo/Makefile.am @@ -17,7 +17,7 @@ libdmo_filter_la_SOURCES = \ dmo.c \ dmo_guids.c \ DMO_VideoDecoder.c - + noinst_HEADERS = \ DMO_AudioDecoder.h \ dmo_guids.h \ diff --git a/src/libw32dll/dmo/dmo.c b/src/libw32dll/dmo/dmo.c index 98cfbad40..103105040 100644 --- a/src/libw32dll/dmo/dmo.c +++ b/src/libw32dll/dmo/dmo.c @@ -61,7 +61,7 @@ DMO_Filter* DMO_FilterCreate(const char* dllname, const GUID* id, //trapbug(); hr = func(id, &IID_IClassFactory, (void**)&factory); if (hr || !factory) - { + { em = "no such class object"; break; } diff --git a/src/libw32dll/libwin32.h b/src/libw32dll/libwin32.h index e256ebf47..a8cc8504f 100644 --- a/src/libw32dll/libwin32.h +++ b/src/libw32dll/libwin32.h @@ -38,7 +38,7 @@ typedef struct _CodecInfo typedef struct _CImage // public your_libvo_mem { char* ptr; - + /*char* (*Data)(); { return 0; @@ -47,7 +47,7 @@ typedef struct _CImage // public your_libvo_mem /*int (*Supported)(fourcc_t csp, int bits); { return true; - // if you support such surface + // if you support such surface }*/ }CImage; @@ -105,18 +105,18 @@ struct IAudioEncoder typedef struct _BitmapInfo { - long biSize; - long biWidth; - long biHeight; - short biPlanes; - short biBitCount; - long biCompression; - long biSizeImage; - long biXPelsPerMeter; - long biYPelsPerMeter; - long biClrUsed; - long biClrImportant; - int colors[3]; + long biSize; + long biWidth; + long biHeight; + short biPlanes; + short biBitCount; + long biCompression; + long biSizeImage; + long biXPelsPerMeter; + long biYPelsPerMeter; + long biClrUsed; + long biClrImportant; + int colors[3]; } BitmapInfo; typedef struct _IVideoDecoder diff --git a/src/libw32dll/qt_decoder.c b/src/libw32dll/qt_decoder.c index 99e2ba9d4..f032b3827 100644 --- a/src/libw32dll/qt_decoder.c +++ b/src/libw32dll/qt_decoder.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2006 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -110,19 +110,19 @@ typedef struct SoundComponentData { typedef int (__cdecl* LPFUNC1)(long flag); -typedef int (__cdecl* LPFUNC2)(const SoundComponentData *, +typedef int (__cdecl* LPFUNC2)(const SoundComponentData *, const SoundComponentData *, SoundConverter *); typedef int (__cdecl* LPFUNC3)(SoundConverter sc); typedef int (__cdecl* LPFUNC4)(void); typedef int (__cdecl* LPFUNC5)(SoundConverter sc, OSType selector,void * infoPtr); -typedef int (__cdecl* LPFUNC6)(SoundConverter sc, +typedef int (__cdecl* LPFUNC6)(SoundConverter sc, unsigned long inputBytesTarget, unsigned long *inputFrames, unsigned long *inputBytes, unsigned long *outputBytes ); -typedef int (__cdecl* LPFUNC7)(SoundConverter sc, - const void *inputPtr, +typedef int (__cdecl* LPFUNC7)(SoundConverter sc, + const void *inputPtr, unsigned long inputFrames, void *outputPtr, unsigned long *outputFrames, @@ -131,7 +131,7 @@ typedef int (__cdecl* LPFUNC8)(SoundConverter sc, void *outputPtr, unsigned long *outputFrames, unsigned long *outputBytes); -typedef int (__cdecl* LPFUNC9)(SoundConverter sc) ; +typedef int (__cdecl* LPFUNC9)(SoundConverter sc) ; typedef struct { @@ -146,7 +146,7 @@ typedef struct qta_decoder_s { xine_stream_t *stream; - HINSTANCE qtml_dll; + HINSTANCE qtml_dll; xine_waveformatex wave; uint8_t out_buf[1000000]; @@ -173,7 +173,7 @@ typedef struct qta_decoder_s { uint8_t data[BUFSIZE]; int data_len; int num_frames; - + ldt_fs_t *ldt_fs; } qta_decoder_t; @@ -227,9 +227,9 @@ static void qta_init_driver (qta_decoder_t *this, buf_element_t *buf) { lprintf ("audio: init_driver... (mutex locked)\n"); this->ldt_fs = Setup_LDT_Keeper(); - + this->qtml_dll = LoadLibraryA("qtmlClient.dll"); - + if (this->qtml_dll == NULL ) { xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "qt_audio: failed to load dll\n" ); pthread_mutex_unlock(&win32_codec_mutex); @@ -240,63 +240,63 @@ static void qta_init_driver (qta_decoder_t *this, buf_element_t *buf) { this->InitializeQTML = (LPFUNC1)GetProcAddress (this->qtml_dll, "InitializeQTML"); if ( this->InitializeQTML == NULL ) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "qt_audio: failed geting proc address InitializeQTML\n"); pthread_mutex_unlock(&win32_codec_mutex); return; } this->SoundConverterOpen = (LPFUNC2)GetProcAddress (this->qtml_dll, "SoundConverterOpen"); if ( this->SoundConverterOpen == NULL ) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "qt_audio: failed getting proc address SoundConverterOpen\n"); pthread_mutex_unlock(&win32_codec_mutex); return; } this->SoundConverterClose = (LPFUNC3)GetProcAddress (this->qtml_dll, "SoundConverterClose"); if ( this->SoundConverterClose == NULL ) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "qt_audio: failed getting proc address SoundConverterClose\n"); pthread_mutex_unlock(&win32_codec_mutex); return; } this->TerminateQTML = (LPFUNC4)GetProcAddress (this->qtml_dll, "TerminateQTML"); if ( this->TerminateQTML == NULL ) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "qt_audio: failed getting proc address TerminateQTML\n"); pthread_mutex_unlock(&win32_codec_mutex); return; } this->SoundConverterSetInfo = (LPFUNC5)GetProcAddress (this->qtml_dll, "SoundConverterSetInfo"); if ( this->SoundConverterSetInfo == NULL ) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "qt_audio: failed getting proc address SoundConverterSetInfo\n"); pthread_mutex_unlock(&win32_codec_mutex); return; } this->SoundConverterGetBufferSizes = (LPFUNC6)GetProcAddress (this->qtml_dll, "SoundConverterGetBufferSizes"); if ( this->SoundConverterGetBufferSizes == NULL ) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "qt_audio: failed getting proc address SoundConverterGetBufferSizes\n"); pthread_mutex_unlock(&win32_codec_mutex); return; } this->SoundConverterConvertBuffer = (LPFUNC7)GetProcAddress (this->qtml_dll, "SoundConverterConvertBuffer"); if ( this->SoundConverterConvertBuffer == NULL ) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "qt_audio: failed getting proc address SoundConverterConvertBuffer1\n"); pthread_mutex_unlock(&win32_codec_mutex); return; } this->SoundConverterEndConversion = (LPFUNC8)GetProcAddress (this->qtml_dll, "SoundConverterEndConversion"); if ( this->SoundConverterEndConversion == NULL ) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "qt_audio: failed getting proc address SoundConverterEndConversion\n"); pthread_mutex_unlock(&win32_codec_mutex); return; } this->SoundConverterBeginConversion = (LPFUNC9)GetProcAddress (this->qtml_dll, "SoundConverterBeginConversion"); if ( this->SoundConverterBeginConversion == NULL ) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "qt_audio: failed getting proc address SoundConverterBeginConversion\n"); pthread_mutex_unlock(&win32_codec_mutex); return; @@ -323,17 +323,17 @@ static void qta_init_driver (qta_decoder_t *this, buf_element_t *buf) { switch (buf->type) { case BUF_AUDIO_QDESIGN1: this->InputFormatInfo.format = FOUR_CHAR_CODE('Q','D','M','C'); - _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, + _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, "QDesign Music Codec v1 (QT DLL)"); break; case BUF_AUDIO_QDESIGN2: this->InputFormatInfo.format = FOUR_CHAR_CODE('Q','D','M','2'); - _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, + _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, "QDesign Music Codec v2 (QT DLL)"); break; case BUF_AUDIO_QCLP: this->InputFormatInfo.format = FOUR_CHAR_CODE('Q','c','l','p'); - _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, + _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, "Qualcomm Purevoice Codec (QT DLL)"); break; default: @@ -352,8 +352,8 @@ static void qta_init_driver (qta_decoder_t *this, buf_element_t *buf) { qta_hexdump ((unsigned char *)buf->decoder_info_ptr[2], buf->decoder_info[2]); #endif - error = this->SoundConverterOpen (&this->InputFormatInfo, - &this->OutputFormatInfo, + error = this->SoundConverterOpen (&this->InputFormatInfo, + &this->OutputFormatInfo, &this->myConverter); lprintf ("audio: SoundConverterOpen:%i\n",error); @@ -392,7 +392,7 @@ static void qta_init_driver (qta_decoder_t *this, buf_element_t *buf) { error = this->SoundConverterBeginConversion (this->myConverter); lprintf ("audio: SoundConverterBeginConversion:%i\n",error); - if (error) { + if (error) { pthread_mutex_unlock(&win32_codec_mutex); return; } @@ -403,7 +403,7 @@ static void qta_init_driver (qta_decoder_t *this, buf_element_t *buf) { this->frame_size = this->wave.nChannels * this->wave.wBitsPerSample / 8; - this->output_open = (this->stream->audio_out->open) (this->stream->audio_out, + this->output_open = (this->stream->audio_out->open) (this->stream->audio_out, this->stream, this->wave.wBitsPerSample, this->wave.nSamplesPerSec, @@ -433,17 +433,17 @@ static void qta_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { this->wave.nSamplesPerSec = buf->decoder_info[1]; lprintf ("audio: header copied\n"); - + } else if (buf->decoder_flags & BUF_FLAG_SPECIAL) { lprintf ("audio: special buffer\n"); - + if (buf->decoder_info[1] == BUF_SPECIAL_STSD_ATOM) { lprintf ("audio: got stsd atom -> init codec\n"); if (!this->codec_initialized) { qta_init_driver (this, buf); } - + if (!this->codec_initialized) _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_HANDLED, 0); } @@ -457,13 +457,13 @@ static void qta_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { int num_frames = this->data_len / this->InFrameSize; long out_frames, out_bytes; int error, frames_left, bytes_sent; - + Check_FS_Segment(this->ldt_fs); pthread_mutex_lock(&win32_codec_mutex); error = this->SoundConverterConvertBuffer (this->myConverter, this->data, - num_frames, + num_frames, this->out_buf, &out_frames, &out_bytes); pthread_mutex_unlock(&win32_codec_mutex); @@ -474,7 +474,7 @@ static void qta_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { this->data_len -= this->InFrameSize * num_frames; if (this->data_len>0) memmove (this->data, this->data+num_frames*this->InFrameSize, this->data_len); - + frames_left = out_frames; bytes_sent = 0; @@ -498,21 +498,21 @@ static void qta_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { lprintf ("audio: sending %d frames, %d frames left\n", nframes, frames_left); - this->stream->audio_out->put_buffer (this->stream->audio_out, + this->stream->audio_out->put_buffer (this->stream->audio_out, audio_buffer, this->stream); - + bytes_sent += nframes*this->frame_size; frames_left -= nframes; } } - + } } static void qta_reset (audio_decoder_t *this_gen) { qta_decoder_t *this = (qta_decoder_t *) this_gen; - + this->data_len = 0; } @@ -522,7 +522,7 @@ static void qta_discontinuity (audio_decoder_t *this_gen) { static void qta_dispose (audio_decoder_t *this_gen) { - qta_decoder_t *this = (qta_decoder_t *) this_gen; + qta_decoder_t *this = (qta_decoder_t *) this_gen; int error; unsigned long ConvertedFrames=0; unsigned long ConvertedBytes=0; @@ -548,7 +548,7 @@ static void qta_dispose (audio_decoder_t *this_gen) { free (this); } -static audio_decoder_t *qta_open_plugin (audio_decoder_class_t *class_gen, +static audio_decoder_t *qta_open_plugin (audio_decoder_class_t *class_gen, xine_stream_t *stream) { qta_decoder_t *this ; @@ -602,7 +602,7 @@ static void *qta_init_class (xine_t *xine, void *data) { return this; } -static uint32_t audio_types[] = { +static uint32_t audio_types[] = { BUF_AUDIO_QDESIGN1, BUF_AUDIO_QDESIGN2, BUF_AUDIO_QCLP, @@ -636,7 +636,7 @@ typedef struct qtv_decoder_s { xine_stream_t *stream; - HINSTANCE qtml_dll; + HINSTANCE qtml_dll; xine_bmiheader bih; double ratio; @@ -658,8 +658,8 @@ typedef struct qtv_decoder_s { /* ImageSubCodecDecompressCapabilities icap; // for ImageCodecInitialize() */ Rect OutBufferRect; /* the dimensions of our GWorld */ - GWorldPtr OutBufferGWorld; /* a GWorld is some kind of - description for a drawing + GWorldPtr OutBufferGWorld; /* a GWorld is some kind of + description for a drawing environment */ ImageDescriptionHandle framedescHandle; @@ -691,7 +691,7 @@ typedef struct qtv_decoder_s { CodecDecompressParams * params); ComponentResult (*ImageCodecBandDecompress)(ComponentInstance ci, CodecDecompressParams * params); - PixMapHandle (*GetGWorldPixMap) (GWorldPtr offscreenGWorld); + PixMapHandle (*GetGWorldPixMap) (GWorldPtr offscreenGWorld); OSErr (*QTNewGWorldFromPtr)(GWorldPtr *gw, OSType pixelFormat, const Rect *boundsRect, @@ -699,7 +699,7 @@ typedef struct qtv_decoder_s { /*GDHandle*/void* aGDevice, /*unused*/ GWorldFlags flags, void *baseAddr, - long rowBytes); + long rowBytes); OSErr (*NewHandleClear)(Size byteCount); ldt_fs_t *ldt_fs; @@ -759,9 +759,9 @@ static void qtv_init_driver (qtv_decoder_t *this, buf_element_t *buf) { lprintf ("video: mutex locked\n"); this->ldt_fs = Setup_LDT_Keeper(); - + this->qtml_dll = LoadLibraryA("qtmlClient.dll"); - + if (this->qtml_dll == NULL ) { xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "qt_video: failed to load dll\n" ); pthread_mutex_unlock(&win32_codec_mutex); @@ -784,8 +784,8 @@ static void qtv_init_driver (qtv_decoder_t *this, buf_element_t *buf) { this->GetGWorldPixMap = (PixMapHandle(*)(GWorldPtr))GetProcAddress(this->qtml_dll, "GetGWorldPixMap"); this->QTNewGWorldFromPtr = (OSErr(*)(GWorldPtr*,OSType,const Rect*,CTabHandle,void*,GWorldFlags,void*,long))GetProcAddress(this->qtml_dll, "QTNewGWorldFromPtr"); this->NewHandleClear = (OSErr(*)(Size))GetProcAddress(this->qtml_dll, "NewHandleClear"); - - if (!this->InitializeQTML || !this->EnterMovies || !this->FindNextComponent + + if (!this->InitializeQTML || !this->EnterMovies || !this->FindNextComponent || !this->ImageCodecBandDecompress){ xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "qt_video: invalid qt DLL!\n"); pthread_mutex_unlock(&win32_codec_mutex); @@ -872,7 +872,7 @@ static void qtv_init_driver (qtv_decoder_t *this, buf_element_t *buf) { memcpy(&id->name,stdata+0x2D,32); id->depth = _X_BE_16 (stdata+0x4E); id->clutID = _X_BE_16 (stdata+0x50); - if (stdata_len>0x56) + if (stdata_len>0x56) memcpy (((char*)&id->clutID)+2, stdata+0x52, stdata_len-0x52); lprintf ("video: id (%d bytes)\n", stdata_len); @@ -900,12 +900,12 @@ static void qtv_init_driver (qtv_decoder_t *this, buf_element_t *buf) { this->plane = malloc (this->bih.biWidth * this->bih.biHeight * 3); - result = this->QTNewGWorldFromPtr(&this->OutBufferGWorld, + result = this->QTNewGWorldFromPtr(&this->OutBufferGWorld, kYUVSPixelFormat, /*pixel format of new GWorld==YUY2 */ &this->OutBufferRect, /*we should benchmark if yvu9 is faster for svq3, too */ - 0, - 0, - 0, + 0, + 0, + 0, this->plane, this->bih.biWidth*2); @@ -922,14 +922,14 @@ static void qtv_init_driver (qtv_decoder_t *this, buf_element_t *buf) { this->decpar.accuracy = codecNormalQuality; this->decpar.port = (CGrafPtr)this->OutBufferGWorld; this->decpar.srcRect = this->OutBufferRect; - + this->decpar.transferMode = srcCopy; this->decpar.dstPixMap = **this->GetGWorldPixMap (this->OutBufferGWorld);/*destPixmap; */ - + cres = this->ImageCodecPreDecompress (this->ci, &this->decpar); lprintf ("video: ImageCodecPreDecompress cres=0x%X\n", cres); - + this->data_len = 0; this->codec_initialized = 1; @@ -943,7 +943,7 @@ static void qtv_init_driver (qtv_decoder_t *this, buf_element_t *buf) { static void qtv_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { qtv_decoder_t *this = (qtv_decoder_t *) this_gen; - lprintf ("video: decode_data, flags=0x%08x, len=%d, pts=%lld ...\n", + lprintf ("video: decode_data, flags=0x%08x, len=%d, pts=%lld ...\n", buf->decoder_flags, buf->size, buf->pts); if (buf->decoder_flags & BUF_FLAG_STDHEADER) { @@ -957,7 +957,7 @@ static void qtv_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { } else if (buf->decoder_flags & BUF_FLAG_SPECIAL) { lprintf ("video: special buffer\n"); - + if (buf->decoder_info[1] == BUF_SPECIAL_STSD_ATOM) { lprintf ("video: got stsd atom -> init codec\n"); @@ -975,12 +975,12 @@ static void qtv_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { this->data_len += buf->size; lprintf ("video: got %d bytes in buffer\n", this->data_len); - + if (buf->decoder_flags & BUF_FLAG_FRAME_END) { ComponentResult cres; vo_frame_t *img; - + Check_FS_Segment(this->ldt_fs); pthread_mutex_lock(&win32_codec_mutex); @@ -990,30 +990,30 @@ static void qtv_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { (**this->framedescHandle).dataSize=this->data_len; cres = this->ImageCodecBandDecompress (this->ci, &this->decpar); - + ++this->decpar.frameNumber; pthread_mutex_unlock(&win32_codec_mutex); if (cres&0xFFFF){ - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "qt_video: ImageCodecBandDecompress cres=0x%lX (-0x%lX) %ld :(\n", cres,-cres,cres); } img = this->stream->video_out->get_frame (this->stream->video_out, this->bih.biWidth, this->bih.biHeight, - this->ratio, + this->ratio, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); - + img->pts = buf->pts; img->duration = buf->decoder_info[0]; img->bad_frame = 0; - - xine_fast_memcpy (img->base[0], this->plane, + + xine_fast_memcpy (img->base[0], this->plane, this->bih.biWidth*this->bih.biHeight*2); - + img->draw(img, this->stream); img->free(img); @@ -1032,7 +1032,7 @@ static void qtv_flush (video_decoder_t *this_gen) { static void qtv_reset (video_decoder_t *this_gen) { qtv_decoder_t *this = (qtv_decoder_t *) this_gen; - + this->data_len = 0; } @@ -1057,7 +1057,7 @@ static void qtv_dispose (video_decoder_t *this_gen) { free (this); } -static video_decoder_t *qtv_open_plugin (video_decoder_class_t *class_gen, +static video_decoder_t *qtv_open_plugin (video_decoder_class_t *class_gen, xine_stream_t *stream) { qtv_class_t *cls = (qtv_class_t *) class_gen; @@ -1094,13 +1094,13 @@ static void qtv_dispose_class (video_decoder_class_t *this) { } /* - * some fake functions to make qt codecs happy + * some fake functions to make qt codecs happy */ #if 0 static void codec_path_cb (void *data, xine_cfg_entry_t *cfg) { qtv_class_t *this = (qt_class_t *) data; - + this->qt_codec_path = cfg->str_value; } #endif @@ -1138,7 +1138,7 @@ static const decoder_info_t qtv_dec_info = { }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_VIDEO_DECODER | PLUGIN_MUST_PRELOAD, 18, "qtv", XINE_VERSION_CODE, &qtv_dec_info, qtv_init_class }, { PLUGIN_AUDIO_DECODER | PLUGIN_MUST_PRELOAD, 15, "qta", XINE_VERSION_CODE, &qta_dec_info, qta_init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } diff --git a/src/libw32dll/qtx/qtxsdk/components.h b/src/libw32dll/qtx/qtxsdk/components.h index 1456342f9..11e0824c9 100644 --- a/src/libw32dll/qtx/qtxsdk/components.h +++ b/src/libw32dll/qtx/qtxsdk/components.h @@ -721,13 +721,13 @@ static inline void dump_CodecDecompressParams(void* xxx){ printf("sequenceID=%ld\n",cd->sequenceID); idh=cd->imageDescription; if(idh && idh[0]) dump_ImageDescription(idh[0]); - + for(i=0;i<sizeof(CodecDecompressParams);i++){ printf(" %02X",((unsigned char*)cd)[i]); if((i%16)==15) printf("\n"); } printf("\n"); - + printf("data=%p size=%ld\n",cd->data,cd->bufferSize); printf("frameno=%ld lines: %ld .. %ld condflags=0x%lX callerflags=0x%X\n", cd->frameNumber, cd->startLine, cd->stopLine, cd->conditionFlags,cd->callerFlags); diff --git a/src/libw32dll/w32codec.c b/src/libw32dll/w32codec.c index e61ebcb82..32cd7db29 100644 --- a/src/libw32dll/w32codec.c +++ b/src/libw32dll/w32codec.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2006 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -25,7 +25,7 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif - + #include <stdlib.h> #include <stdio.h> #include <inttypes.h> @@ -37,8 +37,8 @@ #include "wine/vfw.h" #include "wine/mmreg.h" #include "wine/ldt_keeper.h" -#include "wine/win32.h" -#include "wine/wineacm.h" +#include "wine/win32.h" +#include "wine/wineacm.h" #include "wine/loader.h" #define NOAVIFILE_HEADERS @@ -67,13 +67,13 @@ static GUID CLSID_Voxware = 0x73f7a062, 0x8829, 0x11d1, { 0xb5, 0x50, 0x00, 0x60, 0x97, 0x24, 0x2d, 0x8d } }; - + static GUID CLSID_Acelp = { 0x4009f700, 0xaeba, 0x11d1, { 0x83, 0x44, 0x00, 0xc0, 0x4f, 0xb9, 0x2e, 0xb7 } }; - + static GUID wmv1_clsid = { 0x4facbba1, 0xffd8, 0x4cd7, @@ -146,11 +146,11 @@ typedef struct w32v_decoder_s { video_decoder_t video_decoder; xine_stream_t *stream; - + int64_t video_step; int decoder_ok; - BITMAPINFOHEADER *bih, o_bih; + BITMAPINFOHEADER *bih, o_bih; double ratio; char scratch1[16]; /* some codecs overflow o_bih */ HIC hic; @@ -162,7 +162,7 @@ typedef struct w32v_decoder_s { void *img_buffer; int size; long outfmt; - + int ex_functions; int driver_type; GUID *guid; @@ -170,8 +170,8 @@ typedef struct w32v_decoder_s { DMO_VideoDecoder *dmo_dec; int stream_id; - int skipframes; - + int skipframes; + ldt_fs_t *ldt_fs; } w32v_decoder_t; @@ -181,7 +181,7 @@ typedef struct { typedef struct w32a_decoder_s { audio_decoder_t audio_decoder; - + xine_stream_t *stream; int output_open; @@ -190,25 +190,25 @@ typedef struct w32a_decoder_s { unsigned char *buf; int size; int64_t pts; - + /* these are used for pts estimation */ int64_t lastpts, sumpts, sumsize; double byterate; unsigned char *outbuf; int outsize; - + HACMSTREAM srcstream; int rec_audio_src_size; int max_audio_src_size; int num_channels; int rate; - + int driver_type; GUID *guid; DS_AudioDecoder *ds_dec; DMO_AudioDecoder *dmo_dec; - + ldt_fs_t *ldt_fs; } w32a_decoder_t; @@ -242,7 +242,7 @@ typedef struct { #define CENTERSAMPLE 128 #define SCALEBITS 16 -#define FIX(x) ( (int32_t) ( (x) * (1<<SCALEBITS) + 0.5 ) ) +#define FIX(x) ( (int32_t) ( (x) * (1<<SCALEBITS) + 0.5 ) ) #define ONE_HALF ( (int32_t) (1<< (SCALEBITS-1)) ) #define CBCR_OFFSET (CENTERSAMPLE << SCALEBITS) @@ -280,7 +280,7 @@ static void w32v_init_rgb_ycc(void) * the YCbCr constants times R,G,B for all possible values. */ int i; - + if (rgb_ycc_tab) return; rgb_ycc_tab = malloc(TABLE_SIZE * sizeof(int32_t)); @@ -349,14 +349,14 @@ static char* get_vids_codec_name(w32v_decoder_t *this, this->flipped=0; this->driver_type = DRIVER_STD; this->ex_functions = 0; - + buf_type &= 0xffff0000; switch (buf_type) { case BUF_VIDEO_MSMPEG4_V1: case BUF_VIDEO_MSMPEG4_V2: /* Microsoft MPEG-4 v1/v2 */ - /* old dll is disabled now due segfaults + /* old dll is disabled now due segfaults * (using directshow instead) this->yuv_supported=1; this->yuv_hack_needed=1; @@ -368,7 +368,7 @@ static char* get_vids_codec_name(w32v_decoder_t *this, this->guid=&msmpeg4_clsid; _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, "MS MPEG-4 V1/V2 (win32)"); - return "mpg4ds32.ax"; + return "mpg4ds32.ax"; case BUF_VIDEO_MSMPEG4_V3: /* Microsoft MPEG-4 v3 */ @@ -383,28 +383,28 @@ static char* get_vids_codec_name(w32v_decoder_t *this, /* Video in Indeo Video 5 format */ this->yuv_supported=1; /* YUV pic is upside-down :( */ this->flipped=0; - _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, + _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, "Indeo Video 5 (win32)"); return "ir50_32.dll"; case BUF_VIDEO_IV41: /* Video in Indeo Video 4.1 format */ this->flipped=1; - _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, + _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, "Indeo Video 4.1 (win32)"); return "ir41_32.dll"; - + case BUF_VIDEO_IV32: /* Video in Indeo Video 3.2 format */ this->flipped=1; - _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, + _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, "Indeo Video 3.2 (win32)"); return "ir32_32.dll"; - + case BUF_VIDEO_IV31: /* Video in Indeo Video 3.1 format */ this->flipped=1; - _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, + _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, "Indeo Video 3.1 (win32)"); return "ir32_32.dll"; @@ -412,7 +412,7 @@ static char* get_vids_codec_name(w32v_decoder_t *this, /* Video in Cinepak format */ this->flipped=1; this->yuv_supported=0; - _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, + _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, "Cinepak (win32)"); return "iccvid.dll"; @@ -425,15 +425,15 @@ static char* get_vids_codec_name(w32v_decoder_t *this, case BUF_VIDEO_ATIVCR2: /* Video in ATI VCR2 format */ this->yuv_supported=1; - _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, + _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, "ATI VCR2 (win32)"); return "ativcr2.dll"; - + case BUF_VIDEO_I263: /* Video in I263 format */ this->flipped=1; this->yuv_supported=1; - _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, + _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, "I263 (win32)"); return "i263_32.drv"; @@ -442,22 +442,22 @@ static char* get_vids_codec_name(w32v_decoder_t *this, /* note: can't play streams with 8bpp */ this->flipped=1; this->yuv_supported=0; - _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, + _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, "MS Windows Video 1 (win32)"); - return "msvidc32.dll"; - + return "msvidc32.dll"; + case BUF_VIDEO_DV: /* Sony DV Codec (not working yet) */ this->yuv_supported=1; this->driver_type = DRIVER_DS; this->guid=&dvsd_clsid; - _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, + _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, "Sony DV (win32)"); - return "qdv.dll"; - + return "qdv.dll"; + case BUF_VIDEO_WMV7: this->yuv_supported=1; - _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, + _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, "MS WMV 7 (win32)"); if (n == 2) { this->driver_type = DRIVER_DMO; @@ -466,11 +466,11 @@ static char* get_vids_codec_name(w32v_decoder_t *this, } this->driver_type = DRIVER_DS; this->guid=&wmv1_clsid; - return "wmvds32.ax"; - + return "wmvds32.ax"; + case BUF_VIDEO_WMV8: this->yuv_supported=1; - _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, + _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, "MS WMV 8 (win32)"); if (n == 2) { this->driver_type = DRIVER_DMO; @@ -480,11 +480,11 @@ static char* get_vids_codec_name(w32v_decoder_t *this, this->driver_type = DRIVER_DS; this->guid=&wmv2_clsid; return "wmv8ds32.ax"; - + case BUF_VIDEO_WMV9: this->yuv_supported=1; this->driver_type = DRIVER_DMO; - _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, + _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, "MS WMV 9 (win32)"); if (n == 2) { this->guid=&wmvdmo_clsid; @@ -492,14 +492,14 @@ static char* get_vids_codec_name(w32v_decoder_t *this, } this->guid=&wmv3_clsid; return "wmv9dmod.dll"; - + case BUF_VIDEO_VP31: this->yuv_supported=1; this->ex_functions=1; this->flipped=1; - _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, + _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, "On2 VP3.1 (win32)"); - return "vp31vfw.dll"; + return "vp31vfw.dll"; case BUF_VIDEO_VP4: this->yuv_supported=1; @@ -507,46 +507,46 @@ static char* get_vids_codec_name(w32v_decoder_t *this, _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, "On2 VP4 (win32)"); return "vp4vfw.dll"; - + case BUF_VIDEO_VP5: this->yuv_supported=1; this->ex_functions=1; _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, "On2 VP5 (win32)"); return "vp5vfw.dll"; - + case BUF_VIDEO_VP6: this->yuv_supported=1; this->ex_functions=1; _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, "On2 VP6 (win32)"); return "vp6vfw.dll"; - + case BUF_VIDEO_MSS1: this->driver_type = DRIVER_DS; this->guid=&mss1_clsid; - _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, + _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, "Windows Screen Video (win32)"); - return "msscds32.ax"; + return "msscds32.ax"; case BUF_VIDEO_TSCC: this->flipped=1; this->yuv_supported=0; - _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, + _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, "TechSmith Screen Capture Codec (win32)"); - return "tsccvid.dll"; - + return "tsccvid.dll"; + case BUF_VIDEO_UCOD: this->yuv_supported=1; - _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, + _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, "ClearVideo (win32)"); - return "clrviddd.dll"; - + return "clrviddd.dll"; + } xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "w32codec: this didn't happen: unknown video buf type %08x\n", buf_type); - + return NULL; } @@ -570,9 +570,9 @@ static void w32v_init_codec (w32v_decoder_t *this, int buf_type) { memset(&this->o_bih, 0, sizeof(BITMAPINFOHEADER)); this->o_bih.biSize = sizeof(BITMAPINFOHEADER); - + this->ldt_fs = Setup_LDT_Keeper(); - + outfmt = IMGFMT_15RGB; if (this->yuv_supported) { vo_cap = this->stream->video_out->get_capabilities (this->stream->video_out); @@ -580,12 +580,12 @@ static void w32v_init_codec (w32v_decoder_t *this, int buf_type) { outfmt = IMGFMT_YUY2; } - this->hic = ICOpen ((int)win32_codec_name, - this->bih->biCompression, + this->hic = ICOpen ((int)win32_codec_name, + this->bih->biCompression, ICMODE_FASTDECOMPRESS); if(!this->hic){ - xine_log (this->stream->xine, XINE_LOG_MSG, + xine_log (this->stream->xine, XINE_LOG_MSG, _("w32codec: ICOpen failed! unknown codec %08lx / wrong parameters?\n"), this->bih->biCompression); this->decoder_ok = 0; @@ -594,14 +594,14 @@ static void w32v_init_codec (w32v_decoder_t *this, int buf_type) { ret = ICDecompressGetFormat(this->hic, this->bih, &this->o_bih); if(ret){ - xine_log (this->stream->xine, XINE_LOG_MSG, + xine_log (this->stream->xine, XINE_LOG_MSG, _("w32codec: ICDecompressGetFormat (%.4s %08lx/%d) failed: Error %ld\n"), - (char*)&this->o_bih.biCompression, this->bih->biCompression, - this->bih->biBitCount, (long)ret); + (char*)&this->o_bih.biCompression, this->bih->biCompression, + this->bih->biBitCount, (long)ret); this->decoder_ok = 0; return; } - + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "w32codec: video output format: %.4s %08lx\n", (char*)&this->o_bih.biCompression, this->o_bih.biCompression); @@ -615,28 +615,28 @@ static void w32v_init_codec (w32v_decoder_t *this, int buf_type) { * this->o_bih.biBitCount / 8; if (this->flipped) - this->o_bih.biHeight=-this->bih->biHeight; + this->o_bih.biHeight=-this->bih->biHeight; if(outfmt==IMGFMT_YUY2 && !this->yuv_hack_needed) this->o_bih.biCompression = mmioFOURCC('Y','U','Y','2'); - else + else this->o_bih.biCompression = 0; - - ret = (!this->ex_functions) + + ret = (!this->ex_functions) ?ICDecompressQuery(this->hic, this->bih, &this->o_bih) :ICDecompressQueryEx(this->hic, this->bih, &this->o_bih); - + if(ret){ xine_log (this->stream->xine, XINE_LOG_MSG, _("w32codec: ICDecompressQuery failed: Error %ld\n"), (long)ret); this->decoder_ok = 0; return; } - - ret = (!this->ex_functions) + + ret = (!this->ex_functions) ?ICDecompressBegin(this->hic, this->bih, &this->o_bih) :ICDecompressBeginEx(this->hic, this->bih, &this->o_bih); - + if(ret){ xine_log (this->stream->xine, XINE_LOG_MSG, _("w32codec: ICDecompressBegin failed: Error %ld\n"), (long)ret); @@ -645,14 +645,14 @@ static void w32v_init_codec (w32v_decoder_t *this, int buf_type) { } if (outfmt==IMGFMT_YUY2 && this->yuv_hack_needed) - this->o_bih.biCompression = mmioFOURCC('Y','U','Y','2'); + this->o_bih.biCompression = mmioFOURCC('Y','U','Y','2'); this->size = 0; if ( this->img_buffer ) free (this->img_buffer); this->img_buffer = malloc (this->o_bih.biSizeImage); - + if ( this->buf ) free (this->buf); this->bufsize = VIDEOBUFSIZE; @@ -667,14 +667,14 @@ static void w32v_init_codec (w32v_decoder_t *this, int buf_type) { static void w32v_init_ds_dmo_codec (w32v_decoder_t *this, int buf_type) { uint32_t vo_cap; int outfmt; - + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "w32codec: init DirectShow/DMO video codec...\n"); - + memset(&this->o_bih, 0, sizeof(BITMAPINFOHEADER)); this->o_bih.biSize = sizeof(BITMAPINFOHEADER); this->ldt_fs = Setup_LDT_Keeper(); - + /* hack: dvsd is the only fourcc accepted by qdv.dll */ if( buf_type == BUF_VIDEO_DV ) this->bih->biCompression = mmioFOURCC('d','v','s','d'); @@ -682,7 +682,7 @@ static void w32v_init_ds_dmo_codec (w32v_decoder_t *this, int buf_type) { if( this->driver_type == DRIVER_DS ) { this->ds_dec = DS_VideoDecoder_Open(win32_codec_name, this->guid, this->bih, this->flipped, 0); - + if(!this->ds_dec){ xine_log (this->stream->xine, XINE_LOG_MSG, _("w32codec: DS_VideoDecoder failed! unknown codec %08lx / wrong parameters?\n"), @@ -693,7 +693,7 @@ static void w32v_init_ds_dmo_codec (w32v_decoder_t *this, int buf_type) { } else { this->dmo_dec = DMO_VideoDecoder_Open(win32_codec_name, this->guid, this->bih, this->flipped, 0); - + if(!this->dmo_dec){ xine_log (this->stream->xine, XINE_LOG_MSG, _("w32codec: DMO_VideoDecoder failed! unknown codec %08lx / wrong parameters?\n"), @@ -702,7 +702,7 @@ static void w32v_init_ds_dmo_codec (w32v_decoder_t *this, int buf_type) { return; } } - + outfmt = IMGFMT_15RGB; if (this->yuv_supported) { vo_cap = this->stream->video_out->get_capabilities (this->stream->video_out); @@ -717,42 +717,42 @@ static void w32v_init_ds_dmo_codec (w32v_decoder_t *this, int buf_type) { this->o_bih.biWidth = this->bih->biWidth; this->o_bih.biHeight = this->bih->biHeight; - + this->o_bih.biSizeImage = this->o_bih.biWidth * this->o_bih.biHeight * this->o_bih.biBitCount / 8; if (this->flipped) - this->o_bih.biHeight=-this->bih->biHeight; + this->o_bih.biHeight=-this->bih->biHeight; if(outfmt==IMGFMT_YUY2 && !this->yuv_hack_needed) this->o_bih.biCompression = mmioFOURCC('Y','U','Y','2'); - else + else this->o_bih.biCompression = 0; - + if( this->driver_type == DRIVER_DS ) DS_VideoDecoder_SetDestFmt(this->ds_dec, this->o_bih.biBitCount, this->o_bih.biCompression); else DMO_VideoDecoder_SetDestFmt(this->dmo_dec, this->o_bih.biBitCount, this->o_bih.biCompression); - + if (outfmt==IMGFMT_YUY2 && this->yuv_hack_needed) - this->o_bih.biCompression = mmioFOURCC('Y','U','Y','2'); - + this->o_bih.biCompression = mmioFOURCC('Y','U','Y','2'); + if( this->driver_type == DRIVER_DS ) DS_VideoDecoder_StartInternal(this->ds_dec); else DMO_VideoDecoder_StartInternal(this->dmo_dec); - + this->size = 0; if ( this->img_buffer ) free (this->img_buffer); this->img_buffer = malloc (this->o_bih.biSizeImage); - + if ( this->buf ) free (this->buf); this->bufsize = VIDEOBUFSIZE; this->buf = malloc(this->bufsize); - + (this->stream->video_out->open) (this->stream->video_out, this->stream); this->outfmt = outfmt; @@ -763,26 +763,26 @@ static void w32v_init_ds_dmo_codec (w32v_decoder_t *this, int buf_type) { static void w32v_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { w32v_decoder_t *this = (w32v_decoder_t *) this_gen; - lprintf ("processing packet type = %08x, buf->decoder_flags=%08x\n", + lprintf ("processing packet type = %08x, buf->decoder_flags=%08x\n", buf->type, buf->decoder_flags); - + if (buf->decoder_flags & BUF_FLAG_PREVIEW) return; - + if (buf->decoder_flags & BUF_FLAG_FRAMERATE) { this->video_step = buf->decoder_info[0]; _x_stream_info_set(this->stream, XINE_STREAM_INFO_FRAME_DURATION, this->video_step); - + lprintf ("video_step is %lld\n", this->video_step); } - + if (buf->decoder_flags & BUF_FLAG_STDHEADER) { int num_decoders; if ( buf->type & 0xff ) return; - - lprintf ("processing header ...\n"); + + lprintf ("processing header ...\n"); /* init package containing bih */ if( this->bih ) @@ -816,7 +816,7 @@ static void w32v_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { if( !this->decoder_ok ) { xine_log (this->stream->xine, XINE_LOG_MSG, - _("w32codec: decoder failed to start. Is '%s' installed?\n"), + _("w32codec: decoder failed to start. Is '%s' installed?\n"), win32_codec_name ); _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_HANDLED, 0); _x_message(this->stream, XINE_MSG_LIBRARY_LOAD_ERROR, @@ -824,30 +824,30 @@ static void w32v_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { } pthread_mutex_unlock(&win32_codec_mutex); - + this->stream_id = -1; this->skipframes = 0; - + } else if (this->decoder_ok) { - lprintf ("processing packet ...\n"); + lprintf ("processing packet ...\n"); if( (int) buf->size <= 0 ) return; - + if( this->stream_id < 0 ) this->stream_id = buf->type & 0xff; - + if( this->stream_id != (buf->type & 0xff) ) return; - + if( this->size + buf->size > this->bufsize ) { this->bufsize = this->size + 2 * buf->size; xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "w32codec: increasing source buffer to %d to avoid overflow.\n", this->bufsize); this->buf = realloc( this->buf, this->bufsize ); } - + xine_fast_memcpy (&this->buf[this->size], buf->content, buf->size); this->size += buf->size; @@ -864,11 +864,11 @@ static void w32v_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { /* decoder video frame */ this->bih->biSizeImage = this->size; - + img = this->stream->video_out->get_frame (this->stream->video_out, - this->bih->biWidth, - this->bih->biHeight, - this->ratio, + this->bih->biWidth, + this->bih->biHeight, + this->ratio, IMGFMT_YUY2, VO_BOTH_FIELDS); @@ -878,7 +878,7 @@ static void w32v_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { if (this->outfmt==IMGFMT_YUY2) img_buffer = img->base[0]; - + flags = 0; if( !(buf->decoder_flags & BUF_FLAG_KEYFRAME) ) flags |= ICDECOMPRESS_NOTKEYFRAME; @@ -887,16 +887,16 @@ static void w32v_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { if( this->skipframes && (buf->type & ~0xff) != BUF_VIDEO_IV32 ) img_buffer = NULL; - + pthread_mutex_lock(&win32_codec_mutex); if( this->driver_type == DRIVER_STD ) ret = (!this->ex_functions) ?ICDecompress(this->hic, flags, - this->bih, this->buf, &this->o_bih, + this->bih, this->buf, &this->o_bih, img_buffer) :ICDecompressEx(this->hic, flags, this->bih, this->buf, &this->o_bih, - img_buffer); + img_buffer); else if( this->driver_type == DRIVER_DS ) { ret = DS_VideoDecoder_DecodeInternal(this->ds_dec, this->buf, this->size, buf->decoder_flags & BUF_FLAG_KEYFRAME, @@ -907,7 +907,7 @@ static void w32v_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { img_buffer); } pthread_mutex_unlock(&win32_codec_mutex); - + if (!this->skipframes) { if (this->outfmt==IMGFMT_YUY2) { /* already decoded into YUY2 format by DLL */ @@ -921,23 +921,23 @@ static void w32v_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { #if HAS_SLOW_MULT int32_t *ctab = rgb_ycc_tab; #endif - + for (row=0; row<this->bih->biHeight; row++) { - + uint16_t *pixel, *out; - + pixel = (uint16_t *) ( (uint8_t *)this->img_buffer + 2 * row * this->o_bih.biWidth ); out = (uint16_t *) (img->base[0] + row * img->pitches[0] ); - + for (col=0; col<this->o_bih.biWidth; col++, pixel++, out++) { - + uint8_t r,g,b; uint8_t y,u,v; - + b = (*pixel & 0x001F) << 3; g = (*pixel & 0x03E0) >> 5 << 3; r = (*pixel & 0x7C00) >> 10 << 3; - + #if HAS_SLOW_MULT y = (ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF]) >> SCALEBITS; if (!(col & 0x0001)) { @@ -966,19 +966,19 @@ static void w32v_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { } } } - + img->pts = buf->pts; if (ret || this->skipframes) { if (!this->skipframes) xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, - "w32codec: Error decompressing frame, err=%ld\n", (long)ret); + "w32codec: Error decompressing frame, err=%ld\n", (long)ret); img->bad_frame = 1; lprintf ("BAD FRAME, duration is %d\n", img->duration); } else { img->bad_frame = 0; lprintf ("GOOD FRAME, duration is %d\n\n", img->duration); } - + this->skipframes = img->draw(img, this->stream); lprintf ("skipframes is %d\n", this->skipframes); @@ -1000,15 +1000,15 @@ static void w32v_flush (video_decoder_t *this_gen) { static void w32v_reset (video_decoder_t *this_gen) { w32v_decoder_t *this = (w32v_decoder_t *) this_gen; - + /* FIXME: need to improve this function. currently it doesn't avoid artifacts when seeking. */ - + pthread_mutex_lock(&win32_codec_mutex); if( this->driver_type == DRIVER_STD ) { if( this->hic ) { - if (!this->ex_functions) + if (!this->ex_functions) ICDecompressBegin(this->hic, this->bih, &this->o_bih); else ICDecompressBeginEx(this->hic, this->bih, &this->o_bih); @@ -1049,7 +1049,7 @@ static void w32v_dispose (video_decoder_t *this_gen) { free (this->img_buffer); this->img_buffer = NULL; } - + if ( this->buf ) { free (this->buf); this->buf = NULL; @@ -1060,7 +1060,7 @@ static void w32v_dispose (video_decoder_t *this_gen) { this->bih = NULL; } - if( this->decoder_ok ) { + if( this->decoder_ok ) { this->decoder_ok = 0; this->stream->video_out->close(this->stream->video_out, this->stream); } @@ -1079,23 +1079,23 @@ static char* get_auds_codec_name(w32a_decoder_t *this, int buf_type) { switch (buf_type) { case BUF_AUDIO_WMAV1: - _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, + _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, "Windows Media Audio v1 (win32)"); return "divxa32.acm"; case BUF_AUDIO_WMAV2: - _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, + _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, "Windows Media Audio v2 (win32)"); return "divxa32.acm"; case BUF_AUDIO_WMAV3: this->driver_type = DRIVER_DMO; this->guid=&wma3_clsid; - _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, + _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, "Windows Media Audio v3 (win32)"); return "wma9dmod.dll"; case BUF_AUDIO_WMALL: this->driver_type = DRIVER_DMO; this->guid=&wma3_clsid; - _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, + _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, "Windows Media Audio Lossless (win32)"); return "wma9dmod.dll"; case BUF_AUDIO_WMAV: @@ -1105,43 +1105,43 @@ static char* get_auds_codec_name(w32a_decoder_t *this, int buf_type) { "Windows Media Audio Voice (win32)"); return "wmspdmod.dll"; case BUF_AUDIO_MSADPCM: - _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, + _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, "MS ADPCM (win32)"); return "msadp32.acm"; case BUF_AUDIO_MSIMAADPCM: - _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, + _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, "MS IMA ADPCM (win32)"); return "imaadp32.acm"; case BUF_AUDIO_MSGSM: - _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, + _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, "MS GSM (win32)"); return "msgsm32.acm"; case BUF_AUDIO_IMC: - _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, + _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, "Intel Music Coder (win32)"); return "imc32.acm"; case BUF_AUDIO_LH: - _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, + _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, "Lernout & Hauspie (win32)"); return "lhacm.acm"; case BUF_AUDIO_VOXWARE: this->driver_type = DRIVER_DS; this->guid=&CLSID_Voxware; - _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, + _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, "Voxware Metasound (win32)"); return "voxmsdec.ax"; case BUF_AUDIO_ACELPNET: this->driver_type = DRIVER_DS; this->guid=&CLSID_Acelp; - _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, + _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, "ACELP.net (win32)"); return "acelpdec.ax"; case BUF_AUDIO_VIVOG723: - _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, + _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, "Vivo G.723/Siren Audio Codec (win32)"); return "vivog723.acm"; } - + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "w32codec: this didn't happen: unknown audio buf type %08x\n", buf_type); return NULL; @@ -1165,7 +1165,7 @@ static int w32a_init_audio (w32a_decoder_t *this, uint8_t *buf, int bufsize, int buftype) { HRESULT ret; - WAVEFORMATEX wf; + WAVEFORMATEX wf; WAVEFORMATEX *in_fmt; unsigned long in_size; unsigned long out_size; @@ -1178,19 +1178,19 @@ static int w32a_init_audio (w32a_decoder_t *this, this->srcstream = 0; this->num_channels = (in_fmt->nChannels >= 2)?2:1; this->rate = in_fmt->nSamplesPerSec; - + if (this->output_open) this->stream->audio_out->close (this->stream->audio_out, this->stream); this->output_open = (this->stream->audio_out->open) ( this->stream->audio_out, this->stream, - 16, in_fmt->nSamplesPerSec, + 16, in_fmt->nSamplesPerSec, _x_ao_channels2mode(in_fmt->nChannels)); if (!this->output_open) { xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "w32codec: (ACM_Decoder) Cannot open audio output device\n"); return 0; } - + audio_buffer = this->stream->audio_out->get_buffer (this->stream->audio_out); audio_buffer_mem_size = audio_buffer->mem_size; audio_buffer->num_frames = 0; @@ -1204,12 +1204,12 @@ static int w32a_init_audio (w32a_decoder_t *this, wf.nBlockAlign = 2*in_fmt->nChannels; wf.wBitsPerSample = 16; wf.cbSize = 0; - + this->ldt_fs = Setup_LDT_Keeper(); win32_codec_name = get_auds_codec_name (this, buftype); - + if( this->driver_type == DRIVER_STD ) { - + MSACM_RegisterDriver(win32_codec_name, in_fmt->wFormatTag, 0); ret=acmStreamOpen(&this->srcstream,(HACMDRIVER)NULL, @@ -1229,73 +1229,73 @@ static int w32a_init_audio (w32a_decoder_t *this, acmStreamSize(this->srcstream, in_size, &out_size, ACM_STREAMSIZEF_SOURCE); out_size*=2; - if(out_size < audio_buffer_mem_size) + if(out_size < audio_buffer_mem_size) out_size=audio_buffer_mem_size; xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "w32codec: Audio buffer min. size: %d\n",(int)out_size); - - acmStreamSize(this->srcstream, out_size, (LPDWORD) &this->rec_audio_src_size, + + acmStreamSize(this->srcstream, out_size, (LPDWORD) &this->rec_audio_src_size, ACM_STREAMSIZEF_DESTINATION); } else if( this->driver_type == DRIVER_DS ) { this->ds_dec=DS_AudioDecoder_Open(win32_codec_name,this->guid, in_fmt); - + if( this->ds_dec == NULL ) { xine_log (this->stream->xine, XINE_LOG_MSG, _("w32codec: Error initializing DirectShow Audio\n")); this->srcstream = 0; return 0; } - - out_size = audio_buffer_mem_size; + + out_size = audio_buffer_mem_size; xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "w32codec: output buffer size: %d\n",(int)out_size); this->rec_audio_src_size=DS_AudioDecoder_GetSrcSize(this->ds_dec,out_size); - - /* somehow DS_Filters seems to eat more than rec_audio_src_size if the output - buffer is big enough. Doubling rec_audio_src_size should make this + + /* somehow DS_Filters seems to eat more than rec_audio_src_size if the output + buffer is big enough. Doubling rec_audio_src_size should make this impossible */ - this->rec_audio_src_size*=2; + this->rec_audio_src_size*=2; } else if( this->driver_type == DRIVER_DMO ) { this->dmo_dec=DMO_AudioDecoder_Open(win32_codec_name,this->guid, in_fmt, wf.nChannels); - + if( this->dmo_dec == NULL ) { xine_log (this->stream->xine, XINE_LOG_MSG, _("w32codec: Error initializing DMO Audio\n")); this->srcstream = 0; return 0; } - - out_size = audio_buffer_mem_size; + + out_size = audio_buffer_mem_size; xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "w32codec: output buffer size: %d\n",(int)out_size); this->rec_audio_src_size=DMO_AudioDecoder_GetSrcSize(this->dmo_dec,out_size); - + /* i don't know if DMO has the same problem as above. so, just in case... */ - this->rec_audio_src_size*=2; + this->rec_audio_src_size*=2; } - + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, - "w32codec: Recommended source buffer size: %d\n", this->rec_audio_src_size); + "w32codec: Recommended source buffer size: %d\n", this->rec_audio_src_size); if( this->rec_audio_src_size < in_fmt->nBlockAlign ) { this->rec_audio_src_size = in_fmt->nBlockAlign; xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, - "w32codec: adjusting source buffer size to %d\n", this->rec_audio_src_size); + "w32codec: adjusting source buffer size to %d\n", this->rec_audio_src_size); } - + if( this->buf ) free(this->buf); - + if( this->outbuf ) free(this->outbuf); this->max_audio_src_size = 2 * this->rec_audio_src_size; - + this->buf = malloc( this->max_audio_src_size ); out_size += 32768; this->outbuf = malloc( out_size ); this->outsize = out_size; - + this->size = 0; this->pts = this->lastpts = this->sumpts = this->sumsize = 0; @@ -1307,7 +1307,7 @@ static void w32a_ensure_buffer_size(w32a_decoder_t *this, int size) { if( this->size + size > this->max_audio_src_size ) { this->max_audio_src_size = this->size + 2 * size; xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, - "w32codec: increasing source buffer to %d to avoid overflow.\n", + "w32codec: increasing source buffer to %d to avoid overflow.\n", this->max_audio_src_size); this->buf = realloc( this->buf, this->max_audio_src_size ); } @@ -1315,9 +1315,9 @@ static void w32a_ensure_buffer_size(w32a_decoder_t *this, int size) { static void w32a_decode_audio (w32a_decoder_t *this, - unsigned char *data, - uint32_t size, - int frame_end, + unsigned char *data, + uint32_t size, + int frame_end, int64_t pts) { static ACMSTREAMHEADER ash; @@ -1350,7 +1350,7 @@ static void w32a_decode_audio (w32a_decoder_t *this, delay = (int)((double)this->size / this->byterate); else delay = 0; - + this->sumsize += size; w32a_ensure_buffer_size(this, this->size + size); @@ -1365,17 +1365,17 @@ static void w32a_decode_audio (w32a_decoder_t *this, memset(&ash, 0, sizeof(ash)); ash.cbStruct=sizeof(ash); ash.fdwStatus=0; - ash.dwUser=0; + ash.dwUser=0; ash.pbSrc=this->buf; ash.cbSrcLength=this->rec_audio_src_size; ash.pbDst=this->outbuf; ash.cbDstLength=this->outsize; - - lprintf ("decoding %d of %d bytes (%02x %02x %02x %02x ... %02x %02x)\n", + + lprintf ("decoding %d of %d bytes (%02x %02x %02x %02x ... %02x %02x)\n", this->rec_audio_src_size, this->size, this->buf[0], this->buf[1], this->buf[2], this->buf[3], - this->buf[this->rec_audio_src_size-2], this->buf[this->rec_audio_src_size-1]); - + this->buf[this->rec_audio_src_size-2], this->buf[this->rec_audio_src_size-1]); + pthread_mutex_lock(&win32_codec_mutex); if( this->driver_type == DRIVER_STD ) { hr=acmStreamPrepareHeader(this->srcstream,&ash,0); @@ -1385,7 +1385,7 @@ static void w32a_decode_audio (w32a_decoder_t *this, pthread_mutex_unlock(&win32_codec_mutex); return; } - + hr=acmStreamConvert(this->srcstream,&ash,0); } else if( this->driver_type == DRIVER_DS ){ hr=DS_AudioDecoder_Convert(this->ds_dec, ash.pbSrc, ash.cbSrcLength, @@ -1401,7 +1401,7 @@ static void w32a_decode_audio (w32a_decoder_t *this, ash.cbDstLengthUsed = size_written; } pthread_mutex_unlock(&win32_codec_mutex); - + if(hr){ xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "w32codec: stream convert error %d, used %d bytes\n", (int)hr,(int)ash.cbSrcLengthUsed); @@ -1416,18 +1416,18 @@ static void w32a_decode_audio (w32a_decoder_t *this, DstLengthUsed = ash.cbDstLengthUsed; p = this->outbuf; - + while( DstLengthUsed ) { audio_buffer = this->stream->audio_out->get_buffer (this->stream->audio_out); - + if( DstLengthUsed < audio_buffer->mem_size ) bufsize = DstLengthUsed; else bufsize = audio_buffer->mem_size; xine_fast_memcpy( audio_buffer->mem, p, bufsize ); - + audio_buffer->num_frames = bufsize / (this->num_channels*2); if (this->pts) audio_buffer->vpts = this->pts - delay; @@ -1437,7 +1437,7 @@ static void w32a_decode_audio (w32a_decoder_t *this, lprintf("w32a_decode_audio: decoder pts=%lld\n", audio_buffer->vpts); this->stream->audio_out->put_buffer (this->stream->audio_out, audio_buffer, this->stream); - + this->pts = 0; DstLengthUsed -= bufsize; p += bufsize; @@ -1470,19 +1470,19 @@ static void w32a_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { lprintf ("preview data ignored.\n"); return; } - + if (buf->decoder_flags & BUF_FLAG_STDHEADER) { lprintf ("got audio header\n"); - + /* accumulate init data */ w32a_ensure_buffer_size(this, this->size + buf->size); memcpy(this->buf + this->size, buf->content, buf->size); this->size += buf->size; - + if (buf->decoder_flags & BUF_FLAG_FRAME_END) { pthread_mutex_lock(&win32_codec_mutex); this->decoder_ok = w32a_init_audio (this, this->buf, this->size, buf->type); - + if( !this->decoder_ok ) { xine_log (this->stream->xine, XINE_LOG_MSG, _("w32codec: decoder failed to start. Is '%s' installed?\n"), win32_codec_name ); @@ -1490,7 +1490,7 @@ static void w32a_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { } pthread_mutex_unlock(&win32_codec_mutex); } - + } else if (this->decoder_ok) { lprintf ("decoding %d data bytes...\n", buf->size); @@ -1498,9 +1498,9 @@ static void w32a_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { return; Check_FS_Segment(this->ldt_fs); - + w32a_decode_audio (this, buf->content, buf->size, - buf->decoder_flags & BUF_FLAG_FRAME_END, + buf->decoder_flags & BUF_FLAG_FRAME_END, buf->pts); } } @@ -1509,7 +1509,7 @@ static void w32a_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { static void w32a_dispose (audio_decoder_t *this_gen) { w32a_decoder_t *this = (w32a_decoder_t *) this_gen; - + pthread_mutex_lock(&win32_codec_mutex); if( this->driver_type == DRIVER_STD ) { if( this->srcstream ) { @@ -1533,12 +1533,12 @@ static void w32a_dispose (audio_decoder_t *this_gen) { free(this->buf); this->buf = NULL; } - + if( this->outbuf ) { free(this->outbuf); this->outbuf = NULL; } - + this->decoder_ok = 0; if (this->output_open) { @@ -1549,7 +1549,7 @@ static void w32a_dispose (audio_decoder_t *this_gen) { free (this); } -static video_decoder_t *open_video_decoder_plugin (video_decoder_class_t *class_gen, +static video_decoder_t *open_video_decoder_plugin (video_decoder_class_t *class_gen, xine_stream_t *stream) { w32v_decoder_t *this ; @@ -1605,7 +1605,7 @@ static void *init_video_decoder_class (xine_t *xine, void *data) { this->decoder_class.dispose = dispose_video_class; pthread_once (&once_control, init_routine); - + return this; } @@ -1613,7 +1613,7 @@ static void *init_video_decoder_class (xine_t *xine, void *data) { * audio part */ -static audio_decoder_t *open_audio_decoder_plugin (audio_decoder_class_t *class_gen, +static audio_decoder_t *open_audio_decoder_plugin (audio_decoder_class_t *class_gen, xine_stream_t *stream) { w32a_decoder_t *this ; @@ -1624,11 +1624,11 @@ static audio_decoder_t *open_audio_decoder_plugin (audio_decoder_class_t *class_ this->audio_decoder.reset = w32a_reset; this->audio_decoder.discontinuity = w32a_discontinuity; this->audio_decoder.dispose = w32a_dispose; - + this->stream = stream; this->output_open = 0; this->decoder_ok = 0; - + this->buf = NULL; this->outbuf = NULL; @@ -1655,7 +1655,7 @@ static void *init_audio_decoder_class (xine_t *xine, void *data) { w32a_class_t *this; config_values_t *cfg; - + cfg = xine->config; if ((win32_def_path = get_win32_codecs_path(cfg)) == NULL) return NULL; @@ -1676,12 +1676,12 @@ static void *init_audio_decoder_class (xine_t *xine, void *data) { * exported plugin catalog entry */ -static uint32_t video_types[] = { +static uint32_t video_types[] = { BUF_VIDEO_MSMPEG4_V1, BUF_VIDEO_MSMPEG4_V2, BUF_VIDEO_MSMPEG4_V3, BUF_VIDEO_IV50, BUF_VIDEO_IV41, BUF_VIDEO_IV32, BUF_VIDEO_IV31, BUF_VIDEO_CINEPAK, /* BUF_VIDEO_ATIVCR1, */ BUF_VIDEO_ATIVCR2, BUF_VIDEO_I263, BUF_VIDEO_MSVC, - BUF_VIDEO_DV, BUF_VIDEO_WMV7, BUF_VIDEO_WMV8, BUF_VIDEO_WMV9, + BUF_VIDEO_DV, BUF_VIDEO_WMV7, BUF_VIDEO_WMV8, BUF_VIDEO_WMV9, BUF_VIDEO_VP31, BUF_VIDEO_MSS1, BUF_VIDEO_TSCC, BUF_VIDEO_UCOD, BUF_VIDEO_VP4, BUF_VIDEO_VP5, BUF_VIDEO_VP6, 0 @@ -1692,8 +1692,8 @@ static const decoder_info_t dec_info_video = { 1 /* priority */ }; -static uint32_t audio_types[] = { - BUF_AUDIO_WMAV1, BUF_AUDIO_WMAV2, BUF_AUDIO_WMAV3, BUF_AUDIO_MSADPCM, +static uint32_t audio_types[] = { + BUF_AUDIO_WMAV1, BUF_AUDIO_WMAV2, BUF_AUDIO_WMAV3, BUF_AUDIO_MSADPCM, BUF_AUDIO_MSIMAADPCM, BUF_AUDIO_MSGSM, BUF_AUDIO_IMC, BUF_AUDIO_LH, BUF_AUDIO_VOXWARE, BUF_AUDIO_ACELPNET, BUF_AUDIO_VIVOG723, BUF_AUDIO_WMAV, BUF_AUDIO_WMALL, @@ -1706,7 +1706,7 @@ static const decoder_info_t dec_info_audio = { }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_VIDEO_DECODER | PLUGIN_MUST_PRELOAD, 18, "win32v", XINE_VERSION_CODE, &dec_info_video, init_video_decoder_class }, { PLUGIN_AUDIO_DECODER | PLUGIN_MUST_PRELOAD, 15, "win32a", XINE_VERSION_CODE, &dec_info_audio, init_audio_decoder_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } diff --git a/src/libw32dll/w32codec.h b/src/libw32dll/w32codec.h index 1f02ba764..78dcb5c88 100644 --- a/src/libw32dll/w32codec.h +++ b/src/libw32dll/w32codec.h @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2001 the xine project - * + * * This file is part of xine, a unix video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA diff --git a/src/libw32dll/wine/Makefile.am b/src/libw32dll/wine/Makefile.am index 70341a502..f04560130 100644 --- a/src/libw32dll/wine/Makefile.am +++ b/src/libw32dll/wine/Makefile.am @@ -35,7 +35,7 @@ libwine_la_SOURCES = \ vfl.c \ win32.c \ stubs.s \ - wrapper.S + wrapper.S noinst_HEADERS = \ avifmt.h \ diff --git a/src/libxineadec/fooaudio.c b/src/libxineadec/fooaudio.c index 53fcef801..776136fc2 100644 --- a/src/libxineadec/fooaudio.c +++ b/src/libxineadec/fooaudio.c @@ -130,7 +130,7 @@ static void fooaudio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) * the accumulator buffer size as necessary */ if( this->size + buf->size > this->bufsize ) { this->bufsize = this->size + 2 * buf->size; - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "fooaudio: increasing source buffer to %d to avoid overflow.\n", this->bufsize); this->buf = realloc( this->buf, this->bufsize ); } @@ -151,8 +151,8 @@ static void fooaudio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) * This decoder generates a continuous sine pattern based on the pts * values sent by the xine engine. Two pts values are needed to know * how long to make the audio. Thus, If this is the first frame or - * a seek has occurred (indicated by this->last_pts = -1), - * log the pts but do not create any audio. + * a seek has occurred (indicated by this->last_pts = -1), + * log the pts but do not create any audio. * * When a valid pts delta is generated, create n audio samples, where * n is given as: @@ -181,7 +181,7 @@ static void fooaudio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) /* get an audio buffer */ audio_buffer = this->stream->audio_out->get_buffer (this->stream->audio_out); if (audio_buffer->mem_size == 0) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "fooaudio: Help! Allocated audio buffer with nothing in it!\n"); return; } @@ -196,7 +196,7 @@ static void fooaudio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) #define WAVE_HZ 300 /* fill up the samples in the buffer */ for (i = 0; i < samples_to_send; i++) - audio_buffer->mem[i] = + audio_buffer->mem[i] = (short)(sin(2 * M_PI * this->iteration++ / WAVE_HZ) * 32767); /* final prep for audio buffer dispatch */ @@ -308,7 +308,7 @@ static void dispose_class (audio_decoder_class_t *this_gen) { free (this); } -/* This function allocates a private audio decoder class and initializes +/* This function allocates a private audio decoder class and initializes * the class's member functions. */ static void *init_plugin (xine_t *xine, void *data) { @@ -324,18 +324,18 @@ static void *init_plugin (xine_t *xine, void *data) { return this; } -/* This is a list of all of the internal xine audio buffer types that +/* This is a list of all of the internal xine audio buffer types that * this decoder is able to handle. Check src/xine-engine/buffer.h for a * list of valid buffer types (and add a new one if the one you need does * not exist). Terminate the list with a 0. */ -static uint32_t audio_types[] = { +static uint32_t audio_types[] = { /* BUF_AUDIO_FOO, */ 0 }; /* This data structure combines the list of supported xine buffer types and * the priority that the plugin should be given with respect to other - * plugins that handle the same buffer type. A plugin with priority (n+1) + * plugins that handle the same buffer type. A plugin with priority (n+1) * will be used instead of a plugin with priority (n). */ static const decoder_info_t dec_info_audio = { audio_types, /* supported types */ diff --git a/src/libxineadec/nosefart/Makefile.am b/src/libxineadec/nosefart/Makefile.am index 51cc3f238..4ca4f75b6 100644 --- a/src/libxineadec/nosefart/Makefile.am +++ b/src/libxineadec/nosefart/Makefile.am @@ -13,7 +13,7 @@ libnosefart_la_SOURCES = \ memguard.c \ nes6502.c \ nsf.c \ - vrcvisnd.c + vrcvisnd.c libnosefart_la_CFLAGS = $(VISIBILITY_FLAG) -DNSF_PLAYER -fno-strict-aliasing diff --git a/src/libxineadec/nsf.c b/src/libxineadec/nsf.c index d4841ec6e..643d431a2 100644 --- a/src/libxineadec/nsf.c +++ b/src/libxineadec/nsf.c @@ -253,7 +253,7 @@ static void dispose_class (audio_decoder_class_t *this_gen) { free (this); } -/* This function allocates a private audio decoder class and initializes +/* This function allocates a private audio decoder class and initializes * the class's member functions. */ static void *init_plugin (xine_t *xine, void *data) { @@ -269,18 +269,18 @@ static void *init_plugin (xine_t *xine, void *data) { return this; } -/* This is a list of all of the internal xine audio buffer types that +/* This is a list of all of the internal xine audio buffer types that * this decoder is able to handle. Check src/xine-engine/buffer.h for a * list of valid buffer types (and add a new one if the one you need does * not exist). Terminate the list with a 0. */ -static uint32_t audio_types[] = { +static uint32_t audio_types[] = { BUF_AUDIO_NSF, 0 }; /* This data structure combines the list of supported xine buffer types and * the priority that the plugin should be given with respect to other - * plugins that handle the same buffer type. A plugin with priority (n+1) + * plugins that handle the same buffer type. A plugin with priority (n+1) * will be used instead of a plugin with priority (n). */ static const decoder_info_t dec_info_audio = { audio_types, /* supported types */ diff --git a/src/libxineadec/xine_lpcm_decoder.c b/src/libxineadec/xine_lpcm_decoder.c index 435545d56..b7c0f8d1a 100644 --- a/src/libxineadec/xine_lpcm_decoder.c +++ b/src/libxineadec/xine_lpcm_decoder.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -58,10 +58,10 @@ typedef struct lpcm_decoder_s { xine_stream_t *stream; uint32_t rate; - uint32_t bits_per_sample; - uint32_t number_of_channels; - uint32_t ao_cap_mode; - + uint32_t bits_per_sample; + uint32_t number_of_channels; + uint32_t ao_cap_mode; + int output_open; int cpu_be; /* TRUE, if we're a Big endian CPU */ } lpcm_decoder_t; @@ -82,7 +82,7 @@ static void lpcm_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { int stream_be; audio_buffer_t *audio_buffer; int format_changed = 0; - + /* Drop preview data */ if (buf->decoder_flags & BUF_FLAG_PREVIEW) return; @@ -93,7 +93,7 @@ static void lpcm_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { unsigned int bits_per_sample = 16; unsigned int sample_rate = 0; unsigned int num_channels; - + num_channels = (buf->decoder_info[2] & 0x7) + 1; switch ((buf->decoder_info[2]>>4) & 3) { case 0: sample_rate = 48000; break; @@ -106,7 +106,7 @@ static void lpcm_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { case 1: bits_per_sample = 20; break; case 2: bits_per_sample = 24; break; } - + if( this->bits_per_sample != bits_per_sample || this->number_of_channels != num_channels || this->rate != sample_rate || @@ -115,16 +115,16 @@ static void lpcm_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { this->number_of_channels = num_channels; this->rate = sample_rate; format_changed++; - } + } } - + if( buf->decoder_flags & BUF_FLAG_STDHEADER ) { this->rate=buf->decoder_info[1]; - this->bits_per_sample=buf->decoder_info[2] ; - this->number_of_channels=buf->decoder_info[3] ; + this->bits_per_sample=buf->decoder_info[2] ; + this->number_of_channels=buf->decoder_info[3] ; format_changed++; } - + /* * (re-)open output device */ @@ -148,11 +148,11 @@ static void lpcm_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { /* stream/meta info */ _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, "Linear PCM"); - _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_BITRATE, + _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_BITRATE, this->bits_per_sample * this->rate * this->number_of_channels); } - if (!this->output_open || (buf->decoder_flags & BUF_FLAG_HEADER) ) + if (!this->output_open || (buf->decoder_flags & BUF_FLAG_HEADER) ) return; audio_buffer = this->stream->audio_out->get_buffer (this->stream->audio_out); @@ -160,7 +160,7 @@ static void lpcm_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { /* Swap LPCM samples into native byte order, if necessary */ buf->type &= 0xffff0000; stream_be = ( buf->type == BUF_AUDIO_LPCM_BE ); - + if( this->bits_per_sample == 16 ){ if (stream_be != this->cpu_be) swab (sample_buffer, audio_buffer->mem, buf->size); @@ -171,20 +171,20 @@ static void lpcm_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { uint8_t *s = (uint8_t *)sample_buffer; uint8_t *d = (uint8_t *)audio_buffer->mem; int n = buf->size; - + if (stream_be != this->cpu_be) { while( n >= 0 ) { swab( s, d, 8 ); s += 10; d += 8; - n -= 10; + n -= 10; } } else { while( n >= 0 ) { memcpy( d, s, 8 ); s += 10; d += 8; - n -= 10; + n -= 10; } } } else if( this->bits_per_sample == 24 ) { @@ -223,7 +223,7 @@ static void lpcm_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { } else { memcpy (audio_buffer->mem, sample_buffer, buf->size); } - + audio_buffer->vpts = buf->pts; audio_buffer->num_frames = (((buf->size*8)/this->number_of_channels)/this->bits_per_sample); @@ -232,9 +232,9 @@ static void lpcm_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { } static void lpcm_dispose (audio_decoder_t *this_gen) { - lpcm_decoder_t *this = (lpcm_decoder_t *) this_gen; + lpcm_decoder_t *this = (lpcm_decoder_t *) this_gen; - if (this->output_open) + if (this->output_open) this->stream->audio_out->close (this->stream->audio_out, this->stream); this->output_open = 0; @@ -254,11 +254,11 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, xine_stre this->output_open = 0; this->rate = 0; - this->bits_per_sample=0; - this->number_of_channels=0; - this->ao_cap_mode=0; + this->bits_per_sample=0; + this->number_of_channels=0; + this->ao_cap_mode=0; this->stream = stream; - + this->cpu_be = ( htons(1) == 1 ); return &this->audio_decoder; @@ -290,7 +290,7 @@ static void *init_plugin (xine_t *xine, void *data) { return this; } -static uint32_t audio_types[] = { +static uint32_t audio_types[] = { BUF_AUDIO_LPCM_BE, BUF_AUDIO_LPCM_LE, 0 }; @@ -300,7 +300,7 @@ static const decoder_info_t dec_info_audio = { }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_AUDIO_DECODER, 15, "pcm", XINE_VERSION_CODE, &dec_info_audio, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libxineadec/xine_speex_decoder.c b/src/libxineadec/xine_speex_decoder.c index 46ea3a9f9..9ae2e9718 100644 --- a/src/libxineadec/xine_speex_decoder.c +++ b/src/libxineadec/xine_speex_decoder.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -175,10 +175,10 @@ void read_metadata (speex_decoder_t *this, char * comments, int length) if ( !strncasecmp (speex_comment_keys[i].key, c, keylen) ) { char meta_info[(len - keylen) + 1]; - + lprintf ("known metadata %d %d\n", i, speex_comment_keys[i].xine_metainfo_index); - + strncpy(meta_info, &c[keylen], len-keylen); _x_meta_info_set_utf8(this->stream, speex_comment_keys[i].xine_metainfo_index, meta_info); } @@ -221,7 +221,7 @@ static void speex_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, LOG_MODULE ": invalid mode ID %u\n", modeID); return; } - + spx_mode = (SpeexMode *) speex_mode_list[modeID]; if (spx_mode->bitstream_version != spx_header->mode_bitstream_version) { @@ -243,7 +243,7 @@ static void speex_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { this->channels = spx_header->nb_channels; if (this->channels == 2) { SpeexCallback callback; - + callback.callback_id = SPEEX_INBAND_STEREO; callback.func = speex_std_stereo_request_handler; callback.data = &this->stereo; @@ -252,7 +252,7 @@ static void speex_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { this->nframes = spx_header->frames_per_packet; if (!this->nframes) this->nframes = 1; - + speex_decoder_ctl (this->st, SPEEX_GET_FRAME_SIZE, &this->frame_size); speex_decoder_ctl (this->st, SPEEX_GET_BITRATE, &bitrate); @@ -271,10 +271,10 @@ static void speex_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { if (!this->header_count) { int mode = _x_ao_channels2mode(this->channels); - + if (!this->output_open) { this->output_open = - (this->stream->audio_out->open) (this->stream->audio_out, + (this->stream->audio_out->open) (this->stream->audio_out, this->stream, 16, this->rate, @@ -283,7 +283,7 @@ static void speex_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { } } } - + } else if (this->output_open) { int j; @@ -322,9 +322,9 @@ static void speex_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { audio_buffer->vpts = this->pts; this->pts=0; audio_buffer->num_frames = this->frame_size; - + this->stream->audio_out->put_buffer (this->stream->audio_out, audio_buffer, this->stream); - + buf->pts=0; } @@ -336,20 +336,20 @@ static void speex_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { static void speex_dispose (audio_decoder_t *this_gen) { - speex_decoder_t *this = (speex_decoder_t *) this_gen; - + speex_decoder_t *this = (speex_decoder_t *) this_gen; + if (this->st) { speex_decoder_destroy (this->st); } speex_bits_destroy (&this->bits); - if (this->output_open) + if (this->output_open) this->stream->audio_out->close (this->stream->audio_out, this->stream); free (this_gen); } -static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, +static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, xine_stream_t *stream) { speex_decoder_t *this ; @@ -395,7 +395,7 @@ static void dispose_class (audio_decoder_class_t *this) { static void *init_plugin (xine_t *xine, void *data) { speex_class_t *this; - + this = (speex_class_t *) calloc(1, sizeof(speex_class_t)); this->decoder_class.open_plugin = open_plugin; @@ -406,7 +406,7 @@ static void *init_plugin (xine_t *xine, void *data) { return this; } -static uint32_t audio_types[] = { +static uint32_t audio_types[] = { BUF_AUDIO_SPEEX, 0 }; @@ -416,7 +416,7 @@ static const decoder_info_t dec_info_audio = { }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_AUDIO_DECODER, 15, "speex", XINE_VERSION_CODE, &dec_info_audio, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libxineadec/xine_vorbis_decoder.c b/src/libxineadec/xine_vorbis_decoder.c index 218c26033..99012c40d 100644 --- a/src/libxineadec/xine_vorbis_decoder.c +++ b/src/libxineadec/xine_vorbis_decoder.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -88,7 +88,7 @@ static void vorbis_reset (audio_decoder_t *this_gen) { /* clear block first, as it might contain allocated data */ vorbis_block_clear(&this->vb); - vorbis_block_init(&this->vd,&this->vb); + vorbis_block_init(&this->vd,&this->vb); } static void vorbis_discontinuity (audio_decoder_t *this_gen) { @@ -146,8 +146,8 @@ static void get_metadata (vorbis_decoder_t *this) { static void vorbis_check_bufsize (vorbis_decoder_t *this, int size) { if (size > this->bufsize) { this->bufsize = size + size / 2; - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - _("vorbis: increasing buffer to %d to avoid overflow.\n"), + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("vorbis: increasing buffer to %d to avoid overflow.\n"), this->bufsize); this->buf = realloc(this->buf, this->bufsize); } @@ -170,87 +170,87 @@ static void vorbis_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { /* reset accumultaion buffer */ this->size = 0; - + if ( (buf->decoder_flags & BUF_FLAG_HEADER) && !(buf->decoder_flags & BUF_FLAG_STDHEADER) ) { - + lprintf ("%d headers to go\n", this->header_count); - + if (this->header_count) { int res = 0; - + if (this->header_count == 3) this->op.b_o_s = 1; - + if ( (res = vorbis_synthesis_headerin(&this->vi,&this->vc,&this->op)) < 0 ) { /* error case; not a vorbis header */ xine_log(this->stream->xine, XINE_LOG_MSG, "libvorbis: this bitstream does not contain vorbis audio data. Following first 64 bytes (return: %d).\n", res); xine_hexdump((char *)this->op.packet, this->op.bytes < 64 ? this->op.bytes : 64); return; } - + this->header_count--; - + if (!this->header_count) { - + int mode = AO_CAP_MODE_MONO; - + get_metadata (this); - + mode = _x_ao_channels2mode(this->vi.channels); - + this->convsize=MAX_NUM_SAMPLES/this->vi.channels; - + if (!this->output_open) { - this->output_open = (this->stream->audio_out->open) (this->stream->audio_out, + this->output_open = (this->stream->audio_out->open) (this->stream->audio_out, this->stream, 16, this->vi.rate, mode) ; - - _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_BITRATE, + + _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_BITRATE, this->vi.bitrate_nominal); - + } - + /* OK, got and parsed all three headers. Initialize the Vorbis * packet->PCM decoder. */ lprintf("all three headers parsed. initializing decoder.\n"); - /* initialize central decode state */ - vorbis_synthesis_init(&this->vd,&this->vi); + /* initialize central decode state */ + vorbis_synthesis_init(&this->vd,&this->vi); /* initialize local state for most of the decode so multiple - * block decodes can proceed in parallel. We could init + * block decodes can proceed in parallel. We could init * multiple vorbis_block structures for vd here */ - vorbis_block_init(&this->vd,&this->vb); + vorbis_block_init(&this->vd,&this->vb); } } - + } else if (this->output_open) { - + float **pcm; int samples; - - if(vorbis_synthesis(&this->vb,&this->op)==0) + + if(vorbis_synthesis(&this->vb,&this->op)==0) vorbis_synthesis_blockin(&this->vd,&this->vb); - + if (buf->pts!=0) this->pts=buf->pts; - + while ((samples=vorbis_synthesis_pcmout(&this->vd,&pcm))>0){ - + /* **pcm is a multichannel float vector. In stereo, for * example, pcm[0][...] is left, and pcm[1][...] is right. * samples is the size of each channel. Convert the float * values (-1.<=range<=1.) to whatever PCM format and write * it out */ - + int i,j; int bout=(samples<this->convsize?samples:this->convsize); audio_buffer_t *audio_buffer; - + audio_buffer = this->stream->audio_out->get_buffer (this->stream->audio_out); - + /* convert floats to 16 bit signed ints (host order) and interleave */ for(i=0;i<this->vi.channels;i++){ @@ -269,15 +269,15 @@ static void vorbis_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { ptr+=this->vi.channels; } } - + audio_buffer->vpts = this->pts; this->pts=0; audio_buffer->num_frames = bout; - + this->stream->audio_out->put_buffer (this->stream->audio_out, audio_buffer, this->stream); - + buf->pts=0; - + /* tell libvorbis how many samples we actually consumed */ vorbis_synthesis_read(&this->vd,bout); } @@ -289,7 +289,7 @@ static void vorbis_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { static void vorbis_dispose (audio_decoder_t *this_gen) { - vorbis_decoder_t *this = (vorbis_decoder_t *) this_gen; + vorbis_decoder_t *this = (vorbis_decoder_t *) this_gen; if( !this->header_count ) { lprintf("deinitializing decoder\n"); @@ -302,7 +302,7 @@ static void vorbis_dispose (audio_decoder_t *this_gen) { vorbis_info_clear(&this->vi); /* must be called last */ - if (this->output_open) + if (this->output_open) this->stream->audio_out->close (this->stream->audio_out, this->stream); lprintf("libvorbis instance destroyed\n"); @@ -310,7 +310,7 @@ static void vorbis_dispose (audio_decoder_t *this_gen) { free (this_gen); } -static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, +static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, xine_stream_t *stream) { vorbis_decoder_t *this ; @@ -358,7 +358,7 @@ static void dispose_class (audio_decoder_class_t *this) { static void *init_plugin (xine_t *xine, void *data) { vorbis_class_t *this; - + this = (vorbis_class_t *) calloc(1, sizeof(vorbis_class_t)); this->decoder_class.open_plugin = open_plugin; @@ -369,7 +369,7 @@ static void *init_plugin (xine_t *xine, void *data) { return this; } -static uint32_t audio_types[] = { +static uint32_t audio_types[] = { BUF_AUDIO_VORBIS, 0 }; @@ -379,7 +379,7 @@ static const decoder_info_t dec_info_audio = { }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_AUDIO_DECODER, 15, "vorbis", XINE_VERSION_CODE, &dec_info_audio, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libxinevdec/foovideo.c b/src/libxinevdec/foovideo.c index 7a80c7c66..6e1fd0ac3 100644 --- a/src/libxinevdec/foovideo.c +++ b/src/libxinevdec/foovideo.c @@ -67,7 +67,7 @@ typedef struct foovideo_decoder_s { /* these are variables exclusive to the foo video decoder */ unsigned char current_yuv_byte; - + } foovideo_decoder_t; /************************************************************************** @@ -98,7 +98,7 @@ static void foovideo_decode_data (video_decoder_t *this_gen, this->video_step = buf->decoder_info[0]; _x_stream_info_set(this->stream, XINE_STREAM_INFO_FRAME_DURATION, this->video_step); } - + if (buf->decoder_flags & BUF_FLAG_STDHEADER) { /* need to initialize */ (this->stream->video_out->open) (this->stream->video_out, this->stream); @@ -276,7 +276,7 @@ static void *init_plugin (xine_t *xine, void *data) { * list of valid buffer types (and add a new one if the one you need does * not exist). Terminate the list with a 0. */ -static const uint32_t video_types[] = { +static const uint32_t video_types[] = { /* BUF_VIDEO_FOOVIDEO, */ BUF_VIDEO_VQA, BUF_VIDEO_SORENSON_V3, diff --git a/src/libxinevdec/gdkpixbuf.c b/src/libxinevdec/gdkpixbuf.c index de4c2271e..8815edabe 100644 --- a/src/libxinevdec/gdkpixbuf.c +++ b/src/libxinevdec/gdkpixbuf.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2006 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -65,7 +65,7 @@ typedef struct image_decoder_s { xine_stream_t *stream; int video_open; - + GdkPixbufLoader *loader; } image_decoder_t; @@ -158,8 +158,8 @@ static void image_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { * alloc and draw video frame */ img = this->stream->video_out->get_frame (this->stream->video_out, width, - height, (double)width/(double)height, - XINE_IMGFMT_YUY2, + height, (double)width/(double)height, + XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); img->pts = buf->pts; img->duration = 3600; @@ -167,9 +167,9 @@ static void image_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { yuv444_to_yuy2(&yuv_planes, img->base[0], img->pitches[0]); free_yuv_planes(&yuv_planes); - + _x_stream_info_set(this->stream, XINE_STREAM_INFO_FRAME_DURATION, img->duration); - + img->draw(img, this->stream); img->free(img); } @@ -178,7 +178,7 @@ static void image_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { static void image_flush (video_decoder_t *this_gen) { /* image_decoder_t *this = (image_decoder_t *) this_gen; */ - + /* * flush out any frames that are still stored in the decoder */ @@ -187,7 +187,7 @@ static void image_flush (video_decoder_t *this_gen) { static void image_reset (video_decoder_t *this_gen) { image_decoder_t *this = (image_decoder_t *) this_gen; - + /* * reset decoder after engine flush (prepare for new * video data not related to recently decoded data) @@ -203,7 +203,7 @@ static void image_reset (video_decoder_t *this_gen) { static void image_discontinuity (video_decoder_t *this_gen) { /* image_decoder_t *this = (image_decoder_t *) this_gen; */ - + /* * a time reference discontinuity has happened. * that is, it must forget any currently held pts value @@ -231,7 +231,7 @@ static void image_dispose (video_decoder_t *this_gen) { } -static video_decoder_t *open_plugin (video_decoder_class_t *class_gen, +static video_decoder_t *open_plugin (video_decoder_class_t *class_gen, xine_stream_t *stream) { image_class_t *cls = (image_class_t *) class_gen; @@ -274,7 +274,7 @@ static void dispose_class (video_decoder_class_t *this_gen) { image_class_t *this = (image_class_t *) this_gen; lprintf("class closed\n"); - + free (this); } @@ -294,7 +294,7 @@ static void *init_class (xine_t *xine, void *data) { */ lprintf("class opened\n"); - + return this; } @@ -310,7 +310,7 @@ static const decoder_info_t dec_info_image = { }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_VIDEO_DECODER, 18, "gdkpixbuf", XINE_VERSION_CODE, &dec_info_image, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libxinevdec/image.c b/src/libxinevdec/image.c index bd749be8e..2c19d36fb 100644 --- a/src/libxinevdec/image.c +++ b/src/libxinevdec/image.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2003-2005 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -71,7 +71,7 @@ typedef struct image_decoder_s { xine_stream_t *stream; int video_open; - + unsigned char *image; int index; @@ -89,7 +89,7 @@ static void image_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { xine_buffer_copyin(this->image, this->index, buf->mem, buf->size); this->index += buf->size; - + if (buf->decoder_flags & BUF_FLAG_FRAME_END) { int width, height, i; int status; @@ -143,8 +143,8 @@ static void image_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { * alloc and draw video frame */ img = this->stream->video_out->get_frame (this->stream->video_out, width, - height, (double)width/(double)height, - XINE_IMGFMT_YUY2, + height, (double)width/(double)height, + XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); img->pts = buf->pts; img->duration = 3600; @@ -152,9 +152,9 @@ static void image_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { yuv444_to_yuy2(&yuv_planes, img->base[0], img->pitches[0]); free_yuv_planes(&yuv_planes); - + _x_stream_info_set(this->stream, XINE_STREAM_INFO_FRAME_DURATION, img->duration); - + img->draw(img, this->stream); img->free(img); } @@ -163,7 +163,7 @@ static void image_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { static void image_flush (video_decoder_t *this_gen) { /* image_decoder_t *this = (image_decoder_t *) this_gen; */ - + /* * flush out any frames that are still stored in the decoder */ @@ -172,19 +172,19 @@ static void image_flush (video_decoder_t *this_gen) { static void image_reset (video_decoder_t *this_gen) { image_decoder_t *this = (image_decoder_t *) this_gen; - + /* * reset decoder after engine flush (prepare for new * video data not related to recently decoded data) */ - + this->index = 0; } static void image_discontinuity (video_decoder_t *this_gen) { /* image_decoder_t *this = (image_decoder_t *) this_gen; */ - + /* * a time reference discontinuity has happened. * that is, it must forget any currently held pts value @@ -208,7 +208,7 @@ static void image_dispose (video_decoder_t *this_gen) { } -static video_decoder_t *open_plugin (video_decoder_class_t *class_gen, +static video_decoder_t *open_plugin (video_decoder_class_t *class_gen, xine_stream_t *stream) { image_class_t *cls = (image_class_t *) class_gen; @@ -251,7 +251,7 @@ static void dispose_class (video_decoder_class_t *this_gen) { image_class_t *this = (image_class_t *) this_gen; lprintf("class closed\n"); - + free (this); } @@ -271,7 +271,7 @@ static void *init_class (xine_t *xine, void *data) { */ lprintf("class opened\n"); - + return this; } @@ -288,7 +288,7 @@ static const decoder_info_t dec_info_image = { }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_VIDEO_DECODER, 18, "image", XINE_VERSION_CODE, &dec_info_image, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libxinevdec/rgb.c b/src/libxinevdec/rgb.c index fc206a0ce..9e28afd90 100644 --- a/src/libxinevdec/rgb.c +++ b/src/libxinevdec/rgb.c @@ -27,7 +27,7 @@ * file can be 32-, 24-, 16-, 8-, 4-, 2-, or 1-bit. Any resolutions <= 8 * can also be greyscale depending on what the QT file specifies. * - * One more catch: Raw RGB from a Microsoft file is upside down. This is + * One more catch: Raw RGB from a Microsoft file is upside down. This is * indicated by a negative height parameter. */ @@ -80,7 +80,7 @@ typedef struct rgb_decoder_s { unsigned char yuv_palette[256 * 4]; yuv_planes_t yuv_planes; - + } rgb_decoder_t; static void rgb_decode_data (video_decoder_t *this_gen, @@ -121,7 +121,7 @@ static void rgb_decode_data (video_decoder_t *this_gen, this->video_step = buf->decoder_info[0]; _x_stream_info_set(this->stream, XINE_STREAM_INFO_FRAME_DURATION, this->video_step); } - + if (buf->decoder_flags & BUF_FLAG_STDHEADER) { /* need to initialize */ (this->stream->video_out->open) (this->stream->video_out, this->stream); @@ -195,11 +195,11 @@ static void rgb_decode_data (video_decoder_t *this_gen, palette_index = this->buf[buf_ptr++]; - this->yuv_planes.y[row_ptr + pixel_ptr] = + this->yuv_planes.y[row_ptr + pixel_ptr] = this->yuv_palette[palette_index * 4 + 0]; - this->yuv_planes.u[row_ptr + pixel_ptr] = + this->yuv_planes.u[row_ptr + pixel_ptr] = this->yuv_palette[palette_index * 4 + 1]; - this->yuv_planes.v[row_ptr + pixel_ptr] = + this->yuv_planes.v[row_ptr + pixel_ptr] = this->yuv_palette[palette_index * 4 + 2]; } else if (this->bytes_per_pixel == 2) { @@ -209,11 +209,11 @@ static void rgb_decode_data (video_decoder_t *this_gen, buf_ptr += 2; UNPACK_BGR15(packed_pixel, r, g, b); - this->yuv_planes.y[row_ptr + pixel_ptr] = + this->yuv_planes.y[row_ptr + pixel_ptr] = COMPUTE_Y(r, g, b); - this->yuv_planes.u[row_ptr + pixel_ptr] = + this->yuv_planes.u[row_ptr + pixel_ptr] = COMPUTE_U(r, g, b); - this->yuv_planes.v[row_ptr + pixel_ptr] = + this->yuv_planes.v[row_ptr + pixel_ptr] = COMPUTE_V(r, g, b); } else { @@ -226,11 +226,11 @@ static void rgb_decode_data (video_decoder_t *this_gen, /* the next line takes care of 'A' in the 32-bit case */ buf_ptr += this->bytes_per_pixel - 3; - this->yuv_planes.y[row_ptr + pixel_ptr] = + this->yuv_planes.y[row_ptr + pixel_ptr] = COMPUTE_Y(r, g, b); - this->yuv_planes.u[row_ptr + pixel_ptr] = + this->yuv_planes.u[row_ptr + pixel_ptr] = COMPUTE_U(r, g, b); - this->yuv_planes.v[row_ptr + pixel_ptr] = + this->yuv_planes.v[row_ptr + pixel_ptr] = COMPUTE_V(r, g, b); } @@ -250,18 +250,18 @@ static void rgb_decode_data (video_decoder_t *this_gen, } if (pixel_byte & 0x80) { - this->yuv_planes.y[row_ptr + pixel_ptr] = + this->yuv_planes.y[row_ptr + pixel_ptr] = this->yuv_palette[1 * 4 + 0]; - this->yuv_planes.u[row_ptr + pixel_ptr] = + this->yuv_planes.u[row_ptr + pixel_ptr] = this->yuv_palette[1 * 4 + 1]; - this->yuv_planes.v[row_ptr + pixel_ptr] = + this->yuv_planes.v[row_ptr + pixel_ptr] = this->yuv_palette[1 * 4 + 2]; } else { - this->yuv_planes.y[row_ptr + pixel_ptr] = + this->yuv_planes.y[row_ptr + pixel_ptr] = this->yuv_palette[0 * 4 + 0]; - this->yuv_planes.u[row_ptr + pixel_ptr] = + this->yuv_planes.u[row_ptr + pixel_ptr] = this->yuv_palette[0 * 4 + 1]; - this->yuv_planes.v[row_ptr + pixel_ptr] = + this->yuv_planes.v[row_ptr + pixel_ptr] = this->yuv_palette[0 * 4 + 2]; } pixels_left--; @@ -275,11 +275,11 @@ static void rgb_decode_data (video_decoder_t *this_gen, } palette_index = (pixel_byte & 0xC0) >> 6; - this->yuv_planes.y[row_ptr + pixel_ptr] = + this->yuv_planes.y[row_ptr + pixel_ptr] = this->yuv_palette[palette_index * 4 + 0]; - this->yuv_planes.u[row_ptr + pixel_ptr] = + this->yuv_planes.u[row_ptr + pixel_ptr] = this->yuv_palette[palette_index * 4 + 1]; - this->yuv_planes.v[row_ptr + pixel_ptr] = + this->yuv_planes.v[row_ptr + pixel_ptr] = this->yuv_palette[palette_index * 4 + 2]; pixels_left--; @@ -293,11 +293,11 @@ static void rgb_decode_data (video_decoder_t *this_gen, } palette_index = (pixel_byte & 0xF0) >> 4; - this->yuv_planes.y[row_ptr + pixel_ptr] = + this->yuv_planes.y[row_ptr + pixel_ptr] = this->yuv_palette[palette_index * 4 + 0]; - this->yuv_planes.u[row_ptr + pixel_ptr] = + this->yuv_planes.u[row_ptr + pixel_ptr] = this->yuv_palette[palette_index * 4 + 1]; - this->yuv_planes.v[row_ptr + pixel_ptr] = + this->yuv_planes.v[row_ptr + pixel_ptr] = this->yuv_palette[palette_index * 4 + 2]; pixels_left--; @@ -307,11 +307,11 @@ static void rgb_decode_data (video_decoder_t *this_gen, palette_index = this->buf[buf_ptr++]; - this->yuv_planes.y[row_ptr + pixel_ptr] = + this->yuv_planes.y[row_ptr + pixel_ptr] = this->yuv_palette[palette_index * 4 + 0]; - this->yuv_planes.u[row_ptr + pixel_ptr] = + this->yuv_planes.u[row_ptr + pixel_ptr] = this->yuv_palette[palette_index * 4 + 1]; - this->yuv_planes.v[row_ptr + pixel_ptr] = + this->yuv_planes.v[row_ptr + pixel_ptr] = this->yuv_palette[palette_index * 4 + 2]; } else if (this->bytes_per_pixel == 2) { @@ -321,16 +321,16 @@ static void rgb_decode_data (video_decoder_t *this_gen, buf_ptr += 2; UNPACK_RGB15(packed_pixel, r, g, b); - this->yuv_planes.y[row_ptr + pixel_ptr] = + this->yuv_planes.y[row_ptr + pixel_ptr] = COMPUTE_Y(r, g, b); - this->yuv_planes.u[row_ptr + pixel_ptr] = + this->yuv_planes.u[row_ptr + pixel_ptr] = COMPUTE_U(r, g, b); - this->yuv_planes.v[row_ptr + pixel_ptr] = + this->yuv_planes.v[row_ptr + pixel_ptr] = COMPUTE_V(r, g, b); } else { - /* RGB24 or ARGB32; the next line takes care of 'A' in the + /* RGB24 or ARGB32; the next line takes care of 'A' in the * 32-bit case */ buf_ptr += this->bytes_per_pixel - 3; @@ -338,11 +338,11 @@ static void rgb_decode_data (video_decoder_t *this_gen, g = this->buf[buf_ptr++]; b = this->buf[buf_ptr++]; - this->yuv_planes.y[row_ptr + pixel_ptr] = + this->yuv_planes.y[row_ptr + pixel_ptr] = COMPUTE_Y(r, g, b); - this->yuv_planes.u[row_ptr + pixel_ptr] = + this->yuv_planes.u[row_ptr + pixel_ptr] = COMPUTE_U(r, g, b); - this->yuv_planes.v[row_ptr + pixel_ptr] = + this->yuv_planes.v[row_ptr + pixel_ptr] = COMPUTE_V(r, g, b); } @@ -450,7 +450,7 @@ static void *init_plugin (xine_t *xine, void *data) { * exported plugin catalog entry */ -static const uint32_t video_types[] = { +static const uint32_t video_types[] = { BUF_VIDEO_RGB, 0 }; @@ -461,7 +461,7 @@ static const decoder_info_t dec_info_video = { }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_VIDEO_DECODER, 18, "rgb", XINE_VERSION_CODE, &dec_info_video, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libxinevdec/xine_theora_decoder.c b/src/libxinevdec/xine_theora_decoder.c index d15625812..bf51a8779 100644 --- a/src/libxinevdec/xine_theora_decoder.c +++ b/src/libxinevdec/xine_theora_decoder.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2001-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -101,17 +101,17 @@ static void yuv2frame(yuv_buffer *yuv, vo_frame_t *frame, int offset_x, int offs crop_offset=offset_x+yuv->y_stride*offset_y; for(i=0;i<frame->height;i++) - xine_fast_memcpy(frame->base[0]+frame->pitches[0]*i, - yuv->y+crop_offset+yuv->y_stride*i, + xine_fast_memcpy(frame->base[0]+frame->pitches[0]*i, + yuv->y+crop_offset+yuv->y_stride*i, frame->width); crop_offset=(offset_x/2)+(yuv->uv_stride)*(offset_y/2); for(i=0;i<frame->height/2;i++){ - xine_fast_memcpy(frame->base[1]+frame->pitches[1]*i, - yuv->u+crop_offset+yuv->uv_stride*i, + xine_fast_memcpy(frame->base[1]+frame->pitches[1]*i, + yuv->u+crop_offset+yuv->uv_stride*i, frame->width/2); - xine_fast_memcpy(frame->base[2]+frame->pitches[2]*i, - yuv->v+crop_offset+yuv->uv_stride*i, + xine_fast_memcpy(frame->base[2]+frame->pitches[2]*i, + yuv->v+crop_offset+yuv->uv_stride*i, frame->width/2); } @@ -123,7 +123,7 @@ static int collect_data (theora_decoder_t *this, buf_element_t *buf ) { if (buf->decoder_flags & BUF_FLAG_FRAME_START) { this->done=0; /*start from the beginnig*/ - this->reject=0;/*new packet - new try*/ + this->reject=0;/*new packet - new try*/ /*copy the ogg_packet struct and the sum, correct the adress of the packet*/ xine_fast_memcpy (&this->op, buf->content, sizeof(ogg_packet)); @@ -142,7 +142,7 @@ static int collect_data (theora_decoder_t *this, buf_element_t *buf ) { } readin_op (this, buf->content, buf->size ); } - + if ((buf->decoder_flags & BUF_FLAG_FRAME_END) && !this->reject) { if ( this->done != this->op.bytes ) { printf ("libtheora: A packet changed its size during transfer - rejected\n"); @@ -156,8 +156,8 @@ static int collect_data (theora_decoder_t *this, buf_element_t *buf ) { static void theora_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { /* - * decode data from buf and feed decoded frames to - * video output + * decode data from buf and feed decoded frames to + * video output */ theora_decoder_t *this = (theora_decoder_t *) this_gen; vo_frame_t *frame; @@ -195,7 +195,7 @@ static void theora_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { } /*headers are now decoded. initialize the decoder*/ theora_decode_init (&this->t_state, &this->t_info); - + lprintf("theora stream is Theora %dx%d %.02f fps video.\n" " frame content is %dx%d with offset (%d,%d).\n" " pixel aspect is %d:%d.\n", @@ -353,7 +353,7 @@ static char *theora_get_identifier (video_decoder_class_t *this) { static char *theora_get_description (video_decoder_class_t *this) { /* - * return human readable (verbose = 1 line) description for + * return human readable (verbose = 1 line) description for * this plugin class */ return "theora video decoder plugin"; @@ -369,7 +369,7 @@ static void theora_dispose_class (video_decoder_class_t *this) { static void *init_plugin (xine_t *xine, void *data) { /*initialize our plugin*/ theora_class_t *this; - + this = (theora_class_t *) calloc(1, sizeof(theora_class_t)); this->decoder_class.open_plugin = theora_open_plugin; @@ -392,7 +392,7 @@ static const decoder_info_t dec_info_video = { }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_VIDEO_DECODER, 18, "theora", XINE_VERSION_CODE, &dec_info_video, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libxinevdec/yuv.c b/src/libxinevdec/yuv.c index b1a69cd65..6cb1b240c 100644 --- a/src/libxinevdec/yuv.c +++ b/src/libxinevdec/yuv.c @@ -62,7 +62,7 @@ typedef struct yuv_decoder_s { int width; /* the width of a video frame */ int height; /* the height of a video frame */ double ratio; /* the width to height ratio */ - + int progressive; int top_field_first; @@ -104,10 +104,10 @@ static void yuv_decode_data (video_decoder_t *this_gen, this->ratio = (double)buf->decoder_info[1] / (double)buf->decoder_info[2]; else this->ratio = (double)this->width / (double)this->height; - + this->progressive = buf->decoder_info[3]; this->top_field_first = buf->decoder_info[4]; - + if (this->buf) { free (this->buf); this->buf = NULL; @@ -125,7 +125,7 @@ static void yuv_decode_data (video_decoder_t *this_gen, case BUF_VIDEO_YUY2: _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, "Raw YUY2"); break; - + case BUF_VIDEO_YV12: _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, "Raw YV12"); break; @@ -137,13 +137,13 @@ static void yuv_decode_data (video_decoder_t *this_gen, case BUF_VIDEO_GREY: _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, "Greyscale YUV"); break; - + case BUF_VIDEO_I420: _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, "Raw I420"); break; } - + _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_WIDTH, this->width); _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_HEIGHT, this->height); _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_RATIO, this->ratio*10000); @@ -166,14 +166,14 @@ static void yuv_decode_data (video_decoder_t *this_gen, xine_fast_memcpy (&this->buf[this->size], buf->content, buf->size); this->size += buf->size; - + src = this->buf; } if (buf->decoder_flags & BUF_FLAG_FRAME_END) { if (buf->type == BUF_VIDEO_YUY2) { - + img = this->stream->video_out->get_frame (this->stream->video_out, this->width, this->height, this->ratio, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); @@ -184,14 +184,14 @@ static void yuv_decode_data (video_decoder_t *this_gen, /* dst */ img->base[0], img->pitches[0], /* width x height */ - this->width, this->height); - + this->width, this->height); + } else if (buf->type == BUF_VIDEO_YV12) { img = this->stream->video_out->get_frame (this->stream->video_out, this->width, this->height, this->ratio, XINE_IMGFMT_YV12, VO_BOTH_FIELDS); - + yv12_to_yv12( /* Y */ src, this->width, @@ -206,7 +206,7 @@ static void yuv_decode_data (video_decoder_t *this_gen, this->width, this->height); } else if (buf->type == BUF_VIDEO_I420) { - + img = this->stream->video_out->get_frame (this->stream->video_out, this->width, this->height, this->ratio, XINE_IMGFMT_YV12, VO_BOTH_FIELDS); @@ -233,17 +233,17 @@ static void yuv_decode_data (video_decoder_t *this_gen, yuv9_to_yv12( /* Y */ - src, + src, this->width, - img->base[0], + img->base[0], img->pitches[0], /* U */ - src + (this->width * this->height), + src + (this->width * this->height), this->width / 4, img->base[1], img->pitches[1], /* V */ - src + (this->width * this->height) + + src + (this->width * this->height) + (this->width * this->height / 16), this->width / 4, img->base[2], @@ -373,8 +373,8 @@ static void *init_plugin (xine_t *xine, void *data) { * exported plugin catalog entry */ -static const uint32_t video_types[] = { - BUF_VIDEO_YUY2, +static const uint32_t video_types[] = { + BUF_VIDEO_YUY2, BUF_VIDEO_YV12, BUF_VIDEO_YVU9, BUF_VIDEO_GREY, @@ -388,7 +388,7 @@ static const decoder_info_t dec_info_video = { }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_VIDEO_DECODER, 18, "yuv", XINE_VERSION_CODE, &dec_info_video, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/post/audio/audio_filters.c b/src/post/audio/audio_filters.c index 12d48784c..eb90d38cb 100644 --- a/src/post/audio/audio_filters.c +++ b/src/post/audio/audio_filters.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -38,7 +38,7 @@ static const post_info_t volnorm_special_info = { XINE_POST_TYPE_AUDIO_FILTER const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_POST, 9, "upmix", XINE_VERSION_CODE, &upmix_special_info, &upmix_init_plugin }, { PLUGIN_POST, 9, "upmix_mono", XINE_VERSION_CODE, &upmix_mono_special_info, &upmix_mono_init_plugin }, { PLUGIN_POST, 9, "stretch", XINE_VERSION_CODE, &stretch_special_info, &stretch_init_plugin }, diff --git a/src/post/audio/audio_filters.h b/src/post/audio/audio_filters.h index 6c064945a..c2bf88cf8 100644 --- a/src/post/audio/audio_filters.h +++ b/src/post/audio/audio_filters.h @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA diff --git a/src/post/audio/dsp.h b/src/post/audio/dsp.h index 237640283..8dabe4f36 100644 --- a/src/post/audio/dsp.h +++ b/src/post/audio/dsp.h @@ -1,5 +1,5 @@ /*============================================================================= - * + * * This software has been released under the terms of the GNU Public * license. See http://www.gnu.org/copyleft/gpl.html for details. * @@ -9,7 +9,7 @@ */ #ifndef _DSP_H -#define _DSP_H 1 +#define _DSP_H 1 /* Implementation of routines used for DSP */ diff --git a/src/post/audio/filter.c b/src/post/audio/filter.c index 55d75e1e4..f41d880fc 100644 --- a/src/post/audio/filter.c +++ b/src/post/audio/filter.c @@ -1,5 +1,5 @@ /*============================================================================= - * + * * This software has been released under the terms of the GNU Public * license. See http://www.gnu.org/copyleft/gpl.html for details. * @@ -25,12 +25,12 @@ * * n number of filter taps, where mod(n,4)==0 * w filter taps - * x input signal must be a circular buffer which is indexed backwards + * x input signal must be a circular buffer which is indexed backwards */ inline _ftype_t fir(register unsigned int n, _ftype_t* w, _ftype_t* x) { register _ftype_t y; /* Output */ - y = 0.0; + y = 0.0; do{ n--; y+=w[n]*x[n]; @@ -44,7 +44,7 @@ inline _ftype_t fir(register unsigned int n, _ftype_t* w, _ftype_t* x) * d number of filters * xi current index in xq * w filter taps k by n big - * x input signal must be a circular buffers which are indexed backwards + * x input signal must be a circular buffers which are indexed backwards * y output buffer * s output buffer stride */ @@ -67,11 +67,11 @@ inline _ftype_t* pfir(unsigned int n, unsigned int d, unsigned int xi, _ftype_t* at the new samples, xi current index in xq and n the length of the filter. xq must be n*2 by k big, s is the index for in. */ -inline int updatepq(unsigned int n, unsigned int d, unsigned int xi, _ftype_t** xq, _ftype_t* in, unsigned int s) +inline int updatepq(unsigned int n, unsigned int d, unsigned int xi, _ftype_t** xq, _ftype_t* in, unsigned int s) { register _ftype_t* txq = *xq + xi; register int nt = n*2; - + while(d-- >0){ *txq= *(txq+n) = *in; txq+=nt; @@ -88,26 +88,26 @@ inline int updatepq(unsigned int n, unsigned int d, unsigned int xi, _ftype_t** n filter length must be odd for HP and BS filters w buffer for the filter taps (must be n long) - fc cutoff frequencies (1 for LP and HP, 2 for BP and BS) + fc cutoff frequencies (1 for LP and HP, 2 for BP and BS) 0 < fc < 1 where 1 <=> Fs/2 flags window and filter type as defined in filter.h - variables are ored together: i.e. LP|HAMMING will give a - low pass filter designed using a hamming window + variables are ored together: i.e. LP|HAMMING will give a + low pass filter designed using a hamming window opt beta constant used only when designing using kaiser windows - + returns 0 if OK, -1 if fail */ int design_fir(unsigned int n, _ftype_t* w, _ftype_t* fc, unsigned int flags, _ftype_t opt) { - unsigned int o = n & 1; /* Indicator for odd filter length */ + unsigned int o = n & 1; /* Indicator for odd filter length */ unsigned int end = ((n + 1) >> 1) - o; /* Loop end */ unsigned int i; /* Loop index */ _ftype_t k1 = 2 * M_PI; /* 2*pi*fc1 */ _ftype_t k2 = 0.5 * (_ftype_t)(1 - o);/* Constant used if the filter has even length */ _ftype_t k3; /* 2*pi*fc2 Constant used in BP and BS design */ - _ftype_t g = 0.0; /* Gain */ - _ftype_t t1,t2,t3; /* Temporary variables */ + _ftype_t g = 0.0; /* Gain */ + _ftype_t t1,t2,t3; /* Temporary variables */ _ftype_t fc1,fc2; /* Cutoff frequencies */ /* Sanity check */ @@ -130,10 +130,10 @@ int design_fir(unsigned int n, _ftype_t* w, _ftype_t* fc, unsigned int flags, _f case(KAISER): kaiser(n,w,opt); break; default: - return -1; + return -1; } - if(flags & (LP | HP)){ + if(flags & (LP | HP)){ fc1=*fc; /* Cutoff frequency must be < 0.5 where 0.5 <=> Fs/2 */ fc1 = ((fc1 <= 1.0) && (fc1 > 0.0)) ? fc1/2 : 0.25; @@ -143,7 +143,7 @@ int design_fir(unsigned int n, _ftype_t* w, _ftype_t* fc, unsigned int flags, _f /* * If the filter length is odd, there is one point which is exactly - * in the middle. The value at this point is 2*fCutoff*sin(x)/x, + * in the middle. The value at this point is 2*fCutoff*sin(x)/x, * where x is zero. To make sure nothing strange happens, we set this * value separately. */ @@ -196,9 +196,9 @@ int design_fir(unsigned int n, _ftype_t* w, _ftype_t* fc, unsigned int flags, _f t2 = sin(k3 * t1)/(M_PI * t1); /* Sinc fc2 */ t3 = sin(k1 * t1)/(M_PI * t1); /* Sinc fc1 */ g += w[end-i-1] * (t3 + t2); /* Total gain in filter */ - w[end-i-1] = w[n-end+i] = w[end-i-1] * (t2 - t3); + w[end-i-1] = w[n-end+i] = w[end-i-1] * (t2 - t3); } - } + } else{ /* Band stop */ if (!o) /* Band stop filters must have odd length */ return -1; @@ -210,7 +210,7 @@ int design_fir(unsigned int n, _ftype_t* w, _ftype_t* fc, unsigned int flags, _f t1 = (_ftype_t)(i+1); t2 = sin(k1 * t1)/(M_PI * t1); /* Sinc fc1 */ t3 = sin(k3 * t1)/(M_PI * t1); /* Sinc fc2 */ - w[end-i-1] = w[n-end+i] = w[end-i-1] * (t2 - t3); + w[end-i-1] = w[n-end+i] = w[end-i-1] * (t2 - t3); g += 2*w[end-i-1]; /* Total gain in filter */ } } @@ -218,9 +218,9 @@ int design_fir(unsigned int n, _ftype_t* w, _ftype_t* fc, unsigned int flags, _f /* Normalize gain */ g=1/g; - for (i=0; i<n; i++) + for (i=0; i<n; i++) w[i] *= g; - + return 0; } @@ -229,7 +229,7 @@ int design_fir(unsigned int n, _ftype_t* w, _ftype_t* fc, unsigned int flags, _f * n length of prototype filter * k number of polyphase components * w prototype filter taps - * pw Parallel FIR filter + * pw Parallel FIR filter * g Filter gain * flags FWD forward indexing * REW reverse indexing @@ -240,10 +240,10 @@ int design_fir(unsigned int n, _ftype_t* w, _ftype_t* fc, unsigned int flags, _f int design_pfir(unsigned int n, unsigned int k, _ftype_t* w, _ftype_t** pw, _ftype_t g, unsigned int flags) { int l = (int)n/k; /* Length of individual FIR filters */ - int i; /* Counters */ + int i; /* Counters */ int j; _ftype_t t; /* g * w[i] */ - + /* Sanity check */ if(l<1 || k<1 || !w || !pw) return -1; @@ -276,7 +276,7 @@ int design_pfir(unsigned int n, unsigned int k, _ftype_t* w, _ftype_t** pw, _fty /* Pre-warp the coefficients of a numerator or denominator. * Note that a0 is assumed to be 1, so there is no wrapping - * of it. + * of it. */ void prewarp(_ftype_t* a, _ftype_t fc, _ftype_t fs) { @@ -303,12 +303,12 @@ void prewarp(_ftype_t* a, _ftype_t fc, _ftype_t fs) * Arguments: * a - s-domain numerator coefficients * b - s-domain denominator coefficients - * k - filter gain factor. Initially set to 1 and modified by each + * k - filter gain factor. Initially set to 1 and modified by each * biquad section in such a way, as to make it the * coefficient by which to multiply the overall filter gain * in order to achieve a desired overall filter gain, - * specified in initial value of k. - * fs - sampling rate (Hz) + * specified in initial value of k. + * fs - sampling rate (Hz) * coef - array of z-domain coefficients to be filled in. * * Return: On return, set coef z-domain coefficients and k to the gain @@ -342,7 +342,7 @@ void bilinear(_ftype_t* a, _ftype_t* b, _ftype_t* k, _ftype_t fs, _ftype_t *coef * create a filter fill in a, b, Q and fs and make space for coef and k. * * - * Example Butterworth design: + * Example Butterworth design: * * Below are Butterworth polynomials, arranged as a series of 2nd * order sections: @@ -398,12 +398,12 @@ void bilinear(_ftype_t* a, _ftype_t* b, _ftype_t* k, _ftype_t fs, _ftype_t *coef * a - s-domain numerator coefficients, a[1] is always assumed to be 1.0 * b - s-domain denominator coefficients * Q - Q value for the filter - * k - filter gain factor. Initially set to 1 and modified by each + * k - filter gain factor. Initially set to 1 and modified by each * biquad section in such a way, as to make it the * coefficient by which to multiply the overall filter gain * in order to achieve a desired overall filter gain, - * specified in initial value of k. - * fs - sampling rate (Hz) + * specified in initial value of k. + * fs - sampling rate (Hz) * coef - array of z-domain coefficients to be filled in. * * Note: Upon return from each call, the k argument will be set to a @@ -419,7 +419,7 @@ int szxform(const _ftype_t* a, const _ftype_t* b, _ftype_t Q, _ftype_t fc, _ftyp _ftype_t at[3]; _ftype_t bt[3]; - if(!a || !b || !k || !coef || (Q>1000.0 || Q< 1.0)) + if(!a || !b || !k || !coef || (Q>1000.0 || Q< 1.0)) return -1; memcpy(at,a,3*sizeof(_ftype_t)); diff --git a/src/post/audio/filter.h b/src/post/audio/filter.h index 0e08aa2b9..4d756a618 100644 --- a/src/post/audio/filter.h +++ b/src/post/audio/filter.h @@ -1,5 +1,5 @@ /*============================================================================= - * + * * This software has been released under the terms of the GNU Public * license. See http://www.gnu.org/copyleft/gpl.html for details. * @@ -37,7 +37,7 @@ #define WINDOW_MASK 0x0000001F /* Parallel filter design */ -#define FWD 0x00000001 /* Forward indexing of polyphase filter */ +#define FWD 0x00000001 /* Forward indexing of polyphase filter */ #define REW 0x00000002 /* Reverse indexing of polyphase filter */ #define ODD 0x00000010 /* Make filter HP */ @@ -60,7 +60,7 @@ extern int szxform(const _ftype_t* a, const _ftype_t* b, _ftype_t Q, _ftype_t fc /* Add new data to circular queue designed to be used with a FIR * filter. xq is the circular queue, in pointing at the new sample, xi * current index for xq and n the length of the filter. xq must be n*2 - * long. + * long. */ #define updateq(n,xi,xq,in)\ xq[xi]=(xq)[(xi)+(n)]=*(in);\ diff --git a/src/post/audio/stretch.c b/src/post/audio/stretch.c index d4621a800..154202da4 100644 --- a/src/post/audio/stretch.c +++ b/src/post/audio/stretch.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -70,19 +70,19 @@ static void stretchscr_set_pivot (stretchscr_t *this) { struct timeval tv; int64_t pts; - double pts_calc; + double pts_calc; xine_monotonic_clock(&tv, NULL); pts_calc = (tv.tv_sec - this->cur_time.tv_sec) * this->speed_factor; pts_calc += (tv.tv_usec - this->cur_time.tv_usec) * this->speed_factor / 1e6; pts = this->cur_pts + pts_calc; -/* This next part introduces a one off inaccuracy - * to the scr due to rounding tv to pts. +/* This next part introduces a one off inaccuracy + * to the scr due to rounding tv to pts. */ this->cur_time.tv_sec=tv.tv_sec; this->cur_time.tv_usec=tv.tv_usec; - this->cur_pts=pts; + this->cur_pts=pts; return ; } @@ -94,7 +94,7 @@ static int stretchscr_set_speed (scr_plugin_t *scr, int speed) { stretchscr_set_pivot( this ); this->xine_speed = speed; - this->speed_factor = (double) speed * 90000.0 / XINE_FINE_SPEED_NORMAL / + this->speed_factor = (double) speed * 90000.0 / XINE_FINE_SPEED_NORMAL / (*this->stretch_factor); pthread_mutex_unlock (&this->lock); @@ -125,7 +125,7 @@ static void stretchscr_start (scr_plugin_t *scr, int64_t start_vpts) { this->cur_pts = start_vpts; pthread_mutex_unlock (&this->lock); - + stretchscr_set_speed (&this->scr, XINE_FINE_SPEED_NORMAL); } @@ -134,16 +134,16 @@ static int64_t stretchscr_get_current (scr_plugin_t *scr) { struct timeval tv; int64_t pts; - double pts_calc; + double pts_calc; pthread_mutex_lock (&this->lock); xine_monotonic_clock(&tv, NULL); - + pts_calc = (tv.tv_sec - this->cur_time.tv_sec) * this->speed_factor; pts_calc += (tv.tv_usec - this->cur_time.tv_usec) * this->speed_factor / 1e6; pts = this->cur_pts + pts_calc; - + pthread_mutex_unlock (&this->lock); return pts; @@ -168,9 +168,9 @@ static stretchscr_t *XINE_MALLOC stretchscr_init (double *stretch_factor) { this->scr.start = stretchscr_start; this->scr.get_current = stretchscr_get_current; this->scr.exit = stretchscr_exit; - + pthread_mutex_init (&this->lock, NULL); - + this->stretch_factor = stretch_factor; stretchscr_set_speed (&this->scr, XINE_SPEED_PAUSE); @@ -202,21 +202,21 @@ typedef struct stretch_parameters_s { START_PARAM_DESCR( stretch_parameters_t ) PARAM_ITEM( POST_PARAM_TYPE_BOOL, preserve_pitch, NULL, 0, 1, 0, "Preserve pitch" ) -PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, factor, NULL, 0.5, 1.5, 0, +PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, factor, NULL, 0.5, 1.5, 0, "Time stretch factor (<1.0 shorten duration)" ) END_PARAM_DESCR( param_descr ) /* plugin structure */ struct post_plugin_stretch_s { post_plugin_t post; - + stretchscr_t* scr; /* private data */ stretch_parameters_t params; xine_post_in_t params_input; int params_changed; - + int channels; int bytes_per_frame; @@ -228,9 +228,9 @@ struct post_plugin_stretch_s { int num_frames; /* current # of frames on audiofrag */ int16_t last_sample[RESAMPLE_MAX_CHANNELS]; - + int64_t pts; /* pts for audiofrag */ - + pthread_mutex_t lock; }; @@ -290,16 +290,16 @@ static int stretch_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream, post_audio_port_t *port = (post_audio_port_t *)port_gen; post_plugin_stretch_t *this = (post_plugin_stretch_t *)port->post; int64_t time; - + _x_post_rewire(&this->post); _x_post_inc_usage(port); - + port->stream = stream; port->bits = bits; port->rate = rate; port->mode = mode; - - /* register our own scr provider */ + + /* register our own scr provider */ time = port->stream->xine->clock->get_current_time(port->stream->xine->clock); this->scr = stretchscr_init(&this->params.factor); this->scr->scr.start(&this->scr->scr, time); @@ -307,7 +307,7 @@ static int stretch_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream, /* force updating on stretch_port_put_buffer */ this->params_changed = 1; - + return (port->original_port->open) (port->original_port, stream, bits, rate, mode); } @@ -320,34 +320,34 @@ static void stretch_port_close(xine_audio_port_t *port_gen, xine_stream_t *strea port->stream->xine->clock->unregister_scr(port->stream->xine->clock, &this->scr->scr); this->scr->scr.exit(&this->scr->scr); } - + if(this->audiofrag) { free(this->audiofrag); this->audiofrag = NULL; } - + if(this->outfrag) { free(this->outfrag); this->outfrag = NULL; } - + if(this->w) { free(this->w); this->w = NULL; } - + port->stream = NULL; port->original_port->close(port->original_port, stream ); - + _x_post_dec_usage(port); } -static void stretch_process_fragment( post_audio_port_t *port, +static void stretch_process_fragment( post_audio_port_t *port, xine_stream_t *stream, extra_info_t *extra_info ) { post_plugin_stretch_t *this = (post_plugin_stretch_t *)port->post; - + audio_buffer_t *outbuf; int16_t *data_out = this->outfrag; int num_frames_in = this->num_frames; @@ -374,52 +374,52 @@ static void stretch_process_fragment( post_audio_port_t *port, * input chunk has two halves, A and B. * output chunk is composed as follow: * - some frames copied directly from A - * - some frames copied from A merged with frames from B + * - some frames copied from A merged with frames from B * weighted by an increasing factor (0 -> 1.0) * - frames from A weighted by a decreasing factor (1.0 -> 0) * merged with frames copied from B * - some frames copied directly from B */ - + int merge_frames = num_frames_in - num_frames_out; int copy_frames; int16_t *src = this->audiofrag; int16_t *dst = this->outfrag; int i, j; - + if( merge_frames > num_frames_out ) merge_frames = num_frames_out; copy_frames = num_frames_out - merge_frames; - + memcpy(dst, src, copy_frames/2 * this->bytes_per_frame); dst += copy_frames/2 * this->channels; src += copy_frames/2 * this->channels; - + for( i = 0; i < merge_frames/2; i++ ) { for( j = 0; j < this->channels; j++, src++, dst++ ) { - + int32_t s = (int32_t) ((_ftype_t) src[0] + src[merge_frames * this->channels] * this->w[i]); *dst = CLIP_INT16(s); } } - + for( ; i < merge_frames; i++ ) { for( j = 0; j < this->channels; j++, src++, dst++ ) { - + int32_t s = (int32_t) ((_ftype_t) src[0] * this->w[i] + src[merge_frames * this->channels]); *dst = CLIP_INT16(s); } } - + src += merge_frames * this->channels; - + memcpy(dst, src, (copy_frames - copy_frames/2) * this->bytes_per_frame); - + } else { /* * time expansion strategy @@ -427,13 +427,13 @@ static void stretch_process_fragment( post_audio_port_t *port, * output chunk is composed of two versions of the * input chunk: * - first part copied directly from input, and then - * merged with the second (delayed) part using a + * merged with the second (delayed) part using a * decreasing factor (1.0 -> 0) * - the delayed version of the input is merged with - * an increasing factor (0 -> 1.0) and then (when - * factor reaches 1.0) just copied until the end. + * an increasing factor (0 -> 1.0) and then (when + * factor reaches 1.0) just copied until the end. */ - + int merge_frames = num_frames_out - num_frames_in; int copy_frames = num_frames_out - merge_frames; int16_t *src1 = this->audiofrag; @@ -449,67 +449,67 @@ static void stretch_process_fragment( post_audio_port_t *port, for( i = 0; i < merge_frames/2; i++ ) { for( j = 0; j < this->channels; j++, src1++, src2++, dst++ ) { - + int32_t s = (int32_t) ((_ftype_t) *src1 + *src2 * this->w[i]); *dst = CLIP_INT16(s); } } - + for( ; i < merge_frames; i++ ) { for( j = 0; j < this->channels; j++, src1++, src2++, dst++ ) { - + int32_t s = (int32_t) ((_ftype_t) *src1 * this->w[i] + *src2); *dst = CLIP_INT16(s); } } - + memcpy(dst, src2, (copy_frames - copy_frames/2) * this->bytes_per_frame); } } - + /* copy processed fragment into multiple audio buffers, if needed */ while( num_frames_out ) { - outbuf = port->original_port->get_buffer(port->original_port); - + outbuf = port->original_port->get_buffer(port->original_port); + outbuf->num_frames = outbuf->mem_size / this->bytes_per_frame; if( outbuf->num_frames > num_frames_out ) outbuf->num_frames = num_frames_out; - - memcpy( outbuf->mem, data_out, + + memcpy( outbuf->mem, data_out, outbuf->num_frames * this->bytes_per_frame ); num_frames_out -= outbuf->num_frames; data_out = (uint16_t *)((uint8_t *)data_out + outbuf->num_frames * this->bytes_per_frame); - + outbuf->vpts = this->pts; this->pts = 0; outbuf->stream = stream; outbuf->format.bits = port->bits; outbuf->format.rate = port->rate; outbuf->format.mode = port->mode; - + _x_extra_info_merge( outbuf->extra_info, extra_info ); - - port->original_port->put_buffer(port->original_port, outbuf, stream ); + + port->original_port->put_buffer(port->original_port, outbuf, stream ); } - + this->num_frames = 0; } -static void stretch_port_put_buffer (xine_audio_port_t *port_gen, +static void stretch_port_put_buffer (xine_audio_port_t *port_gen, audio_buffer_t *buf, xine_stream_t *stream) { - + post_audio_port_t *port = (post_audio_port_t *)port_gen; post_plugin_stretch_t *this = (post_plugin_stretch_t *)port->post; int16_t *data_in; - + pthread_mutex_lock (&this->lock); - + if( this->params_changed ) { int64_t audio_step; @@ -517,40 +517,40 @@ static void stretch_port_put_buffer (xine_audio_port_t *port_gen, /* output whatever we have before changing parameters */ stretch_process_fragment( port, stream, buf->extra_info ); } - + this->channels = _x_ao_mode2channels(port->mode); this->bytes_per_frame = port->bits / 8 * this->channels; - + audio_step = ((int64_t)90000 * (int64_t)32768) / (int64_t)port->rate; audio_step = (int64_t) ((double)audio_step / this->params.factor); stream->metronom->set_audio_rate(stream->metronom, audio_step); stretchscr_set_speed(&this->scr->scr, this->scr->xine_speed); - + if(this->audiofrag) { free(this->audiofrag); this->audiofrag = NULL; } - + if(this->outfrag) { free(this->outfrag); this->outfrag = NULL; } - + if(this->w) { free(this->w); this->w = NULL; } - + this->frames_per_frag = port->rate * AUDIO_FRAGMENT; this->frames_per_outfrag = (int) ((double)this->params.factor * this->frames_per_frag); if( this->frames_per_frag != this->frames_per_outfrag ) { int wsize; - - this->audiofrag = malloc( this->frames_per_frag * this->bytes_per_frame ); - this->outfrag = malloc( this->frames_per_outfrag * this->bytes_per_frame ); - + + this->audiofrag = malloc( this->frames_per_frag * this->bytes_per_frame ); + this->outfrag = malloc( this->frames_per_outfrag * this->bytes_per_frame ); + if( this->frames_per_frag > this->frames_per_outfrag ) wsize = this->frames_per_frag - this->frames_per_outfrag; else @@ -559,41 +559,41 @@ static void stretch_port_put_buffer (xine_audio_port_t *port_gen, this->w = (_ftype_t*) malloc( wsize * sizeof(_ftype_t) ); triang(wsize, this->w); } - + this->num_frames = 0; this->pts = 0; - + this->params_changed = 0; } - + pthread_mutex_unlock (&this->lock); /* just pass data through if we have nothing to do */ if( this->frames_per_frag == this->frames_per_outfrag || /* FIXME: we only handle 1 or 2 channels, 16 bits for now */ - (this->channels != 1 && this->channels != 2) || + (this->channels != 1 && this->channels != 2) || port->bits != 16 ) { - - port->original_port->put_buffer(port->original_port, buf, stream ); - + + port->original_port->put_buffer(port->original_port, buf, stream ); + return; } - + /* update pts for our current audio fragment */ if( buf->vpts ) this->pts = buf->vpts - (this->num_frames * 90000 / port->rate); - + data_in = buf->mem; while( buf->num_frames ) { int frames_to_copy = this->frames_per_frag - this->num_frames; - + if( frames_to_copy > buf->num_frames ) frames_to_copy = buf->num_frames; /* copy up to one fragment from input buf to our buffer */ memcpy( (uint8_t *)this->audiofrag + this->num_frames * this->bytes_per_frame, data_in, frames_to_copy * this->bytes_per_frame ); - + data_in = (uint16_t *)((uint8_t *)data_in + frames_to_copy * this->bytes_per_frame); this->num_frames += frames_to_copy; buf->num_frames -= frames_to_copy; @@ -603,10 +603,10 @@ static void stretch_port_put_buffer (xine_audio_port_t *port_gen, stretch_process_fragment( port, stream, buf->extra_info ); } } - + buf->num_frames=0; /* UNDOCUMENTED, but hey, it works! Force old audio_out buffer free. */ - port->original_port->put_buffer(port->original_port, buf, stream ); - + port->original_port->put_buffer(port->original_port, buf, stream ); + return; } @@ -630,21 +630,21 @@ static post_plugin_t *stretch_open_plugin(post_class_t *class_gen, int inputs, xine_post_in_t *input_api; post_audio_port_t *port; stretch_parameters_t init_params; - + if (!this || !audio_target || !audio_target[0] ) { free(this); return NULL; } - + _x_post_init(&this->post, 1, 0); init_params.preserve_pitch = 1; init_params.factor = 0.80; - + pthread_mutex_init (&this->lock, NULL); set_parameters ((xine_post_t *)&this->post, &init_params); - + port = _x_post_intercept_audio_port(&this->post, audio_target[0], &input, &output); port->new_port.open = stretch_port_open; port->new_port.close = stretch_port_close; @@ -682,16 +682,16 @@ static void stretch_class_dispose(post_class_t *class_gen) void *stretch_init_plugin(xine_t *xine, void *data) { post_class_stretch_t *class = (post_class_stretch_t *)malloc(sizeof(post_class_stretch_t)); - + if (!class) return NULL; - + class->post_class.open_plugin = stretch_open_plugin; class->post_class.get_identifier = stretch_get_identifier; class->post_class.get_description = stretch_get_description; class->post_class.dispose = stretch_class_dispose; - + class->xine = xine; - + return class; } diff --git a/src/post/audio/upmix.c b/src/post/audio/upmix.c index e753f4a2a..9cf68b365 100644 --- a/src/post/audio/upmix.c +++ b/src/post/audio/upmix.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -167,13 +167,13 @@ static int upmix_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream, _x_post_rewire(&this->post); _x_post_inc_usage(port); - + port->stream = stream; port->bits = bits; port->rate = rate; port->mode = mode; capabilities = port->original_port->get_capabilities(port->original_port); - + this->channels = _x_ao_mode2channels(mode); /* FIXME: Handle all desired output formats */ if ((capabilities & AO_CAP_MODE_5_1CHANNEL) && (capabilities & AO_CAP_FLOAT32)) { @@ -232,7 +232,7 @@ static int upmix_frames_2to51_any_to_float( uint8_t *dst8, uint8_t *src8, int nu float right; float sum; int frame; - int src_units_per_sample=1; + int src_units_per_sample=1; if (step_channel_in == 3) src_units_per_sample=step_channel_in; /* Special handling for 24 bit 3byte input */ for (frame=0;frame < num_frames; frame++) { @@ -297,9 +297,9 @@ static int upmix_frames_2to51_any_to_float( uint8_t *dst8, uint8_t *src8, int nu return frame; } -static void upmix_port_put_buffer (xine_audio_port_t *port_gen, +static void upmix_port_put_buffer (xine_audio_port_t *port_gen, audio_buffer_t *buf, xine_stream_t *stream) { - + post_audio_port_t *port = (post_audio_port_t *)port_gen; post_plugin_upmix_t *this = (post_plugin_upmix_t *)port->post; int src_step_frame; @@ -315,7 +315,7 @@ static void upmix_port_put_buffer (xine_audio_port_t *port_gen, if ((this->channels==2) && (this->channels_out==6)) { while (num_frames_processed < buf->num_frames) { - this->buf = port->original_port->get_buffer(port->original_port); + this->buf = port->original_port->get_buffer(port->original_port); /* this->buf->num_frames is handled after the upmix */ this->buf->vpts = buf->vpts; if (num_frames_processed != 0) this->buf->vpts = 0; @@ -327,7 +327,7 @@ static void upmix_port_put_buffer (xine_audio_port_t *port_gen, this->buf->format.bits = 32; /* Upmix to floats */ this->buf->format.rate = port->rate; this->buf->format.mode = AO_CAP_MODE_5_1CHANNEL; - _x_extra_info_merge( this->buf->extra_info, buf->extra_info); + _x_extra_info_merge( this->buf->extra_info, buf->extra_info); step_channel_in = port->bits>>3; step_channel_out = this->buf->format.bits>>3; dst_step_frame = this->channels_out*step_channel_out; @@ -353,18 +353,18 @@ static void upmix_port_put_buffer (xine_audio_port_t *port_gen, } } pthread_mutex_unlock (&this->lock); - + num_frames_done = upmix_frames_2to51_any_to_float(data8dst, data8src, num_frames, step_channel_in, this->sub); this->buf->num_frames = num_frames_done; num_frames_processed+= num_frames_done; /* pass data to original port */ - port->original_port->put_buffer(port->original_port, this->buf, stream ); + port->original_port->put_buffer(port->original_port, this->buf, stream ); } /* free data from origial buffer */ buf->num_frames=0; /* UNDOCUMENTED, but hey, it works! Force old audio_out buffer free. */ } - port->original_port->put_buffer(port->original_port, buf, stream ); - + port->original_port->put_buffer(port->original_port, buf, stream ); + return; } @@ -388,16 +388,16 @@ static post_plugin_t *upmix_open_plugin(post_class_t *class_gen, int inputs, post_out_t *output; xine_post_in_t *input_api; post_audio_port_t *port; - + if (!this || !audio_target || !audio_target[0] ) { free(this); return NULL; } - + _x_post_init(&this->post, 1, 0); this->params.cut_off_freq = 100; - + port = _x_post_intercept_audio_port(&this->post, audio_target[0], &input, &output); port->new_port.open = upmix_port_open; #if 0 @@ -437,16 +437,16 @@ static void upmix_class_dispose(post_class_t *class_gen) void *upmix_init_plugin(xine_t *xine, void *data) { post_class_upmix_t *class = (post_class_upmix_t *)malloc(sizeof(post_class_upmix_t)); - + if (!class) return NULL; - + class->post_class.open_plugin = upmix_open_plugin; class->post_class.get_identifier = upmix_get_identifier; class->post_class.get_description = upmix_get_description; class->post_class.dispose = upmix_class_dispose; - + class->xine = xine; - + return class; } diff --git a/src/post/audio/upmix_mono.c b/src/post/audio/upmix_mono.c index 52b5f497b..43fe3df0d 100644 --- a/src/post/audio/upmix_mono.c +++ b/src/post/audio/upmix_mono.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -68,11 +68,11 @@ struct post_plugin_upmix_mono_s { /* private data */ int channels; - + upmix_mono_parameters_t params; xine_post_in_t params_input; int params_changed; - + pthread_mutex_t lock; }; @@ -134,7 +134,7 @@ static int upmix_mono_port_open(xine_audio_port_t *port_gen, xine_stream_t *stre _x_post_rewire(&this->post); _x_post_inc_usage(port); - + port->stream = stream; port->bits = bits; port->rate = rate; @@ -142,7 +142,7 @@ static int upmix_mono_port_open(xine_audio_port_t *port_gen, xine_stream_t *stre this->channels = _x_ao_mode2channels(mode); capabilities = port->original_port->get_capabilities(port->original_port); - + if (this->channels == 1 && (capabilities & AO_CAP_MODE_STEREO)) { xprintf(stream->xine, XINE_VERBOSITY_LOG, _(LOG_MODULE ": upmixing Mono to Stereo.\n")); @@ -151,7 +151,7 @@ static int upmix_mono_port_open(xine_audio_port_t *port_gen, xine_stream_t *stre if ( this->channels != 1) xprintf(stream->xine, XINE_VERBOSITY_LOG, ngettext(LOG_MODULE ": upmixing a single channel from original %d channel stream.\n", - LOG_MODULE ": upmixing a single channel from original %d channels stream.\n", + LOG_MODULE ": upmixing a single channel from original %d channels stream.\n", this->channels), this->channels); else { xprintf(stream->xine, XINE_VERBOSITY_LOG, @@ -163,15 +163,15 @@ static int upmix_mono_port_open(xine_audio_port_t *port_gen, xine_stream_t *stre return (port->original_port->open) (port->original_port, stream, bits, rate, mode); } -static void upmix_mono_port_put_buffer(xine_audio_port_t *port_gen, +static void upmix_mono_port_put_buffer(xine_audio_port_t *port_gen, audio_buffer_t *buf, xine_stream_t *stream) { - + post_audio_port_t *port = (post_audio_port_t *)port_gen; post_plugin_upmix_mono_t *this = (post_plugin_upmix_mono_t *)port->post; - + pthread_mutex_lock (&this->lock); - if (this->channels == 1) + if (this->channels == 1) { audio_buffer_t *buf0 = port->original_port->get_buffer(port->original_port); audio_buffer_t *buf1 = port->original_port->get_buffer(port->original_port); @@ -232,7 +232,7 @@ static void upmix_mono_port_put_buffer(xine_audio_port_t *port_gen, /* free data from origial buffer */ buf->num_frames = 0; /* UNDOCUMENTED, but hey, it works! Force old audio_out buffer free. */ } - else if (this->channels && this->params.channel >= 0) + else if (this->channels && this->params.channel >= 0) { audio_buffer_t *buf0 = port->original_port->get_buffer(port->original_port); buf0->num_frames = buf->num_frames; @@ -253,12 +253,12 @@ static void upmix_mono_port_put_buffer(xine_audio_port_t *port_gen, uint8_t *dst0 = (uint8_t *)buf0->mem; int cur_channel = this->params.channel; int i, j; - + if( cur_channel >= this->channels ) cur_channel = this->channels-1; src += cur_channel * step; - + for (i = 0; i < buf->num_frames; i++) { for (j = 0; j < this->channels; j++ ) @@ -276,11 +276,11 @@ static void upmix_mono_port_put_buffer(xine_audio_port_t *port_gen, /* free data from origial buffer */ buf->num_frames = 0; /* UNDOCUMENTED, but hey, it works! Force old audio_out buffer free. */ } - + pthread_mutex_unlock (&this->lock); - + port->original_port->put_buffer(port->original_port, buf, stream); - + return; } @@ -303,24 +303,24 @@ static post_plugin_t *upmix_mono_open_plugin(post_class_t *class_gen, int inputs xine_post_in_t *input_api; post_audio_port_t *port; upmix_mono_parameters_t init_params; - + if (!this || !audio_target || !audio_target[0]) { free(this); return NULL; } - + _x_post_init(&this->post, 1, 0); init_params.channel = -1; - + pthread_mutex_init (&this->lock, NULL); set_parameters ((xine_post_t *)&this->post, &init_params); - + port = _x_post_intercept_audio_port(&this->post, audio_target[0], &input, &output); port->new_port.open = upmix_mono_port_open; port->new_port.put_buffer = upmix_mono_port_put_buffer; - + input_api = &this->params_input; input_api->name = "parameters"; input_api->type = XINE_POST_DATA_PARAMETERS; @@ -352,17 +352,17 @@ static void upmix_mono_class_dispose(post_class_t *class_gen) void *upmix_mono_init_plugin(xine_t *xine, void *data) { post_class_upmix_mono_t *class = (post_class_upmix_mono_t *)malloc(sizeof(post_class_upmix_mono_t)); - + if (!class) return NULL; - + class->post_class.open_plugin = upmix_mono_open_plugin; class->post_class.get_identifier = upmix_mono_get_identifier; class->post_class.get_description = upmix_mono_get_description; class->post_class.dispose = upmix_mono_class_dispose; - + class->xine = xine; - + return class; } diff --git a/src/post/audio/volnorm.c b/src/post/audio/volnorm.c index 158705ef7..945fd2505 100644 --- a/src/post/audio/volnorm.c +++ b/src/post/audio/volnorm.c @@ -1,24 +1,24 @@ /* * Copyright (C) 2000-2008 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * Volume normalization audio filter for xine. Ported by Jason Tackaberry - * from MPlayer's af_volnorm, which is copyright 2004 by Alex Beregszaszi + * from MPlayer's af_volnorm, which is copyright 2004 by Alex Beregszaszi * & Pierre Lombard. */ @@ -117,7 +117,7 @@ struct post_plugin_volnorm_s { /************************************************************************** * volnorm parameters functions *************************************************************************/ -static int set_parameters (xine_post_t *this_gen, void *param_gen) +static int set_parameters (xine_post_t *this_gen, void *param_gen) { post_plugin_volnorm_t *this = (post_plugin_volnorm_t *)this_gen; volnorm_parameters_t *param = (volnorm_parameters_t *)param_gen; @@ -129,7 +129,7 @@ static int set_parameters (xine_post_t *this_gen, void *param_gen) return 1; } -static int get_parameters (xine_post_t *this_gen, void *param_gen) +static int get_parameters (xine_post_t *this_gen, void *param_gen) { post_plugin_volnorm_t *this = (post_plugin_volnorm_t *)this_gen; volnorm_parameters_t *param = (volnorm_parameters_t *)param_gen; @@ -141,12 +141,12 @@ static int get_parameters (xine_post_t *this_gen, void *param_gen) return 1; } -static xine_post_api_descr_t * get_param_descr (void) +static xine_post_api_descr_t * get_param_descr (void) { return ¶m_descr; } -static char * get_help (void) +static char * get_help (void) { return _("Normalizes audio by maximizing the volume without distorting " "the sound.\n" @@ -172,14 +172,14 @@ static xine_post_api_t post_api = { *************************************************************************/ static int volnorm_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream, - uint32_t bits, uint32_t rate, int mode) + uint32_t bits, uint32_t rate, int mode) { post_audio_port_t *port = (post_audio_port_t *)port_gen; post_plugin_volnorm_t *this = (post_plugin_volnorm_t *)port->post; _x_post_rewire(&this->post); _x_post_inc_usage(port); - + port->stream = stream; port->bits = bits; port->rate = rate; @@ -373,10 +373,10 @@ static void method2_float(post_plugin_volnorm_t *this, audio_buffer_t *buf) } -static void volnorm_port_put_buffer (xine_audio_port_t *port_gen, - audio_buffer_t *buf, xine_stream_t *stream) +static void volnorm_port_put_buffer (xine_audio_port_t *port_gen, + audio_buffer_t *buf, xine_stream_t *stream) { - + post_audio_port_t *port = (post_audio_port_t *)port_gen; post_plugin_volnorm_t *this = (post_plugin_volnorm_t *)port->post; @@ -391,8 +391,8 @@ static void volnorm_port_put_buffer (xine_audio_port_t *port_gen, else if (buf->format.bits == 32) method2_float(this, buf); } - port->original_port->put_buffer(port->original_port, buf, stream ); - + port->original_port->put_buffer(port->original_port, buf, stream ); + return; } @@ -416,12 +416,12 @@ static post_plugin_t *volnorm_open_plugin(post_class_t *class_gen, int inputs, post_out_t *output; xine_post_in_t *input_api; post_audio_port_t *port; - + if (!this || !audio_target || !audio_target[0] ) { free(this); return NULL; } - + _x_post_init(&this->post, 1, 0); pthread_mutex_init (&this->lock, NULL); @@ -468,16 +468,16 @@ static void volnorm_class_dispose(post_class_t *class_gen) void *volnorm_init_plugin(xine_t *xine, void *data) { post_class_volnorm_t *class = (post_class_volnorm_t *)malloc(sizeof(post_class_volnorm_t)); - + if (!class) return NULL; - + class->post_class.open_plugin = volnorm_open_plugin; class->post_class.get_identifier = volnorm_get_identifier; class->post_class.get_description = volnorm_get_description; class->post_class.dispose = volnorm_class_dispose; - + class->xine = xine; - + return class; } diff --git a/src/post/audio/window.c b/src/post/audio/window.c index fdea90590..ca58152d5 100644 --- a/src/post/audio/window.c +++ b/src/post/audio/window.c @@ -1,5 +1,5 @@ /*============================================================================= - * + * * This software has been released under the terms of the GNU Public * license. See http://www.gnu.org/copyleft/gpl.html for details. * @@ -39,7 +39,7 @@ void boxcar(int n, _ftype_t* w) /* * Triang a.k.a Bartlett * - * | (N-1)| + * | (N-1)| * 2 * |k - -----| * | 2 | * w = 1.0 - --------------- @@ -53,7 +53,7 @@ void triang(int n, _ftype_t* w) _ftype_t k2 = 1/((_ftype_t)n + k1); int end = (n + 1) >> 1; int i; - + /* Calculate window coefficients */ for (i=0 ; i<end ; i++) w[i] = w[n-i-1] = (2.0*((_ftype_t)(i+1))-(1.0-k1))*k2; @@ -72,7 +72,7 @@ void hanning(int n, _ftype_t* w) { int i; _ftype_t k = 2*M_PI/((_ftype_t)(n+1)); /* 2*pi/(N+1) */ - + /* Calculate window coefficients */ for (i=0; i<n; i++) *w++ = 0.5*(1.0 - cos(k*(_ftype_t)(i+1))); @@ -131,22 +131,22 @@ void flattop(int n,_ftype_t* w) int i; _ftype_t k1 = 2*M_PI/((_ftype_t)(n-1)); /* 2*pi/(N-1) */ _ftype_t k2 = 2*k1; /* 4*pi/(N-1) */ - + /* Calculate window coefficients */ for (i=0; i<n; i++) *w++ = 0.2810638602 - 0.5208971735*cos(k1*(_ftype_t)i) + 0.1980389663*cos(k2*(_ftype_t)i); } -/* Computes the 0th order modified Bessel function of the first kind. - * (Needed to compute Kaiser window) - * +/* Computes the 0th order modified Bessel function of the first kind. + * (Needed to compute Kaiser window) + * * y = sum( (x/(2*n))^2 ) * n */ #define BIZ_EPSILON 1E-21 /* Max error acceptable */ static _ftype_t besselizero(_ftype_t x) -{ +{ _ftype_t temp; _ftype_t sum = 1.0; _ftype_t u = 1.0; @@ -175,10 +175,10 @@ static _ftype_t besselizero(_ftype_t x) * Gold (Theory and Application of DSP) under Kaiser windows for more * about Beta. The following table from Rabiner and Gold gives some * feel for the effect of Beta: - * + * * All ripples in dB, width of transition band = D*N where N = window * length - * + * * BETA D PB RIP SB RIP * 2.120 1.50 +-0.27 -30 * 3.384 2.23 0.0864 -40 @@ -195,8 +195,8 @@ void kaiser(int n, _ftype_t* w, _ftype_t b) _ftype_t k1 = 1.0/besselizero(b); int k2 = 1 - (n & 1); int end = (n + 1) >> 1; - int i; - + int i; + /* Calculate window coefficients */ for (i=0 ; i<end ; i++){ tmp = (_ftype_t)(2*i + k2) / ((_ftype_t)n - 1.0); diff --git a/src/post/audio/window.h b/src/post/audio/window.h index d0a7446eb..638707809 100644 --- a/src/post/audio/window.h +++ b/src/post/audio/window.h @@ -1,5 +1,5 @@ /*============================================================================= - * + * * This software has been released under the terms of the GNU Public * license. See http://www.gnu.org/copyleft/gpl.html for details. * diff --git a/src/post/deinterlace/Makefile.am b/src/post/deinterlace/Makefile.am index bac6bac33..bf5b281a8 100644 --- a/src/post/deinterlace/Makefile.am +++ b/src/post/deinterlace/Makefile.am @@ -3,12 +3,12 @@ include $(top_srcdir)/misc/Makefile.common SUBDIRS = plugins -EXTRA_DIST = +EXTRA_DIST = xinepost_LTLIBRARIES = xineplug_post_tvtime.la xineplug_post_tvtime_la_SOURCES = xine_plugin.c \ - deinterlace.c pulldown.c speedy.c tvtime.c + deinterlace.c pulldown.c speedy.c tvtime.c xineplug_post_tvtime_la_LIBADD = $(XINE_LIB) $(LTLIBINTL) $(PTHREAD_LIBS) \ $(top_builddir)/src/post/deinterlace/plugins/libdeinterlaceplugins.la diff --git a/src/post/deinterlace/plugins/greedy.c b/src/post/deinterlace/plugins/greedy.c index b5fcad3e5..925779224 100644 --- a/src/post/deinterlace/plugins/greedy.c +++ b/src/post/deinterlace/plugins/greedy.c @@ -48,7 +48,7 @@ // upon which give the smaller comb factor, and then clip to avoid large damage // when wrong. // -// I'd intended this to be part of a larger more elaborate method added to +// I'd intended this to be part of a larger more elaborate method added to // Blended Clip but this give too good results for the CPU to ignore here. static void copy_scanline( uint8_t *output, @@ -134,7 +134,7 @@ static void deinterlace_greedy_packed422_scanline_mmxext( uint8_t *output, paddusb_r2r( mm3, mm2 ); // now = Max(L1,L3) pcmpeqb_r2r( mm7, mm7 ); // all ffffffff - psubusb_r2r( mm1, mm7 ); // - L1 + psubusb_r2r( mm1, mm7 ); // - L1 paddusb_r2r( mm7, mm3 ); // add, may sat at fff.. psubusb_r2r( mm7, mm3 ); // now = Min(L1,L3) @@ -146,7 +146,7 @@ static void deinterlace_greedy_packed422_scanline_mmxext( uint8_t *output, paddusb_r2r( mm3, mm4 ); // now = Max(best,Min(L1,L3) pcmpeqb_r2r( mm7, mm7 ); // all ffffffff - psubusb_r2r( mm4, mm7 ); // - Max(best,Min(best,L3) + psubusb_r2r( mm4, mm7 ); // - Max(best,Min(best,L3) paddusb_r2r( mm7, mm2 ); // add may sat at FFF.. psubusb_r2r( mm7, mm2 ); // now = Min( Max(best, Min(L1,L3), L2 )=L2 clipped diff --git a/src/post/deinterlace/plugins/greedy2frame_template.c b/src/post/deinterlace/plugins/greedy2frame_template.c index 1067e2cb8..7fe52519f 100644 --- a/src/post/deinterlace/plugins/greedy2frame_template.c +++ b/src/post/deinterlace/plugins/greedy2frame_template.c @@ -79,9 +79,9 @@ /**************************************************************************** ** Field 1 | Field 2 | Field 3 | Field 4 | -** T0 | | T1 | | -** | M0 | | M1 | -** B0 | | B1 | | +** T0 | | T1 | | +** | M0 | | M1 | +** B0 | | B1 | | */ @@ -95,15 +95,15 @@ #define MASKS_DEFINED static const int64_t __attribute__((__used__)) YMask = 0x00ff00ff00ff00ffll; static const int64_t __attribute__((__used__)) Mask = 0x7f7f7f7f7f7f7f7fll; - static const int64_t __attribute__((__used__)) DwordOne = 0x0000000100000001ll; - static const int64_t __attribute__((__used__)) DwordTwo = 0x0000000200000002ll; + static const int64_t __attribute__((__used__)) DwordOne = 0x0000000100000001ll; + static const int64_t __attribute__((__used__)) DwordTwo = 0x0000000200000002ll; static int64_t qwGreedyTwoFrameThreshold; #endif #include <mangle.h> #if defined(IS_SSE) -static void DeinterlaceGreedy2Frame_SSE(uint8_t *output, int outstride, +static void DeinterlaceGreedy2Frame_SSE(uint8_t *output, int outstride, deinterlace_frame_data_t *data, int bottom_field, int second_field, int width, int height ) #elif defined(IS_3DNOW) @@ -135,7 +135,7 @@ static void DeinterlaceGreedy2Frame_MMX(uint8_t *output, int outstride, qwGreedyTwoFrameThreshold = GreedyTwoFrameThreshold; qwGreedyTwoFrameThreshold += (GreedyTwoFrameThreshold2 << 8); qwGreedyTwoFrameThreshold += (qwGreedyTwoFrameThreshold << 48) + - (qwGreedyTwoFrameThreshold << 32) + + (qwGreedyTwoFrameThreshold << 32) + (qwGreedyTwoFrameThreshold << 16); @@ -150,7 +150,7 @@ static void DeinterlaceGreedy2Frame_MMX(uint8_t *output, int outstride, M0 = data->f1; T0 = data->f2; } - + if( bottom_field ) { M1 += stride; T1 += 0; @@ -194,9 +194,9 @@ static void DeinterlaceGreedy2Frame_MMX(uint8_t *output, int outstride, "movq %2, %%mm3 \n\t" // B1 "movq %3, %%mm2 \n\t" // M0 : /* no output */ - : "m" (*T1), "m" (*M1), + : "m" (*T1), "m" (*M1), "m" (*B1), "m" (*M0), "m" (Mask) ); - + asm volatile( /* Figure out what to do with the scanline above the one we just copied. @@ -271,7 +271,7 @@ static void DeinterlaceGreedy2Frame_MMX(uint8_t *output, int outstride, "pcmpgtb %3, %%mm5 \n\t" "pand %%mm6, %%mm5 \n\t" /* get rid of sign bit */ - "pcmpgtd %5, %%mm5 \n\t" + "pcmpgtd %5, %%mm5 \n\t" "pandn %5, %%mm5 \n\t" "paddd %%mm5, %%mm4 \n\t" @@ -307,9 +307,9 @@ static void DeinterlaceGreedy2Frame_MMX(uint8_t *output, int outstride, "movq %%mm4, %%mm5 \n\t" /* mm4 now is 1 where we want to weave and 0 where we want to bob */ - "pand %%mm0, %%mm4 \n\t" - "pandn %%mm7, %%mm5 \n\t" - "por %%mm5, %%mm4 \n\t" + "pand %%mm0, %%mm4 \n\t" + "pandn %%mm7, %%mm5 \n\t" + "por %%mm5, %%mm4 \n\t" #ifdef IS_SSE "movntq %%mm4, %0 \n\t" #else @@ -353,9 +353,9 @@ static void DeinterlaceGreedy2Frame_MMX(uint8_t *output, int outstride, } else { - xine_fast_memcpy(Dest, T1, stride); + xine_fast_memcpy(Dest, T1, stride); } - + /* clear out the MMX registers ready for doing floating point again */ asm("emms\n\t"); #endif diff --git a/src/post/deinterlace/plugins/greedyhmacros.h b/src/post/deinterlace/plugins/greedyhmacros.h index 5f65959c3..fd1eb2068 100644 --- a/src/post/deinterlace/plugins/greedyhmacros.h +++ b/src/post/deinterlace/plugins/greedyhmacros.h @@ -15,7 +15,7 @@ // ///////////////////////////////////////////////////////////////////////////// -// Define a few macros for CPU dependent instructions. +// Define a few macros for CPU dependent instructions. // I suspect I don't really understand how the C macro preprocessor works but // this seems to get the job done. // TRB 7/01 @@ -35,9 +35,9 @@ "paddusb "mmrw", "mmr1"\n\t" #define V_PAVGB_SSE(mmr1, mmr2, mmrw, smask) "pavgb "mmr2", "mmr1"\n\t" #define V_PAVGB_3DNOW(mmr1, mmr2, mmrw, smask) "pavgusb "mmr2", "mmr1"\n\t" -#define V_PAVGB(mmr1, mmr2, mmrw, smask) V_PAVGB2(mmr1, mmr2, mmrw, smask, SSE_TYPE) -#define V_PAVGB2(mmr1, mmr2, mmrw, smask, ssetyp) V_PAVGB3(mmr1, mmr2, mmrw, smask, ssetyp) -#define V_PAVGB3(mmr1, mmr2, mmrw, smask, ssetyp) V_PAVGB_##ssetyp(mmr1, mmr2, mmrw, smask) +#define V_PAVGB(mmr1, mmr2, mmrw, smask) V_PAVGB2(mmr1, mmr2, mmrw, smask, SSE_TYPE) +#define V_PAVGB2(mmr1, mmr2, mmrw, smask, ssetyp) V_PAVGB3(mmr1, mmr2, mmrw, smask, ssetyp) +#define V_PAVGB3(mmr1, mmr2, mmrw, smask, ssetyp) V_PAVGB_##ssetyp(mmr1, mmr2, mmrw, smask) // some macros for pmaxub instruction #define V_PMAXUB_MMX(mmr1, mmr2) \ @@ -45,9 +45,9 @@ "paddusb "mmr2", "mmr1"\n\t" #define V_PMAXUB_SSE(mmr1, mmr2) "pmaxub "mmr2", "mmr1"\n\t" #define V_PMAXUB_3DNOW(mmr1, mmr2) V_PMAXUB_MMX(mmr1, mmr2) // use MMX version -#define V_PMAXUB(mmr1, mmr2) V_PMAXUB2(mmr1, mmr2, SSE_TYPE) -#define V_PMAXUB2(mmr1, mmr2, ssetyp) V_PMAXUB3(mmr1, mmr2, ssetyp) -#define V_PMAXUB3(mmr1, mmr2, ssetyp) V_PMAXUB_##ssetyp(mmr1, mmr2) +#define V_PMAXUB(mmr1, mmr2) V_PMAXUB2(mmr1, mmr2, SSE_TYPE) +#define V_PMAXUB2(mmr1, mmr2, ssetyp) V_PMAXUB3(mmr1, mmr2, ssetyp) +#define V_PMAXUB3(mmr1, mmr2, ssetyp) V_PMAXUB_##ssetyp(mmr1, mmr2) // some macros for pminub instruction // V_PMINUB(mmr1, mmr2, mmr work register) mmr2 may NOT = mmrw @@ -58,17 +58,17 @@ "psubusb "mmrw", "mmr1"\n\t" #define V_PMINUB_SSE(mmr1, mmr2, mmrw) "pminub "mmr2", "mmr1"\n\t" #define V_PMINUB_3DNOW(mmr1, mmr2, mmrw) V_PMINUB_MMX(mmr1, mmr2, mmrw) // use MMX version -#define V_PMINUB(mmr1, mmr2, mmrw) V_PMINUB2(mmr1, mmr2, mmrw, SSE_TYPE) -#define V_PMINUB2(mmr1, mmr2, mmrw, ssetyp) V_PMINUB3(mmr1, mmr2, mmrw, ssetyp) -#define V_PMINUB3(mmr1, mmr2, mmrw, ssetyp) V_PMINUB_##ssetyp(mmr1, mmr2, mmrw) +#define V_PMINUB(mmr1, mmr2, mmrw) V_PMINUB2(mmr1, mmr2, mmrw, SSE_TYPE) +#define V_PMINUB2(mmr1, mmr2, mmrw, ssetyp) V_PMINUB3(mmr1, mmr2, mmrw, ssetyp) +#define V_PMINUB3(mmr1, mmr2, mmrw, ssetyp) V_PMINUB_##ssetyp(mmr1, mmr2, mmrw) // some macros for movntq instruction -// V_MOVNTQ(mmr1, mmr2) +// V_MOVNTQ(mmr1, mmr2) #define V_MOVNTQ_MMX(mmr1, mmr2) "movq "mmr2", "mmr1"\n\t" #define V_MOVNTQ_3DNOW(mmr1, mmr2) "movq "mmr2", "mmr1"\n\t" #define V_MOVNTQ_SSE(mmr1, mmr2) "movntq "mmr2", "mmr1"\n\t" -#define V_MOVNTQ(mmr1, mmr2) V_MOVNTQ2(mmr1, mmr2, SSE_TYPE) -#define V_MOVNTQ2(mmr1, mmr2, ssetyp) V_MOVNTQ3(mmr1, mmr2, ssetyp) +#define V_MOVNTQ(mmr1, mmr2) V_MOVNTQ2(mmr1, mmr2, SSE_TYPE) +#define V_MOVNTQ2(mmr1, mmr2, ssetyp) V_MOVNTQ3(mmr1, mmr2, ssetyp) #define V_MOVNTQ3(mmr1, mmr2, ssetyp) V_MOVNTQ_##ssetyp(mmr1, mmr2) // end of macros diff --git a/src/post/deinterlace/plugins/linearblend.c b/src/post/deinterlace/plugins/linearblend.c index 96e56063f..c594f41dd 100644 --- a/src/post/deinterlace/plugins/linearblend.c +++ b/src/post/deinterlace/plugins/linearblend.c @@ -254,7 +254,7 @@ static void deinterlace_scanline_linear_blend2_mmxext( uint8_t *output, uint8_t *b1 = data->b1; int i; - + READ_PREFETCH_2048( t1 ); READ_PREFETCH_2048( b1 ); READ_PREFETCH_2048( m0 ); diff --git a/src/post/deinterlace/plugins/tomsmocomp/tomsmocompmacros.h b/src/post/deinterlace/plugins/tomsmocomp/tomsmocompmacros.h index a0136fd44..875ed7055 100644 --- a/src/post/deinterlace/plugins/tomsmocomp/tomsmocompmacros.h +++ b/src/post/deinterlace/plugins/tomsmocomp/tomsmocompmacros.h @@ -8,7 +8,7 @@ #define MyMemCopy xine_fast_memcpy -// Define a few macros for CPU dependent instructions. +// Define a few macros for CPU dependent instructions. // I suspect I don't really understand how the C macro preprocessor works but // this seems to get the job done. // TRB 7/01 @@ -28,9 +28,9 @@ "paddusb "mmrw", "mmr1"\n\t" #define V_PAVGB_SSE(mmr1, mmr2, mmrw, smask) "pavgb "mmr2", "mmr1"\n\t" #define V_PAVGB_3DNOW(mmr1, mmr2, mmrw, smask) "pavgusb "mmr2", "mmr1"\n\t" -#define V_PAVGB(mmr1, mmr2, mmrw, smask) V_PAVGB2(mmr1, mmr2, mmrw, smask, SSE_TYPE) -#define V_PAVGB2(mmr1, mmr2, mmrw, smask, ssetyp) V_PAVGB3(mmr1, mmr2, mmrw, smask, ssetyp) -#define V_PAVGB3(mmr1, mmr2, mmrw, smask, ssetyp) V_PAVGB_##ssetyp(mmr1, mmr2, mmrw, smask) +#define V_PAVGB(mmr1, mmr2, mmrw, smask) V_PAVGB2(mmr1, mmr2, mmrw, smask, SSE_TYPE) +#define V_PAVGB2(mmr1, mmr2, mmrw, smask, ssetyp) V_PAVGB3(mmr1, mmr2, mmrw, smask, ssetyp) +#define V_PAVGB3(mmr1, mmr2, mmrw, smask, ssetyp) V_PAVGB_##ssetyp(mmr1, mmr2, mmrw, smask) // some macros for pmaxub instruction #define V_PMAXUB_MMX(mmr1, mmr2) \ @@ -38,9 +38,9 @@ "paddusb "mmr2", "mmr1"\n\t" #define V_PMAXUB_SSE(mmr1, mmr2) "pmaxub "mmr2", "mmr1"\n\t" #define V_PMAXUB_3DNOW(mmr1, mmr2) V_PMAXUB_MMX(mmr1, mmr2) // use MMX version -#define V_PMAXUB(mmr1, mmr2) V_PMAXUB2(mmr1, mmr2, SSE_TYPE) -#define V_PMAXUB2(mmr1, mmr2, ssetyp) V_PMAXUB3(mmr1, mmr2, ssetyp) -#define V_PMAXUB3(mmr1, mmr2, ssetyp) V_PMAXUB_##ssetyp(mmr1, mmr2) +#define V_PMAXUB(mmr1, mmr2) V_PMAXUB2(mmr1, mmr2, SSE_TYPE) +#define V_PMAXUB2(mmr1, mmr2, ssetyp) V_PMAXUB3(mmr1, mmr2, ssetyp) +#define V_PMAXUB3(mmr1, mmr2, ssetyp) V_PMAXUB_##ssetyp(mmr1, mmr2) // some macros for pminub instruction // V_PMINUB(mmr1, mmr2, mmr work register) mmr2 may NOT = mmrw @@ -51,17 +51,17 @@ "psubusb "mmrw", "mmr1"\n\t" #define V_PMINUB_SSE(mmr1, mmr2, mmrw) "pminub "mmr2", "mmr1"\n\t" #define V_PMINUB_3DNOW(mmr1, mmr2, mmrw) V_PMINUB_MMX(mmr1, mmr2, mmrw) // use MMX version -#define V_PMINUB(mmr1, mmr2, mmrw) V_PMINUB2(mmr1, mmr2, mmrw, SSE_TYPE) -#define V_PMINUB2(mmr1, mmr2, mmrw, ssetyp) V_PMINUB3(mmr1, mmr2, mmrw, ssetyp) -#define V_PMINUB3(mmr1, mmr2, mmrw, ssetyp) V_PMINUB_##ssetyp(mmr1, mmr2, mmrw) +#define V_PMINUB(mmr1, mmr2, mmrw) V_PMINUB2(mmr1, mmr2, mmrw, SSE_TYPE) +#define V_PMINUB2(mmr1, mmr2, mmrw, ssetyp) V_PMINUB3(mmr1, mmr2, mmrw, ssetyp) +#define V_PMINUB3(mmr1, mmr2, mmrw, ssetyp) V_PMINUB_##ssetyp(mmr1, mmr2, mmrw) // some macros for movntq instruction -// V_MOVNTQ(mmr1, mmr2) +// V_MOVNTQ(mmr1, mmr2) #define V_MOVNTQ_MMX(mmr1, mmr2) "movq "mmr2", "mmr1"\n\t" #define V_MOVNTQ_3DNOW(mmr1, mmr2) "movq "mmr2", "mmr1"\n\t" #define V_MOVNTQ_SSE(mmr1, mmr2) "movntq "mmr2", "mmr1"\n\t" -#define V_MOVNTQ(mmr1, mmr2) V_MOVNTQ2(mmr1, mmr2, SSE_TYPE) -#define V_MOVNTQ2(mmr1, mmr2, ssetyp) V_MOVNTQ3(mmr1, mmr2, ssetyp) +#define V_MOVNTQ(mmr1, mmr2) V_MOVNTQ2(mmr1, mmr2, SSE_TYPE) +#define V_MOVNTQ2(mmr1, mmr2, ssetyp) V_MOVNTQ3(mmr1, mmr2, ssetyp) #define V_MOVNTQ3(mmr1, mmr2, ssetyp) V_MOVNTQ_##ssetyp(mmr1, mmr2) // end of macros diff --git a/src/post/deinterlace/pulldown.c b/src/post/deinterlace/pulldown.c index 4f6247444..2218855f0 100644 --- a/src/post/deinterlace/pulldown.c +++ b/src/post/deinterlace/pulldown.c @@ -47,7 +47,7 @@ * Bot 2 : Drop * Top 3 : Merge * Bot 3 : Drop - * Top 4 : Show + * Top 4 : Show * Bot 4 : Drop * Top 5 : Drop * Bot 5 : Show @@ -69,15 +69,15 @@ * * [ ] * [ * *] | 0 top BC - * [* * ] | 1 BC bottom BC + * [* * ] | 1 BC bottom BC * * [ ] * [ * *] | 0 top CC - * [ * *] | 0 CC bottom CC + * [ * *] | 0 CC bottom CC * * [ ] * [* * ] | 1 top DD - * [ * *] | 0 DD bottom DD + * [ * *] | 0 DD bottom DD * * * [* * ] | 1 top AA @@ -608,7 +608,7 @@ int pulldown_drop( int action, int bottom_field ) if( action == PULLDOWN_SEQ_CC && !bottom_field ) ret = 0; if( action == PULLDOWN_SEQ_DD && bottom_field ) - ret = 0; + ret = 0; return ret; } diff --git a/src/post/deinterlace/speedy.c b/src/post/deinterlace/speedy.c index a980780d7..32c8b03e3 100644 --- a/src/post/deinterlace/speedy.c +++ b/src/post/deinterlace/speedy.c @@ -116,11 +116,11 @@ void (*composite_bars_packed4444_scanline)( uint8_t *output, uint8_t *background, int width, int a, int luma, int cb, int cr, int percentage ); -void (*packed444_to_nonpremultiplied_packed4444_scanline)( uint8_t *output, +void (*packed444_to_nonpremultiplied_packed4444_scanline)( uint8_t *output, uint8_t *input, int width, int alpha ); void (*aspect_adjust_packed4444_scanline)( uint8_t *output, - uint8_t *input, + uint8_t *input, int width, double pixel_aspect ); void (*packed444_to_packed422_scanline)( uint8_t *output, @@ -622,7 +622,7 @@ static void vfilter_chroma_121_packed422_scanline_mmx( uint8_t *output, int widt paddw_r2r( mm1, mm2 ); psllw_i2r( 6, mm2 ); - pand_r2r( mm6, mm2 ); + pand_r2r( mm6, mm2 ); por_r2r ( mm3, mm2 ); @@ -637,7 +637,7 @@ static void vfilter_chroma_121_packed422_scanline_mmx( uint8_t *output, int widt *output = (*t + *b + (*m << 1)) >> 2; output+=2; t+=2; b+=2; m+=2; } - + emms(); } #endif @@ -661,7 +661,7 @@ static void vfilter_chroma_332_packed422_scanline_mmx( uint8_t *output, int widt const mmx_t cmask = { 0xff00ff00ff00ff00ULL }; // Get width in bytes. - width *= 2; + width *= 2; i = width / 8; width -= i * 8; @@ -1939,7 +1939,7 @@ static int conv_YR_inited = 0; static int myround(double n) { - if (n >= 0) + if (n >= 0) return (int)(n + 0.5); else return (int)(n - 0.5); @@ -1956,7 +1956,7 @@ static void init_RGB_to_YCbCr_tables(void) * to one of each, add the following: * + (fixed-point-factor / 2) --- for rounding later * + (Q-offset * fixed-point-factor) --- to add the offset - * + * */ for (i = 0; i < 256; i++) { Y_R[i] = myround(0.299 * (double)i * 219.0 / 255.0 * (double)(1<<FP_BITS)); @@ -1988,7 +1988,7 @@ static void init_YCbCr_to_RGB_tables(void) * to one of each, add the following: * + (fixed-point-factor / 2) --- for rounding later * + (Q-offset * fixed-point-factor) --- to add the offset - * + * */ /* clip Y values under 16 */ @@ -2005,7 +2005,7 @@ static void init_YCbCr_to_RGB_tables(void) RGB_Y[i] = myround((1.0 * (double)(235) * 255.0 / 219.0 * (double)(1<<FP_BITS)) + (double)(1<<(FP_BITS-1))); } - + /* clip Cb/Cr values below 16 */ for (i = 0; i < 16; i++) { R_Cr[i] = myround(1.402 * (double)(-112) * 255.0 / 224.0 * (double)(1<<FP_BITS)); @@ -2055,7 +2055,7 @@ static void rgba32_to_packed4444_rec601_scanline_c( uint8_t *output, uint8_t *in int g = input[ 1 ]; int b = input[ 2 ]; int a = input[ 3 ]; - + output[ 0 ] = a; output[ 1 ] = (Y_R[ r ] + Y_G[ g ] + Y_B[ b ]) >> FP_BITS; output[ 2 ] = (Cb_R[ r ] + Cb_G[ g ] + Cb_B[ b ]) >> FP_BITS; @@ -2128,7 +2128,7 @@ static void packed444_to_rgb24_rec601_reference_scanline( uint8_t *output, uint8 } */ -static void packed444_to_nonpremultiplied_packed4444_scanline_c( uint8_t *output, +static void packed444_to_nonpremultiplied_packed4444_scanline_c( uint8_t *output, uint8_t *input, int width, int alpha ) { @@ -2146,7 +2146,7 @@ static void packed444_to_nonpremultiplied_packed4444_scanline_c( uint8_t *output } static void aspect_adjust_packed4444_scanline_c( uint8_t *output, - uint8_t *input, + uint8_t *input, int width, double pixel_aspect ) { @@ -2259,7 +2259,7 @@ static void chroma_422_to_444_mpeg2_plane_c( uint8_t *dst, uint8_t *src, int wid /* odd samples (21 -52 159 159 -52 21) */ dst[ i2 + 1 ] = clip255( ( 21*(src[im2]+src[ip3]) - - 52*(src[im1]+src[ip2]) + - 52*(src[im1]+src[ip2]) + 159*(src[i]+src[ip1]) + 128 ) >> 8 ); } src += w; diff --git a/src/post/deinterlace/speedy.h b/src/post/deinterlace/speedy.h index b4ad56393..55a2a1d5b 100644 --- a/src/post/deinterlace/speedy.h +++ b/src/post/deinterlace/speedy.h @@ -237,7 +237,7 @@ extern void (*subpix_blit_vertical_packed422_scanline)( uint8_t *output, uint8_t * Simple function to convert a 4:4:4 scanline to a 4:4:4:4 scanline by * adding an alpha channel. Result is non-premultiplied. */ -extern void (*packed444_to_nonpremultiplied_packed4444_scanline)( uint8_t *output, +extern void (*packed444_to_nonpremultiplied_packed4444_scanline)( uint8_t *output, uint8_t *input, int width, int alpha ); @@ -248,7 +248,7 @@ extern void (*packed444_to_nonpremultiplied_packed4444_scanline)( uint8_t *outpu * aspect ratio. */ extern void (*aspect_adjust_packed4444_scanline)( uint8_t *output, - uint8_t *input, + uint8_t *input, int width, double pixel_aspect ); diff --git a/src/post/deinterlace/tvtime.h b/src/post/deinterlace/tvtime.h index 2253f264e..22d863a56 100644 --- a/src/post/deinterlace/tvtime.h +++ b/src/post/deinterlace/tvtime.h @@ -98,4 +98,4 @@ tvtime_t *tvtime_new_context(void); void tvtime_reset_context( tvtime_t *this ); -#endif +#endif diff --git a/src/post/deinterlace/xine_plugin.c b/src/post/deinterlace/xine_plugin.c index 7149f2bdb..d56c54d47 100644 --- a/src/post/deinterlace/xine_plugin.c +++ b/src/post/deinterlace/xine_plugin.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -50,7 +50,7 @@ static void *deinterlace_init_plugin(xine_t *xine, void *); static const post_info_t deinterlace_special_info = { XINE_POST_TYPE_VIDEO_FILTER }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_POST | PLUGIN_MUST_PRELOAD, 9, "tvtime", XINE_VERSION_CODE, &deinterlace_special_info, &deinterlace_init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; @@ -66,7 +66,7 @@ static char *enum_framerate[] = { "full", "half_top", "half_bottom", NULL }; static void *help_string; /* - * this is the struct used by "parameters api" + * this is the struct used by "parameters api" */ typedef struct deinterlace_parameters_s { @@ -86,15 +86,15 @@ typedef struct deinterlace_parameters_s { * description of params struct */ START_PARAM_DESCR( deinterlace_parameters_t ) -PARAM_ITEM( POST_PARAM_TYPE_INT, method, enum_methods, 0, 0, 0, +PARAM_ITEM( POST_PARAM_TYPE_INT, method, enum_methods, 0, 0, 0, "deinterlace method" ) PARAM_ITEM( POST_PARAM_TYPE_BOOL, enabled, NULL, 0, 1, 0, "enable/disable" ) -PARAM_ITEM( POST_PARAM_TYPE_INT, pulldown, enum_pulldown, 0, 0, 0, +PARAM_ITEM( POST_PARAM_TYPE_INT, pulldown, enum_pulldown, 0, 0, 0, "pulldown algorithm" ) -PARAM_ITEM( POST_PARAM_TYPE_INT, pulldown_error_wait, NULL, 0, 0, 0, +PARAM_ITEM( POST_PARAM_TYPE_INT, pulldown_error_wait, NULL, 0, 0, 0, "number of frames of telecine pattern sync required before mode change" ) -PARAM_ITEM( POST_PARAM_TYPE_INT, framerate_mode, enum_framerate, 0, 0, 0, +PARAM_ITEM( POST_PARAM_TYPE_INT, framerate_mode, enum_framerate, 0, 0, 0, "framerate output mode" ) PARAM_ITEM( POST_PARAM_TYPE_BOOL, judder_correction, NULL, 0, 1, 0, "make frames evenly spaced for film mode (24 fps)" ) @@ -129,7 +129,7 @@ struct post_plugin_deinterlace_s { int tvtime_changed; int tvtime_last_filmmode; int vo_deinterlace_enabled; - + int framecounter; uint8_t rff_pattern; @@ -144,10 +144,10 @@ typedef struct post_class_deinterlace_s { deinterlace_parameters_t init_param; } post_class_deinterlace_t; -static void _flush_frames(post_plugin_deinterlace_t *this) +static void _flush_frames(post_plugin_deinterlace_t *this) { int i; - + for( i = 0; i < NUM_RECENT_FRAMES; i++ ) { if( this->recent_frame[i] ) { this->recent_frame[i]->free(this->recent_frame[i]); @@ -189,7 +189,7 @@ static int set_parameters (xine_post_t *this_gen, void *param_gen) { static int get_parameters (xine_post_t *this_gen, void *param_gen) { post_plugin_deinterlace_t *this = (post_plugin_deinterlace_t *)this_gen; deinterlace_parameters_t *param = (deinterlace_parameters_t *)param_gen; - + param->method = this->cur_method; param->enabled = this->enabled; param->pulldown = this->pulldown; @@ -202,7 +202,7 @@ static int get_parameters (xine_post_t *this_gen, void *param_gen) { return 1; } - + static xine_post_api_descr_t * get_param_descr (void) { return ¶m_descr; } @@ -309,7 +309,7 @@ static void *deinterlace_init_plugin(xine_t *xine, void *data) if (!class) return NULL; - + class->class.open_plugin = deinterlace_open_plugin; class->class.get_identifier = deinterlace_get_identifier; class->class.get_description = deinterlace_get_description; @@ -331,7 +331,7 @@ static void *deinterlace_init_plugin(xine_t *xine, void *data) filter_deinterlace_methods( config_flags, 5 /*fieldsavailable*/ ); if( !get_num_deinterlace_methods() ) { - xprintf(xine, XINE_VERBOSITY_LOG, + xprintf(xine, XINE_VERBOSITY_LOG, _("tvtime: No deinterlacing methods available, exiting.\n")); return NULL; } @@ -344,7 +344,7 @@ static void *deinterlace_init_plugin(xine_t *xine, void *data) deinterlace_method_t *method; method = get_deinterlace_method(i); - + enum_methods[i+1] = method->short_name; xine_buffer_strcat( help_string, "[" ); xine_buffer_strcat( help_string, method->short_name ); @@ -356,7 +356,7 @@ static void *deinterlace_init_plugin(xine_t *xine, void *data) xine_buffer_strcat( help_string, "\n---\n" ); } enum_methods[i+1] = NULL; - + /* Some default values */ class->init_param.method = 1; /* First (plugin) method available */ @@ -364,7 +364,7 @@ static void *deinterlace_init_plugin(xine_t *xine, void *data) class->init_param.pulldown = 1; /* vektor */ class->init_param.pulldown_error_wait = 60; /* about one second */ class->init_param.framerate_mode = 0; /* full */ - class->init_param.judder_correction = 1; + class->init_param.judder_correction = 1; class->init_param.use_progressive_frame_flag = 1; class->init_param.chroma_filter = 0; class->init_param.cheap_mode = 0; @@ -383,12 +383,12 @@ static post_plugin_t *deinterlace_open_plugin(post_class_t *class_gen, int input post_out_t *output; post_class_deinterlace_t *class = (post_class_deinterlace_t *)class_gen; post_video_port_t *port; - + if (!this || !video_target || !video_target[0]) { free(this); return NULL; } - + _x_post_init(&this->post, 0, 1); this->tvtime = tvtime_new_context(); @@ -398,7 +398,7 @@ static post_plugin_t *deinterlace_open_plugin(post_class_t *class_gen, int input pthread_mutex_init (&this->lock, NULL); set_parameters ((xine_post_t *)&this->post, &class->init_param); - + port = _x_post_intercept_video_port(&this->post, video_target[0], &input, &output); /* replace with our own get_frame function */ port->new_port.open = deinterlace_open; @@ -408,7 +408,7 @@ static post_plugin_t *deinterlace_open_plugin(post_class_t *class_gen, int input port->new_port.flush = deinterlace_flush; port->intercept_frame = deinterlace_intercept_frame; port->new_frame->draw = deinterlace_draw; - + input_api = &this->parameter_input; input_api->name = "parameters"; input_api->type = XINE_POST_DATA_PARAMETERS; @@ -417,11 +417,11 @@ static post_plugin_t *deinterlace_open_plugin(post_class_t *class_gen, int input input->xine_in.name = "video"; output->xine_out.name = "deinterlaced video"; - + this->post.xine_post.video_input[0] = &port->new_port; - + this->post.dispose = deinterlace_dispose; - + return &this->post; } @@ -477,9 +477,9 @@ static int deinterlace_set_property(xine_video_port_t *port_gen, int property, i pthread_mutex_unlock (&this->lock); this->vo_deinterlace_enabled = this->enabled && (!this->cur_method); - - port->original_port->set_property(port->original_port, - XINE_PARAM_VO_DEINTERLACE, + + port->original_port->set_property(port->original_port, + XINE_PARAM_VO_DEINTERLACE, this->vo_deinterlace_enabled); return this->enabled; @@ -500,14 +500,14 @@ static void deinterlace_open(xine_video_port_t *port_gen, xine_stream_t *stream) { post_video_port_t *port = (post_video_port_t *)port_gen; post_plugin_deinterlace_t *this = (post_plugin_deinterlace_t *)port->post; - + _x_post_rewire(&this->post); _x_post_inc_usage(port); port->stream = stream; (port->original_port->open) (port->original_port, stream); this->vo_deinterlace_enabled = !this->cur_method; - port->original_port->set_property(port->original_port, - XINE_PARAM_VO_DEINTERLACE, + port->original_port->set_property(port->original_port, + XINE_PARAM_VO_DEINTERLACE, this->vo_deinterlace_enabled); } @@ -518,8 +518,8 @@ static void deinterlace_close(xine_video_port_t *port_gen, xine_stream_t *stream port->stream = NULL; _flush_frames(this); - port->original_port->set_property(port->original_port, - XINE_PARAM_VO_DEINTERLACE, + port->original_port->set_property(port->original_port, + XINE_PARAM_VO_DEINTERLACE, 0); port->original_port->close(port->original_port, stream); _x_post_dec_usage(port); @@ -530,21 +530,21 @@ static int deinterlace_intercept_frame(post_video_port_t *port, vo_frame_t *fram { post_plugin_deinterlace_t *this = (post_plugin_deinterlace_t *)port->post; int vo_deinterlace_enabled = 0; - + vo_deinterlace_enabled = ( frame->format != XINE_IMGFMT_YV12 && frame->format != XINE_IMGFMT_YUY2 && this->enabled ); - + if( this->cur_method && this->vo_deinterlace_enabled != vo_deinterlace_enabled ) { this->vo_deinterlace_enabled = vo_deinterlace_enabled; - port->original_port->set_property(port->original_port, - XINE_PARAM_VO_DEINTERLACE, + port->original_port->set_property(port->original_port, + XINE_PARAM_VO_DEINTERLACE, this->vo_deinterlace_enabled); } - + return (this->enabled && this->cur_method && - (frame->flags & VO_INTERLACED_FLAG) && + (frame->flags & VO_INTERLACED_FLAG) && (frame->format == XINE_IMGFMT_YV12 || frame->format == XINE_IMGFMT_YUY2) ); } @@ -559,7 +559,7 @@ static void apply_chroma_filter( uint8_t *data, int stride, int width, int heigh */ for( i = 0; i < height; i++, data += stride ) { vfilter_chroma_332_packed422_scanline( data, width, - data, + data, (i) ? (data - stride) : data, (i < height-1) ? (data + stride) : data ); } @@ -567,7 +567,7 @@ static void apply_chroma_filter( uint8_t *data, int stride, int width, int heigh /* Build the output frame from the specified field. */ static int deinterlace_build_output_field( - post_plugin_deinterlace_t *this, post_video_port_t *port, + post_plugin_deinterlace_t *this, post_video_port_t *port, xine_stream_t *stream, vo_frame_t *frame, vo_frame_t *yuy2_frame, int bottom_field, int second_field, @@ -576,14 +576,14 @@ static int deinterlace_build_output_field( vo_frame_t *deinterlaced_frame; int scaler = 1; int force24fps; - + force24fps = this->judder_correction && !this->cheap_mode && ( this->pulldown == PULLDOWN_VEKTOR && this->tvtime->filmmode ); - + if( this->tvtime->curmethod->doscalerbob ) { scaler = 2; } - + pthread_mutex_unlock (&this->lock); deinterlaced_frame = port->original_port->get_frame(port->original_port, frame->width, frame->height / scaler, frame->ratio, yuy2_frame->format, @@ -596,7 +596,7 @@ static int deinterlace_build_output_field( deinterlaced_frame->crop_bottom = frame->crop_bottom; _x_extra_info_merge(deinterlaced_frame->extra_info, frame->extra_info); - + if( skip > 0 && !this->pulldown ) { deinterlaced_frame->bad_frame = 1; } else { @@ -605,60 +605,60 @@ static int deinterlace_build_output_field( deinterlaced_frame->bad_frame = !tvtime_build_copied_field(this->tvtime, deinterlaced_frame->base[0], yuy2_frame->base[0], bottom_field, - frame->width, frame->height, + frame->width, frame->height, yuy2_frame->pitches[0], deinterlaced_frame->pitches[0] ); } else { deinterlaced_frame->bad_frame = !tvtime_build_copied_field(this->tvtime, deinterlaced_frame->base[0], yuy2_frame->base[0], bottom_field, - frame->width/2, frame->height, + frame->width/2, frame->height, yuy2_frame->pitches[0], deinterlaced_frame->pitches[0] ); deinterlaced_frame->bad_frame += !tvtime_build_copied_field(this->tvtime, deinterlaced_frame->base[1], yuy2_frame->base[1], bottom_field, - frame->width/4, frame->height/2, + frame->width/4, frame->height/2, yuy2_frame->pitches[1], deinterlaced_frame->pitches[1] ); deinterlaced_frame->bad_frame += !tvtime_build_copied_field(this->tvtime, deinterlaced_frame->base[2], yuy2_frame->base[2], bottom_field, - frame->width/4, frame->height/2, + frame->width/4, frame->height/2, yuy2_frame->pitches[2], deinterlaced_frame->pitches[2] ); } } else { if( yuy2_frame->format == XINE_IMGFMT_YUY2 ) { deinterlaced_frame->bad_frame = !tvtime_build_deinterlaced_frame(this->tvtime, deinterlaced_frame->base[0], - yuy2_frame->base[0], - (this->recent_frame[0])?this->recent_frame[0]->base[0]:yuy2_frame->base[0], + yuy2_frame->base[0], + (this->recent_frame[0])?this->recent_frame[0]->base[0]:yuy2_frame->base[0], (this->recent_frame[1])?this->recent_frame[1]->base[0]:yuy2_frame->base[0], - bottom_field, second_field, frame->width, frame->height, + bottom_field, second_field, frame->width, frame->height, yuy2_frame->pitches[0], deinterlaced_frame->pitches[0]); } else { deinterlaced_frame->bad_frame = !tvtime_build_deinterlaced_frame(this->tvtime, deinterlaced_frame->base[0], - yuy2_frame->base[0], - (this->recent_frame[0])?this->recent_frame[0]->base[0]:yuy2_frame->base[0], + yuy2_frame->base[0], + (this->recent_frame[0])?this->recent_frame[0]->base[0]:yuy2_frame->base[0], (this->recent_frame[1])?this->recent_frame[1]->base[0]:yuy2_frame->base[0], - bottom_field, second_field, frame->width/2, frame->height, + bottom_field, second_field, frame->width/2, frame->height, yuy2_frame->pitches[0], deinterlaced_frame->pitches[0]); deinterlaced_frame->bad_frame += !tvtime_build_deinterlaced_frame(this->tvtime, deinterlaced_frame->base[1], - yuy2_frame->base[1], - (this->recent_frame[0])?this->recent_frame[0]->base[1]:yuy2_frame->base[1], + yuy2_frame->base[1], + (this->recent_frame[0])?this->recent_frame[0]->base[1]:yuy2_frame->base[1], (this->recent_frame[1])?this->recent_frame[1]->base[1]:yuy2_frame->base[1], bottom_field, second_field, frame->width/4, frame->height/2, yuy2_frame->pitches[1], deinterlaced_frame->pitches[1]); deinterlaced_frame->bad_frame += !tvtime_build_deinterlaced_frame(this->tvtime, deinterlaced_frame->base[2], - yuy2_frame->base[2], - (this->recent_frame[0])?this->recent_frame[0]->base[2]:yuy2_frame->base[2], + yuy2_frame->base[2], + (this->recent_frame[0])?this->recent_frame[0]->base[2]:yuy2_frame->base[2], (this->recent_frame[1])?this->recent_frame[1]->base[2]:yuy2_frame->base[2], - bottom_field, second_field, frame->width/4, frame->height/2, + bottom_field, second_field, frame->width/4, frame->height/2, yuy2_frame->pitches[2], deinterlaced_frame->pitches[2]); } } } - + pthread_mutex_unlock (&this->lock); if( force24fps ) { if( !deinterlaced_frame->bad_frame ) { @@ -670,7 +670,7 @@ static int deinterlace_build_output_field( deinterlaced_frame->pts = 0; deinterlaced_frame->duration = FPS_24_DURATION; if( this->chroma_filter && !this->cheap_mode ) - apply_chroma_filter( deinterlaced_frame->base[0], deinterlaced_frame->pitches[0], + apply_chroma_filter( deinterlaced_frame->base[0], deinterlaced_frame->pitches[0], frame->width, frame->height / scaler ); skip = deinterlaced_frame->draw(deinterlaced_frame, stream); } else { @@ -680,15 +680,15 @@ static int deinterlace_build_output_field( deinterlaced_frame->pts = pts; deinterlaced_frame->duration = duration; if( this->chroma_filter && !this->cheap_mode && !deinterlaced_frame->bad_frame ) - apply_chroma_filter( deinterlaced_frame->base[0], deinterlaced_frame->pitches[0], + apply_chroma_filter( deinterlaced_frame->base[0], deinterlaced_frame->pitches[0], frame->width, frame->height / scaler ); skip = deinterlaced_frame->draw(deinterlaced_frame, stream); } - + /* _x_post_frame_copy_up(frame, deinterlaced_frame); */ deinterlaced_frame->free(deinterlaced_frame); pthread_mutex_lock (&this->lock); - + return skip; } @@ -705,7 +705,7 @@ static int deinterlace_draw(vo_frame_t *frame, xine_stream_t *stream) orig_frame = frame; _x_post_frame_copy_down(frame, frame->next); frame = frame->next; - + /* update tvtime context and method */ pthread_mutex_lock (&this->lock); if( this->tvtime_changed ) { @@ -716,8 +716,8 @@ static int deinterlace_draw(vo_frame_t *frame, xine_stream_t *stream) else this->tvtime->curmethod = NULL; - port->original_port->set_property(port->original_port, - XINE_PARAM_VO_DEINTERLACE, + port->original_port->set_property(port->original_port, + XINE_PARAM_VO_DEINTERLACE, !this->cur_method); this->tvtime_changed = 0; @@ -736,11 +736,11 @@ static int deinterlace_draw(vo_frame_t *frame, xine_stream_t *stream) lprintf("frame flags pf: %d rff: %d tff: %d duration: %d\n", frame->progressive_frame, frame->repeat_first_field, frame->top_field_first, frame->duration); - + /* detect special rff patterns */ this->rff_pattern = this->rff_pattern << 1; this->rff_pattern |= !!frame->repeat_first_field; - + if( ((this->rff_pattern & 0xff) == 0xaa || (this->rff_pattern & 0xff) == 0x55) ) { /* @@ -752,7 +752,7 @@ static int deinterlace_draw(vo_frame_t *frame, xine_stream_t *stream) /* using frame->progressive_frame may help displaying still menus. * however, it is known that some rare material set it wrong. - * + * * we also assume that repeat_first_field is progressive (it doesn't * make much sense to display interlaced fields out of order) */ @@ -760,8 +760,8 @@ static int deinterlace_draw(vo_frame_t *frame, xine_stream_t *stream) (frame->repeat_first_field || frame->progressive_frame) ) { progressive = 1; } - - if( !frame->bad_frame && + + if( !frame->bad_frame && (frame->flags & VO_INTERLACED_FLAG) && this->tvtime->curmethod ) { @@ -773,17 +773,17 @@ static int deinterlace_draw(vo_frame_t *frame, xine_stream_t *stream) yuy2_frame = port->original_port->get_frame(port->original_port, frame->width, frame->height, frame->ratio, XINE_IMGFMT_YUY2, frame->flags | VO_BOTH_FIELDS); _x_post_frame_copy_down(frame, yuy2_frame); - + /* the logic for deciding upsampling to use comes from: * http://www.hometheaterhifi.com/volume_8_2/dvd-benchmark-special-report-chroma-bug-4-2001.html */ - yv12_to_yuy2(frame->base[0], frame->pitches[0], - frame->base[1], frame->pitches[1], - frame->base[2], frame->pitches[2], + yv12_to_yuy2(frame->base[0], frame->pitches[0], + frame->base[1], frame->pitches[1], + frame->base[2], frame->pitches[2], yuy2_frame->base[0], yuy2_frame->pitches[0], - frame->width, frame->height, + frame->width, frame->height, frame->progressive_frame || progressive ); - + } else { yuy2_frame = frame; yuy2_frame->lock(yuy2_frame); @@ -793,10 +793,10 @@ static int deinterlace_draw(vo_frame_t *frame, xine_stream_t *stream) pthread_mutex_lock (&this->lock); /* check if frame format changed */ for(i = 0; i < NUM_RECENT_FRAMES; i++ ) { - if( this->recent_frame[i] && - (this->recent_frame[i]->width != frame->width || - this->recent_frame[i]->height != frame->height || - this->recent_frame[i]->format != yuy2_frame->format ) ) { + if( this->recent_frame[i] && + (this->recent_frame[i]->width != frame->width || + this->recent_frame[i]->height != frame->height || + this->recent_frame[i]->format != yuy2_frame->format ) ) { this->recent_frame[i]->free(this->recent_frame[i]); this->recent_frame[i] = NULL; } @@ -809,10 +809,10 @@ static int deinterlace_draw(vo_frame_t *frame, xine_stream_t *stream) framerate_mode = FRAMERATE_HALF_TFF; this->tvtime->pulldown_alg = PULLDOWN_NONE; } - + if( framerate_mode == FRAMERATE_FULL ) { int top_field_first = frame->top_field_first; - + /* if i understood mpeg2 specs correctly, top_field_first * shall be zero for field pictures and the output order * is the same that the fields are decoded. @@ -824,7 +824,7 @@ static int deinterlace_draw(vo_frame_t *frame, xine_stream_t *stream) if ( (frame->flags & VO_BOTH_FIELDS) != VO_BOTH_FIELDS ) { top_field_first = (frame->flags & VO_TOP_FIELD) ? 1 : 0; } - + if ( top_field_first ) { fields[0] = 0; fields[1] = 1; @@ -837,8 +837,8 @@ static int deinterlace_draw(vo_frame_t *frame, xine_stream_t *stream) } else if ( framerate_mode == FRAMERATE_HALF_BFF ) { fields[0] = 1; } - - + + if( progressive ) { /* If the previous field was interlaced and this one is progressive @@ -850,10 +850,10 @@ static int deinterlace_draw(vo_frame_t *frame, xine_stream_t *stream) * duration is used in the calculation because the generated frame * represents the second half of the previous frame. */ - if (this->recent_frame[0] && !this->recent_frame[0]->progressive_frame && + if (this->recent_frame[0] && !this->recent_frame[0]->progressive_frame && this->tvtime->curmethod->delaysfield) { - skip = deinterlace_build_output_field( + skip = deinterlace_build_output_field( this, port, stream, frame, yuy2_frame, fields[0], 0, @@ -879,19 +879,19 @@ static int deinterlace_draw(vo_frame_t *frame, xine_stream_t *stream) /* Build the output from the first field. */ if ( !(this->recent_frame[0] && this->recent_frame[0]->progressive_frame && this->tvtime->curmethod->delaysfield) ) { - skip = deinterlace_build_output_field( + skip = deinterlace_build_output_field( this, port, stream, frame, yuy2_frame, fields[0], 0, frame->pts, (framerate_mode == FRAMERATE_FULL) ? frame->duration/2 : frame->duration, 0); - } + } if( framerate_mode == FRAMERATE_FULL ) { - + /* Build the output from the second field. */ - skip = deinterlace_build_output_field( + skip = deinterlace_build_output_field( this, port, stream, frame, yuy2_frame, fields[1], 1, @@ -901,7 +901,7 @@ static int deinterlace_draw(vo_frame_t *frame, xine_stream_t *stream) } } - /* don't drop frames when pulldown mode is enabled. otherwise + /* don't drop frames when pulldown mode is enabled. otherwise * pulldown detection fails (yo-yo effect has also been seen) */ if( this->pulldown ) @@ -909,7 +909,7 @@ static int deinterlace_draw(vo_frame_t *frame, xine_stream_t *stream) /* store back progressive flag for frame history */ yuy2_frame->progressive_frame = progressive; - + /* keep track of recent frames */ i = NUM_RECENT_FRAMES-1; if( this->recent_frame[i] ) @@ -930,8 +930,8 @@ static int deinterlace_draw(vo_frame_t *frame, xine_stream_t *stream) } else { skip = frame->draw(frame, stream); } - + _x_post_frame_copy_up(orig_frame, frame); - + return skip; } diff --git a/src/post/goom/xine_goom.c b/src/post/goom/xine_goom.c index db7079423..72692ffe1 100644 --- a/src/post/goom/xine_goom.c +++ b/src/post/goom/xine_goom.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -71,19 +71,19 @@ struct post_plugin_goom_s { /* private data */ xine_video_port_t *vo_port; post_out_t video_output; - + post_class_goom_t *class; - + /* private metronom for syncing the video */ metronom_t *metronom; - + /* goom context */ PluginInfo *goom; - - int data_idx; + + int data_idx; gint16 data [2][NUMSAMPLES]; audio_buffer_t buf; /* dummy buffer just to hold a copy of audio data */ - + int channels; int sample_rate; int samples_per_frame; @@ -99,7 +99,7 @@ struct post_plugin_goom_s { yuv_planes_t yuv; - + /* frame skipping */ int skip_frame; }; @@ -110,12 +110,12 @@ static void *goom_init_plugin(xine_t *xine, void *); /* plugin catalog information */ -static const post_info_t goom_special_info = { +static const post_info_t goom_special_info = { XINE_POST_TYPE_AUDIO_VISUALIZATION }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_POST | PLUGIN_MUST_PRELOAD, 9, "goom", XINE_VERSION_CODE, &goom_special_info, &goom_init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; @@ -144,7 +144,7 @@ static void goom_port_put_buffer (xine_audio_port_t *this, audio_buffer_t *buf, static void fps_changed_cb(void *data, xine_cfg_entry_t *cfg) { post_class_goom_t *class = (post_class_goom_t*) data; - + if(class->ip) { post_plugin_goom_t *this = class->ip; @@ -160,7 +160,7 @@ static void fps_changed_cb(void *data, xine_cfg_entry_t *cfg) { static void width_changed_cb(void *data, xine_cfg_entry_t *cfg) { post_class_goom_t *class = (post_class_goom_t*) data; - + if(class->ip) { post_plugin_goom_t *this = class->ip; this->width = cfg->num_value; @@ -169,7 +169,7 @@ static void width_changed_cb(void *data, xine_cfg_entry_t *cfg) { static void height_changed_cb(void *data, xine_cfg_entry_t *cfg) { post_class_goom_t *class = (post_class_goom_t*) data; - + if(class->ip) { post_plugin_goom_t *this = class->ip; this->height = cfg->num_value; @@ -178,7 +178,7 @@ static void height_changed_cb(void *data, xine_cfg_entry_t *cfg) { static void csc_method_changed_cb(void *data, xine_cfg_entry_t *cfg) { post_class_goom_t *class = (post_class_goom_t*) data; - + if(class->ip) { post_plugin_goom_t *this = class->ip; this->csc_method = cfg->num_value; @@ -192,14 +192,14 @@ static void *goom_init_plugin(xine_t *xine, void *data) if (!this) return NULL; - + this->class.open_plugin = goom_open_plugin; this->class.get_identifier = goom_get_identifier; this->class.get_description = goom_get_description; this->class.dispose = goom_class_dispose; this->ip = NULL; this->xine = xine; - + cfg = xine->config; cfg->register_num (cfg, "effects.goom.fps", FPS, @@ -212,12 +212,12 @@ static void *goom_init_plugin(xine_t *xine, void *data) _("goom image width"), _("The width in pixels of the image to be generated."), 10, width_changed_cb, this); - + cfg->register_num (cfg, "effects.goom.height", GOOM_HEIGHT, _("goom image height"), _("The height in pixels of the image to be generated."), 10, height_changed_cb, this); - + cfg->register_enum (cfg, "effects.goom.csc_method", 0, goom_csc_methods, @@ -246,34 +246,34 @@ static post_plugin_t *goom_open_plugin(post_class_t *class_gen, int inputs, free(this); return NULL; } - + _x_post_init(&this->post, 1, 0); - + /* * Lookup config entries. */ this->class = class; class->ip = this; this->vo_port = video_target[0]; - + this->metronom = _x_metronom_init(1, 0, class->xine); lprintf("goom_open_plugin\n"); if(xine_config_lookup_entry(class->xine, "effects.goom.fps", - &fps_entry)) + &fps_entry)) fps_changed_cb(class, &fps_entry); if(xine_config_lookup_entry(class->xine, "effects.goom.width", - &width_entry)) + &width_entry)) width_changed_cb(class, &width_entry); if(xine_config_lookup_entry(class->xine, "effects.goom.height", - &height_entry)) + &height_entry)) height_changed_cb(class, &height_entry); if(xine_config_lookup_entry(class->xine, "effects.goom.csc_method", - &csc_method_entry)) + &csc_method_entry)) csc_method_changed_cb(class, &csc_method_entry); this->width_back = this->width; @@ -285,13 +285,13 @@ static post_plugin_t *goom_open_plugin(post_class_t *class_gen, int inputs, this->ratio = (double)this->width_back/(double)this->height_back; this->buf.mem = NULL; - this->buf.mem_size = 0; + this->buf.mem_size = 0; port = _x_post_intercept_audio_port(&this->post, audio_target[0], &input, &output); port->new_port.open = goom_port_open; port->new_port.close = goom_port_close; port->new_port.put_buffer = goom_port_put_buffer; - + outputv = &this->video_output; outputv->xine_out.name = "generated video"; outputv->xine_out.type = XINE_POST_DATA_VIDEO; @@ -299,7 +299,7 @@ static post_plugin_t *goom_open_plugin(post_class_t *class_gen, int inputs, outputv->xine_out.rewire = goom_rewire_video; outputv->post = &this->post; xine_list_push_back(this->post.output, outputv); - + this->post.xine_post.audio_input[0] = &port->new_port; this->post.dispose = goom_dispose; @@ -322,13 +322,13 @@ static void goom_class_dispose(post_class_t *class_gen) post_class_goom_t *this = (post_class_goom_t*) class_gen; this->xine->config->unregister_callback(this->xine->config, - "effects.goom.fps"); + "effects.goom.fps"); this->xine->config->unregister_callback(this->xine->config, - "effects.goom.width"); + "effects.goom.width"); this->xine->config->unregister_callback(this->xine->config, - "effects.goom.height"); + "effects.goom.height"); this->xine->config->unregister_callback(this->xine->config, - "effects.goom.csc_method"); + "effects.goom.csc_method"); free(class_gen); } @@ -358,7 +358,7 @@ static int goom_rewire_video(xine_post_out_t *output_gen, void *data) xine_video_port_t *old_port = *(xine_video_port_t **)output_gen->data; xine_video_port_t *new_port = (xine_video_port_t *)data; post_plugin_goom_t *this = (post_plugin_goom_t *)output->post; - + if (!data) return 0; /* register our stream at the new output port */ @@ -377,12 +377,12 @@ static int goom_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream, _x_post_rewire(&this->post); _x_post_inc_usage(port); - + port->stream = stream; port->bits = bits; port->rate = rate; port->mode = mode; - + this->channels = _x_ao_mode2channels(mode); this->sample_rate = rate; this->samples_per_frame = rate / this->fps; @@ -392,7 +392,7 @@ static int goom_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream, this->do_samples_skip = 0; this->left_to_read = NUMSAMPLES; - + (this->vo_port->open) (this->vo_port, XINE_ANON_STREAM); this->metronom->set_master(this->metronom, stream->metronom); @@ -407,18 +407,18 @@ static void goom_port_close(xine_audio_port_t *port_gen, xine_stream_t *stream ) free_yuv_planes(&this->yuv); port->stream = NULL; - + this->vo_port->close(this->vo_port, XINE_ANON_STREAM); this->metronom->set_master(this->metronom, NULL); - + port->original_port->close(port->original_port, stream ); - + _x_post_dec_usage(port); } -static void goom_port_put_buffer (xine_audio_port_t *port_gen, +static void goom_port_put_buffer (xine_audio_port_t *port_gen, audio_buffer_t *buf, xine_stream_t *stream) { - + post_audio_port_t *port = (post_audio_port_t *)port_gen; post_plugin_goom_t *this = (post_plugin_goom_t *)port->post; vo_frame_t *frame; @@ -431,28 +431,28 @@ static void goom_port_put_buffer (xine_audio_port_t *port_gen, int width, height; int current_sample = 0; - + /* make a copy of buf data for private use */ if( this->buf.mem_size < buf->mem_size ) { this->buf.mem = realloc(this->buf.mem, buf->mem_size); this->buf.mem_size = buf->mem_size; } - memcpy(this->buf.mem, buf->mem, + memcpy(this->buf.mem, buf->mem, buf->num_frames*this->channels*((port->bits == 8)?1:2)); this->buf.num_frames = buf->num_frames; - + /* pass data to original port */ - port->original_port->put_buffer(port->original_port, buf, stream); - + port->original_port->put_buffer(port->original_port, buf, stream); + /* we must not use original data anymore, it should have already being moved * to the fifo of free audio buffers. just use our private copy instead. */ - buf = &this->buf; + buf = &this->buf; j = (this->channels >= 2) ? 1 : 0; while (current_sample < buf->num_frames) { - + if (this->do_samples_skip) { if (current_sample + this->left_to_read > buf->num_frames) { this->left_to_read -= (buf->num_frames-current_sample); @@ -461,14 +461,14 @@ static void goom_port_put_buffer (xine_audio_port_t *port_gen, current_sample+=this->left_to_read; this->left_to_read = NUMSAMPLES; this->do_samples_skip = 0; - + } } else { if( port->bits == 8 ) { data8 = (int8_t *)buf->mem; data8 += current_sample * this->channels; - + /* scale 8 bit data to 16 bits and convert to signed as well */ for ( i=current_sample ; this->data_idx < NUMSAMPLES && i < buf->num_frames; i++, this->data_idx++,data8 += this->channels) { @@ -507,13 +507,13 @@ static void goom_port_put_buffer (xine_audio_port_t *port_gen, frame = this->vo_port->get_frame (this->vo_port, this->width_back, this->height_back, this->ratio, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); - + frame->extra_info->invalid = 1; - + frame->duration = 90000 * this->samples_per_frame / this->sample_rate; frame->pts = pts; this->metronom->got_video_frame(this->metronom, frame); - + if (!this->skip_frame) { /* Try to be fast */ goom_frame = (uint8_t *)goom_update (this->goom, this->data, 0, 0, NULL, NULL); @@ -521,13 +521,13 @@ static void goom_port_put_buffer (xine_audio_port_t *port_gen, dest_ptr = frame -> base[0]; goom_frame_end = goom_frame + 4 * (this->width_back * this->height_back); - if ((this->csc_method == 1) && + if ((this->csc_method == 1) && (xine_mm_accel() & MM_ACCEL_X86_MMX)) { int plane_ptr = 0; while (goom_frame < goom_frame_end) { uint8_t r, g, b; - + /* don't take endianness into account since MMX is only available * on Intel processors */ b = *goom_frame; goom_frame++; @@ -563,7 +563,7 @@ static void goom_port_put_buffer (xine_audio_port_t *port_gen, g2 = *goom_frame; goom_frame++; r2 = *goom_frame; goom_frame += 2; #endif - + *dest_ptr = COMPUTE_Y(r1, g1, b1); dest_ptr++; *dest_ptr = COMPUTE_U(r1, g1, b1); @@ -585,7 +585,7 @@ static void goom_port_put_buffer (xine_audio_port_t *port_gen, } frame->free(frame); - + width = this->width; height = this->height; if ((width != this->width_back) || (height != this->height_back)) { diff --git a/src/post/mosaico/mosaico.c b/src/post/mosaico/mosaico.c index c9ac9ab4c..ec46e1ca0 100644 --- a/src/post/mosaico/mosaico.c +++ b/src/post/mosaico/mosaico.c @@ -1,23 +1,23 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA */ - + /* * simple video mosaico plugin */ @@ -44,7 +44,7 @@ static void *mosaico_init_plugin(xine_t *xine, void *); static const post_info_t mosaico_special_info = { XINE_POST_TYPE_VIDEO_COMPOSE }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_POST, 9, "mosaico", XINE_VERSION_CODE, &mosaico_special_info, &mosaico_init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; @@ -84,9 +84,9 @@ struct mosaico_pip_s { }; struct post_mosaico_s { - post_plugin_t post; + post_plugin_t post; xine_post_in_t parameter_input; - + mosaico_pip_t *pip; int64_t vpts_limit; pthread_cond_t vpts_limit_changed; @@ -130,7 +130,7 @@ static void *mosaico_init_plugin(xine_t *xine, void *data) if (!this) return NULL; - + this->class.open_plugin = mosaico_open_plugin; this->class.get_identifier = mosaico_get_identifier; this->class.get_description = mosaico_get_description; @@ -149,17 +149,17 @@ static post_plugin_t *mosaico_open_plugin(post_class_t *class_gen, int inputs, xine_post_in_t *input_api; post_out_t *output; post_video_port_t *port; - static xine_post_api_t post_api = + static xine_post_api_t post_api = { mosaico_set_parameters, mosaico_get_parameters, mosaico_get_param_descr, mosaico_get_help }; int i; - + lprintf("mosaico open\n"); if (inputs < 2 || !this || !video_target || !video_target[0]) { free(this); return NULL; } - + _x_post_init(&this->post, 0, inputs); this->pip = (mosaico_pip_t *)calloc((inputs - 1), sizeof(mosaico_pip_t)); @@ -167,7 +167,7 @@ static post_plugin_t *mosaico_open_plugin(post_class_t *class_gen, int inputs, pthread_cond_init(&this->vpts_limit_changed, NULL); pthread_mutex_init(&this->mutex, NULL); - + /* the port for the background video */ port = _x_post_intercept_video_port(&this->post, video_target[0], &input, &output); port->intercept_frame = mosaico_intercept_frame; @@ -183,7 +183,7 @@ static post_plugin_t *mosaico_open_plugin(post_class_t *class_gen, int inputs, this->pip[i].w = 150; this->pip[i].h = 150; asprintf(&(this->pip[i].input_name), "video in %d", i+1); - + port = _x_post_intercept_video_port(&this->post, video_target[0], &input, NULL); port->new_port.close = mosaico_close; port->intercept_frame = mosaico_intercept_frame; @@ -224,7 +224,7 @@ static void mosaico_class_dispose(post_class_t *class_gen) static void mosaico_dispose(post_plugin_t *this_gen) { post_mosaico_t *this = (post_mosaico_t *)this_gen; - + if (_x_post_dispose(this_gen)) { int i; for (i = 0; i < this->pip_count; i++) @@ -246,7 +246,7 @@ static int mosaico_set_parameters(xine_post_t *this_gen, void *param_gen) { post_mosaico_t *this = (post_mosaico_t *)this_gen; mosaico_parameters_t *param = (mosaico_parameters_t *)param_gen; - + if (param->pip_num > this->pip_count) return 0; this->pip[param->pip_num - 1].x = param->x; this->pip[param->pip_num - 1].y = param->y; @@ -259,7 +259,7 @@ static int mosaico_get_parameters(xine_post_t *this_gen, void *param_gen) { post_mosaico_t *this = (post_mosaico_t *)this_gen; mosaico_parameters_t *param = (mosaico_parameters_t *)param_gen; - + if (param->pip_num > this->pip_count || param->pip_num < 1) param->pip_num = 1; param->x = this->pip[param->pip_num - 1].x; @@ -291,7 +291,7 @@ static void mosaico_close(xine_video_port_t *port_gen, xine_stream_t *stream) for (pip_num = 0; pip_num < this->pip_count; pip_num++) if (this->post.xine_post.video_input[pip_num+1] == port_gen) break; - + pthread_mutex_lock(&this->mutex); free_frame = this->pip[pip_num].frame; this->pip[pip_num].frame = NULL; @@ -320,11 +320,11 @@ static void frame_copy_content(vo_frame_t *to, vo_frame_t *from) case XINE_IMGFMT_YUY2: /* TODO: implement conversion to YV12 or implement support to paste * frames of different types together */ - break; - + break; + case XINE_IMGFMT_YV12: /* Y */ - size = to->pitches[0] * to->height; + size = to->pitches[0] * to->height; xine_fast_memcpy(to->base[0], from->base[0], size); /* U */ @@ -349,7 +349,7 @@ static void frame_paste(post_mosaico_t *this, vo_frame_t *background, int pip_nu unsigned long i, j; if (!this->pip[pip_num].frame) return; - + target_width = this->pip[pip_num].w; target_height = this->pip[pip_num].h; background_width = background->width; @@ -364,8 +364,8 @@ static void frame_paste(post_mosaico_t *this, vo_frame_t *background, int pip_nu switch (this->pip[pip_num].frame->format) { case XINE_IMGFMT_YUY2: /* TODO: implement YUY2 */ - break; - + break; + case XINE_IMGFMT_YV12: /* Y */ target_offset = 0; @@ -382,7 +382,7 @@ static void frame_paste(post_mosaico_t *this, vo_frame_t *background, int pip_nu pos = pos_y * background_width + pos_x; target_width = (target_width + 1) / 2; target_height = (target_height + 1) / 2; - + /* U */ target_offset = 0; for (j = 0; j < target_height; j++, target_offset += (background_width - target_width)) @@ -390,7 +390,7 @@ static void frame_paste(post_mosaico_t *this, vo_frame_t *background, int pip_nu source_offset = ((i * scale_x) >> shift_x) + (((j * scale_y) >> shift_y) * source_width); background->base[1][pos + target_offset] = this->pip[pip_num].frame->base[1][source_offset]; } - + /* V */ target_offset = 0; for (j = 0; j < target_height; j++, target_offset += (background_width - target_width)) @@ -398,7 +398,7 @@ static void frame_paste(post_mosaico_t *this, vo_frame_t *background, int pip_nu source_offset = ((i * scale_x) >> shift_x) + (((j * scale_y) >> shift_y) * source_width); background->base[2][pos + target_offset] = this->pip[pip_num].frame->base[2][source_offset]; } - + break; } } @@ -411,47 +411,47 @@ static int mosaico_draw_background(vo_frame_t *frame, xine_stream_t *stream) int pip_num, skip; pthread_mutex_lock(&this->mutex); - + if (frame->bad_frame) { _x_post_frame_copy_down(frame, frame->next); skip = frame->next->draw(frame->next, stream); _x_post_frame_copy_up(frame, frame->next); - + this->vpts_limit = frame->vpts + frame->duration; if (skip) { this->skip = skip; this->skip_vpts = frame->vpts; } else this->skip = 0; - + pthread_mutex_unlock(&this->mutex); pthread_cond_broadcast(&this->vpts_limit_changed); - + return skip; } - + background = port->original_port->get_frame(port->original_port, frame->width, frame->height, frame->ratio, frame->format, frame->flags | VO_BOTH_FIELDS); _x_post_frame_copy_down(frame, background); frame_copy_content(background, frame); - + for (pip_num = 0; pip_num < this->pip_count; pip_num++) frame_paste(this, background, pip_num); - + skip = background->draw(background, stream); _x_post_frame_copy_up(frame, background); this->vpts_limit = background->vpts + background->duration; background->free(background); - + if (skip) { this->skip = skip; this->skip_vpts = frame->vpts; } else this->skip = 0; - + pthread_mutex_unlock(&this->mutex); pthread_cond_broadcast(&this->vpts_limit_changed); - + return skip; } @@ -465,11 +465,11 @@ static int mosaico_draw(vo_frame_t *frame, xine_stream_t *stream) for (pip_num = 0; pip_num < this->pip_count; pip_num++) if (this->post.xine_post.video_input[pip_num+1] == frame->port) break; _x_assert(pip_num < this->pip_count); - + frame->lock(frame); - + pthread_mutex_lock(&this->mutex); - + /* the original output will never see this frame again */ _x_post_frame_u_turn(frame, stream); while (frame->vpts > this->vpts_limit || !this->vpts_limit) @@ -478,12 +478,12 @@ static int mosaico_draw(vo_frame_t *frame, xine_stream_t *stream) free_frame = this->pip[pip_num].frame; if (port->stream) this->pip[pip_num].frame = frame; - + if (this->skip && frame->vpts <= this->skip_vpts) skip = this->skip; else skip = 0; - + pthread_mutex_unlock(&this->mutex); if (free_frame) @@ -492,6 +492,6 @@ static int mosaico_draw(vo_frame_t *frame, xine_stream_t *stream) /* do not keep this frame when no stream is connected to us, * otherwise, this frame might never get freed */ frame->free(frame); - + return skip; } diff --git a/src/post/mosaico/switch.c b/src/post/mosaico/switch.c index a01c821b2..7cba7c998 100644 --- a/src/post/mosaico/switch.c +++ b/src/post/mosaico/switch.c @@ -1,23 +1,23 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA */ - + /* * simple switch video post plugin */ @@ -40,7 +40,7 @@ static void *switch_init_plugin(xine_t *xine, void *); static const post_info_t switch_special_info = { XINE_POST_TYPE_VIDEO_COMPOSE }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_POST, 9, "switch", XINE_VERSION_CODE, &switch_special_info, &switch_init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; @@ -67,7 +67,7 @@ struct post_class_switch_s { struct post_switch_s { post_plugin_t post; xine_post_in_t parameter_input; - + int64_t vpts_limit; pthread_cond_t display_condition_changed; int64_t skip_vpts; @@ -105,7 +105,7 @@ static void *switch_init_plugin(xine_t *xine, void *data) if (!this) return NULL; - + this->class.open_plugin = switch_open_plugin; this->class.get_identifier = switch_get_identifier; this->class.get_description = switch_get_description; @@ -127,28 +127,28 @@ static post_plugin_t *switch_open_plugin(post_class_t *class_gen, int inputs, static xine_post_api_t post_api = { switch_set_parameters, switch_get_parameters, switch_get_param_descr, switch_get_help }; int i; - + lprintf("switch open\n"); if (inputs < 2 || !this || !video_target || !video_target[0]) { free(this); return NULL; } - + _x_post_init(&this->post, 0, inputs); this->source_count = inputs; this->selected_source = 1; - + pthread_cond_init(&this->display_condition_changed, NULL); pthread_mutex_init(&this->mutex, NULL); - + port = _x_post_intercept_video_port(&this->post, video_target[0], &input, &output); port->new_frame->draw = switch_draw; port->port_lock = &this->mutex; port->frame_lock = &this->mutex; this->post.xine_post.video_input[0] = &port->new_port; - + for (i = 1; i < inputs; i++) { port = _x_post_intercept_video_port(&this->post, video_target[0], &input, NULL); port->new_frame->draw = switch_draw; @@ -156,7 +156,7 @@ static post_plugin_t *switch_open_plugin(post_class_t *class_gen, int inputs, port->frame_lock = &this->mutex; this->post.xine_post.video_input[i] = &port->new_port; } - + input_api = &this->parameter_input; input_api->name = "parameters"; input_api->type = XINE_POST_DATA_PARAMETERS; @@ -187,7 +187,7 @@ static void switch_class_dispose(post_class_t *class_gen) static void switch_dispose(post_plugin_t *this_gen) { post_switch_t *this = (post_switch_t *)this_gen; - + if (_x_post_dispose(this_gen)) { pthread_cond_destroy(&this->display_condition_changed); pthread_mutex_destroy(&this->mutex); @@ -205,7 +205,7 @@ static int switch_set_parameters(xine_post_t *this_gen, void *param_gen) { post_switch_t *this = (post_switch_t *)this_gen; switch_parameter_t *param = (switch_parameter_t *)param_gen; - + if (param->select > this->source_count) return 0; pthread_mutex_lock(&this->mutex); this->selected_source = param->select; @@ -218,7 +218,7 @@ static int switch_get_parameters(xine_post_t *this_gen, void *param_gen) { post_switch_t *this = (post_switch_t *)this_gen; switch_parameter_t *param = (switch_parameter_t *)param_gen; - + param->select = this->selected_source; return 1; } @@ -241,7 +241,7 @@ static int switch_draw(vo_frame_t *frame, xine_stream_t *stream) for (source_num = 1; source_num <= this->source_count; source_num++) if (this->post.xine_post.video_input[source_num-1] == frame->port) break; _x_assert(source_num <= this->source_count); - + pthread_mutex_lock(&this->mutex); /* the original output will probably never see this frame again */ _x_post_frame_u_turn(frame, stream); @@ -268,6 +268,6 @@ static int switch_draw(vo_frame_t *frame, xine_stream_t *stream) skip = 0; pthread_mutex_unlock(&this->mutex); } - + return skip; } diff --git a/src/post/planar/boxblur.c b/src/post/planar/boxblur.c index 517cec489..ceeba3b40 100644 --- a/src/post/planar/boxblur.c +++ b/src/post/planar/boxblur.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -36,7 +36,7 @@ void *boxblur_init_plugin(xine_t *xine, void *); typedef struct post_plugin_boxblur_s post_plugin_boxblur_t; /* - * this is the struct used by "parameters api" + * this is the struct used by "parameters api" */ typedef struct boxblur_parameters_s { @@ -51,13 +51,13 @@ typedef struct boxblur_parameters_s { * description of params struct */ START_PARAM_DESCR( boxblur_parameters_t ) -PARAM_ITEM( POST_PARAM_TYPE_INT, luma_radius, NULL, 0, 10, 0, +PARAM_ITEM( POST_PARAM_TYPE_INT, luma_radius, NULL, 0, 10, 0, "radius of luma blur" ) -PARAM_ITEM( POST_PARAM_TYPE_INT, luma_power, NULL, 0, 10, 0, +PARAM_ITEM( POST_PARAM_TYPE_INT, luma_power, NULL, 0, 10, 0, "power of luma blur" ) -PARAM_ITEM( POST_PARAM_TYPE_INT, chroma_radius, NULL, -1, 10, 0, +PARAM_ITEM( POST_PARAM_TYPE_INT, chroma_radius, NULL, -1, 10, 0, "radius of chroma blur (-1 = same as luma)" ) -PARAM_ITEM( POST_PARAM_TYPE_INT, chroma_power, NULL, -1, 10, 0, +PARAM_ITEM( POST_PARAM_TYPE_INT, chroma_power, NULL, -1, 10, 0, "power of chroma blur (-1 = same as luma)" ) END_PARAM_DESCR( param_descr ) @@ -96,7 +96,7 @@ static int get_parameters (xine_post_t *this_gen, void *param_gen) { return 1; } - + static xine_post_api_descr_t * get_param_descr (void) { return ¶m_descr; } @@ -144,7 +144,7 @@ void *boxblur_init_plugin(xine_t *xine, void *data) if (!class) return NULL; - + class->open_plugin = boxblur_open_plugin; class->get_identifier = boxblur_get_identifier; class->get_description = boxblur_get_description; @@ -163,14 +163,14 @@ static post_plugin_t *boxblur_open_plugin(post_class_t *class_gen, int inputs, xine_post_in_t *input_api; post_out_t *output; post_video_port_t *port; - + if (!this || !video_target || !video_target[0]) { free(this); return NULL; } - + _x_post_init(&this->post, 0, 1); - + this->params.luma_radius = 2; this->params.luma_power = 1; this->params.chroma_radius = -1; @@ -181,7 +181,7 @@ static post_plugin_t *boxblur_open_plugin(post_class_t *class_gen, int inputs, port = _x_post_intercept_video_port(&this->post, video_target[0], &input, &output); port->intercept_frame = boxblur_intercept_frame; port->new_frame->draw = boxblur_draw; - + input_api = &this->params_input; input_api->name = "parameters"; input_api->type = XINE_POST_DATA_PARAMETERS; @@ -190,11 +190,11 @@ static post_plugin_t *boxblur_open_plugin(post_class_t *class_gen, int inputs, input->xine_in.name = "video"; output->xine_out.name = "boxblured video"; - + this->post.xine_post.video_input[0] = &port->new_port; - + this->post.dispose = boxblur_dispose; - + return &this->post; } @@ -217,7 +217,7 @@ static void boxblur_class_dispose(post_class_t *class_gen) static void boxblur_dispose(post_plugin_t *this_gen) { post_plugin_boxblur_t *this = (post_plugin_boxblur_t *)this_gen; - + if (_x_post_dispose(this_gen)) { pthread_mutex_destroy(&this->lock); free(this); @@ -262,7 +262,7 @@ static inline void blur(uint8_t *dst, uint8_t *src, int w, int radius, int dstSt static inline void blur2(uint8_t *dst, uint8_t *src, int w, int radius, int power, int dstStep, int srcStep){ uint8_t temp[2][4096]; uint8_t *a= temp[0], *b=temp[1]; - + if(radius){ blur(a, src, w, radius, 1, srcStep); for(; power>2; power--){ @@ -286,9 +286,9 @@ static inline void blur2(uint8_t *dst, uint8_t *src, int w, int radius, int powe static void hBlur(uint8_t *dst, uint8_t *src, int w, int h, int dstStride, int srcStride, int radius, int power){ int y; - + if(radius==0 && dst==src) return; - + for(y=0; y<h; y++){ blur2(dst + y*dstStride, src + y*srcStride, w, radius, power, 1, 1); } @@ -296,7 +296,7 @@ static void hBlur(uint8_t *dst, uint8_t *src, int w, int h, int dstStride, int s static void vBlur(uint8_t *dst, uint8_t *src, int w, int h, int dstStride, int srcStride, int radius, int power){ int x; - + if(radius==0 && dst==src) return; for(x=0; x<w; x++){ @@ -345,25 +345,25 @@ static int boxblur_draw(vo_frame_t *frame, xine_stream_t *stream) pthread_mutex_lock (&this->lock); - chroma_radius = (this->params.chroma_radius != -1) ? this->params.chroma_radius : + chroma_radius = (this->params.chroma_radius != -1) ? this->params.chroma_radius : this->params.luma_radius; - chroma_power = (this->params.chroma_power != -1) ? this->params.chroma_power : + chroma_power = (this->params.chroma_power != -1) ? this->params.chroma_power : this->params.luma_power; cw = yv12_frame->width/2; ch = yv12_frame->height/2; - hBlur(out_frame->base[0], yv12_frame->base[0], yv12_frame->width, yv12_frame->height, + hBlur(out_frame->base[0], yv12_frame->base[0], yv12_frame->width, yv12_frame->height, out_frame->pitches[0], yv12_frame->pitches[0], this->params.luma_radius, this->params.luma_power); - hBlur(out_frame->base[1], yv12_frame->base[1], cw,ch, + hBlur(out_frame->base[1], yv12_frame->base[1], cw,ch, out_frame->pitches[1], yv12_frame->pitches[1], chroma_radius, chroma_power); - hBlur(out_frame->base[2], yv12_frame->base[2], cw,ch, + hBlur(out_frame->base[2], yv12_frame->base[2], cw,ch, out_frame->pitches[2], yv12_frame->pitches[2], chroma_radius, chroma_power); - vBlur(out_frame->base[0], out_frame->base[0], yv12_frame->width, yv12_frame->height, + vBlur(out_frame->base[0], out_frame->base[0], yv12_frame->width, yv12_frame->height, out_frame->pitches[0], out_frame->pitches[0], this->params.luma_radius, this->params.luma_power); - vBlur(out_frame->base[1], out_frame->base[1], cw,ch, + vBlur(out_frame->base[1], out_frame->base[1], cw,ch, out_frame->pitches[1], out_frame->pitches[1], chroma_radius, chroma_power); - vBlur(out_frame->base[2], out_frame->base[2], cw,ch, + vBlur(out_frame->base[2], out_frame->base[2], cw,ch, out_frame->pitches[2], out_frame->pitches[2], chroma_radius, chroma_power); pthread_mutex_unlock (&this->lock); diff --git a/src/post/planar/denoise3d.c b/src/post/planar/denoise3d.c index 21b58dbf9..2073151b4 100644 --- a/src/post/planar/denoise3d.c +++ b/src/post/planar/denoise3d.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -44,7 +44,7 @@ typedef struct post_plugin_denoise3d_s post_plugin_denoise3d_t; /* - * this is the struct used by "parameters api" + * this is the struct used by "parameters api" */ typedef struct denoise3d_parameters_s { @@ -58,11 +58,11 @@ typedef struct denoise3d_parameters_s { * description of params struct */ START_PARAM_DESCR( denoise3d_parameters_t ) -PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, luma, NULL, 0, 10, 0, +PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, luma, NULL, 0, 10, 0, "spatial luma strength" ) -PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, chroma, NULL, 0, 10, 0, +PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, chroma, NULL, 0, 10, 0, "spatial chroma strength" ) -PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, time, NULL, 0, 10, 0, +PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, time, NULL, 0, 10, 0, "temporal strength" ) END_PARAM_DESCR( param_descr ) @@ -129,7 +129,7 @@ static int get_parameters (xine_post_t *this_gen, void *param_gen) { return 1; } - + static xine_post_api_descr_t * get_param_descr (void) { return ¶m_descr; } @@ -184,7 +184,7 @@ void *denoise3d_init_plugin(xine_t *xine, void *data) if (!class) return NULL; - + class->open_plugin = denoise3d_open_plugin; class->get_identifier = denoise3d_get_identifier; class->get_description = denoise3d_get_description; @@ -203,14 +203,14 @@ static post_plugin_t *denoise3d_open_plugin(post_class_t *class_gen, int inputs, xine_post_in_t *input_api; post_out_t *output; post_video_port_t *port; - + if (!this || !video_target || !video_target[0]) { free(this); return NULL; } _x_post_init(&this->post, 0, 1); - + this->params.luma = PARAM1_DEFAULT; this->params.chroma = PARAM2_DEFAULT; this->params.time = PARAM3_DEFAULT; @@ -222,7 +222,7 @@ static post_plugin_t *denoise3d_open_plugin(post_class_t *class_gen, int inputs, port->new_port.close = denoise3d_close; port->intercept_frame = denoise3d_intercept_frame; port->new_frame->draw = denoise3d_draw; - + input_api = &this->params_input; input_api->name = "parameters"; input_api->type = XINE_POST_DATA_PARAMETERS; @@ -231,13 +231,13 @@ static post_plugin_t *denoise3d_open_plugin(post_class_t *class_gen, int inputs, input->xine_in.name = "video"; output->xine_out.name = "denoise3d video"; - + this->post.xine_post.video_input[0] = &port->new_port; - + this->post.dispose = denoise3d_dispose; set_parameters ((xine_post_t *)this, &this->params); - + return &this->post; } @@ -260,7 +260,7 @@ static void denoise3d_class_dispose(post_class_t *class_gen) static void denoise3d_dispose(post_plugin_t *this_gen) { post_plugin_denoise3d_t *this = (post_plugin_denoise3d_t *)this_gen; - + if (_x_post_dispose(this_gen)) { pthread_mutex_destroy(&this->lock); free(this); @@ -292,10 +292,10 @@ static int denoise3d_intercept_frame(post_video_port_t *port, vo_frame_t *frame) #define LowPass(Prev, Curr, Coef) (((Prev)*Coef[Prev - Curr] + (Curr)*(65536-(Coef[Prev - Curr]))) / 65536) -static void deNoise(unsigned char *Frame, - unsigned char *FramePrev, - unsigned char *FrameDest, - unsigned char *LineAnt, +static void deNoise(unsigned char *Frame, + unsigned char *FramePrev, + unsigned char *FrameDest, + unsigned char *LineAnt, int W, int H, int sStride, int pStride, int dStride, int *Horizontal, int *Vertical, int *Temporal) { @@ -353,15 +353,15 @@ static int denoise3d_draw(vo_frame_t *frame, xine_stream_t *stream) yv12_frame = port->original_port->get_frame(port->original_port, frame->width, frame->height, frame->ratio, XINE_IMGFMT_YV12, frame->flags | VO_BOTH_FIELDS); - + _x_post_frame_copy_down(frame, yv12_frame); - + yuy2_to_yv12(frame->base[0], frame->pitches[0], yv12_frame->base[0], yv12_frame->pitches[0], yv12_frame->base[1], yv12_frame->pitches[1], yv12_frame->base[2], yv12_frame->pitches[2], frame->width, frame->height); - + } else { yv12_frame = frame; yv12_frame->lock(yv12_frame); @@ -401,7 +401,7 @@ static int denoise3d_draw(vo_frame_t *frame, xine_stream_t *stream) pthread_mutex_unlock (&this->lock); skip = out_frame->draw(out_frame, stream); - + _x_post_frame_copy_up(frame, out_frame); out_frame->free(out_frame); diff --git a/src/post/planar/eq.c b/src/post/planar/eq.c index 45bc43463..73607b8a1 100644 --- a/src/post/planar/eq.c +++ b/src/post/planar/eq.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -47,7 +47,7 @@ static void process_MMX(unsigned char *dest, int dstride, unsigned char *src, in brvec[0] = brvec[1] = brvec[2] = brvec[3] = brightness; contvec[0] = contvec[1] = contvec[2] = contvec[3] = contrast; - + while (h--) { asm volatile ( "movq (%5), %%mm3 \n\t" @@ -125,7 +125,7 @@ void *eq_init_plugin(xine_t *xine, void *); typedef struct post_plugin_eq_s post_plugin_eq_t; /* - * this is the struct used by "parameters api" + * this is the struct used by "parameters api" */ typedef struct eq_parameters_s { @@ -138,9 +138,9 @@ typedef struct eq_parameters_s { * description of params struct */ START_PARAM_DESCR( eq_parameters_t ) -PARAM_ITEM( POST_PARAM_TYPE_INT, brightness, NULL, -100, 100, 0, +PARAM_ITEM( POST_PARAM_TYPE_INT, brightness, NULL, -100, 100, 0, "brightness" ) -PARAM_ITEM( POST_PARAM_TYPE_INT, contrast, NULL, -100, 100, 0, +PARAM_ITEM( POST_PARAM_TYPE_INT, contrast, NULL, -100, 100, 0, "contrast" ) END_PARAM_DESCR( param_descr ) @@ -179,7 +179,7 @@ static int get_parameters (xine_post_t *this_gen, void *param_gen) { return 1; } - + static xine_post_api_descr_t * get_param_descr (void) { return ¶m_descr; } @@ -236,7 +236,7 @@ void *eq_init_plugin(xine_t *xine, void *data) if (!class) return NULL; - + class->open_plugin = eq_open_plugin; class->get_identifier = eq_get_identifier; class->get_description = eq_get_description; @@ -255,7 +255,7 @@ static post_plugin_t *eq_open_plugin(post_class_t *class_gen, int inputs, xine_post_in_t *input_api; post_out_t *output; post_video_port_t *port; - + if (!this || !video_target || !video_target[0]) { free(this); return NULL; @@ -263,7 +263,7 @@ static post_plugin_t *eq_open_plugin(post_class_t *class_gen, int inputs, process = process_C; #if defined(ARCH_X86) || defined(ARCH_X86_64) - if( xine_mm_accel() & MM_ACCEL_X86_MMX ) + if( xine_mm_accel() & MM_ACCEL_X86_MMX ) process = process_MMX; #endif @@ -273,14 +273,14 @@ static post_plugin_t *eq_open_plugin(post_class_t *class_gen, int inputs, this->params.contrast = 0; pthread_mutex_init (&this->lock, NULL); - + port = _x_post_intercept_video_port(&this->post, video_target[0], &input, &output); port->new_port.get_property = eq_get_property; port->new_port.set_property = eq_set_property; port->intercept_frame = eq_intercept_frame; port->new_frame->draw = eq_draw; - input_api = &this->params_input; + input_api = &this->params_input; input_api->name = "parameters"; input_api->type = XINE_POST_DATA_PARAMETERS; input_api->data = &post_api; @@ -288,11 +288,11 @@ static post_plugin_t *eq_open_plugin(post_class_t *class_gen, int inputs, input->xine_in.name = "video"; output->xine_out.name = "eqd video"; - + this->post.xine_post.video_input[0] = &port->new_port; - + this->post.dispose = eq_dispose; - + return &this->post; } @@ -374,15 +374,15 @@ static int eq_draw(vo_frame_t *frame, xine_stream_t *stream) yv12_frame = port->original_port->get_frame(port->original_port, frame->width, frame->height, frame->ratio, XINE_IMGFMT_YV12, frame->flags | VO_BOTH_FIELDS); - + _x_post_frame_copy_down(frame, yv12_frame); - + yuy2_to_yv12(frame->base[0], frame->pitches[0], yv12_frame->base[0], yv12_frame->pitches[0], yv12_frame->base[1], yv12_frame->pitches[1], yv12_frame->base[2], yv12_frame->pitches[2], frame->width, frame->height); - + } else { yv12_frame = frame; yv12_frame->lock(yv12_frame); @@ -408,7 +408,7 @@ static int eq_draw(vo_frame_t *frame, xine_stream_t *stream) pthread_mutex_unlock (&this->lock); skip = out_frame->draw(out_frame, stream); - + _x_post_frame_copy_up(frame, out_frame); out_frame->free(out_frame); diff --git a/src/post/planar/eq2.c b/src/post/planar/eq2.c index 1a301fdab..542ea7bad 100644 --- a/src/post/planar/eq2.c +++ b/src/post/planar/eq2.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2008 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -114,7 +114,7 @@ void affine_1d_MMX (eq2_param_t *par, unsigned char *dst, unsigned char *src, int pel; short brvec[4]; short contvec[4]; - + contrast = (int) (par->c * 256 * 16); brightness = ((int) (100.0 * par->b + 100.0) * 511) / 200 - 128 - contrast / 32; @@ -269,7 +269,7 @@ void *eq2_init_plugin(xine_t *xine, void *); typedef struct post_plugin_eq2_s post_plugin_eq2_t; /* - * this is the struct used by "parameters api" + * this is the struct used by "parameters api" */ typedef struct eq2_parameters_s { @@ -288,19 +288,19 @@ typedef struct eq2_parameters_s { * description of params struct */ START_PARAM_DESCR( eq2_parameters_t ) -PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, gamma, NULL, 0, 5, 0, +PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, gamma, NULL, 0, 5, 0, "gamma" ) -PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, brightness, NULL, -1, 1, 0, +PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, brightness, NULL, -1, 1, 0, "brightness" ) -PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, contrast, NULL, 0, 2, 0, +PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, contrast, NULL, 0, 2, 0, "contrast" ) -PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, saturation, NULL, 0, 2, 0, +PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, saturation, NULL, 0, 2, 0, "saturation" ) -PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, rgamma, NULL, 0, 5, 0, +PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, rgamma, NULL, 0, 5, 0, "rgamma" ) -PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, ggamma, NULL, 0, 5, 0, +PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, ggamma, NULL, 0, 5, 0, "ggamma" ) -PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, bgamma, NULL, 0, 5, 0, +PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, bgamma, NULL, 0, 5, 0, "bgamma" ) END_PARAM_DESCR( param_descr ) @@ -312,7 +312,7 @@ struct post_plugin_eq2_s { /* private data */ eq2_parameters_t params; xine_post_in_t params_input; - + vf_eq2_t eq2; pthread_mutex_t lock; @@ -352,7 +352,7 @@ static int get_parameters (xine_post_t *this_gen, void *param_gen) { return 1; } - + static xine_post_api_descr_t * get_param_descr (void) { return ¶m_descr; } @@ -417,7 +417,7 @@ void *eq2_init_plugin(xine_t *xine, void *data) if (!class) return NULL; - + class->open_plugin = eq2_open_plugin; class->get_identifier = eq2_get_identifier; class->get_description = eq2_get_description; @@ -436,12 +436,12 @@ static post_plugin_t *eq2_open_plugin(post_class_t *class_gen, int inputs, xine_post_in_t *input_api; post_out_t *output; post_video_port_t *port; - + if (!this || !video_target || !video_target[0]) { free(this); return NULL; } - + _x_post_init(&this->post, 0, 1); memset(&this->eq2, 0, sizeof(this->eq2)); @@ -455,13 +455,13 @@ static post_plugin_t *eq2_open_plugin(post_class_t *class_gen, int inputs, this->eq2.bgamma = this->params.bgamma = 1.0; pthread_mutex_init(&this->lock, NULL); - + port = _x_post_intercept_video_port(&this->post, video_target[0], &input, &output); port->new_port.get_property = eq2_get_property; port->new_port.set_property = eq2_set_property; port->intercept_frame = eq2_intercept_frame; port->new_frame->draw = eq2_draw; - + input_api = &this->params_input; input_api->name = "parameters"; input_api->type = XINE_POST_DATA_PARAMETERS; @@ -470,13 +470,13 @@ static post_plugin_t *eq2_open_plugin(post_class_t *class_gen, int inputs, input->xine_in.name = "video"; output->xine_out.name = "eqd video"; - + this->post.xine_post.video_input[0] = &port->new_port; - + this->post.dispose = eq2_dispose; set_parameters ((xine_post_t *)this, &this->params); - + return &this->post; } @@ -566,15 +566,15 @@ static int eq2_draw(vo_frame_t *frame, xine_stream_t *stream) yv12_frame = port->original_port->get_frame(port->original_port, frame->width, frame->height, frame->ratio, XINE_IMGFMT_YV12, frame->flags | VO_BOTH_FIELDS); - + _x_post_frame_copy_down(frame, yv12_frame); - + yuy2_to_yv12(frame->base[0], frame->pitches[0], yv12_frame->base[0], yv12_frame->pitches[0], yv12_frame->base[1], yv12_frame->pitches[1], yv12_frame->base[2], yv12_frame->pitches[2], frame->width, frame->height); - + } else { yv12_frame = frame; yv12_frame->lock(yv12_frame); @@ -604,7 +604,7 @@ static int eq2_draw(vo_frame_t *frame, xine_stream_t *stream) pthread_mutex_unlock (&this->lock); skip = out_frame->draw(out_frame, stream); - + _x_post_frame_copy_up(frame, out_frame); out_frame->free(out_frame); diff --git a/src/post/planar/expand.c b/src/post/planar/expand.c index 52bc2b37a..cc189118f 100644 --- a/src/post/planar/expand.c +++ b/src/post/planar/expand.c @@ -1,23 +1,23 @@ /* * Copyright (C) 2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * - * $Id: + * $Id: * * expand video filter by James Stembridge 24/05/2003 * improved by Michael Roitzsch @@ -58,7 +58,7 @@ * bars to the left and right of the image and will then set up cropping * to efficiently remove the black border around the 4:3 image, which the * plugin would produce otherwise for this case. - */ + */ /* plugin class initialization function */ @@ -85,9 +85,9 @@ END_PARAM_DESCR(expand_param_descr) typedef struct post_expand_s { post_plugin_t post; - + xine_post_in_t parameter_input; - + int enable_automatic_shift; int overlay_y_offset; double aspect; @@ -114,8 +114,8 @@ static int expand_get_parameters(xine_post_t *this_gen, void *param_g static char *expand_get_help (void); /* replaced video port functions */ -static vo_frame_t *expand_get_frame(xine_video_port_t *port_gen, uint32_t width, - uint32_t height, double ratio, +static vo_frame_t *expand_get_frame(xine_video_port_t *port_gen, uint32_t width, + uint32_t height, double ratio, int format, int flags); /* replaced vo_frame functions */ @@ -131,15 +131,15 @@ static int32_t expand_overlay_add_event(video_overlay_manager_t *this_gen void *expand_init_plugin(xine_t *xine, void *data) { post_class_t *class = (post_class_t *)malloc(sizeof(post_class_t)); - + if (!class) return NULL; - + class->open_plugin = expand_open_plugin; class->get_identifier = expand_get_identifier; class->get_description = expand_get_description; class->dispose = expand_class_dispose; - + return class; } @@ -155,39 +155,39 @@ static post_plugin_t *expand_open_plugin(post_class_t *class_gen, int inputs, post_video_port_t *port; static xine_post_api_t post_api = { expand_set_parameters, expand_get_parameters, expand_get_param_descr, expand_get_help }; - + if (!this || !video_target || !video_target[0]) { free(this); return NULL; } - + _x_post_init(&this->post, 0, 1); - + this->enable_automatic_shift = 0; this->overlay_y_offset = 0; this->aspect = 4.0 / 3.0; this->centre_cut_out_mode = 0; this->cropping_active = 0; - + port = _x_post_intercept_video_port(&this->post, video_target[0], &input, &output); port->new_port.get_frame = expand_get_frame; port->new_frame->draw = expand_draw; port->intercept_ovl = expand_intercept_ovl; port->new_manager->add_event = expand_overlay_add_event; - + input_param = &this->parameter_input; input_param->name = "parameters"; input_param->type = XINE_POST_DATA_PARAMETERS; input_param->data = &post_api; xine_list_push_back(this->post.input, input_param); - + input->xine_in.name = "video"; output->xine_out.name = "expanded video"; - + this->post.xine_post.video_input[0] = &port->new_port; - + this->post.dispose = expand_dispose; - + return &this->post; } @@ -210,7 +210,7 @@ static void expand_class_dispose(post_class_t *class_gen) static void expand_dispose(post_plugin_t *this_gen) { post_expand_t *this = (post_expand_t *)this_gen; - + if (_x_post_dispose(this_gen)) free(this); } @@ -238,12 +238,12 @@ static int expand_get_parameters(xine_post_t *this_gen, void *param_gen) { post_expand_t *this = (post_expand_t *)this_gen; expand_parameters_t *param = (expand_parameters_t *)param_gen; - + param->enable_automatic_shift = this->enable_automatic_shift; param->overlay_y_offset = this->overlay_y_offset; param->aspect = this->aspect; param->centre_cut_out_mode = this->centre_cut_out_mode; - + return 1; } @@ -271,7 +271,7 @@ static int is_pixel_black(vo_frame_t *frame, int x, int y) if (x >= frame->width) x = frame->width - 1; if (y < 0) y = 0; if (y >= frame->height) y = frame->height - 1; - + switch (frame->format) { case XINE_IMGFMT_YV12: @@ -279,7 +279,7 @@ static int is_pixel_black(vo_frame_t *frame, int x, int y) Cr = *(frame->base[ 1 ] + frame->pitches[ 1 ] * y / 2 + x / 2); Cb = *(frame->base[ 2 ] + frame->pitches[ 2 ] * y / 2 + x / 2); break; - + case XINE_IMGFMT_YUY2: Y = *(frame->base[ 0 ] + frame->pitches[ 0 ] * y + x * 2 + 0); x &= ~1; @@ -340,8 +340,8 @@ static int expand_draw(vo_frame_t *frame, xine_stream_t *stream) } -static vo_frame_t *expand_get_frame(xine_video_port_t *port_gen, uint32_t width, - uint32_t height, double ratio, +static vo_frame_t *expand_get_frame(xine_video_port_t *port_gen, uint32_t width, + uint32_t height, double ratio, int format, int flags) { post_video_port_t *port = (post_video_port_t *)port_gen; @@ -349,27 +349,27 @@ static vo_frame_t *expand_get_frame(xine_video_port_t *port_gen, uint32_t width, vo_frame_t *frame; uint32_t new_height, top_bar_height; int i, end; - + _x_post_rewire(&this->post); - + if (ratio <= 0.0) ratio = (double)width / (double)height; - + /* Calculate height of expanded frame */ new_height = (double)height * ratio / this->aspect; new_height = (new_height + 1) & ~1; top_bar_height = (new_height - height) / 2; top_bar_height = (top_bar_height + 1) & ~1; - + this->top_bar_height = top_bar_height; if (new_height > height && (format == XINE_IMGFMT_YV12 || format == XINE_IMGFMT_YUY2)) { frame = port->original_port->get_frame(port->original_port, width, new_height, this->aspect, format, flags); - + _x_post_inc_usage(port); frame = _x_post_intercept_video_frame(frame, port); - + /* paint black bars in the top and bottom of the frame and hide these * from the decoders by modifying the pointers to and * the size of the drawing area */ @@ -414,7 +414,7 @@ static vo_frame_t *expand_get_frame(xine_video_port_t *port_gen, uint32_t width, width, height, ratio, format, flags); /* no need to intercept this one, we are not going to do anything with it */ } - + return frame; } @@ -424,7 +424,7 @@ static int expand_intercept_ovl(post_video_port_t *port) post_expand_t *this = (post_expand_t *)port->post; if (this->centre_cut_out_mode && this->cropping_active) return 0; - + /* we always intercept overlay manager */ return 1; } @@ -435,7 +435,7 @@ static int32_t expand_overlay_add_event(video_overlay_manager_t *this_gen, void video_overlay_event_t *event = (video_overlay_event_t *)event_gen; post_video_port_t *port = _x_post_ovl_manager_to_port(this_gen); post_expand_t *this = (post_expand_t *)port->post; - + if (event->event_type == OVERLAY_EVENT_SHOW) { switch (event->object.object_type) { case 0: @@ -450,6 +450,6 @@ static int32_t expand_overlay_add_event(video_overlay_manager_t *this_gen, void event->object.overlay->y += this->top_bar_height; } } - + return port->original_manager->add_event(port->original_manager, event_gen); } diff --git a/src/post/planar/fill.c b/src/post/planar/fill.c index 98c572777..dd8b83c82 100644 --- a/src/post/planar/fill.c +++ b/src/post/planar/fill.c @@ -12,7 +12,7 @@ * 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -49,15 +49,15 @@ static int fill_draw(vo_frame_t *frame, xine_stream_t *stream); void *fill_init_plugin(xine_t *xine, void *data) { post_class_t *class = (post_class_t *)malloc(sizeof(post_class_t)); - + if (!class) return NULL; - + class->open_plugin = fill_open_plugin; class->get_identifier = fill_get_identifier; class->get_description = fill_get_description; class->dispose = fill_class_dispose; - + return class; } @@ -70,25 +70,25 @@ static post_plugin_t *fill_open_plugin(post_class_t *class_gen, int inputs, post_in_t *input; post_out_t *output; post_video_port_t *port; - + if (!this || !video_target || !video_target[0]) { free(this); return NULL; } - + _x_post_init(this, 0, 1); - + port = _x_post_intercept_video_port(this, video_target[0], &input, &output); port->new_port.get_frame = fill_get_frame; port->new_frame->draw = fill_draw; - + input->xine_in.name = "video"; output->xine_out.name = "cropped video"; - + this->xine_post.video_input[0] = &port->new_port; - + this->dispose = fill_dispose; - + return this; } @@ -114,33 +114,33 @@ static void fill_dispose(post_plugin_t *this) } -static vo_frame_t *fill_get_frame(xine_video_port_t *port_gen, uint32_t width, - uint32_t height, double ratio, +static vo_frame_t *fill_get_frame(xine_video_port_t *port_gen, uint32_t width, + uint32_t height, double ratio, int format, int flags) { post_video_port_t *port = (post_video_port_t *)port_gen; post_plugin_t *this = port->post; vo_frame_t *frame; - + _x_post_rewire(this); - + if (ratio <= 0.0) ratio = (double)width / (double)height; - + if ((ratio > 4.0/3.0) && (format == XINE_IMGFMT_YV12 || format == XINE_IMGFMT_YUY2)) { frame = port->original_port->get_frame(port->original_port, width, height, 4.0/3.0, format, flags); - + _x_post_inc_usage(port); frame = _x_post_intercept_video_frame(frame, port); - + frame->ratio = ratio; } else { frame = port->original_port->get_frame(port->original_port, width, height, ratio, format, flags); /* no need to intercept this one, we are not going to do anything with it */ } - + return frame; } @@ -148,13 +148,13 @@ static vo_frame_t *fill_get_frame(xine_video_port_t *port_gen, uint32_t width, static int fill_draw(vo_frame_t *frame, xine_stream_t *stream) { int skip, new_width; - + new_width = (4.0*frame->width) / (3.0*frame->ratio); - + frame->crop_left += (frame->width - new_width) / 2; frame->crop_right += (frame->width + 1 - new_width) / 2; frame->ratio = 4.0/3.0; - + _x_post_frame_copy_down(frame, frame->next); skip = frame->next->draw(frame->next, stream); _x_post_frame_copy_up(frame, frame->next); diff --git a/src/post/planar/invert.c b/src/post/planar/invert.c index d1f0c8d4e..820221cf5 100644 --- a/src/post/planar/invert.c +++ b/src/post/planar/invert.c @@ -1,23 +1,23 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA */ - + /* * simple video inverter plugin */ @@ -50,15 +50,15 @@ static int invert_draw(vo_frame_t *frame, xine_stream_t *stream); void *invert_init_plugin(xine_t *xine, void *data) { post_class_t *class = (post_class_t *)malloc(sizeof(post_class_t)); - + if (!class) return NULL; - + class->open_plugin = invert_open_plugin; class->get_identifier = invert_get_identifier; class->get_description = invert_get_description; class->dispose = invert_class_dispose; - + return class; } @@ -71,23 +71,23 @@ static post_plugin_t *invert_open_plugin(post_class_t *class_gen, int inputs, post_in_t *input; post_out_t *output; post_video_port_t *port; - + if (!this || !video_target || !video_target[0]) { free(this); return NULL; } - + _x_post_init(this, 0, 1); - + port = _x_post_intercept_video_port(this, video_target[0], &input, &output); port->intercept_frame = invert_intercept_frame; port->new_frame->draw = invert_draw; input->xine_in.name = "video"; output->xine_out.name = "inverted video"; this->xine_post.video_input[0] = &port->new_port; - + this->dispose = invert_dispose; - + return this; } @@ -125,18 +125,18 @@ static int invert_draw(vo_frame_t *frame, xine_stream_t *stream) post_video_port_t *port = (post_video_port_t *)frame->port; vo_frame_t *inverted_frame; int size, i, skip; - + if (frame->bad_frame) { _x_post_frame_copy_down(frame, frame->next); skip = frame->next->draw(frame->next, stream); _x_post_frame_copy_up(frame, frame->next); return skip; } - + inverted_frame = port->original_port->get_frame(port->original_port, frame->width, frame->height, frame->ratio, frame->format, frame->flags | VO_BOTH_FIELDS); _x_post_frame_copy_down(frame, inverted_frame); - + switch (inverted_frame->format) { case XINE_IMGFMT_YUY2: size = inverted_frame->pitches[0] * inverted_frame->height; @@ -157,10 +157,10 @@ static int invert_draw(vo_frame_t *frame, xine_stream_t *stream) for (i = 0; i < size; i++) inverted_frame->base[2][i] = 0xff - frame->base[2][i]; break; - } + } skip = inverted_frame->draw(inverted_frame, stream); _x_post_frame_copy_up(frame, inverted_frame); inverted_frame->free(inverted_frame); - + return skip; } diff --git a/src/post/planar/noise.c b/src/post/planar/noise.c index f639fce76..0f1fe98f7 100644 --- a/src/post/planar/noise.c +++ b/src/post/planar/noise.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2006 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -315,7 +315,7 @@ void *noise_init_plugin(xine_t *xine, void *); typedef struct post_plugin_noise_s post_plugin_noise_t; /* - * this is the struct used by "parameters api" + * this is the struct used by "parameters api" */ typedef struct noise_parameters_s { int luma_strength, chroma_strength, @@ -329,15 +329,15 @@ static char *enum_quality[] = {"fixed", "temporal", "averaged temporal", NULL}; * description of params struct */ START_PARAM_DESCR( noise_parameters_t ) -PARAM_ITEM( POST_PARAM_TYPE_INT, luma_strength, NULL, 0, 100, 0, +PARAM_ITEM( POST_PARAM_TYPE_INT, luma_strength, NULL, 0, 100, 0, "Amount of noise to add to luma channel" ) -PARAM_ITEM( POST_PARAM_TYPE_INT, chroma_strength, NULL, 0, 100, 0, +PARAM_ITEM( POST_PARAM_TYPE_INT, chroma_strength, NULL, 0, 100, 0, "Amount of noise to add to chroma channel" ) -PARAM_ITEM( POST_PARAM_TYPE_INT, quality, enum_quality, 0, 0, 0, +PARAM_ITEM( POST_PARAM_TYPE_INT, quality, enum_quality, 0, 0, 0, "Quality level of noise" ) -PARAM_ITEM( POST_PARAM_TYPE_INT, type, enum_types, 0, 0, 0, +PARAM_ITEM( POST_PARAM_TYPE_INT, type, enum_types, 0, 0, 0, "Type of noise" ) -PARAM_ITEM( POST_PARAM_TYPE_BOOL, pattern, NULL, 0, 1, 0, +PARAM_ITEM( POST_PARAM_TYPE_BOOL, pattern, NULL, 0, 1, 0, "Mix random noise with a (semi)regular pattern" ) END_PARAM_DESCR( param_descr ) @@ -354,7 +354,7 @@ struct post_plugin_noise_s { }; -static int set_parameters (xine_post_t *this_gen, void *param_gen) +static int set_parameters (xine_post_t *this_gen, void *param_gen) { post_plugin_noise_t *this = (post_plugin_noise_t *)this_gen; noise_parameters_t *param = (noise_parameters_t *)param_gen; @@ -376,7 +376,7 @@ static int set_parameters (xine_post_t *this_gen, void *param_gen) return 1; } -static int get_parameters (xine_post_t *this_gen, void *param_gen) +static int get_parameters (xine_post_t *this_gen, void *param_gen) { post_plugin_noise_t *this = (post_plugin_noise_t *)this_gen; noise_parameters_t *param = (noise_parameters_t *)param_gen; @@ -395,7 +395,7 @@ static int get_parameters (xine_post_t *this_gen, void *param_gen) pthread_mutex_unlock (&this->lock); return 1; } - + static xine_post_api_descr_t *get_param_descr (void) { return ¶m_descr; } @@ -453,7 +453,7 @@ void *noise_init_plugin(xine_t *xine, void *data) if (!class) return NULL; - + class->open_plugin = noise_open_plugin; class->get_identifier = noise_get_identifier; class->get_description = noise_get_description; @@ -481,12 +481,12 @@ static post_plugin_t *noise_open_plugin(post_class_t *class_gen, int inputs, post_out_t *output; post_video_port_t *port; noise_parameters_t params; - + if (!this || !video_target || !video_target[0]) { free(this); return NULL; } - + _x_post_init(&this->post, 0, 1); memset(¶ms, 0, sizeof(noise_parameters_t)); @@ -496,11 +496,11 @@ static post_plugin_t *noise_open_plugin(post_class_t *class_gen, int inputs, params.quality = 2; pthread_mutex_init(&this->lock, NULL); - + port = _x_post_intercept_video_port(&this->post, video_target[0], &input, &output); port->intercept_frame = noise_intercept_frame; port->new_frame->draw = noise_draw; - + input_api = &this->params_input; input_api->name = "parameters"; input_api->type = XINE_POST_DATA_PARAMETERS; @@ -509,13 +509,13 @@ static post_plugin_t *noise_open_plugin(post_class_t *class_gen, int inputs, input->xine_in.name = "video"; output->xine_out.name = "filtered video"; - + this->post.xine_post.video_input[0] = &port->new_port; - + this->post.dispose = noise_dispose; set_parameters ((xine_post_t *)this, ¶ms); - + return &this->post; } @@ -559,7 +559,7 @@ static int noise_draw(vo_frame_t *frame, xine_stream_t *stream) vo_frame_t *out_frame; int skip; - if (frame->bad_frame || + if (frame->bad_frame || (this->params[0].strength == 0 && this->params[1].strength == 0)) { _x_post_frame_copy_down(frame, frame->next); skip = frame->next->draw(frame->next, stream); @@ -569,26 +569,26 @@ static int noise_draw(vo_frame_t *frame, xine_stream_t *stream) frame->lock(frame); out_frame = port->original_port->get_frame(port->original_port, - frame->width, frame->height, frame->ratio, frame->format, + frame->width, frame->height, frame->ratio, frame->format, frame->flags | VO_BOTH_FIELDS); _x_post_frame_copy_down(frame, out_frame); pthread_mutex_lock (&this->lock); if (frame->format == XINE_IMGFMT_YV12) { - noise(out_frame->base[0], frame->base[0], - out_frame->pitches[0], frame->pitches[0], + noise(out_frame->base[0], frame->base[0], + out_frame->pitches[0], frame->pitches[0], frame->width, frame->height, &this->params[0]); - noise(out_frame->base[1], frame->base[1], - out_frame->pitches[1], frame->pitches[1], + noise(out_frame->base[1], frame->base[1], + out_frame->pitches[1], frame->pitches[1], frame->width/2, frame->height/2, &this->params[1]); - noise(out_frame->base[2], frame->base[2], - out_frame->pitches[2], frame->pitches[2], + noise(out_frame->base[2], frame->base[2], + out_frame->pitches[2], frame->pitches[2], frame->width/2, frame->height/2, &this->params[1]); } else { // Chroma strength is ignored for YUY2. - noise(out_frame->base[0], frame->base[0], - out_frame->pitches[0], frame->pitches[0], + noise(out_frame->base[0], frame->base[0], + out_frame->pitches[0], frame->pitches[0], frame->width * 2, frame->height, &this->params[0]); } diff --git a/src/post/planar/planar.c b/src/post/planar/planar.c index e1c9681ab..112ebdf0d 100644 --- a/src/post/planar/planar.c +++ b/src/post/planar/planar.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -59,7 +59,7 @@ extern void *noise_init_plugin(xine_t *xine, void *); static const post_info_t noise_special_info = { XINE_POST_TYPE_VIDEO_FILTER }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_POST, 9, "expand", XINE_VERSION_CODE, &expand_special_info, &expand_init_plugin }, { PLUGIN_POST, 9, "fill", XINE_VERSION_CODE, &fill_special_info, &fill_init_plugin }, { PLUGIN_POST, 9, "invert", XINE_VERSION_CODE, &invert_special_info, &invert_init_plugin }, diff --git a/src/post/planar/pp.c b/src/post/planar/pp.c index 1ce45e381..c9db99f2c 100644 --- a/src/post/planar/pp.c +++ b/src/post/planar/pp.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -43,7 +43,7 @@ void *pp_init_plugin(xine_t *xine, void *); typedef struct post_plugin_pp_s post_plugin_pp_t; /* - * this is the struct used by "parameters api" + * this is the struct used by "parameters api" */ typedef struct pp_parameters_s { @@ -56,9 +56,9 @@ typedef struct pp_parameters_s { * description of params struct */ START_PARAM_DESCR( pp_parameters_t ) -PARAM_ITEM( POST_PARAM_TYPE_INT, quality, NULL, 0, PP_QUALITY_MAX, 0, +PARAM_ITEM( POST_PARAM_TYPE_INT, quality, NULL, 0, PP_QUALITY_MAX, 0, "postprocessing quality" ) -PARAM_ITEM( POST_PARAM_TYPE_CHAR, mode, NULL, 0, 0, 0, +PARAM_ITEM( POST_PARAM_TYPE_CHAR, mode, NULL, 0, 0, 0, "mode string (overwrites all other options except quality)" ) END_PARAM_DESCR( param_descr ) @@ -105,18 +105,18 @@ static int get_parameters (xine_post_t *this_gen, void *param_gen) { return 1; } - + static xine_post_api_descr_t * get_param_descr (void) { return ¶m_descr; } static char * get_help (void) { - char *help1 = + char *help1 = _("FFmpeg libpostprocess plugin.\n" "\n" "Parameters\n" "\n"); - + char *help2 = _("\n" "* libpostprocess (C) Michael Niedermayer\n" @@ -161,7 +161,7 @@ void *pp_init_plugin(xine_t *xine, void *data) if (!class) return NULL; - + class->open_plugin = pp_open_plugin; class->get_identifier = pp_get_identifier; class->get_description = pp_get_description; @@ -181,14 +181,14 @@ static post_plugin_t *pp_open_plugin(post_class_t *class_gen, int inputs, post_out_t *output; post_video_port_t *port; uint32_t cpu_caps; - + if (!this || !video_target || !video_target[0]) { free(this); return NULL; } _x_post_init(&this->post, 0, 1); - + this->params.quality = 3; strcpy(this->params.mode, "de"); @@ -199,18 +199,18 @@ static post_plugin_t *pp_open_plugin(post_class_t *class_gen, int inputs, this->pp_flags |= PP_CPU_CAPS_MMX; if(cpu_caps & MM_ACCEL_X86_MMXEXT) this->pp_flags |= PP_CPU_CAPS_MMX2; - if(cpu_caps & MM_ACCEL_X86_3DNOW) + if(cpu_caps & MM_ACCEL_X86_3DNOW) this->pp_flags |= PP_CPU_CAPS_3DNOW; this->pp_mode = NULL; this->pp_context = NULL; pthread_mutex_init (&this->lock, NULL); - + port = _x_post_intercept_video_port(&this->post, video_target[0], &input, &output); port->intercept_frame = pp_intercept_frame; port->new_frame->draw = pp_draw; - + input_api = &this->params_input; input_api->name = "parameters"; input_api->type = XINE_POST_DATA_PARAMETERS; @@ -219,11 +219,11 @@ static post_plugin_t *pp_open_plugin(post_class_t *class_gen, int inputs, input->xine_in.name = "video"; output->xine_out.name = "pped video"; - + this->post.xine_post.video_input[0] = &port->new_port; - + this->post.dispose = pp_dispose; - + return &this->post; } @@ -283,9 +283,9 @@ static int pp_draw(vo_frame_t *frame, xine_stream_t *stream) yv12_frame = port->original_port->get_frame(port->original_port, frame->width, frame->height, frame->ratio, XINE_IMGFMT_YV12, frame->flags | VO_BOTH_FIELDS); - + _x_post_frame_copy_down(frame, yv12_frame); - + yuy2_to_yv12(frame->base[0], frame->pitches[0], yv12_frame->base[0], yv12_frame->pitches[0], yv12_frame->base[1], yv12_frame->pitches[1], @@ -299,12 +299,12 @@ static int pp_draw(vo_frame_t *frame, xine_stream_t *stream) out_frame = port->original_port->get_frame(port->original_port, frame->width, frame->height, frame->ratio, XINE_IMGFMT_YV12, frame->flags | VO_BOTH_FIELDS); - + _x_post_frame_copy_down(frame, out_frame); pthread_mutex_lock (&this->lock); - if( !this->pp_context || + if( !this->pp_context || this->frame_width != yv12_frame->width || this->frame_height != yv12_frame->height ) { @@ -324,15 +324,15 @@ static int pp_draw(vo_frame_t *frame, xine_stream_t *stream) } if(!this->pp_mode) - this->pp_mode = pp_get_mode_by_name_and_quality(this->params.mode, + this->pp_mode = pp_get_mode_by_name_and_quality(this->params.mode, this->params.quality); if(this->pp_mode) - pp_postprocess(yv12_frame->base, yv12_frame->pitches, - out_frame->base, out_frame->pitches, + pp_postprocess(yv12_frame->base, yv12_frame->pitches, + out_frame->base, out_frame->pitches, (frame->width+7)&(~7), frame->height, NULL, 0, - this->pp_mode, this->pp_context, + this->pp_mode, this->pp_context, 0 /*this->av_frame->pict_type*/); pthread_mutex_unlock (&this->lock); diff --git a/src/post/planar/unsharp.c b/src/post/planar/unsharp.c index 6fac727ce..dbf723577 100644 --- a/src/post/planar/unsharp.c +++ b/src/post/planar/unsharp.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -64,7 +64,7 @@ static void unsharp( uint8_t *dst, uint8_t *src, int dstStride, int srcStride, i uint32_t **SC = fp->SC; uint32_t SR[MAX_MATRIX_SIZE-1], Tmp1, Tmp2; - uint8_t* src2 = src; + uint8_t* src2 = src; int32_t res; int x, y, z; @@ -77,7 +77,7 @@ static void unsharp( uint8_t *dst, uint8_t *src, int dstStride, int srcStride, i if( !fp->amount ) { if( src == dst ) return; - if( dstStride == srcStride ) + if( dstStride == srcStride ) xine_fast_memcpy( dst, src, srcStride*height ); else for( y=0; y<height; y++, dst+=dstStride, src+=srcStride ) @@ -104,7 +104,7 @@ static void unsharp( uint8_t *dst, uint8_t *src, int dstStride, int srcStride, i if( x>=stepsX && y>=stepsY ) { uint8_t* srx = src - stepsY*srcStride + x - stepsX; uint8_t* dsx = dst - stepsY*dstStride + x - stepsX; - + res = (int32_t)*srx + ( ( ( (int32_t)*srx - (int32_t)((Tmp1+halfscale) >> scalebits) ) * amount ) >> 16 ); *dsx = res>255 ? 255 : res<0 ? 0 : (uint8_t)res; } @@ -123,7 +123,7 @@ void *unsharp_init_plugin(xine_t *xine, void *); typedef struct post_plugin_unsharp_s post_plugin_unsharp_t; /* - * this is the struct used by "parameters api" + * this is the struct used by "parameters api" */ typedef struct unsharp_parameters_s { @@ -141,17 +141,17 @@ typedef struct unsharp_parameters_s { * description of params struct */ START_PARAM_DESCR( unsharp_parameters_t ) -PARAM_ITEM( POST_PARAM_TYPE_INT, luma_matrix_width, NULL, 3, 11, 0, +PARAM_ITEM( POST_PARAM_TYPE_INT, luma_matrix_width, NULL, 3, 11, 0, "width of the matrix (must be odd)" ) -PARAM_ITEM( POST_PARAM_TYPE_INT, luma_matrix_height, NULL, 3, 11, 0, +PARAM_ITEM( POST_PARAM_TYPE_INT, luma_matrix_height, NULL, 3, 11, 0, "height of the matrix (must be odd)" ) -PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, luma_amount, NULL, -2, 2, 0, +PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, luma_amount, NULL, -2, 2, 0, "relative amount of sharpness/blur (=0 disable, <0 blur, >0 sharpen)" ) -PARAM_ITEM( POST_PARAM_TYPE_INT, chroma_matrix_width, NULL, 3, 11, 0, +PARAM_ITEM( POST_PARAM_TYPE_INT, chroma_matrix_width, NULL, 3, 11, 0, "width of the matrix (must be odd)" ) -PARAM_ITEM( POST_PARAM_TYPE_INT, chroma_matrix_height, NULL, 3, 11, 0, +PARAM_ITEM( POST_PARAM_TYPE_INT, chroma_matrix_height, NULL, 3, 11, 0, "height of the matrix (must be odd)" ) -PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, chroma_amount, NULL, -2, 2, 0, +PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, chroma_amount, NULL, -2, 2, 0, "relative amount of sharpness/blur (=0 disable, <0 blur, >0 sharpen)" ) END_PARAM_DESCR( param_descr ) @@ -205,7 +205,7 @@ static int get_parameters (xine_post_t *this_gen, void *param_gen) { return 1; } - + static xine_post_api_descr_t * get_param_descr (void) { return ¶m_descr; } @@ -270,7 +270,7 @@ void *unsharp_init_plugin(xine_t *xine, void *data) if (!class) return NULL; - + class->open_plugin = unsharp_open_plugin; class->get_identifier = unsharp_get_identifier; class->get_description = unsharp_get_description; @@ -289,14 +289,14 @@ static post_plugin_t *unsharp_open_plugin(post_class_t *class_gen, int inputs, xine_post_in_t *input_api; post_out_t *output; post_video_port_t *port; - + if (!this || !video_target || !video_target[0]) { free(this); return NULL; } _x_post_init(&this->post, 0, 1); - + this->params.luma_matrix_width = 5; this->params.luma_matrix_height = 5; this->params.luma_amount = 0.0; @@ -306,11 +306,11 @@ static post_plugin_t *unsharp_open_plugin(post_class_t *class_gen, int inputs, this->params.chroma_amount = 0.0; pthread_mutex_init (&this->lock, NULL); - + port = _x_post_intercept_video_port(&this->post, video_target[0], &input, &output); port->intercept_frame = unsharp_intercept_frame; port->new_frame->draw = unsharp_draw; - + input_api = &this->params_input; input_api->name = "parameters"; input_api->type = XINE_POST_DATA_PARAMETERS; @@ -319,13 +319,13 @@ static post_plugin_t *unsharp_open_plugin(post_class_t *class_gen, int inputs, input->xine_in.name = "video"; output->xine_out.name = "unsharped video"; - + this->post.xine_post.video_input[0] = &port->new_port; - + set_parameters ((xine_post_t *)this, &this->params); - + this->post.dispose = unsharp_dispose; - + return &this->post; } @@ -399,15 +399,15 @@ static int unsharp_draw(vo_frame_t *frame, xine_stream_t *stream) yv12_frame = port->original_port->get_frame(port->original_port, frame->width, frame->height, frame->ratio, XINE_IMGFMT_YV12, frame->flags | VO_BOTH_FIELDS); - + _x_post_frame_copy_down(frame, yv12_frame); - + yuy2_to_yv12(frame->base[0], frame->pitches[0], yv12_frame->base[0], yv12_frame->pitches[0], yv12_frame->base[1], yv12_frame->pitches[1], yv12_frame->base[2], yv12_frame->pitches[2], frame->width, frame->height); - + } else { yv12_frame = frame; yv12_frame->lock(yv12_frame); @@ -435,7 +435,7 @@ static int unsharp_draw(vo_frame_t *frame, xine_stream_t *stream) stepsY = fp->msizeY/2; for( z=0; z<2*stepsY; z++ ) fp->SC[z] = malloc( sizeof(*(fp->SC[z])) * (frame->width+2*stepsX) ); - + fp = &this->priv.chromaParam; stepsX = fp->msizeX/2; stepsY = fp->msizeY/2; @@ -450,7 +450,7 @@ static int unsharp_draw(vo_frame_t *frame, xine_stream_t *stream) pthread_mutex_unlock (&this->lock); skip = out_frame->draw(out_frame, stream); - + _x_post_frame_copy_up(frame, out_frame); out_frame->free(out_frame); diff --git a/src/post/visualizations/fft.c b/src/post/visualizations/fft.c index e9a99911a..7e32dbbf6 100644 --- a/src/post/visualizations/fft.c +++ b/src/post/visualizations/fft.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA diff --git a/src/post/visualizations/fft.h b/src/post/visualizations/fft.h index dff3cd7e8..651c7f15d 100644 --- a/src/post/visualizations/fft.h +++ b/src/post/visualizations/fft.h @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA diff --git a/src/post/visualizations/fftgraph.c b/src/post/visualizations/fftgraph.c index 8bd30ed5c..c3f8ff9f9 100644 --- a/src/post/visualizations/fftgraph.c +++ b/src/post/visualizations/fftgraph.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -66,7 +66,7 @@ struct post_plugin_fftgraph_s { /* private metronom for syncing the video */ metronom_t *metronom; - + double ratio; int data_idx; @@ -92,21 +92,21 @@ static void fade(int r1, int g1, int b1, int r2, int g2, int b2, uint32_t *yuy2_colors, int steps) { int i, r, g, b, y, u, v; - + for (i = 0; i < steps; i++) { r = r1 + (r2 - r1) * i / steps; g = g1 + (g2 - g1) * i / steps; b = b1 + (b2 - b1) * i / steps; - + y = COMPUTE_Y(r, g, b); u = COMPUTE_U(r, g, b); v = COMPUTE_V(r, g, b); - + *(yuy2_colors + i) = be2me_32((y << 24) | (u << 16) | (y << 8) | v); - + } } @@ -212,19 +212,19 @@ static int fftgraph_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream int i,j; uint32_t *color_ptr; uint32_t last_color, yuy2_black; - + /* printf("fftgraph_port_open, port_gen=%p, stream=%p, this=%p\n", port_gen, stream, this); */ _x_post_rewire(&this->post); _x_post_inc_usage(port); - + port->stream = stream; port->bits = bits; port->rate = rate; port->mode = mode; - + this->ratio = (double)FFTGRAPH_WIDTH / (double)FFTGRAPH_HEIGHT; - + this->channels = _x_ao_mode2channels(mode); if( this->channels > MAXCHANNELS ) this->channels = MAXCHANNELS; @@ -239,7 +239,7 @@ static int fftgraph_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream this->fft = fft_new(FFT_BITS); this->cur_line = 0; - + /* compute colors */ color_ptr = this->yuy2_colors; /* black -> red */ @@ -253,7 +253,7 @@ static int fftgraph_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream 40, 0, 160, color_ptr, 256); color_ptr += 256; - + /* blue -> green */ fade(40, 0, 160, 40, 160, 70, @@ -294,15 +294,15 @@ static void fftgraph_port_close(xine_audio_port_t *port_gen, xine_stream_t *stre post_plugin_fftgraph_t *this = (post_plugin_fftgraph_t *)port->post; port->stream = NULL; - + fft_dispose(this->fft); this->fft = NULL; this->vo_port->close(this->vo_port, XINE_ANON_STREAM); this->metronom->set_master(this->metronom, NULL); - + port->original_port->close(port->original_port, stream ); - + _x_post_dec_usage(port); } @@ -329,7 +329,7 @@ static void fftgraph_port_put_buffer (xine_audio_port_t *port_gen, /* pass data to original port */ port->original_port->put_buffer(port->original_port, buf, stream ); - + /* we must not use original data anymore, it should have already being moved * to the fifo of free audio buffers. just use our private copy instead. */ @@ -372,8 +372,8 @@ static void fftgraph_port_put_buffer (xine_audio_port_t *port_gen, this->ratio, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); frame->extra_info->invalid = 1; - - /* frame is marked as bad if we don't have enough samples for + + /* frame is marked as bad if we don't have enough samples for * updating the viz plugin (calculations may be skipped). * we must keep the framerate though. */ if( this->data_idx == NUMSAMPLES ) { @@ -385,10 +385,10 @@ static void fftgraph_port_put_buffer (xine_audio_port_t *port_gen, frame->duration = 90000 * this->samples_per_frame / port->rate; frame->pts = pts; this->metronom->got_video_frame(this->metronom, frame); - + this->sample_counter -= this->samples_per_frame; - if( this->fft ) + if( this->fft ) draw_fftgraph(this, frame); else frame->bad_frame = 1; @@ -431,7 +431,7 @@ static post_plugin_t *fftgraph_open_plugin(post_class_t *class_gen, int inputs, } _x_post_init(&this->post, 1, 0); - + this->metronom = _x_metronom_init(1, 0, class->xine); this->vo_port = video_target[0]; @@ -475,16 +475,16 @@ static void fftgraph_class_dispose(post_class_t *class_gen) void *fftgraph_init_plugin(xine_t *xine, void *data) { post_class_fftgraph_t *class = (post_class_fftgraph_t *)malloc(sizeof(post_class_fftgraph_t)); - + if (!class) return NULL; - + class->post_class.open_plugin = fftgraph_open_plugin; class->post_class.get_identifier = fftgraph_get_identifier; class->post_class.get_description = fftgraph_get_description; class->post_class.dispose = fftgraph_class_dispose; - + class->xine = xine; - + return class; } diff --git a/src/post/visualizations/fftscope.c b/src/post/visualizations/fftscope.c index ccff59634..286c4ac38 100644 --- a/src/post/visualizations/fftscope.c +++ b/src/post/visualizations/fftscope.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -53,7 +53,7 @@ typedef struct post_class_fftscope_s post_class_fftscope_t; struct post_class_fftscope_s { post_class_t post_class; - + xine_t *xine; }; @@ -63,10 +63,10 @@ struct post_plugin_fftscope_s { /* private data */ xine_video_port_t *vo_port; post_out_t video_output; - + /* private metronom for syncing the video */ metronom_t *metronom; - + double ratio; int data_idx; @@ -277,12 +277,12 @@ static int fftscope_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream _x_post_rewire(&this->post); _x_post_inc_usage(port); - + port->stream = stream; port->bits = bits; port->rate = rate; port->mode = mode; - + this->ratio = (double)FFT_WIDTH/(double)FFT_HEIGHT; this->channels = _x_ao_mode2channels(mode); @@ -315,15 +315,15 @@ static void fftscope_port_close(xine_audio_port_t *port_gen, xine_stream_t *stre post_plugin_fftscope_t *this = (post_plugin_fftscope_t *)port->post; port->stream = NULL; - + fft_dispose(this->fft); this->fft = NULL; this->vo_port->close(this->vo_port, XINE_ANON_STREAM); this->metronom->set_master(this->metronom, NULL); - + port->original_port->close(port->original_port, stream ); - + _x_post_dec_usage(port); } @@ -393,8 +393,8 @@ static void fftscope_port_put_buffer (xine_audio_port_t *port_gen, this->ratio, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); frame->extra_info->invalid = 1; - - /* frame is marked as bad if we don't have enough samples for + + /* frame is marked as bad if we don't have enough samples for * updating the viz plugin (calculations may be skipped). * we must keep the framerate though. */ if( this->data_idx == NUMSAMPLES ) { @@ -406,10 +406,10 @@ static void fftscope_port_put_buffer (xine_audio_port_t *port_gen, frame->duration = 90000 * this->samples_per_frame / port->rate; frame->pts = pts; this->metronom->got_video_frame(this->metronom, frame); - + this->sample_counter -= this->samples_per_frame; - if( this->fft ) + if( this->fft ) draw_fftscope(this, frame); else frame->bad_frame = 1; @@ -423,7 +423,7 @@ static void fftscope_port_put_buffer (xine_audio_port_t *port_gen, static void fftscope_dispose(post_plugin_t *this_gen) { post_plugin_fftscope_t *this = (post_plugin_fftscope_t *)this_gen; - + if (_x_post_dispose(this_gen)) { this->metronom->exit(this->metronom); @@ -450,7 +450,7 @@ static post_plugin_t *fftscope_open_plugin(post_class_t *class_gen, int inputs, free(this); return NULL; } - + _x_post_init(&this->post, 1, 0); this->metronom = _x_metronom_init(1, 0, class->xine); @@ -496,16 +496,16 @@ static void fftscope_class_dispose(post_class_t *class_gen) void *fftscope_init_plugin(xine_t *xine, void *data) { post_class_fftscope_t *class = (post_class_fftscope_t *)malloc(sizeof(post_class_fftscope_t)); - + if (!class) return NULL; - + class->post_class.open_plugin = fftscope_open_plugin; class->post_class.get_identifier = fftscope_get_identifier; class->post_class.get_description = fftscope_get_description; class->post_class.dispose = fftscope_class_dispose; - + class->xine = xine; - + return &class->post_class; } diff --git a/src/post/visualizations/fooviz.c b/src/post/visualizations/fooviz.c index c645601fc..ac85da304 100644 --- a/src/post/visualizations/fooviz.c +++ b/src/post/visualizations/fooviz.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -60,7 +60,7 @@ struct post_plugin_fooviz_s { /* private metronom for syncing the video */ metronom_t *metronom; - + double ratio; int data_idx; @@ -90,7 +90,7 @@ static int fooviz_rewire_video(xine_post_out_t *output_gen, void *data) xine_video_port_t *old_port = *(xine_video_port_t **)output_gen->data; xine_video_port_t *new_port = (xine_video_port_t *)data; post_plugin_fooviz_t *this = (post_plugin_fooviz_t *)output->post; - + if (!data) return 0; /* register our stream at the new output port */ @@ -109,12 +109,12 @@ static int fooviz_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream, _x_post_rewire(&this->post); _x_post_inc_usage(port); - + port->stream = stream; port->bits = bits; port->rate = rate; port->mode = mode; - + this->ratio = (double)FOO_WIDTH/(double)FOO_HEIGHT; this->channels = _x_ao_mode2channels(mode); this->samples_per_frame = rate / FPS; @@ -133,18 +133,18 @@ static void fooviz_port_close(xine_audio_port_t *port_gen, xine_stream_t *stream post_plugin_fooviz_t *this = (post_plugin_fooviz_t *)port->post; port->stream = NULL; - + this->vo_port->close(this->vo_port, XINE_ANON_STREAM); this->metronom->set_master(this->metronom, NULL); - + port->original_port->close(port->original_port, stream ); - + _x_post_dec_usage(port); } -static void fooviz_port_put_buffer (xine_audio_port_t *port_gen, +static void fooviz_port_put_buffer (xine_audio_port_t *port_gen, audio_buffer_t *buf, xine_stream_t *stream) { - + post_audio_port_t *port = (post_audio_port_t *)port_gen; post_plugin_fooviz_t *this = (post_plugin_fooviz_t *)port->post; vo_frame_t *frame; @@ -153,34 +153,34 @@ static void fooviz_port_put_buffer (xine_audio_port_t *port_gen, int samples_used = 0; int64_t pts = buf->vpts; int i, j; - + /* make a copy of buf data for private use */ if( this->buf.mem_size < buf->mem_size ) { this->buf.mem = realloc(this->buf.mem, buf->mem_size); this->buf.mem_size = buf->mem_size; } - memcpy(this->buf.mem, buf->mem, + memcpy(this->buf.mem, buf->mem, buf->num_frames*this->channels*((port->bits == 8)?1:2)); this->buf.num_frames = buf->num_frames; - + /* pass data to original port */ - port->original_port->put_buffer(port->original_port, buf, stream ); - + port->original_port->put_buffer(port->original_port, buf, stream ); + /* we must not use original data anymore, it should have already being moved * to the fifo of free audio buffers. just use our private copy instead. */ - buf = &this->buf; + buf = &this->buf; this->sample_counter += buf->num_frames; - + j = (this->channels >= 2) ? 1 : 0; do { - + if( port->bits == 8 ) { data8 = (int8_t *)buf->mem; data8 += samples_used * this->channels; - + /* scale 8 bit data to 16 bits and convert to signed as well */ for( i = samples_used; i < buf->num_frames && this->data_idx < NUMSAMPLES; i++, this->data_idx++, data8 += this->channels ) { @@ -190,24 +190,24 @@ static void fooviz_port_put_buffer (xine_audio_port_t *port_gen, } else { data = buf->mem; data += samples_used * this->channels; - + for( i = samples_used; i < buf->num_frames && this->data_idx < NUMSAMPLES; i++, this->data_idx++, data += this->channels ) { this->data[0][this->data_idx] = data[0]; this->data[1][this->data_idx] = data[j]; } } - + if( this->sample_counter >= this->samples_per_frame ) { - + samples_used += this->samples_per_frame; - + frame = this->vo_port->get_frame (this->vo_port, FOO_WIDTH, FOO_HEIGHT, this->ratio, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); frame->extra_info->invalid = 1; - - /* frame is marked as bad if we don't have enough samples for + + /* frame is marked as bad if we don't have enough samples for * updating the viz plugin (calculations may be skipped). * we must keep the framerate though. */ if( this->data_idx == NUMSAMPLES ) { @@ -219,7 +219,7 @@ static void fooviz_port_put_buffer (xine_audio_port_t *port_gen, frame->duration = 90000 * this->samples_per_frame / port->rate; frame->pts = pts; this->metronom->got_video_frame(this->metronom, frame); - + this->sample_counter -= this->samples_per_frame; memset(frame->base[0], this->current_yuv_byte, FOO_WIDTH * FOO_HEIGHT * 2); @@ -256,14 +256,14 @@ static post_plugin_t *fooviz_open_plugin(post_class_t *class_gen, int inputs, post_out_t *output; post_out_t *outputv; post_audio_port_t *port; - + if (!this || !video_target || !video_target[0] || !audio_target || !audio_target[0] ) { free(this); return NULL; } - + _x_post_init(&this->post, 1, 0); - + this->metronom = _x_metronom_init(1, 0, class->xine); this->vo_port = video_target[0]; @@ -272,7 +272,7 @@ static post_plugin_t *fooviz_open_plugin(post_class_t *class_gen, int inputs, port->new_port.open = fooviz_port_open; port->new_port.close = fooviz_port_close; port->new_port.put_buffer = fooviz_port_put_buffer; - + outputv = &this->video_output; outputv->xine_out.name = "generated video"; outputv->xine_out.type = XINE_POST_DATA_VIDEO; @@ -280,9 +280,9 @@ static post_plugin_t *fooviz_open_plugin(post_class_t *class_gen, int inputs, outputv->xine_out.rewire = fooviz_rewire_video; outputv->post = &this->post; xine_list_push_back(this->post.output, outputv); - + this->post.xine_post.audio_input[0] = &port->new_port; - + this->post.dispose = fooviz_dispose; return &this->post; @@ -307,17 +307,17 @@ static void fooviz_class_dispose(post_class_t *class_gen) static void *fooviz_init_plugin(xine_t *xine, void *data) { post_class_fooviz_t *class = (post_class_fooviz_t *)malloc(sizeof(post_class_fooviz_t)); - + if (!class) return NULL; - + class->post_class.open_plugin = fooviz_open_plugin; class->post_class.get_identifier = fooviz_get_identifier; class->post_class.get_description = fooviz_get_description; class->post_class.dispose = fooviz_class_dispose; - + class->xine = xine; - + return class; } @@ -325,7 +325,7 @@ static void *fooviz_init_plugin(xine_t *xine, void *data) static const post_info_t fooviz_special_info = { XINE_POST_TYPE_AUDIO_VISUALIZATION }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_POST, 9, "fooviz", XINE_VERSION_CODE, &fooviz_special_info, &fooviz_init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/post/visualizations/oscope.c b/src/post/visualizations/oscope.c index a2c9c6961..28d1b4cbc 100644 --- a/src/post/visualizations/oscope.c +++ b/src/post/visualizations/oscope.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -59,13 +59,13 @@ struct post_plugin_oscope_s { /* private metronom for syncing the video */ metronom_t *metronom; - + double ratio; int data_idx; short data [MAXCHANNELS][NUMSAMPLES]; audio_buffer_t buf; /* dummy buffer just to hold a copy of audio data */ - + int channels; int sample_counter; int samples_per_frame; @@ -130,7 +130,7 @@ static void draw_oscope_dots(post_plugin_oscope_t *this) { /* draw channel scope */ for (i = 0; i < NUMSAMPLES; i++) { - pixel_ptr = + pixel_ptr = ((OSCOPE_HEIGHT * (c * 2 + 1) / (2*this->channels) ) + (this->data[c][i] >> 9)) * OSCOPE_WIDTH + i; this->yuv.y[pixel_ptr] = 0xFF; this->yuv.u[pixel_ptr] = this->u_current; @@ -161,7 +161,7 @@ static int oscope_rewire_video(xine_post_out_t *output_gen, void *data) xine_video_port_t *old_port = *(xine_video_port_t **)output_gen->data; xine_video_port_t *new_port = (xine_video_port_t *)data; post_plugin_oscope_t *this = (post_plugin_oscope_t *)output->post; - + if (!data) return 0; old_port->close(old_port, XINE_ANON_STREAM); @@ -179,12 +179,12 @@ static int oscope_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream, _x_post_rewire(&this->post); _x_post_inc_usage(port); - + port->stream = stream; port->bits = bits; port->rate = rate; port->mode = mode; - + this->ratio = (double)OSCOPE_WIDTH/(double)OSCOPE_HEIGHT; this->channels = _x_ao_mode2channels(mode); @@ -210,15 +210,15 @@ static void oscope_port_close(xine_audio_port_t *port_gen, xine_stream_t *stream this->vo_port->close(this->vo_port, XINE_ANON_STREAM); this->metronom->set_master(this->metronom, NULL); - + port->original_port->close(port->original_port, stream ); - + _x_post_dec_usage(port); } -static void oscope_port_put_buffer (xine_audio_port_t *port_gen, +static void oscope_port_put_buffer (xine_audio_port_t *port_gen, audio_buffer_t *buf, xine_stream_t *stream) { - + post_audio_port_t *port = (post_audio_port_t *)port_gen; post_plugin_oscope_t *this = (post_plugin_oscope_t *)port->post; vo_frame_t *frame; @@ -227,32 +227,32 @@ static void oscope_port_put_buffer (xine_audio_port_t *port_gen, int samples_used = 0; int64_t pts = buf->vpts; int i, c; - + /* make a copy of buf data for private use */ if( this->buf.mem_size < buf->mem_size ) { this->buf.mem = realloc(this->buf.mem, buf->mem_size); this->buf.mem_size = buf->mem_size; } - memcpy(this->buf.mem, buf->mem, + memcpy(this->buf.mem, buf->mem, buf->num_frames*this->channels*((port->bits == 8)?1:2)); this->buf.num_frames = buf->num_frames; - + /* pass data to original port */ - port->original_port->put_buffer(port->original_port, buf, stream ); - + port->original_port->put_buffer(port->original_port, buf, stream ); + /* we must not use original data anymore, it should have already being moved * to the fifo of free audio buffers. just use our private copy instead. */ - buf = &this->buf; - + buf = &this->buf; + this->sample_counter += buf->num_frames; - + do { - + if( port->bits == 8 ) { data8 = (int8_t *)buf->mem; data8 += samples_used * this->channels; - + /* scale 8 bit data to 16 bits and convert to signed as well */ for( i = samples_used; i < buf->num_frames && this->data_idx < NUMSAMPLES; i++, this->data_idx++, data8 += this->channels ) @@ -261,23 +261,23 @@ static void oscope_port_put_buffer (xine_audio_port_t *port_gen, } else { data = buf->mem; data += samples_used * this->channels; - + for( i = samples_used; i < buf->num_frames && this->data_idx < NUMSAMPLES; i++, this->data_idx++, data += this->channels ) for( c = 0; c < this->channels; c++) this->data[c][this->data_idx] = data[c]; } - + if( this->sample_counter >= this->samples_per_frame ) { - + samples_used += this->samples_per_frame; - + frame = this->vo_port->get_frame (this->vo_port, OSCOPE_WIDTH, OSCOPE_HEIGHT, this->ratio, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); frame->extra_info->invalid = 1; - - /* frame is marked as bad if we don't have enough samples for + + /* frame is marked as bad if we don't have enough samples for * updating the viz plugin (calculations may be skipped). * we must keep the framerate though. */ if( this->data_idx == NUMSAMPLES ) { @@ -289,12 +289,12 @@ static void oscope_port_put_buffer (xine_audio_port_t *port_gen, frame->duration = 90000 * this->samples_per_frame / port->rate; frame->pts = pts; this->metronom->got_video_frame(this->metronom, frame); - + this->sample_counter -= this->samples_per_frame; - + draw_oscope_dots(this); yuv444_to_yuy2(&this->yuv, frame->base[0], frame->pitches[0]); - + frame->draw(frame, XINE_ANON_STREAM); frame->free(frame); @@ -307,7 +307,7 @@ static void oscope_dispose(post_plugin_t *this_gen) post_plugin_oscope_t *this = (post_plugin_oscope_t *)this_gen; if (_x_post_dispose(this_gen)) { - + this->metronom->exit(this->metronom); if(this->buf.mem) @@ -327,14 +327,14 @@ static post_plugin_t *oscope_open_plugin(post_class_t *class_gen, int inputs, post_out_t *output; post_out_t *outputv; post_audio_port_t *port; - + if (!this || !video_target || !video_target[0] || !audio_target || !audio_target[0] ) { free(this); return NULL; } - + _x_post_init(&this->post, 1, 0); - + this->metronom = _x_metronom_init(1, 0, class->xine); this->vo_port = video_target[0]; @@ -343,7 +343,7 @@ static post_plugin_t *oscope_open_plugin(post_class_t *class_gen, int inputs, port->new_port.open = oscope_port_open; port->new_port.close = oscope_port_close; port->new_port.put_buffer = oscope_port_put_buffer; - + outputv = &this->video_output; outputv->xine_out.name = "generated video"; outputv->xine_out.type = XINE_POST_DATA_VIDEO; @@ -351,9 +351,9 @@ static post_plugin_t *oscope_open_plugin(post_class_t *class_gen, int inputs, outputv->xine_out.rewire = oscope_rewire_video; outputv->post = &this->post; xine_list_push_back(this->post.output, outputv); - + this->post.xine_post.audio_input[0] = &port->new_port; - + this->post.dispose = oscope_dispose; return &this->post; @@ -378,16 +378,16 @@ static void oscope_class_dispose(post_class_t *class_gen) void *oscope_init_plugin(xine_t *xine, void *data) { post_class_oscope_t *class = (post_class_oscope_t *)malloc(sizeof(post_class_oscope_t)); - + if (!class) return NULL; - + class->post_class.open_plugin = oscope_open_plugin; class->post_class.get_identifier = oscope_get_identifier; class->post_class.get_description = oscope_get_description; class->post_class.dispose = oscope_class_dispose; - + class->xine = xine; - + return &class->post_class; } diff --git a/src/video_out/deinterlace.c b/src/video_out/deinterlace.c index 712e9a83e..6d90caca0 100644 --- a/src/video_out/deinterlace.c +++ b/src/video_out/deinterlace.c @@ -42,7 +42,7 @@ const char *deinterlace_methods[] = { - "none", + "none", "bob", "weave", "greedy", @@ -201,7 +201,7 @@ static void deinterlace_bob_yuv_mmx( uint8_t *pdst, uint8_t *psrc[], /* Deinterlace the latest field, with a tendency to weave rather than bob. Good for high detail on low-movement scenes. Seems to produce bad output in general case, need to check if this - is normal or if the code is broken. + is normal or if the code is broken. */ static int deinterlace_weave_yuv_mmx( uint8_t *pdst, uint8_t *psrc[], int width, int height ) @@ -656,7 +656,7 @@ static void deinterlace_linearblend_yuv_mmx( uint8_t *pdst, uint8_t *psrc[], uint64_t *YVal3; uint64_t *Dest; int LineLength = width; - + int n; /* Copy first line */ @@ -676,7 +676,7 @@ static void deinterlace_linearblend_yuv_mmx( uint8_t *pdst, uint8_t *psrc[], movq_m2r (*YVal1++, mm0); movq_m2r (*YVal2++, mm1); movq_m2r (*YVal3++, mm2); - + /* expand bytes to words */ punpckhbw_r2r (mm0, mm3); punpckhbw_r2r (mm1, mm4); @@ -684,8 +684,8 @@ static void deinterlace_linearblend_yuv_mmx( uint8_t *pdst, uint8_t *psrc[], punpcklbw_r2r (mm0, mm0); punpcklbw_r2r (mm1, mm1); punpcklbw_r2r (mm2, mm2); - - /* + + /* * deinterlacing: * deint_line = (line0 + 2*line1 + line2) / 4 */ @@ -704,15 +704,15 @@ static void deinterlace_linearblend_yuv_mmx( uint8_t *pdst, uint8_t *psrc[], /* pack 8 words to 8 bytes in mm0 */ packuswb_r2r (mm3, mm0); - + movq_r2m ( mm0, *Dest++ ); } } /* Copy last line */ - xine_fast_memcpy(pdst + Line * LineLength, + xine_fast_memcpy(pdst + Line * LineLength, psrc[0] + Line * LineLength, LineLength); - + /* clear out the MMX registers ready for doing floating point * again */ @@ -734,7 +734,7 @@ static void deinterlace_linearblend_yuv_mmx( uint8_t *pdst, uint8_t *psrc[], * each line on pdst doesn't depend on previous lines; * due to the way the algorithm is defined, the first & last lines of the screen aren't deinterlaced. - + */ static void deinterlace_linearblend_yuv( uint8_t *pdst, uint8_t *psrc[], int width, int height ) @@ -751,7 +751,7 @@ static void deinterlace_linearblend_yuv( uint8_t *pdst, uint8_t *psrc[], xine_fast_memcpy(l0, l1, width); l0 += width; - for (y = 1; y < height-1; ++y) { + for (y = 1; y < height-1; ++y) { /* computes avg of: l1 + 2*l2 + l3 */ for (x = 0; x < width; ++x) { diff --git a/src/video_out/libdha/Makefile.am b/src/video_out/libdha/Makefile.am index 8d94347d1..9412bcd50 100644 --- a/src/video_out/libdha/Makefile.am +++ b/src/video_out/libdha/Makefile.am @@ -16,7 +16,7 @@ CLEANFILES = $(awk_generated) noinst_LTLIBRARIES = $(dha_lib) libdha_la_SOURCES = libdha.c mtrr.c pci.c mmi.c ports.c irq.c cpu_flush.c -nodist_libdha_la_SOURCES = pci_names.c +nodist_libdha_la_SOURCES = pci_names.c EXTRA_PROGRAMS = test diff --git a/src/video_out/libdha/sysdep/Makefile.am b/src/video_out/libdha/sysdep/Makefile.am index 807572c39..0896a8ded 100644 --- a/src/video_out/libdha/sysdep/Makefile.am +++ b/src/video_out/libdha/sysdep/Makefile.am @@ -24,7 +24,7 @@ EXTRA_DIST = \ pci_svr4.c \ pci_win32.c \ pci_x86.c - + noinst_HEADERS = \ AsmMacros_alpha.h \ AsmMacros_arm32.h \ diff --git a/src/video_out/macosx/video_window.h b/src/video_out/macosx/video_window.h index b46ac43fe..0a3655c0c 100644 --- a/src/video_out/macosx/video_window.h +++ b/src/video_out/macosx/video_window.h @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * Written by Daniel Mack <xine@zonque.org> - * + * * Most parts of this code were taken from VLC, http://www.videolan.org * Thanks for the good research! */ diff --git a/src/video_out/myglext.h b/src/video_out/myglext.h index 1a55a4f87..643b31c3d 100644 --- a/src/video_out/myglext.h +++ b/src/video_out/myglext.h @@ -13,21 +13,21 @@ extern "C" { ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** +** ** http://oss.sgi.com/projects/FreeB -** +** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** +** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2004 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. -** +** ** Additional Notice Provisions: This software was created using the ** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has ** not been independently verified as being compliant with the OpenGL(R) diff --git a/src/video_out/video_out_aa.c b/src/video_out/video_out_aa.c index 770b75a10..2f20bd7c0 100644 --- a/src/video_out/video_out_aa.c +++ b/src/video_out/video_out_aa.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -86,7 +86,7 @@ static uint32_t aa_get_capabilities (vo_driver_t *this) { static void aa_dispose_frame (vo_frame_t *vo_img) { aa_frame_t *frame = (aa_frame_t *)vo_img; - + if (frame->mem[0]) free (frame->mem[0]); if (frame->mem[1]) @@ -117,19 +117,19 @@ static vo_frame_t *aa_alloc_frame(vo_driver_t *this_gen) { frame->vo_frame.field = aa_frame_field; frame->vo_frame.dispose = aa_dispose_frame; frame->vo_frame.driver = this_gen; - + return (vo_frame_t*) frame; } static void aa_update_frame_format (vo_driver_t *this_gen, vo_frame_t *img, - uint32_t width, uint32_t height, + uint32_t width, uint32_t height, double ratio, int format, int flags) { aa_driver_t *this = (aa_driver_t*) this_gen; aa_frame_t *frame = (aa_frame_t *) img; /* printf ("aa_update_format...\n"); */ - if ((frame->width != width) || (frame->height != height) + if ((frame->width != width) || (frame->height != height) || (frame->format != format)) { if (frame->mem[0]) { @@ -140,7 +140,7 @@ static void aa_update_frame_format (vo_driver_t *this_gen, vo_frame_t *img, free (frame->mem[1]); frame->mem[1] = NULL; } - + if (frame->mem[2]) { free (frame->mem[2]); frame->mem[2] = NULL; @@ -202,27 +202,27 @@ static void aa_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { if (frame->format == XINE_IMGFMT_YV12) { for (y = 0; y<aa_imgheight (this->context); y++) { for (x = 0; x<aa_imgwidth (this->context); x++) { - + *img++ = src_image[((int)((double) x * x_fact) + frame->width * (int)((double) y * y_fact))]; - + } } } else { for (y = 0; y<aa_imgheight (this->context); y++) { for (x = 0; x<aa_imgwidth (this->context); x++) { - + *img++ = src_image[((int)((double) x * x_fact) * 2 + frame->width * 2 * (int)((double) y * y_fact))]; - + } } } frame->vo_frame.free (&frame->vo_frame); - aa_fastrender(this->context, 0, 0, - aa_imgwidth (this->context), + aa_fastrender(this->context, 0, 0, + aa_imgwidth (this->context), aa_imgheight (this->context)); aa_flush (this->context); @@ -231,7 +231,7 @@ static void aa_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { static int aa_get_property (vo_driver_t *this_gen, int property) { aa_driver_t *this = (aa_driver_t*) this_gen; - + if ( property == VO_PROP_ASPECT_RATIO) { return this->user_ratio ; } else { @@ -242,7 +242,7 @@ static int aa_get_property (vo_driver_t *this_gen, int property) { return 0; } -static int aa_set_property (vo_driver_t *this_gen, +static int aa_set_property (vo_driver_t *this_gen, int property, int value) { aa_driver_t *this = (aa_driver_t*) this_gen; @@ -259,7 +259,7 @@ static int aa_set_property (vo_driver_t *this_gen, return value; } -static void aa_get_property_min_max (vo_driver_t *this_gen, +static void aa_get_property_min_max (vo_driver_t *this_gen, int property, int *min, int *max) { *min = 0; *max = 0; @@ -277,9 +277,9 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi aa_driver_t *this; this = (aa_driver_t*) calloc(1, sizeof(aa_driver_t)); - + this->context = (aa_context*) visual_gen; - + this->config = class->config; this->xine = class->xine; @@ -298,7 +298,7 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi this->vo_driver.dispose = aa_dispose; return &this->vo_driver; -} +} static char* get_identifier (video_driver_class_t *this_gen) { return "AA"; @@ -315,14 +315,14 @@ static void dispose_class (video_driver_class_t *this_gen) { static void *init_class (xine_t *xine, void *visual_gen) { /* aa_context *context = (aa_context*) visual_gen; */ aa_class_t *this; - + this = calloc(1, sizeof(aa_class_t)); - + this->driver_class.open_plugin = open_plugin; this->driver_class.get_identifier = get_identifier; this->driver_class.get_description = get_description; this->driver_class.dispose = dispose_class; - + this->config = xine->config; this->xine = xine; @@ -335,7 +335,7 @@ static const vo_info_t vo_info_aa = { }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_VIDEO_OUT, 21, "aa", XINE_VERSION_CODE, &vo_info_aa, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/video_out/video_out_caca.c b/src/video_out/video_out_caca.c index 65ebf707e..5a060151e 100644 --- a/src/video_out/video_out_caca.c +++ b/src/video_out/video_out_caca.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2003, 2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -93,7 +93,7 @@ static uint32_t caca_get_capabilities (vo_driver_t *this) { static void caca_dispose_frame (vo_frame_t *vo_img) { caca_frame_t *frame = (caca_frame_t *)vo_img; - + if (frame->mem[0]) free (frame->mem[0]); if (frame->mem[1]) @@ -135,17 +135,17 @@ static vo_frame_t *caca_alloc_frame(vo_driver_t *this_gen) { /* colorspace converter for this frame */ frame->yuv2rgb = this->yuv2rgb_factory->create_converter (this->yuv2rgb_factory); - + return (vo_frame_t*) frame; } static void caca_update_frame_format (vo_driver_t *this_gen, vo_frame_t *img, - uint32_t width, uint32_t height, + uint32_t width, uint32_t height, double ratio, int format, int flags) { caca_driver_t *this = (caca_driver_t*) this_gen; caca_frame_t *frame = (caca_frame_t *) img; - if ((frame->width != width) || (frame->height != height) + if ((frame->width != width) || (frame->height != height) || (frame->format != format)) { if (frame->mem[0]) { @@ -228,7 +228,7 @@ static void caca_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { static int caca_get_property (vo_driver_t *this_gen, int property) { caca_driver_t *this = (caca_driver_t*) this_gen; - + if ( property == VO_PROP_ASPECT_RATIO) { return this->user_ratio; } else { @@ -239,7 +239,7 @@ static int caca_get_property (vo_driver_t *this_gen, int property) { return 0; } -static int caca_set_property (vo_driver_t *this_gen, +static int caca_set_property (vo_driver_t *this_gen, int property, int value) { caca_driver_t *this = (caca_driver_t*) this_gen; @@ -256,7 +256,7 @@ static int caca_set_property (vo_driver_t *this_gen, return value; } -static void caca_get_property_min_max (vo_driver_t *this_gen, +static void caca_get_property_min_max (vo_driver_t *this_gen, int property, int *min, int *max) { *min = 0; *max = 0; @@ -280,7 +280,7 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi caca_driver_t *this; this = calloc(1, sizeof (caca_driver_t)); - + this->config = class->config; this->xine = class->xine; @@ -311,7 +311,7 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi caca_refresh_display(this->dp); return &this->vo_driver; -} +} static char* get_identifier (video_driver_class_t *this_gen) { return "CACA"; @@ -327,14 +327,14 @@ static void dispose_class (video_driver_class_t *this_gen) { } static void *init_class (xine_t *xine, void *visual_gen) { caca_class_t *this; - + this = calloc(1, sizeof(caca_class_t)); - + this->driver_class.open_plugin = open_plugin; this->driver_class.get_identifier = get_identifier; this->driver_class.get_description = get_description; this->driver_class.dispose = dispose_class; - + this->config = xine->config; this->xine = xine; @@ -347,7 +347,7 @@ static const vo_info_t vo_info_caca = { }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_VIDEO_OUT, 21, "caca", XINE_VERSION_CODE, &vo_info_caca, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/video_out/video_out_directfb.c b/src/video_out/video_out_directfb.c index 2e9874cc0..77f20a367 100644 --- a/src/video_out/video_out_directfb.c +++ b/src/video_out/video_out_directfb.c @@ -1,13 +1,13 @@ /* * Copyright (C) 2000-2006 the xine project and Claudio Ciccani - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 @@ -19,7 +19,7 @@ * * * DirectFB based output plugin by Claudio Ciccani <klan@directfb.org> - * + * * Based on video_out_xv.c and video_out_vidix.c. */ @@ -71,18 +71,18 @@ typedef struct directfb_frame_s { typedef struct directfb_driver_s { vo_driver_t vo_driver; - + int visual_type; uint32_t capabilities; xine_t *xine; - + directfb_frame_t *cur_frame; /* DirectFB related stuff */ IDirectFB *dfb; IDirectFBDisplayLayer *underlay; - + /* Video Layer */ IDirectFBDisplayLayer *layer; IDirectFBSurface *surface; @@ -93,23 +93,23 @@ typedef struct directfb_driver_s { DFBColorAdjustment default_cadj; int default_level; int visible; - + /* Subpicture layer */ IDirectFBDisplayLayer *spic_layer; IDirectFBSurface *spic_surface; - + /* for hardware scaling */ IDirectFBSurface *temp; int temp_frame_width; int temp_frame_height; DFBSurfacePixelFormat temp_frame_format; - + /* wheter card supports stretchblit with deinterlacing */ int hw_deinterlace; - + /* wheter to enable deinterlacing */ int deinterlace; - + /* configurable options */ int buffermode; int vsync; @@ -117,7 +117,7 @@ typedef struct directfb_driver_s { uint32_t colorkey; int flicker_filtering; int field_parity; - + #ifdef DIRECTFB_X11 /* X11 related stuff */ Display *display; @@ -126,18 +126,18 @@ typedef struct directfb_driver_s { GC gc; int depth; x11osd *xoverlay; - + void *user_data; void (*lock_display) (void *user_data); void (*unlock_display) (void *user_data); #endif int ovl_changed; - + /* screen size */ int screen_width; int screen_height; - + /* size / aspect ratio calculations */ vo_scale_t sc; @@ -162,7 +162,7 @@ typedef struct { "no-deinit-check,"\ "disable-module=linux_input,"\ "disable-module=keyboard" - + #define XDIRECTFB_OPTIONS "no-banner,"\ "no-sighandler,"\ "no-deinit-check" @@ -189,7 +189,7 @@ typedef struct { else \ XLockDisplay (this->display); \ } while (0) - + #define UNLOCK_DISPLAY() \ do { \ if (this->unlock_display) \ @@ -197,7 +197,7 @@ typedef struct { else \ XUnlockDisplay (this->display); \ } while (0) - + /*** driver functions ***/ @@ -215,11 +215,11 @@ static void directfb_frame_dispose (vo_frame_t *vo_img) { if (frame) { if (frame->surface) { - if (frame->locked) + if (frame->locked) frame->surface->Unlock (frame->surface); frame->surface->Release (frame->surface); } - + free (frame); } } @@ -230,19 +230,19 @@ static vo_frame_t *directfb_alloc_frame (vo_driver_t *this_gen) { frame = (directfb_frame_t *) calloc(1, sizeof(directfb_frame_t)); if (!frame) { - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_directfb: directfb_alloc_frame: out of memory\n"); return NULL; } pthread_mutex_init (&frame->vo_frame.mutex, NULL); - - frame->vo_frame.proc_slice = NULL; + + frame->vo_frame.proc_slice = NULL; frame->vo_frame.proc_frame = NULL; - frame->vo_frame.field = directfb_frame_field; + frame->vo_frame.field = directfb_frame_field; frame->vo_frame.dispose = directfb_frame_dispose; frame->vo_frame.driver = this_gen; - + return &frame->vo_frame; } @@ -253,18 +253,18 @@ static void directfb_update_frame_format (vo_driver_t *this_gen, directfb_driver_t *this = (directfb_driver_t *) this_gen; directfb_frame_t *frame = (directfb_frame_t *) frame_gen; DFBSurfacePixelFormat format = (fmt == XINE_IMGFMT_YUY2) ? DSPF_YUY2 : DSPF_YV12; - + if (frame->surface == NULL || frame->width != width || frame->height != height || - frame->format != format) + frame->format != format) { DFBSurfaceDescription dsc; DFBResult ret; - + lprintf ("frame %p: format changed to %dx%d %s.\n", frame, width, height, (format == DSPF_YUY2) ? "YUY2" : "YV12"); - + if (frame->surface) { if (frame->locked) frame->surface->Unlock (frame->surface); @@ -272,26 +272,26 @@ static void directfb_update_frame_format (vo_driver_t *this_gen, frame->surface = NULL; frame->locked = 0; } - + dsc.flags = DSDESC_CAPS | DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT; dsc.caps = DSCAPS_SYSTEMONLY | DSCAPS_INTERLACED; dsc.width = (width + 7) & ~7; dsc.height = (height + 1) & ~1; dsc.pixelformat = format; - + ret = this->dfb->CreateSurface (this->dfb, &dsc, &frame->surface); if (ret != DFB_OK) { DirectFBError ("IDirectFB::CreateSurface()", ret); return; } - + frame->width = width; frame->height = height; frame->format = format; - - ret = frame->surface->Lock (frame->surface, - DSLF_READ | DSLF_WRITE, + + ret = frame->surface->Lock (frame->surface, + DSLF_READ | DSLF_WRITE, (void**)&frame->vo_frame.base[0], (int *)&frame->vo_frame.pitches[0]); if (ret != DFB_OK) { @@ -299,17 +299,17 @@ static void directfb_update_frame_format (vo_driver_t *this_gen, return; } frame->locked = 1; - + if (frame->format == DSPF_YV12) { frame->vo_frame.pitches[1] = frame->vo_frame.pitches[0]/2; frame->vo_frame.pitches[2] = frame->vo_frame.pitches[0]/2; - frame->vo_frame.base[2] = frame->vo_frame.base[0] + + frame->vo_frame.base[2] = frame->vo_frame.base[0] + dsc.height * frame->vo_frame.pitches[0]; frame->vo_frame.base[1] = frame->vo_frame.base[2] + dsc.height/2 * frame->vo_frame.pitches[2]; } } - + frame->ratio = ratio; } @@ -331,7 +331,7 @@ static uint32_t directfb_colorkey_to_pixel (directfb_driver_t *this) { default: break; } - + return this->colorkey; } #endif @@ -342,11 +342,11 @@ static void directfb_clean_output_area (directfb_driver_t *this) { #ifdef DIRECTFB_X11 if (this->config.options & DLOP_DST_COLORKEY) { int i; - + LOCK_DISPLAY(); - + XSetForeground (this->display, this->gc, BlackPixel(this->display, this->screen)); - + for (i = 0; i < 4; i++) { if (this->sc.border[i].w && this->sc.border[i].h) { XFillRectangle (this->display, this->drawable, this->gc, @@ -354,18 +354,18 @@ static void directfb_clean_output_area (directfb_driver_t *this) { this->sc.border[i].w, this->sc.border[i].h); } } - + XSetForeground (this->display, this->gc, directfb_colorkey_to_pixel(this)); - XFillRectangle (this->display, this->drawable, this->gc, + XFillRectangle (this->display, this->drawable, this->gc, this->sc.output_xoffset, this->sc.output_yoffset, this->sc.output_width, this->sc.output_height); - - + + if (this->xoverlay) { x11osd_resize (this->xoverlay, this->sc.gui_width, this->sc.gui_height); this->ovl_changed = 1; } - + XFlush (this->display); UNLOCK_DISPLAY(); @@ -384,7 +384,7 @@ static void directfb_clean_output_area (directfb_driver_t *this) { rect[i].w = MAX(this->sc.border[i].w, 0); rect[i].h = MAX(this->sc.border[i].h, 0); } - + this->surface->GetCapabilities (this->surface, &caps); if (caps & DSCAPS_DOUBLE) bufs++; @@ -392,7 +392,7 @@ static void directfb_clean_output_area (directfb_driver_t *this) { bufs++; this->surface->SetColor (this->surface, 0x00, 0x00, 0x00, 0xff); - for (i = 0; i < bufs; i++) { + for (i = 0; i < bufs; i++) { this->surface->FillRectangles (this->surface, &rect[0], 4); this->surface->Flip (this->surface, NULL, 0); } @@ -409,7 +409,7 @@ static void directfb_overlay_begin (vo_driver_t *this_gen, #ifdef DIRECTFB_X11 if (this->xoverlay) { LOCK_DISPLAY(); - x11osd_clear (this->xoverlay); + x11osd_clear (this->xoverlay); UNLOCK_DISPLAY(); } #endif @@ -419,7 +419,7 @@ static void directfb_overlay_begin (vo_driver_t *this_gen, this->spic_surface->Clear (this->spic_surface, 0, 0, 0, 0); } } - + this->alphablend_extra_data.offset_x = frame_gen->overlay_offset_x; this->alphablend_extra_data.offset_y = frame_gen->overlay_offset_y; } @@ -435,28 +435,28 @@ static void directfb_subpicture_paint (directfb_driver_t *this, int xoffset; int yoffset; int x, y, i; - + memset (colors, 0, sizeof(colors)); - + xoffset = this->sc.gui_win_x+overlay->x; yoffset = this->sc.gui_win_y+overlay->y; - + clip.x1 = xoffset; clip.y1 = yoffset; clip.x2 = xoffset + overlay->width - 1; clip.y2 = yoffset + overlay->height - 1; this->spic_surface->SetClip (this->spic_surface, &clip); - + for (x = 0, y= 0, i = 0; i < overlay->num_rle; i++) { int idx = overlay->rle[i].color; int len = overlay->rle[i].len; - + while (len > 0) { clut_t color = ((clut_t *)overlay->color)[idx]; uint8_t alpha = overlay->trans[idx]; int index = idx; int width; - + if ((len+x) > overlay->width) { width = overlay->width - x; len -= width; @@ -465,7 +465,7 @@ static void directfb_subpicture_paint (directfb_driver_t *this, width = len; len = 0; } - + if ((y >= overlay->hili_top) && (y <= overlay->hili_bottom) && (x <= overlay->hili_right)) @@ -478,28 +478,28 @@ static void directfb_subpicture_paint (directfb_driver_t *this, color = ((clut_t *)overlay->hili_color)[idx]; alpha = overlay->hili_trans[idx]; index += OVL_PALETTE_SIZE; - + if (x+width-1 > overlay->hili_right) { width -= overlay->hili_right - x; len += overlay->hili_right - x; } } } - + if (alpha) { if (n_rects == MAX_RECTS || (p_index != -1 && p_index != index)) { lprintf ("flushing %d rect(s).\n", n_rects); this->spic_surface->FillRectangles (this->spic_surface, rects, n_rects); n_rects = 0; } - + if (p_index != index) { if (!colors[index].a) { YCBCR_TO_RGB (color.y, color.cb, color.cr, colors[index].r, colors[index].g, colors[index].b); colors[index].a = alpha | (alpha << 4); } - + lprintf ("color change to %02x%02x%02x%02x.\n", colors[index].a, colors[index].r, colors[index].g, colors[index].b); @@ -508,7 +508,7 @@ static void directfb_subpicture_paint (directfb_driver_t *this, colors[index].b, colors[index].a); p_index = index; } - + rects[n_rects].x = x + xoffset; rects[n_rects].y = y + yoffset; rects[n_rects].w = width; @@ -520,10 +520,10 @@ static void directfb_subpicture_paint (directfb_driver_t *this, n_rects--; rects[n_rects].h++; } - } + } n_rects++; } - + x += width; if (x == overlay->width) { if (++y == overlay->height) @@ -532,7 +532,7 @@ static void directfb_subpicture_paint (directfb_driver_t *this, } } } - + if (n_rects) { lprintf ("flushing %d remaining rect(s).\n", n_rects); this->spic_surface->FillRectangles (this->spic_surface, rects, n_rects); @@ -543,17 +543,17 @@ static void directfb_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) { directfb_driver_t *this = (directfb_driver_t *) this_gen; directfb_frame_t *frame = (directfb_frame_t *) frame_gen; - + if (!overlay->rle) return; - + if (overlay->unscaled) { if (!this->ovl_changed) return; #ifdef DIRECTFB_X11 if (this->xoverlay) { LOCK_DISPLAY(); - x11osd_blend (this->xoverlay, overlay); + x11osd_blend (this->xoverlay, overlay); UNLOCK_DISPLAY(); } #endif @@ -570,7 +570,7 @@ static void directfb_overlay_blend (vo_driver_t *this_gen, &this->alphablend_extra_data); } else { - _x_blend_yuv (frame->vo_frame.base, overlay, + _x_blend_yuv (frame->vo_frame.base, overlay, frame->width, frame->height, frame->vo_frame.pitches, &this->alphablend_extra_data); @@ -602,20 +602,20 @@ static void directfb_overlay_end (vo_driver_t *this_gen, vo_frame_t *frame_gen) static int directfb_redraw_needed (vo_driver_t *this_gen) { directfb_driver_t *this = (directfb_driver_t *) this_gen; directfb_frame_t *frame = this->cur_frame; - + if (!frame) return 1; - - this->sc.delivered_width = frame->width; - this->sc.delivered_height = frame->height; - this->sc.delivered_ratio = frame->ratio; + + this->sc.delivered_width = frame->width; + this->sc.delivered_height = frame->height; + this->sc.delivered_ratio = frame->ratio; this->sc.crop_left = frame->vo_frame.crop_left; this->sc.crop_right = frame->vo_frame.crop_right; this->sc.crop_top = frame->vo_frame.crop_top; this->sc.crop_bottom = frame->vo_frame.crop_bottom; - + _x_vo_scale_compute_ideal_size (&this->sc); - + if (_x_vo_scale_redraw_needed (&this->sc)) { lprintf ("redraw needed.\n"); _x_vo_scale_compute_output_size (&this->sc); @@ -624,20 +624,20 @@ static int directfb_redraw_needed (vo_driver_t *this_gen) { this->layer->SetSourceRectangle (this->layer, this->sc.displayed_xoffset, this->sc.displayed_yoffset, - this->sc.displayed_width, + this->sc.displayed_width, this->sc.displayed_height ); this->layer->SetScreenRectangle (this->layer, - this->sc.gui_win_x+this->sc.output_xoffset, + this->sc.gui_win_x+this->sc.output_xoffset, this->sc.gui_win_y+this->sc.output_yoffset, this->sc.output_width, this->sc.output_height); } - + directfb_clean_output_area (this); - + return 1; } - + return 0; } @@ -645,30 +645,30 @@ static int directfb_redraw_needed (vo_driver_t *this_gen) { static void directfb_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { directfb_driver_t *this = (directfb_driver_t *) this_gen; directfb_frame_t *frame = (directfb_frame_t *) frame_gen; - + if (this->cur_frame) this->cur_frame->vo_frame.free (&this->cur_frame->vo_frame); this->cur_frame = frame; - + this->config.flags = DLCONF_NONE; - + if (frame->width != this->config.width) { this->config.flags |= DLCONF_WIDTH; this->config.width = frame->width; } - + if (frame->height != this->config.height) { this->config.flags |= DLCONF_HEIGHT; this->config.height = frame->height; } - - if (this->type & DLTF_VIDEO) { + + if (this->type & DLTF_VIDEO) { if (frame->format != this->config.pixelformat) { this->config.flags |= DLCONF_PIXELFORMAT; this->config.pixelformat = frame->format; } } - + if (this->caps & DLCAPS_DEINTERLACING) { if (this->deinterlace && !(this->config.options & DLOP_DEINTERLACING)) { @@ -681,14 +681,14 @@ static void directfb_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen this->config.options &= ~DLOP_DEINTERLACING; } } - + if (this->config.flags) { DFBDisplayLayerConfigFlags failed = 0; - + lprintf ("changing layer configuration to %dx%d %s.\n", this->config.width, this->config.height, (this->config.pixelformat == DSPF_YUY2) ? "YUY2" : "YV12"); - + this->layer->TestConfiguration (this->layer, &this->config, &failed); this->config.flags &= ~failed; if (this->config.flags) { @@ -700,7 +700,7 @@ static void directfb_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen lprintf ("failed=0x%08x.\n", failed); } - + if (this->sc.delivered_width != frame->width || this->sc.delivered_height != frame->height || this->sc.delivered_ratio != frame->ratio) @@ -708,9 +708,9 @@ static void directfb_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen lprintf ("forcing redraw.\n"); this->sc.force_redraw = 1; } - + directfb_redraw_needed (&this->vo_driver); - + if (!this->visible) { this->layer->SetOpacity (this->layer, 0xff); this->visible = 1; @@ -720,13 +720,13 @@ static void directfb_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen frame->surface->Unlock (frame->surface); frame->locked = 0; } - + if (this->deinterlace) { if (!(this->config.options & DLOP_DEINTERLACING)) { - frame->surface->SetField (frame->surface, + frame->surface->SetField (frame->surface, frame->vo_frame.top_field_first ? 0 : 1); this->surface->SetBlittingFlags (this->surface, DSBLIT_DEINTERLACE); - } + } else { this->surface->SetField (this->surface, frame->vo_frame.top_field_first ? 0 : 1); @@ -734,13 +734,13 @@ static void directfb_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen } else { this->surface->SetBlittingFlags (this->surface, DSBLIT_NOFX); } - + this->surface->Blit (this->surface, frame->surface, NULL, 0, 0); this->surface->Flip (this->surface, NULL, (this->vsync) ? DSFLIP_WAITFORSYNC : DSFLIP_ONSYNC); - - frame->surface->Lock (frame->surface, - DSLF_READ | DSLF_WRITE, + + frame->surface->Lock (frame->surface, + DSLF_READ | DSLF_WRITE, (void**)&frame->vo_frame.base[0], (int *)&frame->vo_frame.pitches[0]); frame->locked = 1; @@ -753,28 +753,28 @@ static void directfb_display_frame2 (vo_driver_t *this_gen, vo_frame_t *frame_ge DFBSurfaceBlittingFlags flags; DFBRectangle s, d; DFBResult ret; - + if (this->cur_frame) this->cur_frame->vo_frame.free (&this->cur_frame->vo_frame); this->cur_frame = frame; - + /* TODO: try to change video mode when frame size changes */ - + if (this->type & DLTF_VIDEO) { if (frame->format != this->config.pixelformat) { this->config.flags = DLCONF_PIXELFORMAT; this->config.pixelformat = frame->format; - + lprintf ("changing layer pixelformat to %s.\n", (this->config.pixelformat == DSPF_YUY2) ? "YUY2" : "YV12"); - + ret = this->layer->SetConfiguration (this->layer, &this->config); this->layer->GetConfiguration (this->layer, &this->config); lprintf ("%s.\n", ret ? "failed" : "ok"); } - } - + } + if (this->temp) { /* try to reduce video memory fragmentation */ if (this->temp_frame_width < frame->width || @@ -784,27 +784,27 @@ static void directfb_display_frame2 (vo_driver_t *this_gen, vo_frame_t *frame_ge DFBSurfaceDescription dsc; lprintf ("reallocating temporary surface.\n"); - + this->temp->Release (this->temp); this->temp = NULL; - + dsc.flags = DSDESC_CAPS | DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT; dsc.caps = DSCAPS_INTERLACED; dsc.width = frame->width; dsc.height = frame->height; dsc.pixelformat = this->config.pixelformat; - + ret = this->dfb->CreateSurface (this->dfb, &dsc, &this->temp); if (ret != DFB_OK) DirectFBError ("IDirectFB::CreateSurface()", ret); - + this->temp_frame_width = frame->width; this->temp_frame_height = frame->height; this->temp_frame_format = this->config.pixelformat; } } - + if (this->sc.delivered_width != frame->width || this->sc.delivered_height != frame->height || this->sc.delivered_ratio != frame->ratio) @@ -812,7 +812,7 @@ static void directfb_display_frame2 (vo_driver_t *this_gen, vo_frame_t *frame_ge lprintf ("forcing redraw.\n"); this->sc.force_redraw = 1; } - + directfb_redraw_needed (&this->vo_driver); if (!this->visible) { @@ -824,24 +824,24 @@ static void directfb_display_frame2 (vo_driver_t *this_gen, vo_frame_t *frame_ge frame->surface->Unlock (frame->surface); frame->locked = 0; } - + /* source rectangle */ s.x = this->sc.displayed_xoffset; s.y = this->sc.displayed_yoffset; s.w = this->sc.displayed_width; s.h = this->sc.displayed_height; - + /* destination rectangle */ d.x = this->sc.gui_win_x+this->sc.output_xoffset; d.y = this->sc.gui_win_y+this->sc.output_yoffset; d.w = this->sc.output_width; d.h = this->sc.output_height; - + flags = (this->deinterlace) ? DSBLIT_DEINTERLACE : DSBLIT_NOFX; - + if (this->temp) { if (this->hw_deinterlace) { - this->temp->SetField (this->temp, + this->temp->SetField (this->temp, frame->vo_frame.top_field_first ? 0 : 1); this->surface->SetBlittingFlags (this->surface, flags); } @@ -850,23 +850,23 @@ static void directfb_display_frame2 (vo_driver_t *this_gen, vo_frame_t *frame_ge frame->vo_frame.top_field_first ? 0 : 1); this->temp->SetBlittingFlags (this->temp, flags); } - + this->temp->Blit (this->temp, frame->surface, &s, 0, 0); s.x = 0; s.y = 0; this->surface->StretchBlit (this->surface, this->temp, &s, &d); - } + } else { frame->surface->SetField (frame->surface, frame->vo_frame.top_field_first ? 0 : 1); this->surface->SetBlittingFlags (this->surface, flags); this->surface->StretchBlit (this->surface, frame->surface, &s, &d); } - + this->surface->Flip (this->surface, NULL, (this->vsync) ? DSFLIP_WAITFORSYNC : DSFLIP_ONSYNC); - - frame->surface->Lock (frame->surface, - DSLF_READ | DSLF_WRITE, + + frame->surface->Lock (frame->surface, + DSLF_READ | DSLF_WRITE, (void**)&frame->vo_frame.base[0], (int *)&frame->vo_frame.pitches[0]); frame->locked = 1; @@ -874,48 +874,48 @@ static void directfb_display_frame2 (vo_driver_t *this_gen, vo_frame_t *frame_ge static int directfb_get_property (vo_driver_t *this_gen, int property) { directfb_driver_t *this = (directfb_driver_t *) this_gen; - + switch (property) { case VO_PROP_INTERLACED: return this->deinterlace; - + case VO_PROP_ASPECT_RATIO: return this->sc.user_ratio; - + case VO_PROP_HUE: if (this->caps & DLCAPS_HUE) return this->cadj.hue; break; - + case VO_PROP_SATURATION: if (this->caps & DLCAPS_SATURATION) return this->cadj.saturation; break; - + case VO_PROP_CONTRAST: if (this->caps & DLCAPS_CONTRAST) return this->cadj.contrast; break; - + case VO_PROP_BRIGHTNESS: if (this->caps & DLCAPS_BRIGHTNESS) return this->cadj.brightness; break; - + case VO_PROP_COLORKEY: if (this->caps & DLCAPS_DST_COLORKEY) return this->colorkey; break; - + case VO_PROP_ZOOM_X: return this->sc.zoom_factor_x * XINE_VO_ZOOM_STEP; - + case VO_PROP_ZOOM_Y: return this->sc.zoom_factor_y * XINE_VO_ZOOM_STEP; - + case VO_PROP_WINDOW_WIDTH: return this->sc.gui_width; - + case VO_PROP_WINDOW_HEIGHT: return this->sc.gui_height; @@ -925,21 +925,21 @@ static int directfb_get_property (vo_driver_t *this_gen, int property) { default: break; } - + return 0; } -static int directfb_set_property (vo_driver_t *this_gen, +static int directfb_set_property (vo_driver_t *this_gen, int property, int value) { directfb_driver_t *this = (directfb_driver_t *) this_gen; - + switch (property) { case VO_PROP_INTERLACED: xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_directfb: deinterlacing set to %d.\n", value); this->deinterlace = value; break; - + case VO_PROP_ASPECT_RATIO: if (value >= XINE_VO_ASPECT_NUM_RATIOS) value = XINE_VO_ASPECT_NUM_RATIOS-1; @@ -950,7 +950,7 @@ static int directfb_set_property (vo_driver_t *this_gen, _x_vo_scale_compute_ideal_size (&this->sc); this->sc.force_redraw = 1; break; - + case VO_PROP_HUE: if (this->caps & DLCAPS_HUE) { if (value > 0xffff) @@ -962,7 +962,7 @@ static int directfb_set_property (vo_driver_t *this_gen, this->layer->SetColorAdjustment (this->layer, &this->cadj); } break; - + case VO_PROP_SATURATION: if (this->caps & DLCAPS_SATURATION) { if (value > 0xffff) @@ -974,7 +974,7 @@ static int directfb_set_property (vo_driver_t *this_gen, this->layer->SetColorAdjustment (this->layer, &this->cadj); } break; - + case VO_PROP_CONTRAST: if (this->caps & DLCAPS_CONTRAST) { if (value > 0xffff) @@ -986,7 +986,7 @@ static int directfb_set_property (vo_driver_t *this_gen, this->layer->SetColorAdjustment (this->layer, &this->cadj); } break; - + case VO_PROP_BRIGHTNESS: if (this->caps & DLCAPS_BRIGHTNESS) { if (value > 0xffff) @@ -998,7 +998,7 @@ static int directfb_set_property (vo_driver_t *this_gen, this->layer->SetColorAdjustment (this->layer, &this->cadj); } break; - + case VO_PROP_COLORKEY: if (this->caps & DLCAPS_DST_COLORKEY) { if (value > 0xffffff) @@ -1012,7 +1012,7 @@ static int directfb_set_property (vo_driver_t *this_gen, directfb_clean_output_area (this); } break; - + case VO_PROP_ZOOM_X: if (value >= XINE_VO_ZOOM_MIN && value <= XINE_VO_ZOOM_MAX) { xprintf (this->xine, XINE_VERBOSITY_DEBUG, @@ -1022,7 +1022,7 @@ static int directfb_set_property (vo_driver_t *this_gen, this->sc.force_redraw = 1; } break; - + case VO_PROP_ZOOM_Y: if (value >= XINE_VO_ZOOM_MIN && value <= XINE_VO_ZOOM_MAX) { xprintf (this->xine, XINE_VERBOSITY_DEBUG, @@ -1032,29 +1032,29 @@ static int directfb_set_property (vo_driver_t *this_gen, this->sc.force_redraw = 1; } break; - + default: break; - } - + } + return value; } static void directfb_get_property_min_max (vo_driver_t *this_gen, int property, int *min, int *max) { directfb_driver_t *this = (directfb_driver_t *) this_gen; - + switch (property) { case VO_PROP_INTERLACED: *min = 0; *max = 1; return; - + case VO_PROP_ASPECT_RATIO: - *min = 0; + *min = 0; *max = XINE_VO_ASPECT_NUM_RATIOS-1; return; - + case VO_PROP_HUE: if (this->caps & DLCAPS_HUE) { *min = 0x0000; @@ -1062,7 +1062,7 @@ static void directfb_get_property_min_max (vo_driver_t *this_gen, return; } break; - + case VO_PROP_SATURATION: if (this->caps & DLCAPS_SATURATION) { *min = 0x0000; @@ -1070,7 +1070,7 @@ static void directfb_get_property_min_max (vo_driver_t *this_gen, return; } break; - + case VO_PROP_CONTRAST: if (this->caps & DLCAPS_CONTRAST) { *min = 0x0000; @@ -1078,7 +1078,7 @@ static void directfb_get_property_min_max (vo_driver_t *this_gen, return; } break; - + case VO_PROP_BRIGHTNESS: if (this->caps & DLCAPS_BRIGHTNESS) { *min = 0x0000; @@ -1086,7 +1086,7 @@ static void directfb_get_property_min_max (vo_driver_t *this_gen, return; } break; - + case VO_PROP_COLORKEY: if (this->caps & DLCAPS_DST_COLORKEY) { *min = 0x000000; @@ -1094,25 +1094,25 @@ static void directfb_get_property_min_max (vo_driver_t *this_gen, return; } break; - + case VO_PROP_ZOOM_X: case VO_PROP_ZOOM_Y: *min = XINE_VO_ZOOM_MIN; *max = XINE_VO_ZOOM_MAX; return; - + default: break; } - + *min = 0; *max = 0; } -static int directfb_gui_data_exchange (vo_driver_t *this_gen, +static int directfb_gui_data_exchange (vo_driver_t *this_gen, int data_type, void *data) { directfb_driver_t *this = (directfb_driver_t *) this_gen; - + switch (data_type) { case XINE_GUI_SEND_DRAWABLE_CHANGED: lprintf ("drawable changed.\n"); @@ -1126,11 +1126,11 @@ static int directfb_gui_data_exchange (vo_driver_t *this_gen, if (this->xoverlay) { x11osd_drawable_changed (this->xoverlay, this->drawable); this->ovl_changed = 1; - } + } UNLOCK_DISPLAY(); this->sc.force_redraw = 1; } -#endif +#endif directfb_clean_output_area (this); break; @@ -1148,13 +1148,13 @@ static int directfb_gui_data_exchange (vo_driver_t *this_gen, #endif directfb_clean_output_area (this); break; - + case XINE_GUI_SEND_TRANSLATE_GUI_TO_VIDEO: { int x1, y1, x2, y2; x11_rectangle_t *rect = data; - + _x_vo_scale_translate_gui2video (&this->sc, - rect->x, rect->y, + rect->x, rect->y, &x1, &y1); _x_vo_scale_translate_gui2video (&this->sc, rect->x + rect->w, rect->y + rect->h, @@ -1164,11 +1164,11 @@ static int directfb_gui_data_exchange (vo_driver_t *this_gen, rect->w = x2-x1; rect->h = y2-y1; } break; - + default: return -1; } - + return 0; } @@ -1177,7 +1177,7 @@ static void directfb_dispose (vo_driver_t *this_gen) { if (this->cur_frame) this->cur_frame->vo_frame.dispose (&this->cur_frame->vo_frame); - + #ifdef DIRECTFB_X11 if (this->visual_type == XINE_VISUAL_TYPE_X11 || this->visual_type == XINE_VISUAL_TYPE_X11_2) { @@ -1191,25 +1191,25 @@ static void directfb_dispose (vo_driver_t *this_gen) { if (this->temp) this->temp->Release (this->temp); - + if (this->spic_surface) this->spic_surface->Release (this->spic_surface); - + if (this->spic_layer) this->spic_layer->Release (this->spic_layer); - + if (this->surface) this->surface->Release (this->surface); - + if (this->layer) { this->layer->SetColorAdjustment (this->layer, &this->default_cadj); this->layer->SetLevel (this->layer, this->default_level); this->layer->Release (this->layer); } - + if (this->underlay) this->underlay->Release (this->underlay); - + if (this->dfb) this->dfb->Release (this->dfb); @@ -1222,12 +1222,12 @@ static void directfb_dispose (vo_driver_t *this_gen) { static void update_config_cb (void *data, xine_cfg_entry_t *entry) { directfb_driver_t *this = (directfb_driver_t *) data; - + lprintf ("update_config_cb(%s).\n", entry->key); - + if (strcmp (entry->key, "video.device.directfb_buffermode") == 0) { DFBDisplayLayerConfig config = { .flags = DLCONF_BUFFERMODE }; - + switch (entry->num_value) { case 0: config.buffermode = DLBM_FRONTONLY; @@ -1239,46 +1239,46 @@ static void update_config_cb (void *data, xine_cfg_entry_t *entry) { config.buffermode = DLBM_BACKVIDEO; break; } - + if (config.buffermode != this->config.buffermode) { if (this->layer->SetConfiguration (this->layer, &config ) != DFB_OK) { xprintf (this->xine, XINE_VERBOSITY_LOG, - "video_out_directfb: failed to set buffermode to %d!\n", + "video_out_directfb: failed to set buffermode to %d!\n", entry->num_value); return; } - + this->layer->GetConfiguration (this->layer, &this->config); } } else if (strcmp (entry->key, "video.device.directfb_colorkeying") == 0) { DFBDisplayLayerConfig config = { .flags = DLCONF_OPTIONS }; - + if (entry->num_value) config.options = this->config.options | DLOP_DST_COLORKEY; else config.options = this->config.options & ~DLOP_DST_COLORKEY; - + if (config.options != this->config.options) { if (this->layer->SetConfiguration (this->layer, &config) != DFB_OK) { xprintf (this->xine, XINE_VERBOSITY_LOG, - "video_out_directfb: failed to set colour keying to %d!\n", + "video_out_directfb: failed to set colour keying to %d!\n", entry->num_value); return; } - + this->layer->GetConfiguration (this->layer, &this->config); directfb_clean_output_area (this); } - } + } else if (strcmp (entry->key, "video.device.directfb_colorkey") == 0) { this->colorkey = entry->num_value; this->layer->SetDstColorKey (this->layer, (this->colorkey & 0xff0000) >> 16, (this->colorkey & 0x00ff00) >> 8, - (this->colorkey & 0x0000ff) >> 0); + (this->colorkey & 0x0000ff) >> 0); #ifdef DIRECTFB_X11 if (this->xoverlay) { - x11osd_colorkey (this->xoverlay, + x11osd_colorkey (this->xoverlay, directfb_colorkey_to_pixel(this), &this->sc); } #endif @@ -1286,52 +1286,52 @@ static void update_config_cb (void *data, xine_cfg_entry_t *entry) { } else if (strcmp (entry->key, "video.device.directfb_flicker_filtering") == 0) { DFBDisplayLayerConfig config = { .flags = DLCONF_OPTIONS }; - + if (entry->num_value) config.options = this->config.options | DLOP_FLICKER_FILTERING; else config.options = this->config.options & ~DLOP_FLICKER_FILTERING; - + if (config.options != this->config.options) { if (this->layer->SetConfiguration (this->layer, &config) != DFB_OK) { xprintf (this->xine, XINE_VERBOSITY_LOG, - "video_out_directfb: failed to set flicker_filtering to %d!\n", + "video_out_directfb: failed to set flicker_filtering to %d!\n", entry->num_value); return; } - + this->layer->GetConfiguration (this->layer, &this->config); } } else if (strcmp (entry->key, "video.device.directfb_field_parity") == 0) { DFBDisplayLayerConfig config = { .flags = DLCONF_OPTIONS }; - + if (entry->num_value) config.options = this->config.options | DLOP_FIELD_PARITY; else config.options = this->config.options & ~DLOP_FIELD_PARITY; - + if (config.options != this->config.options) { if (this->layer->SetConfiguration (this->layer, &config) != DFB_OK) { xprintf (this->xine, XINE_VERBOSITY_LOG, - "video_out_directfb: failed to set field_parity to %d!\n", + "video_out_directfb: failed to set field_parity to %d!\n", entry->num_value); return; } - + this->layer->GetConfiguration (this->layer, &this->config); - } + } } else if (strcmp (entry->key, "video.device.directfb_vsync") == 0) { this->vsync = entry->num_value; } } - + static void init_config (directfb_driver_t *this) { config_values_t *config = this->xine->config; static const char *buffermode_enum[] = {"single", "double", "triple", 0}; static const char *fieldparity_enum[] = {"none", "top", "bottom", 0}; - + this->buffermode = config->register_enum (config, "video.device.directfb_buffermode", this->buffermode, (char**)buffermode_enum, _("video layer buffering mode"), @@ -1339,14 +1339,14 @@ static void init_config (directfb_driver_t *this) { "Double or triple buffering give a smoother playback, " "but consume more video memory."), 10, update_config_cb, (void *)this); - + this->vsync = config->register_bool (config, "video.device.directfb_vsync", this->vsync, _("wait for vertical retrace"), _("Enable synchronizing the update of the video image to the " "repainting of the entire screen (\"vertical retrace\")."), 10, update_config_cb, (void *)this); - + if (this->caps & DLCAPS_DST_COLORKEY) { this->colorkeying = config->register_bool (config, "video.device.directfb_colorkeying", this->colorkeying, @@ -1354,7 +1354,7 @@ static void init_config (directfb_driver_t *this) { _("Enable using a colour key to tell the graphics card " "where to overlay the video image."), 20, update_config_cb, (void *)this); - + this->colorkey = config->register_range (config, "video.device.directfb_colorkey", this->colorkey, 0, 0xffffff, _("video colour key"), @@ -1363,7 +1363,7 @@ static void init_config (directfb_driver_t *this) { "if you experience windows becoming transparent."), 10, update_config_cb, (void *)this); } - + if (this->caps & DLCAPS_FLICKER_FILTERING) { this->flicker_filtering = config->register_bool( config, "video.device.directfb_flicker_filtering", this->flicker_filtering, @@ -1371,7 +1371,7 @@ static void init_config (directfb_driver_t *this) { _("Enable Flicker Filetring for a smooth output on an interlaced display."), 10, update_config_cb, (void *)this); } - + if (this->caps & DLCAPS_FIELD_PARITY) { this->field_parity = config->register_enum( config, "video.device.directfb_field_parity", this->field_parity, (char**)fieldparity_enum, @@ -1385,7 +1385,7 @@ static void init_config (directfb_driver_t *this) { static DFBEnumerationResult find_overlay (DFBDisplayLayerID id, DFBDisplayLayerDescription dsc, void *ctx) { DFBDisplayLayerID *ret_id = (DFBDisplayLayerID *) ctx; - + if (dsc.type & DLTF_VIDEO && dsc.caps & DLCAPS_SURFACE && dsc.caps & DLCAPS_SCREEN_LOCATION) { @@ -1393,27 +1393,27 @@ static DFBEnumerationResult find_overlay (DFBDisplayLayerID id, *ret_id = id; return DFENUM_CANCEL; } - + return DFENUM_OK; } static DFBEnumerationResult find_underlay (DFBDisplayLayerID id, DFBDisplayLayerDescription dsc, void *ctx) { DFBDisplayLayerID *ret_id = (DFBDisplayLayerID *) ctx; - + if (dsc.caps & DLCAPS_SURFACE) { lprintf ("underlay's id = %d.\n", id); *ret_id = id; return DFENUM_CANCEL; } - + return DFENUM_OK; } static DFBEnumerationResult find_subpicture (DFBDisplayLayerID id, DFBDisplayLayerDescription dsc, void *ctx) { DFBDisplayLayerID *ret_id = (DFBDisplayLayerID *) ctx; - + if (id != DLID_PRIMARY && dsc.caps & DLCAPS_SURFACE && dsc.caps & DLCAPS_ALPHACHANNEL) { @@ -1421,33 +1421,33 @@ static DFBEnumerationResult find_subpicture (DFBDisplayLayerID id, *ret_id = id; return DFENUM_CANCEL; } - + return DFENUM_OK; } static void init_subpicture (directfb_driver_t *this) { DFBResult ret; - + /* subpicture layer supported by Unichrome and Radeon */ if (this->caps & DLCAPS_LEVELS && this->underlay) { DFBDisplayLayerDescription dsc; - + this->underlay->GetDescription (this->underlay, &dsc); if (dsc.caps & DLCAPS_ALPHACHANNEL) { DFBDisplayLayerConfig config; - - /* enable alphachannel on the underlay */ + + /* enable alphachannel on the underlay */ config.flags = DLCONF_PIXELFORMAT | DLCONF_OPTIONS; config.pixelformat = DSPF_ARGB; config.options = DLOP_ALPHACHANNEL; - + ret = this->underlay->SetConfiguration (this->underlay, &config); if (ret) { /* try AiRGB if the previous failed */ - config.pixelformat = DSPF_AiRGB; + config.pixelformat = DSPF_AiRGB; ret = this->underlay->SetConfiguration (this->underlay, &config); } - + if (ret == DFB_OK) { this->underlay->AddRef (this->underlay); this->spic_layer = this->underlay; @@ -1456,33 +1456,33 @@ static void init_subpicture (directfb_driver_t *this) { } } } -#if 0 +#if 0 /* most common type of supicture layer */ if (!this->spic_layer) { IDirectFBScreen *screen; DFBDisplayLayerID video_id, id = -1; - + this->layer->GetID (this->layer, &video_id); - + if (this->layer->GetScreen (this->layer, &screen) == DFB_OK) { screen->EnumDisplayLayers (screen, find_subpicture, (void *)&id); screen->Release (screen); } - - if (id != -1 && id != video_id) { + + if (id != -1 && id != video_id) { ret = this->dfb->GetDisplayLayer (this->dfb, id, &this->spic_layer); if (ret == DFB_OK) { DFBDisplayLayerConfig config; - + this->spic_layer->GetConfiguration (this->spic_layer, &config); - + config.flags = DLCONF_OPTIONS; config.options = DLOP_ALPHACHANNEL; if (!DFB_PIXELFORMAT_HAS_ALPHA(config.pixelformat)) { config.flags |= DLCONF_PIXELFORMAT; config.pixelformat = DSPF_ALUT44; } - + ret = this->spic_layer->SetConfiguration (this->spic_layer, &config); if (ret) { lprintf ("failed to set subpicture layer configuration!\n"); @@ -1495,7 +1495,7 @@ static void init_subpicture (directfb_driver_t *this) { } } } -#endif +#endif if (this->spic_layer) { ret = this->spic_layer->GetSurface (this->spic_layer, &this->spic_surface); if (ret) { @@ -1504,10 +1504,10 @@ static void init_subpicture (directfb_driver_t *this) { this->spic_layer = NULL; return; } - + this->spic_surface->Clear (this->spic_surface, 0, 0, 0, 0); this->spic_surface->Flip (this->spic_surface, NULL, 0); - + xprintf (this->xine, XINE_VERBOSITY_LOG, _("video_out_directfb: using hardware subpicture acceleration.\n")); } @@ -1520,18 +1520,18 @@ static DFBResult init_device (directfb_driver_t *this) { DFBResult ret; config.flags = DLCONF_NONE; - + if (this->type & DLTF_VIDEO) { xprintf (this->xine, XINE_VERBOSITY_LOG, _("video_out_directfb: layer supports video output.\n")); config.flags |= DLCONF_PIXELFORMAT; - + /* test for YV12 support */ config.pixelformat = DSPF_YV12; ret = this->layer->TestConfiguration (this->layer, &config, NULL); if (ret) { - xprintf (this->xine, XINE_VERBOSITY_LOG, + xprintf (this->xine, XINE_VERBOSITY_LOG, _("video_out_directfb: layer doesn't support YV12!\n")); /* test for YUY2 support */ @@ -1546,7 +1546,7 @@ static DFBResult init_device (directfb_driver_t *this) { } } } - + #if DIRECTFB_VERSION_CODE < VERSION_CODE(0,9,25) if (!(this->type & DLTF_VIDEO)) { xprintf (this->xine, XINE_VERBOSITY_LOG, @@ -1554,12 +1554,12 @@ static DFBResult init_device (directfb_driver_t *this) { "need at least DirectFB 0.9.25 to play on this layer!\n")); return DFB_UNSUPPORTED; } -#endif - +#endif + /* set layer configuration */ config.flags |= DLCONF_BUFFERMODE | DLCONF_OPTIONS; config.options = DLOP_NONE; - + switch (this->buffermode) { case 0: config.buffermode = DLBM_FRONTONLY; @@ -1571,22 +1571,22 @@ static DFBResult init_device (directfb_driver_t *this) { config.buffermode = DLBM_BACKVIDEO; break; } - + if (this->colorkeying) config.options |= DLOP_DST_COLORKEY; - + if (this->flicker_filtering) config.options |= DLOP_FLICKER_FILTERING; - + if (this->field_parity) config.options |= DLOP_FIELD_PARITY; - + /* test current configuration */ ret = this->layer->TestConfiguration (this->layer, &config, &failed); if (failed & DLCONF_BUFFERMODE) { xprintf (this->xine, XINE_VERBOSITY_LOG, _("video_out_directfb: layer doesn't support buffermode %d!\n"), - this->buffermode); + this->buffermode); config.flags &= ~DLCONF_BUFFERMODE; } if (failed & DLCONF_OPTIONS) { @@ -1595,7 +1595,7 @@ static DFBResult init_device (directfb_driver_t *this) { config.options); config.flags &= ~DLCONF_OPTIONS; } - + ret = this->layer->SetConfiguration (this->layer, &config); /* this should never happen */ if (ret) { @@ -1603,31 +1603,31 @@ static DFBResult init_device (directfb_driver_t *this) { return ret; } - this->layer->GetConfiguration (this->layer, &this->config); - + this->layer->GetConfiguration (this->layer, &this->config); + if (this->caps & DLCAPS_DST_COLORKEY) { this->layer->SetDstColorKey (this->layer, (this->colorkey & 0xff0000) >> 16, (this->colorkey & 0x00ff00) >> 8, (this->colorkey & 0x0000ff) >> 0); } - + if (this->field_parity) this->layer->SetFieldParity (this->layer, this->field_parity-1); - + /* get current color cadjustment */ this->layer->GetColorAdjustment (this->layer, &this->default_cadj); this->cadj = this->default_cadj; - + /* get current level */ this->layer->GetLevel (this->layer, &this->default_level); - + /* retrieve layer's surface */ ret = this->layer->GetSurface (this->layer, &surface); if (ret != DFB_OK) { DirectFBError ("IDirectFBDisplayLayer::GetSurface()", ret); return ret; } - + /* clear surface buffers */ surface->Clear (surface, 0x00, 0x00, 0x00, 0xff); surface->Flip (surface, NULL, 0); @@ -1635,33 +1635,33 @@ static DFBResult init_device (directfb_driver_t *this) { surface->Flip (surface, NULL, 0); surface->Clear (surface, 0x00, 0x00, 0x00, 0xff); surface->Flip (surface, NULL, 0); - + this->surface = surface; - - if (this->caps & DLCAPS_SCREEN_LOCATION) { + + if (this->caps & DLCAPS_SCREEN_LOCATION) { IDirectFBScreen *screen = NULL; DFBDisplayLayerID id = -1; this->screen_width = 640; this->screen_height = 480; - + this->layer->GetScreen (this->layer, &screen); if (screen) { screen->EnumDisplayLayers (screen, find_underlay, (void *)&id); screen->Release (screen); } - + this->dfb->GetDisplayLayer (this->dfb, id, &this->underlay); - if (this->underlay) { + if (this->underlay) { this->underlay->GetConfiguration (this->underlay, &config); this->screen_width = config.width; this->screen_height = config.height; - + if (this->visual_type == XINE_VISUAL_TYPE_FB) { this->underlay->SetCooperativeLevel (this->underlay, DLSCL_EXCLUSIVE); this->underlay->SetConfiguration (this->underlay, &config); } - } + } } else { /* playing to underlay, @@ -1669,42 +1669,42 @@ static DFBResult init_device (directfb_driver_t *this) { IDirectFBSurface *temp; DFBSurfaceDescription dsc; DFBAccelerationMask mask = DFXL_NONE; - + this->layer->AddRef (this->layer); this->underlay = this->layer; - + dsc.flags = DSDESC_CAPS | DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT; dsc.caps = DSCAPS_INTERLACED; dsc.width = 320; dsc.height = 240; dsc.pixelformat = this->config.pixelformat; - + if (this->dfb->CreateSurface (this->dfb, &dsc, &temp) == DFB_OK) { this->surface->GetAccelerationMask (this->surface, temp, &mask); - + if (mask & DFXL_STRETCHBLIT) { xprintf (this->xine, XINE_VERBOSITY_LOG, _("video_out_directfb: " "using hardware accelerated image scaling.\n")); this->temp = temp; - + /* check if stretchblit with deinterlacing is supported */ this->surface->SetBlittingFlags (this->surface, DSBLIT_DEINTERLACE); this->surface->GetAccelerationMask (this->surface, temp, &mask); this->surface->SetBlittingFlags (this->surface, DSBLIT_NOFX); - + this->hw_deinterlace = (mask & DFXL_STRETCHBLIT) ? 1 : 0; if (this->hw_deinterlace) { xprintf (this->xine, XINE_VERBOSITY_LOG, _("video_out_directfb: " "image scaling with deinterlacing is hardware accelerated.\n")); } - + /* used to decide reallocation */ temp->GetSize (temp, &this->temp_frame_width, &this->temp_frame_height); temp->GetPixelFormat (temp, &this->temp_frame_format); - } + } else temp->Release (temp); } @@ -1714,11 +1714,11 @@ static DFBResult init_device (directfb_driver_t *this) { } xprintf (this->xine, XINE_VERBOSITY_DEBUG, - "video_out_directfb: screen size is %dx%d.\n", + "video_out_directfb: screen size is %dx%d.\n", this->screen_width, this->screen_height); - + return DFB_OK; -} +} static void directfb_frame_output_cb (void *user_data, int video_width, int video_height, double video_pixel_aspect, int *dest_x, int *dest_y, @@ -1736,7 +1736,7 @@ static void directfb_frame_output_cb (void *user_data, int video_width, int vide *win_y = 0; } -/*** DirectFB plugin functions ***/ +/*** DirectFB plugin functions ***/ static vo_driver_t *open_plugin_fb (video_driver_class_t *class_gen, const void *visual_gen) { directfb_class_t *class = (directfb_class_t *) class_gen; @@ -1752,18 +1752,18 @@ static vo_driver_t *open_plugin_fb (video_driver_class_t *class_gen, const void this = calloc(1, sizeof(directfb_driver_t)); if (!this) return NULL; - + this->visual_type = XINE_VISUAL_TYPE_FB; this->xine = class->xine; - - /* initialize DirectFB */ + + /* initialize DirectFB */ ret = DirectFBInit (&argn, &argp); if (ret != DFB_OK) { DirectFBError ("DirectFBInit()", ret); free (this); return NULL; } - + /* create the main interface or retrieve an already existing one */ ret = DirectFBCreate (&this->dfb); if (ret != DFB_OK) { @@ -1771,7 +1771,7 @@ static vo_driver_t *open_plugin_fb (video_driver_class_t *class_gen, const void free (this); return NULL; } - + /* allow user/application to select a different layer */ id = config->register_num (config, "video.device.directfb_layer_id", -1, @@ -1780,7 +1780,7 @@ static vo_driver_t *open_plugin_fb (video_driver_class_t *class_gen, const void 20, NULL, 0); if (id == -1) { IDirectFBScreen *screen; - + /* retrieve an interface to the current screen */ ret = this->dfb->GetScreen (this->dfb, DSCID_PRIMARY, &screen); if (ret != DFB_OK) { @@ -1789,7 +1789,7 @@ static vo_driver_t *open_plugin_fb (video_driver_class_t *class_gen, const void free (this); return NULL; } - + /* find an overlay layer on the current screen */ id = DLID_PRIMARY; screen->EnumDisplayLayers (screen, find_overlay, (void*)&id); @@ -1798,11 +1798,11 @@ static vo_driver_t *open_plugin_fb (video_driver_class_t *class_gen, const void xprintf (this->xine, XINE_VERBOSITY_LOG, _("video_out_directfb: using display layer #%d.\n"), id); - + ret = this->dfb->GetDisplayLayer (this->dfb, id, &this->layer); if (ret == DFB_OK) { DFBDisplayLayerDescription dsc; - this->layer->SetCooperativeLevel (this->layer, DLSCL_EXCLUSIVE); + this->layer->SetCooperativeLevel (this->layer, DLSCL_EXCLUSIVE); this->layer->SetOpacity (this->layer, 0x00); this->layer->GetDescription (this->layer, &dsc); this->type = dsc.type; @@ -1816,7 +1816,7 @@ static vo_driver_t *open_plugin_fb (video_driver_class_t *class_gen, const void free (this); return NULL; } - + this->capabilities = VO_CAP_YV12 | VO_CAP_YUY2 | VO_CAP_CROP; /* set default configuration */ this->buffermode = 1; // double @@ -1825,7 +1825,7 @@ static vo_driver_t *open_plugin_fb (video_driver_class_t *class_gen, const void this->colorkey = DEFAULT_COLORKEY; this->flicker_filtering = 0; this->field_parity = 0; - + /* get user configuration */ init_config (this); @@ -1836,19 +1836,19 @@ static vo_driver_t *open_plugin_fb (video_driver_class_t *class_gen, const void free (this); return NULL; } - + /* initialize subpicture layer (if available) */ init_subpicture (this); if (this->spic_layer) this->capabilities |= VO_CAP_UNSCALED_OVERLAY; _x_alphablend_init (&this->alphablend_extra_data, this->xine); - + _x_vo_scale_init (&this->sc, 1, 0, this->xine->config); this->sc.user_ratio = XINE_VO_ASPECT_AUTO; this->sc.gui_width = this->screen_width; - this->sc.gui_height = this->screen_height; - + this->sc.gui_height = this->screen_height; + if (visual) { this->sc.frame_output_cb = visual->frame_output_cb; this->sc.user_data = visual->user_data; @@ -1938,18 +1938,18 @@ static vo_driver_t *open_plugin_x11 (video_driver_class_t *class_gen, const void this = calloc(1, sizeof(directfb_driver_t)); if (!this) return NULL; - + this->visual_type = class->visual_type; this->xine = class->xine; - - /* initialize DirectFB */ + + /* initialize DirectFB */ ret = DirectFBInit (&argn, &argp); if (ret != DFB_OK) { DirectFBError ("DirectFBInit()", ret); free (this); return NULL; } - + /* create the main interface or retrieve an already existing one */ ret = DirectFBCreate (&this->dfb); if (ret != DFB_OK) { @@ -1957,7 +1957,7 @@ static vo_driver_t *open_plugin_x11 (video_driver_class_t *class_gen, const void free (this); return NULL; } - + /* retrieve an interface to the current screen */ ret = this->dfb->GetScreen (this->dfb, DSCID_PRIMARY, &screen); if (ret != DFB_OK) { @@ -1966,7 +1966,7 @@ static vo_driver_t *open_plugin_x11 (video_driver_class_t *class_gen, const void free (this); return NULL; } - + /* find an overlay layer on the current screen */ ret = screen->EnumDisplayLayers (screen, find_overlay, (void*)&id); screen->Release (screen); @@ -1976,7 +1976,7 @@ static vo_driver_t *open_plugin_x11 (video_driver_class_t *class_gen, const void free (this); return NULL; } - + if (id != DLID_PRIMARY) { DFBDisplayLayerDescription dsc; /* get overlay access */ @@ -1997,7 +1997,7 @@ static vo_driver_t *open_plugin_x11 (video_driver_class_t *class_gen, const void this->layer = NULL; } } - + if (!this->layer) { xprintf (this->xine, XINE_VERBOSITY_LOG, _("video_out_directfb: no usable display layer was found!\n")); @@ -2005,10 +2005,10 @@ static vo_driver_t *open_plugin_x11 (video_driver_class_t *class_gen, const void free (this); return NULL; } - + xprintf (this->xine, XINE_VERBOSITY_LOG, _("video_out_directfb: using display layer #%d.\n"), id); - + this->capabilities = VO_CAP_YV12 | VO_CAP_YUY2 | VO_CAP_CROP; /* set default configuration */ this->buffermode = 1; // double @@ -2017,7 +2017,7 @@ static vo_driver_t *open_plugin_x11 (video_driver_class_t *class_gen, const void this->colorkey = DEFAULT_COLORKEY; this->flicker_filtering = 0; this->field_parity = 0; - + /* get user configuration */ init_config (this); @@ -2028,42 +2028,42 @@ static vo_driver_t *open_plugin_x11 (video_driver_class_t *class_gen, const void free (this); return NULL; } - + this->display = visual->display; this->screen = visual->screen; this->drawable = visual->d; this->gc = XCreateGC (this->display, this->drawable, 0, NULL); - + XGetWindowAttributes (this->display, this->drawable, &attrs); this->depth = attrs.depth; _x_alphablend_init (&this->alphablend_extra_data, this->xine); - + _x_vo_scale_init (&this->sc, 1, 0, this->xine->config); this->sc.user_ratio = XINE_VO_ASPECT_AUTO; this->sc.gui_width = attrs.width; this->sc.gui_height = attrs.height; this->sc.frame_output_cb = visual->frame_output_cb; this->sc.user_data = visual->user_data; - + if (this->visual_type == XINE_VISUAL_TYPE_X11_2) { this->user_data = visual->user_data; this->lock_display = visual->lock_display; this->unlock_display = visual->unlock_display; - } - + } + if (this->colorkeying) { this->xoverlay = x11osd_create (this->xine, this->display, this->screen, this->drawable, X11OSD_COLORKEY); if (this->xoverlay) { - x11osd_colorkey (this->xoverlay, + x11osd_colorkey (this->xoverlay, directfb_colorkey_to_pixel(this), &this->sc); } } else { this->xoverlay = x11osd_create (this->xine, this->display, this->screen, this->drawable, X11OSD_SHAPED); } - + if (this->xoverlay) this->capabilities |= VO_CAP_UNSCALED_OVERLAY; @@ -2112,13 +2112,13 @@ static void *init_class_x11 (xine_t *xine, void *visual_gen) { "video_out_directfb: %s!\n", error); return NULL; } - + if (!visual) { xprintf (xine, XINE_VERBOSITY_DEBUG, "video_out_directfb: x11 visual is required!\n"); return NULL; } - + /* check if we are running under XDirectFB */ if (strcmp (XServerVendor (visual->display), "Denis Oliver Kropp")) return NULL; @@ -2141,7 +2141,7 @@ static void *init_class_x11_2 (xine_t *xine, void *visual_gen) { this = init_class_x11( xine, visual_gen ); if (this) this->visual_type = XINE_VISUAL_TYPE_X11_2; - + return this; } diff --git a/src/video_out/video_out_directfb_fb.c b/src/video_out/video_out_directfb_fb.c index b904407c3..bb01c187b 100644 --- a/src/video_out/video_out_directfb_fb.c +++ b/src/video_out/video_out_directfb_fb.c @@ -1,13 +1,13 @@ /* * Copyright (C) 2007 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 diff --git a/src/video_out/video_out_directfb_x.c b/src/video_out/video_out_directfb_x.c index 48f709eae..78aaa9588 100644 --- a/src/video_out/video_out_directfb_x.c +++ b/src/video_out/video_out_directfb_x.c @@ -1,13 +1,13 @@ /* * Copyright (C) 2007 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 diff --git a/src/video_out/video_out_directx.c b/src/video_out/video_out_directx.c index 3c6f6e784..8cb72238a 100644 --- a/src/video_out/video_out_directx.c +++ b/src/video_out/video_out_directx.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2005 the xine project - * + * * This file is part of xine, a unix video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -118,7 +118,7 @@ typedef struct { LPDIRECTDRAW ddobj; /* direct draw object */ LPDIRECTDRAWSURFACE primary; /* primary dd surface */ - LPDIRECTDRAWSURFACE secondary; /* secondary dd surface */ + LPDIRECTDRAWSURFACE secondary; /* secondary dd surface */ LPDIRECTDRAWCLIPPER ddclipper; /* dd clipper object */ uint8_t * contents; /* secondary contents */ win32_frame_t *current; /* current frame */ @@ -151,7 +151,7 @@ typedef struct { * * ----------------------------------------- */ -/* Display formatted error message in +/* Display formatted error message in * popup message box.*/ static void Error( HWND hwnd, LPSTR szfmt, ... ) @@ -169,7 +169,7 @@ static void UpdateRect( win32_visual_t * win32_visual ) { if( win32_visual->FullScreen ) { - SetRect( &win32_visual->WndRect, 0, 0, + SetRect( &win32_visual->WndRect, 0, 0, GetSystemMetrics( SM_CXSCREEN ), GetSystemMetrics( SM_CYSCREEN ) ); } @@ -181,12 +181,12 @@ static void UpdateRect( win32_visual_t * win32_visual ) } } -/* Create our direct draw object, primary +/* Create our direct draw object, primary * surface and clipper object. * - * NOTE : The primary surface is more or + * NOTE : The primary surface is more or * less a viewport into the parent desktop - * window and will always have a pixel format + * window and will always have a pixel format * identical to the current display mode. */ static boolean CreatePrimary( win32_driver_t * win32_driver ) @@ -276,7 +276,7 @@ static boolean CreatePrimary( win32_driver_t * win32_driver ) } /* Create our secondary ( off screen ) buffer. - * The optimal secondary buffer is a h/w + * The optimal secondary buffer is a h/w * overlay with the same pixel format as the * xine frame type. However, since this is * not always supported by the host h/w, @@ -327,7 +327,7 @@ static boolean CreateSecondary( win32_driver_t * win32_driver, int width, int he /* the requested format is XINE_IMGFMT_YV12 */ ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT; - ddsd.ddsCaps.dwCaps = DDSCAPS_VIDEOMEMORY | DDSCAPS_OVERLAY; + ddsd.ddsCaps.dwCaps = DDSCAPS_VIDEOMEMORY | DDSCAPS_OVERLAY; ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); ddsd.ddpfPixelFormat.dwFlags = DDPF_FOURCC; ddsd.ddpfPixelFormat.dwYUVBitCount = 16; @@ -343,7 +343,7 @@ static boolean CreateSecondary( win32_driver_t * win32_driver, int width, int he /* the requested format is XINE_IMGFMT_YUY2 */ ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT; - ddsd.ddsCaps.dwCaps = DDSCAPS_VIDEOMEMORY | DDSCAPS_OVERLAY; + ddsd.ddsCaps.dwCaps = DDSCAPS_VIDEOMEMORY | DDSCAPS_OVERLAY; ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); ddsd.ddpfPixelFormat.dwFlags = DDPF_FOURCC; ddsd.ddpfPixelFormat.dwYUVBitCount = 16; @@ -360,7 +360,7 @@ static boolean CreateSecondary( win32_driver_t * win32_driver, int width, int he /* the requested format is IMGFMT_RGB */ ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT; - ddsd.ddsCaps.dwCaps = DDSCAPS_VIDEOMEMORY | DDSCAPS_OVERLAY; + ddsd.ddsCaps.dwCaps = DDSCAPS_VIDEOMEMORY | DDSCAPS_OVERLAY; ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); ddsd.ddpfPixelFormat.dwFlags = DDPF_RGB; ddsd.ddpfPixelFormat.dwYUVBitCount = 24; @@ -371,7 +371,7 @@ static boolean CreateSecondary( win32_driver_t * win32_driver, int width, int he lprintf("CreateSecondary() - act_format = (RGB) %d\n", IMGFMT_RGB); win32_driver->act_format = IMGFMT_RGB; - } + } #endif /* RGB_SUPPORT */ lprintf("CreateSecondary() - IDirectDraw_CreateSurface()\n"); @@ -423,7 +423,7 @@ static void Destroy( win32_driver_t * win32_driver ) IDirectDraw_Release( win32_driver->ddobj ); _x_alphablend_free(&win32_driver->alphablend_extra_data); - + free( win32_driver ); } @@ -447,7 +447,7 @@ static boolean CheckPixelFormat( win32_driver_t * win32_driver ) Error( 0, "IDirectDrawSurface_GetPixelFormat ( CheckPixelFormat ) : error 0x%lx", result ); return 0; } - + /* store pixel format for CreateSecondary */ win32_driver->primary_pixel_format = ddpf; @@ -508,7 +508,7 @@ static boolean CheckPixelFormat( win32_driver_t * win32_driver ) /* Create a Direct draw surface from * a bitmap resource.. * - * NOTE : This is not really useful + * NOTE : This is not really useful * anymore since the xine logo code is * being pushed to the backend. */ @@ -547,7 +547,7 @@ static LPDIRECTDRAWSURFACE CreateBMP( win32_driver_t * win32_driver, int resourc Error( 0, "CreateSurface ( bitmap ) : could not create dd surface" ); return 0; } - + /* get a handle to our surface dc, * create a compat dc and load * our bitmap into the compat dc */ @@ -572,7 +572,7 @@ static LPDIRECTDRAWSURFACE CreateBMP( win32_driver_t * win32_driver, int resourc } #endif -/* Merge overlay with the current primary +/* Merge overlay with the current primary * surface. This funtion is only used when * a h/w overlay of the current frame type * is supported. */ @@ -583,7 +583,7 @@ static boolean Overlay( LPDIRECTDRAWSURFACE src_surface, RECT * src_rect, { DWORD dw_color_key; DDPIXELFORMAT ddpf; - DDOVERLAYFX ddofx; + DDOVERLAYFX ddofx; int flags; HRESULT result; @@ -903,7 +903,7 @@ static vo_frame_t * win32_alloc_frame( vo_driver_t * vo_driver ) } -static void win32_update_frame_format( vo_driver_t * vo_driver, vo_frame_t * vo_frame, uint32_t width, +static void win32_update_frame_format( vo_driver_t * vo_driver, vo_frame_t * vo_frame, uint32_t width, uint32_t height, double ratio, int format, int flags ) { win32_driver_t *win32_driver = ( win32_driver_t * ) vo_driver; @@ -953,7 +953,7 @@ static void win32_update_frame_format( vo_driver_t * vo_driver, vo_frame_t * vo_ #endif else { - xprintf (win32_driver->xine, XINE_VERBOSITY_DEBUG, + xprintf (win32_driver->xine, XINE_VERBOSITY_DEBUG, "vo_out_directx : !!! unsupported image format %04x !!!\n", format ); exit (1); } @@ -1015,13 +1015,13 @@ static void win32_display_frame( vo_driver_t * vo_driver, vo_frame_t * vo_frame #if NEW_YUV win32_driver->yuv2rgb->configure( win32_driver->yuv2rgb, win32_driver->width, win32_driver->height, - win32_frame->vo_frame.pitches[0], win32_frame->vo_frame.pitches[1], + win32_frame->vo_frame.pitches[0], win32_frame->vo_frame.pitches[1], win32_driver->width, win32_driver->height, win32_driver->width * win32_driver->bytespp); #else yuv2rgb_setup( win32_driver->yuv2rgb, win32_driver->width, win32_driver->height, - win32_frame->vo_frame.pitches[0], win32_frame->vo_frame.pitches[1], + win32_frame->vo_frame.pitches[0], win32_frame->vo_frame.pitches[1], win32_driver->width, win32_driver->height, win32_driver->width * win32_driver->bytespp ); @@ -1041,7 +1041,7 @@ static void win32_display_frame( vo_driver_t * vo_driver, vo_frame_t * vo_frame #if NEW_YUV win32_driver->yuv2rgb->configure( win32_driver->yuv2rgb, win32_driver->width, win32_driver->height, - win32_frame->vo_frame.pitches[0], win32_frame->vo_frame.pitches[0] / 2, + win32_frame->vo_frame.pitches[0], win32_frame->vo_frame.pitches[0] / 2, win32_driver->width, win32_driver->height, win32_driver->width * win32_driver->bytespp ); #else @@ -1087,14 +1087,14 @@ static void win32_display_frame( vo_driver_t * vo_driver, vo_frame_t * vo_frame src += vo_frame->pitches[0]; dst += win32_driver->ddsd.lPitch; } - + src = frame->base[2]; for (line = 0; line < frame->height/2 ; line++){ xine_fast_memcpy( dst, src, frame->width/2); src += vo_frame->pitches[2]; dst += win32_driver->ddsd.lPitch/2; } - + src = frame->base[1]; for (line = 0; line < frame->height/2 ; line++){ xine_fast_memcpy( dst, src, frame->width/2); @@ -1102,10 +1102,10 @@ static void win32_display_frame( vo_driver_t * vo_driver, vo_frame_t * vo_frame dst += win32_driver->ddsd.lPitch/2; } break; - + case XINE_IMGFMT_YUY2: default: - src = frame->base[0]; + src = frame->base[0]; for (line = 0; line < frame->height ; line++){ xine_fast_memcpy( dst, src, frame->width*2); src += vo_frame->pitches[0]; @@ -1184,7 +1184,7 @@ static int win32_gui_data_exchange( vo_driver_t * vo_driver, int data_type, void { HRESULT result; HWND newWndHnd = (HWND) data; - + /* set cooperative level */ result = IDirectDraw_SetCooperativeLevel( win32_driver->ddobj, newWndHnd, DDSCL_NORMAL ); if( result != DD_OK ) @@ -1217,15 +1217,15 @@ static int win32_redraw_needed(vo_driver_t* this_gen) int ret = 0; /* TC - May need to revisit this! */ -#ifdef TC +#ifdef TC win32_driver_t *win32_driver = (win32_driver_t *) this_gen; if( _x_vo_scale_redraw_needed( &win32_driver->sc ) ) { - win32_gui_data_exchange(this_gen, GUI_WIN32_MOVED_OR_RESIZED, 0); + win32_gui_data_exchange(this_gen, GUI_WIN32_MOVED_OR_RESIZED, 0); ret = 1; } #endif - + return ret; } @@ -1246,7 +1246,7 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *wi _x_alphablend_init(&win32_driver->alphablend_extra_data, class->xine); - + win32_driver->xine = class->xine; /* Make sure that the DirectX drivers are available and present! */ @@ -1317,7 +1317,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { directx->xine = xine; directx->config = xine->config; - + return directx; } diff --git a/src/video_out/video_out_fb.c b/src/video_out/video_out_fb.c index d67b0870d..315e77e66 100644 --- a/src/video_out/video_out_fb.c +++ b/src/video_out/video_out_fb.c @@ -1,13 +1,13 @@ /* * Copyright (C) 2000-2003 the xine project and Fredrik Noring - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 @@ -52,8 +52,8 @@ #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> -#include <fcntl.h> - +#include <fcntl.h> + #include "xine.h" #include "video_out.h" @@ -89,7 +89,7 @@ typedef struct fb_frame_s int format; int flags; - + vo_scale_t sc; uint8_t *chunk[3]; /* mem alloc by xmalloc_aligned */ @@ -97,7 +97,7 @@ typedef struct fb_frame_s yuv2rgb_t *yuv2rgb; /* yuv2rgb converter for this frame */ uint8_t *rgb_dst; int yuv_stride; - + int bytes_per_line; uint8_t* video_mem; /* mmapped video memory */ @@ -114,12 +114,12 @@ typedef struct fb_driver_s int fd; int mem_size; uint8_t* video_mem_base; /* mmapped video memory */ - + int depth, bpp, bytes_per_pixel; - + int total_num_native_buffers; int used_num_buffers; - + int yuv2rgb_mode; int yuv2rgb_swap; int yuv2rgb_brightness; @@ -132,11 +132,11 @@ typedef struct fb_driver_s /* size / aspect ratio calculations */ vo_scale_t sc; - + int fb_bytes_per_line; fb_frame_t *cur_frame, *old_frame; - + struct fb_var_screeninfo fb_var; struct fb_fix_screeninfo fb_fix; @@ -161,10 +161,10 @@ static uint32_t fb_get_capabilities(vo_driver_t *this_gen) static void fb_frame_proc_slice(vo_frame_t *vo_img, uint8_t **src) { fb_frame_t *frame = (fb_frame_t *)vo_img ; - + vo_img->proc_called = 1; - - if( frame->vo_frame.crop_left || frame->vo_frame.crop_top || + + if( frame->vo_frame.crop_left || frame->vo_frame.crop_top || frame->vo_frame.crop_right || frame->vo_frame.crop_bottom ) { /* we don't support crop, so don't even waste cpu cycles. @@ -184,18 +184,18 @@ static void fb_frame_proc_slice(vo_frame_t *vo_img, uint8_t **src) static void fb_frame_field(vo_frame_t *vo_img, int which_field) { fb_frame_t *frame = (fb_frame_t *)vo_img ; - + switch(which_field) { case VO_TOP_FIELD: frame->rgb_dst = frame->data; break; - + case VO_BOTTOM_FIELD: frame->rgb_dst = frame->data + frame->bytes_per_line ; break; - + case VO_BOTH_FIELDS: frame->rgb_dst = frame->data; break; @@ -228,16 +228,16 @@ static vo_frame_t *fb_alloc_frame(vo_driver_t *this_gen) memcpy(&frame->sc, &this->sc, sizeof(vo_scale_t)); pthread_mutex_init(&frame->vo_frame.mutex, NULL); - + /* supply required functions */ frame->vo_frame.proc_slice = fb_frame_proc_slice; frame->vo_frame.proc_frame = NULL; - frame->vo_frame.field = fb_frame_field; + frame->vo_frame.field = fb_frame_field; frame->vo_frame.dispose = fb_frame_dispose; frame->vo_frame.driver = this_gen; - + frame->this = this; - + /* colorspace converter for this frame */ frame->yuv2rgb = this->yuv2rgb_factory->create_converter(this->yuv2rgb_factory); @@ -268,7 +268,7 @@ static void fb_compute_ideal_size(fb_driver_t *this, fb_frame_t *frame) static void fb_compute_rgb_size(fb_driver_t *this, fb_frame_t *frame) { _x_vo_scale_compute_output_size(&frame->sc); - + /* avoid problems in yuv2rgb */ if(frame->sc.output_height < (frame->sc.delivered_height+15) >> 4) frame->sc.output_height = (frame->sc.delivered_height+15) >> 4; @@ -277,7 +277,7 @@ static void fb_compute_rgb_size(fb_driver_t *this, fb_frame_t *frame) frame->sc.output_width = 8; /* yuv2rgb_mlib needs an even YUV2 width */ - if (frame->sc.output_width & 1) + if (frame->sc.output_width & 1) frame->sc.output_width++; lprintf("frame source %d x %d => screen output %d x %d%s\n", @@ -305,7 +305,7 @@ static void setup_colorspace_converter(fb_frame_t *frame, int flags) frame->bytes_per_line * 2); frame->yuv_stride = frame->bytes_per_line * 2; break; - + case VO_BOTH_FIELDS: frame->yuv2rgb-> configure(frame->yuv2rgb, @@ -328,7 +328,7 @@ static void frame_reallocate(fb_driver_t *this, fb_frame_t *frame, free(frame->chunk[1]); free(frame->chunk[2]); memset(frame->chunk, 0, sizeof(frame->chunk[0])*3); - + if(this->use_zero_copy) { frame->data = frame->video_mem + @@ -348,19 +348,19 @@ static void frame_reallocate(fb_driver_t *this, fb_frame_t *frame, frame->vo_frame.pitches[0] = 8*((width + 7) / 8); frame->vo_frame.pitches[1] = 8*((width + 15) / 16); frame->vo_frame.pitches[2] = 8*((width + 15) / 16); - + frame->vo_frame.base[0] = xine_xmalloc_aligned(16, frame->vo_frame.pitches[0] * height, (void **)&frame->chunk[0]); - + frame->vo_frame.base[1] = xine_xmalloc_aligned(16, frame->vo_frame.pitches[1] * ((height+1)/2), (void **)&frame->chunk[1]); - + frame->vo_frame.base[2] = xine_xmalloc_aligned(16, frame->vo_frame.pitches[2] * @@ -370,7 +370,7 @@ static void frame_reallocate(fb_driver_t *this, fb_frame_t *frame, else { frame->vo_frame.pitches[0] = 8 * ((width + 3) / 4); - + frame->vo_frame.base[0] = xine_xmalloc_aligned(16, frame->vo_frame.pitches[0] * @@ -380,7 +380,7 @@ static void frame_reallocate(fb_driver_t *this, fb_frame_t *frame, frame->chunk[2] = NULL; } } - + static void fb_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_gen, uint32_t width, uint32_t height, @@ -388,7 +388,7 @@ static void fb_update_frame_format(vo_driver_t *this_gen, { fb_driver_t *this = (fb_driver_t *)this_gen; fb_frame_t *frame = (fb_frame_t *)frame_gen; - + flags &= VO_BOTH_FIELDS; /* Find out if we need to adapt this frame. */ @@ -418,7 +418,7 @@ static void fb_update_frame_format(vo_driver_t *this_gen, else frame->bytes_per_line = frame->sc.output_width * this->bytes_per_pixel; - + setup_colorspace_converter(frame, flags); } @@ -430,7 +430,7 @@ static void fb_overlay_clut_yuv2rgb(fb_driver_t *this, { int i; clut_t* clut = (clut_t*)overlay->color; - + if(!overlay->rgb_clut) { for(i = 0; @@ -446,11 +446,11 @@ static void fb_overlay_clut_yuv2rgb(fb_driver_t *this, } overlay->rgb_clut++; } - + if(!overlay->hili_rgb_clut) { clut = (clut_t*) overlay->hili_color; - + for(i = 0; i < sizeof(overlay->color)/sizeof(overlay->color[0]); i++) @@ -492,7 +492,7 @@ static void fb_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, frame->sc.delivered_height, &this->alphablend_extra_data); break; - + case 24: _x_blend_rgb24(frame->data, overlay, @@ -502,7 +502,7 @@ static void fb_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, frame->sc.delivered_height, &this->alphablend_extra_data); break; - + case 32: _x_blend_rgb32(frame->data, overlay, @@ -512,7 +512,7 @@ static void fb_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, frame->sc.delivered_height, &this->alphablend_extra_data); break; - } + } } } @@ -534,11 +534,11 @@ static void fb_display_frame(vo_driver_t *this_gen, vo_frame_t *frame_gen) this->sc.output_width = frame->sc.output_width; this->sc.output_height = frame->sc.output_height; - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_fb: gui size %d x %d, frame size %d x %d\n", this->sc.gui_width, this->sc.gui_height, frame->sc.output_width, frame->sc.output_height); - + memset(this->video_mem_base, 0, this->mem_size); } @@ -555,10 +555,10 @@ static void fb_display_frame(vo_driver_t *this_gen, vo_frame_t *frame_gen) (&this->old_frame->vo_frame); this->old_frame = this->cur_frame; this->cur_frame = frame; - + this->fb_var.yoffset = frame->yoffset; if(ioctl(this->fd, FBIOPAN_DISPLAY, &this->fb_var) == -1) - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_fb: ioctl FBIOPAN_DISPLAY failed: %s\n", strerror(errno)); } else @@ -567,14 +567,14 @@ static void fb_display_frame(vo_driver_t *this_gen, vo_frame_t *frame_gen) frame->sc.output_yoffset * this->fb_bytes_per_line + frame->sc.output_xoffset * this->bytes_per_pixel; src = frame->data; - + for(y = 0; y < frame->sc.output_height; y++) { xine_fast_memcpy(dst, src, frame->bytes_per_line); src += frame->bytes_per_line; dst += this->fb_bytes_per_line; - } - + } + frame->vo_frame.free(&frame->vo_frame); } } @@ -597,7 +597,7 @@ static int fb_get_property(vo_driver_t *this_gen, int property) case VO_PROP_WINDOW_WIDTH: return this->sc.gui_width; - + case VO_PROP_WINDOW_HEIGHT: return this->sc.gui_height; @@ -614,7 +614,7 @@ static int fb_get_property(vo_driver_t *this_gen, int property) return this->cur_frame->sc.output_yoffset; default: - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_fb: tried to get unsupported property %d\n", property); } @@ -631,7 +631,7 @@ static int fb_set_property(vo_driver_t *this_gen, int property, int value) if(value>=XINE_VO_ASPECT_NUM_RATIOS) value = XINE_VO_ASPECT_AUTO; this->sc.user_ratio = value; - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_fb: aspect ratio changed to %s\n", _x_vo_scale_aspect_ratio_name(value)); break; @@ -660,7 +660,7 @@ static int fb_set_property(vo_driver_t *this_gen, int property, int value) break; default: - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_fb: tried to set unsupported property %d\n", property); } @@ -698,8 +698,8 @@ static int fb_gui_data_exchange(vo_driver_t *this_gen, static void fb_dispose(vo_driver_t *this_gen) { fb_driver_t *this = (fb_driver_t *)this_gen; - - munmap(0, this->mem_size); + + munmap(0, this->mem_size); close(this->fd); _x_alphablend_free(&this->alphablend_extra_data); @@ -710,7 +710,7 @@ static void fb_dispose(vo_driver_t *this_gen) static int get_fb_var_screeninfo(int fd, struct fb_var_screeninfo *var, xine_t *xine) { int i; - + if(ioctl(fd, FBIOGET_VSCREENINFO, var)) { xprintf(xine, XINE_VERBOSITY_DEBUG, "video_out_fb: ioctl FBIOGET_VSCREENINFO: %s\n", strerror(errno)); @@ -731,7 +731,7 @@ static int get_fb_var_screeninfo(int fd, struct fb_var_screeninfo *var, xine_t * continue; break; } - + /* Get proper value for maximized var->yres_virtual. */ if(ioctl(fd, FBIOGET_VSCREENINFO, var) == -1) { @@ -831,26 +831,26 @@ static int open_fb_device(config_values_t *config, xine_t *xine) { device_name = "/dev/fb1"; fd = open(device_name, O_RDWR); - + if(fd < 0) - { + { device_name = "/dev/fb0"; fd = open(device_name, O_RDWR); } } - + if(fd < 0) { - xprintf(xine, XINE_VERBOSITY_DEBUG, + xprintf(xine, XINE_VERBOSITY_DEBUG, "video_out_fb: Unable to open device \"%s\", aborting: %s\n", device_name, strerror(errno)); return -1; } - + config->update_string(config, devkey, device_name); return fd; } - + static int mode_visual(fb_driver_t *this, config_values_t *config, struct fb_var_screeninfo *var, struct fb_fix_screeninfo *fix) @@ -876,7 +876,7 @@ static int mode_visual(fb_driver_t *this, config_values_t *config, if(!var->blue.offset) return MODE_16_RGB; return MODE_16_BGR; - + case 15: if(!var->blue.offset) return MODE_15_RGB; @@ -884,16 +884,16 @@ static int mode_visual(fb_driver_t *this, config_values_t *config, case 8: if(!var->blue.offset) - return MODE_8_RGB; - return MODE_8_BGR; + return MODE_8_RGB; + return MODE_8_BGR; } } - + xprintf(this->xine, XINE_VERBOSITY_LOG, _("video_out_fb: Your video mode was not recognized, sorry.\n")); return 0; } - + static int setup_yuv2rgb(fb_driver_t *this, config_values_t *config, struct fb_var_screeninfo *var, struct fb_fix_screeninfo *fix) @@ -907,13 +907,13 @@ static int setup_yuv2rgb(fb_driver_t *this, config_values_t *config, this->yuv2rgb_contrast = this->yuv2rgb_saturation = 128; this->yuv2rgb_factory = yuv2rgb_factory_init(this->yuv2rgb_mode, - this->yuv2rgb_swap, + this->yuv2rgb_swap, this->yuv2rgb_cmap); this->yuv2rgb_factory->set_csc_levels (this->yuv2rgb_factory, this->yuv2rgb_brightness, this->yuv2rgb_contrast, this->yuv2rgb_saturation); - + return 1; } @@ -934,7 +934,7 @@ static void setup_buffers(fb_driver_t *this, * bpp <= 32 * msb_right = 0 */ - + this->bytes_per_pixel = (this->fb_var.bits_per_pixel + 7)/8; this->bpp = this->bytes_per_pixel * 8; this->depth = this->fb_var.red.length + @@ -943,9 +943,9 @@ static void setup_buffers(fb_driver_t *this, this->total_num_native_buffers = var->yres_virtual / var->yres; this->used_num_buffers = 0; - + this->cur_frame = this->old_frame = 0; - + xprintf(this->xine, XINE_VERBOSITY_LOG, _("video_out_fb: %d video RAM buffers are available.\n"), this->total_num_native_buffers); @@ -955,7 +955,7 @@ static void setup_buffers(fb_driver_t *this, xprintf(this->xine, XINE_VERBOSITY_LOG, _("WARNING: video_out_fb: Zero copy buffers are DISABLED because only %d buffers\n" " are available which is less than the recommended %d buffers. Lowering\n" - " the frame buffer resolution might help.\n"), + " the frame buffer resolution might help.\n"), this->total_num_native_buffers, RECOMMENDED_NUM_BUFFERS); } else @@ -983,11 +983,11 @@ static vo_driver_t *fb_open_plugin(video_driver_class_t *class_gen, fb_driver_t *this; fb_class_t *class; fb_visual_t *visual = NULL; - + if (visual_gen) { visual = (fb_visual_t *) visual_gen; } - + class = (fb_class_t *)class_gen; config = class->config; @@ -997,7 +997,7 @@ static vo_driver_t *fb_open_plugin(video_driver_class_t *class_gen, return NULL; _x_alphablend_init(&this->alphablend_extra_data, class->xine); - + register_callbacks(this); this->fd = open_fb_device(config, class->xine); @@ -1009,7 +1009,7 @@ static vo_driver_t *fb_open_plugin(video_driver_class_t *class_gen, goto error; if (!set_fb_palette (this->fd, &this->fb_var)) goto error; - + this->xine = class->xine; if(this->fb_fix.line_length) @@ -1018,7 +1018,7 @@ static vo_driver_t *fb_open_plugin(video_driver_class_t *class_gen, this->fb_bytes_per_line = (this->fb_var.xres_virtual * this->fb_var.bits_per_pixel)/8; - + _x_vo_scale_init(&this->sc, 0, 0, config); this->sc.gui_width = this->fb_var.xres; this->sc.gui_height = this->fb_var.yres; @@ -1043,10 +1043,10 @@ static vo_driver_t *fb_open_plugin(video_driver_class_t *class_gen, this->fb_var.red.length, this->fb_var.red.offset, this->fb_var.green.length, this->fb_var.green.offset, this->fb_var.blue.length, this->fb_var.blue.offset); - + if(!setup_yuv2rgb(this, config, &this->fb_var, &this->fb_fix)) goto error; - + /* mmap whole video memory */ this->mem_size = this->fb_fix.smem_len; this->video_mem_base = mmap(0, this->mem_size, PROT_READ | PROT_WRITE, @@ -1100,7 +1100,7 @@ static const vo_info_t vo_info_fb = /* exported plugin catalog entry */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_VIDEO_OUT, 21, "fb", XINE_VERSION_CODE, &vo_info_fb, fb_init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/video_out/video_out_none.c b/src/video_out/video_out_none.c index 0de6e34e8..15bc52abe 100644 --- a/src/video_out/video_out_none.c +++ b/src/video_out/video_out_none.c @@ -72,7 +72,7 @@ static void free_framedata(none_frame_t* frame) { static void none_frame_dispose(vo_frame_t *vo_frame) { none_frame_t *frame = (none_frame_t *)vo_frame; - free_framedata(frame); + free_framedata(frame); free (frame); } @@ -87,7 +87,7 @@ static uint32_t none_get_capabilities(vo_driver_t *vo_driver) { static vo_frame_t *none_alloc_frame(vo_driver_t *vo_driver) { /* none_driver_t *this = (none_driver_t *) vo_driver; */ none_frame_t *frame; - + frame = calloc(1, sizeof(none_frame_t)); if(!frame) return NULL; @@ -97,43 +97,43 @@ static vo_frame_t *none_alloc_frame(vo_driver_t *vo_driver) { frame->vo_frame.base[0] = NULL; frame->vo_frame.base[1] = NULL; frame->vo_frame.base[2] = NULL; - + frame->vo_frame.proc_slice = NULL; frame->vo_frame.proc_frame = NULL; frame->vo_frame.field = none_frame_field; frame->vo_frame.dispose = none_frame_dispose; frame->vo_frame.driver = vo_driver; - + return (vo_frame_t *)frame; } static void none_update_frame_format(vo_driver_t *vo_driver, vo_frame_t *vo_frame, - uint32_t width, uint32_t height, + uint32_t width, uint32_t height, double ratio, int format, int flags) { none_driver_t *this = (none_driver_t *) vo_driver; none_frame_t *frame = (none_frame_t *) vo_frame; if((frame->width != width) || (frame->height != height) || (frame->format != format)) { - + free_framedata(frame); - + frame->width = width; frame->height = height; frame->format = format; - + switch(format) { - case XINE_IMGFMT_YV12: + case XINE_IMGFMT_YV12: { int y_size, uv_size; - + frame->vo_frame.pitches[0] = 8*((width + 7) / 8); frame->vo_frame.pitches[1] = 8*((width + 15) / 16); frame->vo_frame.pitches[2] = 8*((width + 15) / 16); - + y_size = frame->vo_frame.pitches[0] * height; uv_size = frame->vo_frame.pitches[1] * ((height+1)/2); - + frame->vo_frame.base[0] = malloc (y_size + 2*uv_size); frame->vo_frame.base[1] = frame->vo_frame.base[0]+y_size+uv_size; frame->vo_frame.base[2] = frame->vo_frame.base[0]+y_size; @@ -152,14 +152,14 @@ static void none_update_frame_format(vo_driver_t *vo_driver, vo_frame_t *vo_fram break; } - - if((format == XINE_IMGFMT_YV12 - && (frame->vo_frame.base[0] == NULL - || frame->vo_frame.base[1] == NULL + + if((format == XINE_IMGFMT_YV12 + && (frame->vo_frame.base[0] == NULL + || frame->vo_frame.base[1] == NULL || frame->vo_frame.base[2] == NULL)) || (format == XINE_IMGFMT_YUY2 && frame->vo_frame.base[0] == NULL)) { xprintf (this->xine, XINE_VERBOSITY_DEBUG, - "video_out_none: error. (framedata allocation failed: out of memory)\n"); + "video_out_none: error. (framedata allocation failed: out of memory)\n"); free_framedata(frame); } } @@ -170,19 +170,19 @@ static void none_update_frame_format(vo_driver_t *vo_driver, vo_frame_t *vo_fram static void none_display_frame(vo_driver_t *vo_driver, vo_frame_t *vo_frame) { /* none_driver_t *driver = (none_driver_t *)vo_driver; */ none_frame_t *frame = (none_frame_t *)vo_frame; - + frame->vo_frame.free(&frame->vo_frame); } static int none_get_property(vo_driver_t *vo_driver, int property) { none_driver_t *driver = (none_driver_t *)vo_driver; - + switch(property) { case VO_PROP_ASPECT_RATIO: return driver->ratio; break; - + default: break; } @@ -192,7 +192,7 @@ static int none_get_property(vo_driver_t *vo_driver, int property) { static int none_set_property(vo_driver_t *vo_driver, int property, int value) { none_driver_t *driver = (none_driver_t *)vo_driver; - + switch(property) { case VO_PROP_ASPECT_RATIO: @@ -208,7 +208,7 @@ static int none_set_property(vo_driver_t *vo_driver, int property, int value) { return value; } -static void none_get_property_min_max(vo_driver_t *vo_driver, +static void none_get_property_min_max(vo_driver_t *vo_driver, int property, int *min, int *max) { *min = 0; *max = 0; @@ -242,13 +242,13 @@ static int none_redraw_needed(vo_driver_t *vo_driver) { static vo_driver_t *open_plugin(video_driver_class_t *driver_class, const void *visual) { none_class_t *class = (none_class_t *) driver_class; none_driver_t *driver; - + driver = calloc(1, sizeof(none_driver_t)); - + driver->config = class->config; driver->xine = class->xine; driver->ratio = XINE_VO_ASPECT_AUTO; - + driver->vo_driver.get_capabilities = none_get_capabilities; driver->vo_driver.alloc_frame = none_alloc_frame ; driver->vo_driver.update_frame_format = none_update_frame_format; @@ -262,9 +262,9 @@ static vo_driver_t *open_plugin(video_driver_class_t *driver_class, const void * driver->vo_driver.gui_data_exchange = none_gui_data_exchange; driver->vo_driver.dispose = none_dispose; driver->vo_driver.redraw_needed = none_redraw_needed; - + return &driver->vo_driver; -} +} /* * Class related functions. @@ -279,13 +279,13 @@ static char* get_description (video_driver_class_t *driver_class) { static void dispose_class (video_driver_class_t *driver_class) { none_class_t *this = (none_class_t *) driver_class; - + free (this); } static void *init_class (xine_t *xine, void *visual) { none_class_t *this; - + this = calloc(1, sizeof(none_class_t)); this->driver_class.open_plugin = open_plugin; @@ -305,7 +305,7 @@ static const vo_info_t vo_info_none = { }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_VIDEO_OUT, 21, "none", XINE_VERSION_CODE, &vo_info_none, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/video_out/video_out_opengl.c b/src/video_out/video_out_opengl.c index a8f11db2f..1904fe6af 100644 --- a/src/video_out/video_out_opengl.c +++ b/src/video_out/video_out_opengl.c @@ -1,13 +1,13 @@ /* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 @@ -142,7 +142,7 @@ typedef struct { uint8_t *chunk[4]; /* mem alloc by xmalloc_aligned */ uint8_t *rgb, *rgb_dst; - + yuv2rgb_t *yuv2rgb; /* yuv2rgb converter set up for this frame */ } opengl_frame_t; @@ -198,7 +198,7 @@ typedef struct { PFNMYGLPROGRAMENVPARAMETER4FARBPROC glProgramEnvParameter4fARB; PFNMYGLGENTEXTURESEXTPROC glGenTexturesEXT; PFNMYGLBINDTEXTUREEXTPROC glBindTextureEXT; - + int yuv2rgb_brightness; int yuv2rgb_contrast; int yuv2rgb_saturation; @@ -233,7 +233,7 @@ typedef struct { int (*setup)(opengl_driver_t *); /* Flag: needs output converted to rgb (is able to do YUV otherwise) */ int needsrgb; - /* Default action: what to do if there's no new image + /* Default action: what to do if there's no new image * typically either RENDER_NONE or RENDER_DRAW (for animated render's) */ enum render_e defaction; /* Fallback: change to following render backend if this one doesn't work */ @@ -327,7 +327,7 @@ static void render_cyl (opengl_driver_t *this, opengl_frame_t *frame) { float off; float tx, ty; struct timeval curtime; - + glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); /* Calc timing + texture coords */ @@ -341,10 +341,10 @@ static void render_cyl (opengl_driver_t *this, opengl_frame_t *frame) { glMatrixMode (GL_MODELVIEW); glLoadIdentity (); glTranslatef (0, 0, -10); - glRotatef (off * CYCLE_FACTOR1, 1, 0, 0); - glRotatef (off, 0, 0, 1); - glRotatef (off * CYCLE_FACTOR2, 0, 1, 0); - + glRotatef (off * CYCLE_FACTOR1, 1, 0, 0); + glRotatef (off, 0, 0, 1); + glRotatef (off * CYCLE_FACTOR2, 0, 1, 0); + /* Note that this is not aspect ratio corrected */ glBegin (GL_QUADS); for (i = 0; i < CYL_TESSELATION; i++) { @@ -363,7 +363,7 @@ static void render_cyl (opengl_driver_t *this, opengl_frame_t *frame) { } /* Animated spinning environment mapped torus */ -#define DIST_FACTOR 16.568542 /* 2 * (sqrt(2)-1) * 20 */ +#define DIST_FACTOR 16.568542 /* 2 * (sqrt(2)-1) * 20 */ static void render_env_tor (opengl_driver_t *this, opengl_frame_t *frame) { float off; float x1, y1, x2, y2, tx, ty; @@ -397,7 +397,7 @@ static void render_env_tor (opengl_driver_t *this, opengl_frame_t *frame) { glLoadIdentity (); glDepthFunc (GL_ALWAYS); glDepthMask (GL_FALSE); - + glBegin (GL_QUADS); glColor3f (1, 1, 1); glTexCoord2f (tx, 0); glVertex3f (x2, y2, -20); @@ -405,7 +405,7 @@ static void render_env_tor (opengl_driver_t *this, opengl_frame_t *frame) { glTexCoord2f (0, ty); glVertex3f (x1, y1, -20); glTexCoord2f (tx, ty); glVertex3f (x2, y1, -20); glEnd (); - + glPopMatrix (); glDepthFunc (GL_LEQUAL); glDepthMask (GL_TRUE); @@ -442,7 +442,7 @@ static int render_help_image_tex (opengl_driver_t *this, int new_w, int new_h, tex_w <<= 1; while (tex_h < new_h) tex_h <<= 1; - + if (tex_w != this->tex_width || tex_h != this->tex_height) { char *tmp = calloc (tex_w * tex_h, 4); /* 4 enough until RGBA */ if (this->glBindTextureEXT) @@ -458,7 +458,7 @@ static int render_help_image_tex (opengl_driver_t *this, int new_w, int new_h, this->tex_width = tex_w; this->tex_height = tex_h; lprintf ("* new texsize: %dx%d\n", tex_w, tex_h); - } + } this->last_width = new_w; this->last_height = new_h; return 1; @@ -481,7 +481,7 @@ static int render_help_image_tiledtex (opengl_driver_t *this, tex_w <<= 1; while (tex_h < new_h) tex_h <<= 1; - + if (tex_w != this->tex_width || tex_h != this->tex_height) { char *tmp = calloc (tex_w * tex_h, 4); /* 4 enough until RGBA */ if (this->glBindTextureEXT) @@ -521,7 +521,7 @@ static int render_help_image_tiledtex (opengl_driver_t *this, this->tex_width = tex_w; this->tex_height = tex_h; lprintf ("* new texsize: %dx%d on %d tiles\n", tex_w, tex_h, num); - } + } this->last_width = new_w; this->last_height = new_h; return 1; @@ -710,7 +710,7 @@ static void *getdladdr (const GLubyte *_funcName) { handle = dlopen (NULL, RTLD_LAZY); } return dlsym (handle, funcName); - + #else /* all other Un*xes */ return dlsym (0, funcName); @@ -883,7 +883,7 @@ static int render_setup_cyl (opengl_driver_t *this) { static int render_setup_torus (opengl_driver_t *this) { int i, j, k; int ret; - + ret = render_setup_3d (this); ret &= render_help_setup_tex (this); @@ -937,7 +937,7 @@ static int render_setup_fp_yuv (opengl_driver_t *this) { "MAD res, { 0, -.391, 2.018 }, tmp.xxxw, res;" "MAD result.color, { 1.596, -.813, 0 }, tmp.yyyw, res;" "END"; - + ret = render_setup_tex2d (this); if (! this->has_fragprog) return 0; @@ -963,7 +963,7 @@ static int render_setup_fp_yuv (opengl_driver_t *this) { */ /* name, display, image, setup, needsrgb, defaction, fallback */ static const opengl_render_t opengl_rb[] = { - { "2D_Tex_Fragprog", render_tex2d, render_image_fp_yuv, + { "2D_Tex_Fragprog", render_tex2d, render_image_fp_yuv, render_setup_fp_yuv, 0, RENDER_NONE, 1 }, { "2D_Tex", render_tex2d, render_image_tex, render_setup_tex2d, 1, RENDER_NONE, 2 }, @@ -1004,10 +1004,10 @@ static void *render_run (opengl_driver_t *this) { struct timeval curtime; struct timespec timeout; const opengl_render_t *render; - + lprintf ("* render thread created\n"); while (1) { - + /* Wait for render action */ pthread_mutex_lock (&this->render_action_mutex); if (! this->render_action) { @@ -1211,28 +1211,28 @@ static uint32_t opengl_get_capabilities (vo_driver_t *this_gen) { static void opengl_frame_proc_slice (vo_frame_t *vo_img, uint8_t **src) { opengl_frame_t *frame = (opengl_frame_t *) vo_img ; /* opengl_driver_t *this = (opengl_driver_t *) vo_img->driver; */ - + vo_img->proc_called = 1; if (! frame->rgb_dst) return; /* lprintf ("%p: frame_copy src %p=%p to %p\n", frame, src[0], frame->chunk[0], frame->rgb_dst); */ - if( frame->vo_frame.crop_left || frame->vo_frame.crop_top || + if( frame->vo_frame.crop_left || frame->vo_frame.crop_top || frame->vo_frame.crop_right || frame->vo_frame.crop_bottom ) { /* TODO: opengl *could* support this?!? */ /* cropping will be performed by video_out.c */ return; } - + if (frame->format == XINE_IMGFMT_YV12) frame->yuv2rgb->yuv2rgb_fun (frame->yuv2rgb, frame->rgb_dst, src[0], src[1], src[2]); else frame->yuv2rgb->yuy22rgb_fun (frame->yuv2rgb, frame->rgb_dst, src[0]); - + /* lprintf ("frame_copy...done\n"); */ } @@ -1243,7 +1243,7 @@ static void opengl_frame_field (vo_frame_t *vo_img, int which_field) { /* lprintf ("%p: frame_field rgb %p which_field %x\n", frame, frame->rgb, which_field); */ if (! opengl_rb[this->render_fun_id].needsrgb) { - frame->rgb_dst = NULL; + frame->rgb_dst = NULL; return; } @@ -1291,7 +1291,7 @@ static vo_frame_t *opengl_alloc_frame (vo_driver_t *this_gen) { */ frame->vo_frame.proc_slice = opengl_frame_proc_slice; frame->vo_frame.proc_frame = NULL; - frame->vo_frame.field = opengl_frame_field; + frame->vo_frame.field = opengl_frame_field; frame->vo_frame.dispose = opengl_frame_dispose; frame->vo_frame.driver = this_gen; @@ -1345,7 +1345,7 @@ static void opengl_update_frame_format (vo_driver_t *this_gen, /* lprintf ("updating frame to %d x %d (ratio=%g, format=%08x)\n", width, height, ratio, format); */ flags &= VO_BOTH_FIELDS; - + XLockDisplay (this->display); /* (re-) allocate render space */ @@ -1399,7 +1399,7 @@ static void opengl_update_frame_format (vo_driver_t *this_gen, frame->height = height; frame->format = format; - XUnlockDisplay (this->display); + XUnlockDisplay (this->display); opengl_frame_field ((vo_frame_t *)frame, flags); } @@ -1433,7 +1433,7 @@ static void opengl_overlay_clut_yuv2rgb(opengl_driver_t *this, vo_overlay_t *ov } } -static void opengl_overlay_begin (vo_driver_t *this_gen, +static void opengl_overlay_begin (vo_driver_t *this_gen, vo_frame_t *frame_gen, int changed) { opengl_driver_t *this = (opengl_driver_t *) this_gen; @@ -1441,10 +1441,10 @@ static void opengl_overlay_begin (vo_driver_t *this_gen, if (this->ovl_changed && this->xoverlay) { XLockDisplay (this->display); - x11osd_clear(this->xoverlay); + x11osd_clear(this->xoverlay); XUnlockDisplay (this->display); } - + this->alphablend_extra_data.offset_x = frame_gen->overlay_offset_x; this->alphablend_extra_data.offset_y = frame_gen->overlay_offset_y; } @@ -1461,7 +1461,7 @@ static void opengl_overlay_end (vo_driver_t *this_gen, vo_frame_t *vo_img) { this->ovl_changed = 0; } -static void opengl_overlay_blend (vo_driver_t *this_gen, +static void opengl_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) { opengl_driver_t *this = (opengl_driver_t *) this_gen; opengl_frame_t *frame = (opengl_frame_t *) frame_gen; @@ -1471,7 +1471,7 @@ static void opengl_overlay_blend (vo_driver_t *this_gen, if (overlay->unscaled) { if (this->ovl_changed && this->xoverlay) { XLockDisplay (this->display); - x11osd_blend (this->xoverlay, overlay); + x11osd_blend (this->xoverlay, overlay); XUnlockDisplay (this->display); } } else { @@ -1512,7 +1512,7 @@ static int opengl_redraw_needed (vo_driver_t *this_gen) { opengl_compute_ideal_size(this); - if( _x_vo_scale_redraw_needed( &this->sc ) ) { + if( _x_vo_scale_redraw_needed( &this->sc ) ) { opengl_compute_rgb_size(this); pthread_mutex_lock (&this->render_action_mutex); if (this->render_action <= RENDER_CLEAN) { @@ -1522,10 +1522,10 @@ static int opengl_redraw_needed (vo_driver_t *this_gen) { pthread_mutex_unlock (&this->render_action_mutex); ret = 1; } - } + } else ret = 1; - + /* lprintf ("done...redraw_needed: %d\n", ret); */ return ret; } @@ -1545,7 +1545,7 @@ static void opengl_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) this->frame[0] = frame; this->render_frame_changed = 1; /* lprintf ("video_out_opengl: cur_frame updated to %d\n", frame->vo_frame.id); */ - + /* * let's see if this frame is different in size / aspect * ratio from the previous one @@ -1556,7 +1556,7 @@ static void opengl_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) /* lprintf("frame format changed\n"); */ this->sc.force_redraw = 1; /* trigger re-calc of output size */ } - + /* * tell gui that we are about to display a frame, * ask for offset and output size @@ -1592,14 +1592,14 @@ static int opengl_get_property (vo_driver_t *this_gen, int property) { case VO_PROP_WINDOW_HEIGHT: return this->sc.gui_height; default: - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_opengl: tried to get unsupported property %d\n", property); } return 0; } -static int opengl_set_property (vo_driver_t *this_gen, +static int opengl_set_property (vo_driver_t *this_gen, int property, int value) { opengl_driver_t *this = (opengl_driver_t *) this_gen; @@ -1611,7 +1611,7 @@ static int opengl_set_property (vo_driver_t *this_gen, opengl_compute_ideal_size (this); this->sc.force_redraw = 1; /* trigger re-calc of output size */ - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_opengl: aspect ratio changed to %s\n", _x_vo_scale_aspect_ratio_name(value)); break; case VO_PROP_BRIGHTNESS: @@ -1639,7 +1639,7 @@ static int opengl_set_property (vo_driver_t *this_gen, this->sc.force_redraw = 1; break; default: - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_opengl: tried to set unsupported property %d\n", property); } @@ -1662,7 +1662,7 @@ static void opengl_get_property_min_max (vo_driver_t *this_gen, } } -static int opengl_gui_data_exchange (vo_driver_t *this_gen, +static int opengl_gui_data_exchange (vo_driver_t *this_gen, int data_type, void *data) { opengl_driver_t *this = (opengl_driver_t *) this_gen; @@ -1677,7 +1677,7 @@ static int opengl_gui_data_exchange (vo_driver_t *this_gen, /* lprintf ("expose event\n"); */ if (this->frame[0]) { XExposeEvent * xev = (XExposeEvent *) data; - + if (xev && xev->count == 0) { pthread_mutex_lock (&this->render_action_mutex); if (this->render_action <= RENDER_CLEAN) { @@ -1714,9 +1714,9 @@ static int opengl_gui_data_exchange (vo_driver_t *this_gen, &this->render_action_mutex); pthread_mutex_unlock (&this->render_action_mutex); break; - + case XINE_GUI_SEND_DRAWABLE_CHANGED: - + pthread_mutex_lock (&this->render_action_mutex); this->render_action = RENDER_RELEASE; pthread_cond_signal (&this->render_action_cond); @@ -1744,7 +1744,7 @@ static int opengl_gui_data_exchange (vo_driver_t *this_gen, if (this->frame[0]) { x11_rectangle_t *rect = data; int x1, y1, x2, y2; - + _x_vo_scale_translate_gui2video(&this->sc, rect->x, rect->y, &x1, &y1); @@ -1773,7 +1773,7 @@ static void opengl_dispose (vo_driver_t *this_gen) { this->render_action = RENDER_EXIT; pthread_cond_signal (&this->render_action_cond); pthread_mutex_unlock (&this->render_action_mutex); - pthread_join (this->render_thread, NULL); + pthread_join (this->render_thread, NULL); pthread_mutex_destroy (&this->render_action_mutex); pthread_cond_destroy (&this->render_action_cond); pthread_cond_destroy (&this->render_return_cond); @@ -1791,7 +1791,7 @@ static void opengl_dispose (vo_driver_t *this_gen) { } _x_alphablend_free(&this->alphablend_extra_data); - + free (this); } @@ -1818,7 +1818,7 @@ static vo_driver_t *opengl_open_plugin (video_driver_class_t *class_gen, const v opengl_driver_t *this; char **render_fun_names; int i; - + this = (opengl_driver_t *) calloc(1, sizeof(opengl_driver_t)); if (!this) @@ -1832,9 +1832,9 @@ static vo_driver_t *opengl_open_plugin (video_driver_class_t *class_gen, const v this->sc.dest_size_cb = visual->dest_size_cb; this->sc.user_data = visual->user_data; this->sc.user_ratio = XINE_VO_ASPECT_AUTO; - + _x_alphablend_init (&this->alphablend_extra_data, class->xine); - + this->drawable = visual->d; this->gui_width = this->gui_height = -1; this->last_width = this->last_height = -1; @@ -1844,7 +1844,7 @@ static vo_driver_t *opengl_open_plugin (video_driver_class_t *class_gen, const v this->ovl_changed = 0; this->xine = class->xine; this->config = config; - + this->vo_driver.get_capabilities = opengl_get_capabilities; this->vo_driver.alloc_frame = opengl_alloc_frame; this->vo_driver.update_frame_format = opengl_update_frame_format; @@ -1862,8 +1862,8 @@ static vo_driver_t *opengl_open_plugin (video_driver_class_t *class_gen, const v this->yuv2rgb_brightness = 0; this->yuv2rgb_contrast = 128; this->yuv2rgb_saturation = 128; - - this->yuv2rgb_factory = yuv2rgb_factory_init (YUV_FORMAT, YUV_SWAP_MODE, + + this->yuv2rgb_factory = yuv2rgb_factory_init (YUV_FORMAT, YUV_SWAP_MODE, NULL); this->yuv2rgb_factory->set_csc_levels (this->yuv2rgb_factory, this->yuv2rgb_brightness, @@ -1915,7 +1915,7 @@ static vo_driver_t *opengl_open_plugin (video_driver_class_t *class_gen, const v "it also reduces flickering a lot.\n" "It should not have any performance impact."), 20, NULL, NULL); - + pthread_mutex_init (&this->render_action_mutex, NULL); pthread_cond_init (&this->render_action_cond, NULL); pthread_cond_init (&this->render_return_cond, NULL); @@ -1945,7 +1945,7 @@ static vo_driver_t *opengl_open_plugin (video_driver_class_t *class_gen, const v xprintf (this->xine, XINE_VERBOSITY_LOG, "video_out_opengl: default visual not OpenGL capable\n" " plugin will only work with clients supporting XINE_GUI_SEND_SELECT_VISUAL.\n"); - + return &this->vo_driver; } @@ -2048,7 +2048,7 @@ static const vo_info_t vo_info_opengl = { */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_VIDEO_OUT, 21, "opengl", XINE_VERSION_CODE, &vo_info_opengl, opengl_init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/video_out/video_out_pgx32.c b/src/video_out/video_out_pgx32.c index 45a54cc76..fa1b0ef99 100644 --- a/src/video_out/video_out_pgx32.c +++ b/src/video_out/video_out_pgx32.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -149,7 +149,7 @@ typedef struct { double ratio; } pgx32_frame_t; -typedef struct { +typedef struct { vo_driver_t vo_driver; vo_scale_t vo_scale; @@ -210,7 +210,7 @@ static int setup_dga(pgx32_driver_t *this) } if (strcmp("TSIgfxp", ident.name) != 0) { - xprintf(this->class->xine, XINE_VERBOSITY_LOG, _("video_out_pgx32: Error: '%s' is not a pgx32 framebuffer device\n"), devname); + xprintf(this->class->xine, XINE_VERBOSITY_LOG, _("video_out_pgx32: Error: '%s' is not a pgx32 framebuffer device\n"), devname); XDgaUnGrabDrawable(this->dgadraw); XUnlockDisplay(this->display); return 0; @@ -485,7 +485,7 @@ static void pgx32_display_frame(vo_driver_t *this_gen, vo_frame_t *frame_gen) _x_vo_scale_compute_ideal_size(&this->vo_scale); } - if (_x_vo_scale_redraw_needed(&this->vo_scale)) { + if (_x_vo_scale_redraw_needed(&this->vo_scale)) { int i; _x_vo_scale_compute_output_size(&this->vo_scale); @@ -589,7 +589,7 @@ static void pgx32_overlay_blend(vo_driver_t *this_gen, vo_frame_t *frame_gen, vo { /*pgx32_driver_t *this = (pgx32_driver_t *)(void *)this_gen;*/ pgx32_frame_t *frame = (pgx32_frame_t *)frame_gen; - + if (overlay->rle) { int i, j, x, y, len, width; int use_clip_palette; @@ -757,7 +757,7 @@ static int pgx32_redraw_needed(vo_driver_t *this_gen) { pgx32_driver_t *this = (pgx32_driver_t *)(void *)this_gen; - if (_x_vo_scale_redraw_needed(&this->vo_scale)) { + if (_x_vo_scale_redraw_needed(&this->vo_scale)) { this->vo_scale.force_redraw = 1; return 1; } @@ -775,7 +775,7 @@ static void pgx32_dispose(vo_driver_t *this_gen) munmap((void *)this->vregs, GFXP_REGS_MMAPLEN); _x_alphablend_free(&this->alphablend_extra_data); - + free(this); } @@ -806,7 +806,7 @@ static vo_driver_t *pgx32_init_driver(video_driver_class_t *class_gen, const voi } _x_alphablend_init(&this->alphablend_extra_data, class->xine); - + this->vo_driver.get_capabilities = pgx32_get_capabilities; this->vo_driver.alloc_frame = pgx32_alloc_frame; this->vo_driver.update_frame_format = pgx32_update_frame_format; diff --git a/src/video_out/video_out_pgx64.c b/src/video_out/video_out_pgx64.c index abda51e2b..c9ec38aa8 100644 --- a/src/video_out/video_out_pgx64.c +++ b/src/video_out/video_out_pgx64.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -213,7 +213,7 @@ typedef struct { uint8_t *buffer_ptrs[3]; } pgx64_frame_t; -typedef struct { +typedef struct { vo_driver_t vo_driver; vo_scale_t vo_scale; @@ -671,7 +671,7 @@ static void pgx64_display_frame(vo_driver_t *this_gen, vo_frame_t *frame_gen) DGA_DRAW_UNLOCK(this->dgadraw); XUnlockDisplay(this->display); - if (_x_vo_scale_redraw_needed(&this->vo_scale)) { + if (_x_vo_scale_redraw_needed(&this->vo_scale)) { short int *cliprects, wx0, wy0, wx1, wy1, cx0, cy0, cx1, cy1; int dgavis; @@ -991,7 +991,7 @@ static void pgx64_overlay_key_blend(vo_driver_t *this_gen, vo_frame_t *frame_gen if (x + width - 1 > overlay->hili_right) { width -= overlay->hili_right - x; len += overlay->hili_right - x; - } + } } } @@ -999,7 +999,7 @@ static void pgx64_overlay_key_blend(vo_driver_t *this_gen, vo_frame_t *frame_gen int j; clut_t *src_clut; uint8_t *src_trans; - + if (use_clip_palette) { src_clut = (clut_t *)&overlay->hili_color; src_trans = (uint8_t *)&overlay->hili_trans; @@ -1035,7 +1035,7 @@ static void pgx64_overlay_key_blend(vo_driver_t *this_gen, vo_frame_t *frame_gen else { palette[use_clip_palette][j] = BlackPixel(this->display, this->screen); } - } + } } else { palette[use_clip_palette][j] = this->colour_key; @@ -1273,7 +1273,7 @@ static int pgx64_redraw_needed(vo_driver_t *this_gen) DGA_DRAW_UNLOCK(this->dgadraw); XUnlockDisplay(this->display); - if (modif || _x_vo_scale_redraw_needed(&this->vo_scale)) { + if (modif || _x_vo_scale_redraw_needed(&this->vo_scale)) { this->vo_scale.force_redraw = 1; this->chromakey_regen_needed = 1; return 1; @@ -1320,7 +1320,7 @@ static void pgx64_config_changed(void *user_data, xine_cfg_entry_t *entry) if (strcmp(entry->key, "video.device.pgx64_colour_key") == 0) { pgx64_set_property(this_gen, VO_PROP_COLORKEY, entry->num_value); update_colour_key_rgb(this); - } + } else if (strcmp(entry->key, "video.device.pgx64_chromakey_en") == 0) { this->chromakey_en = entry->num_value; } diff --git a/src/video_out/video_out_raw.c b/src/video_out/video_out_raw.c index 99e2c0004..860efdfb7 100644 --- a/src/video_out/video_out_raw.c +++ b/src/video_out/video_out_raw.c @@ -152,23 +152,23 @@ static int raw_process_ovl( raw_driver_t *this_gen, vo_overlay_t *overlay ) x = pos%ovl->ovl_w; y = pos/ovl->ovl_w; if ( (x>=overlay->hili_left && x<=overlay->hili_right) && (y>=overlay->hili_top && y<=overlay->hili_bottom) ) { - colors = hili_colors; - trans = hili_trans; + colors = hili_colors; + trans = hili_trans; } else { - colors = low_colors; - trans = low_trans; + colors = low_colors; + trans = low_trans; } rlelen = rle->len; clr = rle->color; alpha = trans[clr]; for ( i=0; i<rlelen; ++i ) { - rgba[0] = colors[clr].y; - rgba[1] = colors[clr].cr; - rgba[2] = colors[clr].cb; - rgba[3] = alpha*255/15; - rgba+= 4; - ++pos; + rgba[0] = colors[clr].y; + rgba[1] = colors[clr].cr; + rgba[2] = colors[clr].cb; + rgba[3] = alpha*255/15; + rgba+= 4; + ++pos; } ++rle; --num_rle; @@ -182,7 +182,7 @@ static void raw_overlay_begin (vo_driver_t *this_gen, vo_frame_t *frame_gen, int raw_driver_t *this = (raw_driver_t *) this_gen; if ( !changed ) - return; + return; ++this->ovl_changed; } diff --git a/src/video_out/video_out_sdl.c b/src/video_out/video_out_sdl.c index 89150f5d0..36d66cd86 100644 --- a/src/video_out/video_out_sdl.c +++ b/src/video_out/video_out_sdl.c @@ -83,7 +83,7 @@ struct sdl_driver_s { vo_driver_t vo_driver; config_values_t *config; - + int hw_accel; SDL_Surface *surface; @@ -100,7 +100,7 @@ struct sdl_driver_s { int screen; Drawable drawable; #endif - + vo_scale_t sc; xine_t *xine; @@ -142,7 +142,7 @@ static vo_frame_t *sdl_alloc_frame (vo_driver_t *this_gen) { if (!frame) return NULL; - + pthread_mutex_init (&frame->vo_frame.mutex, NULL); /* @@ -207,8 +207,8 @@ static void sdl_update_frame_format (vo_driver_t *this_gen, if (frame->overlay == NULL) return; - /* - * This needs to be done becuase I have found that + /* + * This needs to be done becuase I have found that * pixels isn't setup until this is called. */ SDL_LockYUVOverlay (frame->overlay); @@ -242,7 +242,7 @@ static void sdl_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_ this->alphablend_extra_data.offset_x = frame_gen->overlay_offset_x; this->alphablend_extra_data.offset_y = frame_gen->overlay_offset_y; - + if (overlay->rle) { if( frame->format == XINE_IMGFMT_YV12 ) _x_blend_yuv( frame->vo_frame.base, overlay, frame->width, frame->height, frame->vo_frame.pitches, &this->alphablend_extra_data); @@ -354,7 +354,7 @@ static void sdl_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { static int sdl_get_property (vo_driver_t *this_gen, int property) { sdl_driver_t *this = (sdl_driver_t *) this_gen; - + switch (property) { case VO_PROP_WINDOW_WIDTH: return this->sc.gui_width; @@ -383,7 +383,7 @@ static int sdl_set_property (vo_driver_t *this_gen, if (value>=XINE_VO_ASPECT_NUM_RATIOS) value = XINE_VO_ASPECT_AUTO; this->sc.user_ratio = value; - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_sdl: aspect ratio changed to %s\n", _x_vo_scale_aspect_ratio_name(value)); sdl_compute_ideal_size (this); @@ -458,7 +458,7 @@ static void sdl_dispose (vo_driver_t * this_gen) { SDL_QuitSubSystem (SDL_INIT_VIDEO); _x_alphablend_free(&this->alphablend_extra_data); - + free(this); } @@ -476,16 +476,16 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi #ifdef HAVE_X11 XWindowAttributes window_attributes; #endif - + this = (sdl_driver_t *) calloc(1, sizeof(sdl_driver_t)); if (!this) return NULL; _x_alphablend_init(&this->alphablend_extra_data, class->xine); - + this->sdlflags = SDL_HWSURFACE | SDL_RESIZABLE; - - this->hw_accel = class->config->register_bool(class->config, + + this->hw_accel = class->config->register_bool(class->config, "video.device.sdl_hw_accel", 1, _("use hardware acceleration if available"), _("When your system supports it, hardware acceleration provided by your " @@ -525,7 +525,7 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi if (!SDL_ListModes (vidInfo->vfmt, SDL_HWSURFACE | SDL_RESIZABLE)) { this->sdlflags = SDL_RESIZABLE; if (!SDL_ListModes (vidInfo->vfmt, SDL_RESIZABLE)) { - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_sdl: open_plugin - sdl couldn't get any acceptable video mode\n"); return NULL; } @@ -533,7 +533,7 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi this->bpp = vidInfo->vfmt->BitsPerPixel; if (this->bpp < 16) { - xprintf(this->xine, XINE_VERBOSITY_LOG, + xprintf(this->xine, XINE_VERBOSITY_LOG, _("sdl has to emulate a 16 bit surfaces, that will slow things down.\n")); this->bpp = 16; } @@ -593,17 +593,17 @@ static void dispose_class (video_driver_class_t *this_gen) { static void *init_class (xine_t *xine, void *visual_gen) { /* x11_visual_t *visual = (x11_visual_t *) visual_gen; */ sdl_class_t *this; - + /* check if we have SDL */ if ((SDL_Init (SDL_INIT_VIDEO)) < 0) { - xprintf (xine, XINE_VERBOSITY_DEBUG, + xprintf (xine, XINE_VERBOSITY_DEBUG, "video_out_sdl: open_plugin - sdl video initialization failed.\n"); return NULL; } SDL_QuitSubSystem (SDL_INIT_VIDEO); this = (sdl_class_t*) calloc(1, sizeof(sdl_class_t)); - + this->driver_class.open_plugin = open_plugin; this->driver_class.get_identifier = get_identifier; this->driver_class.get_description = get_description; diff --git a/src/video_out/video_out_stk.c b/src/video_out/video_out_stk.c index 00dd80251..647760fd2 100644 --- a/src/video_out/video_out_stk.c +++ b/src/video_out/video_out_stk.c @@ -22,7 +22,7 @@ * * based on video_out_sdl from * Miguel Freitas - * + * * based on mpeg2dec code from * Ryan C. Gordon <icculus@lokigames.com> and * Dominik Schnitzer <aeneas@linuxvideo.org> @@ -82,9 +82,9 @@ typedef struct stk_driver_s { vo_driver_t vo_driver; /* stk private data */ - config_values_t* config; - surface_t* surface; - xine_panel_t* xine_panel; + config_values_t* config; + surface_t* surface; + xine_panel_t* xine_panel; uint8_t bpp; /* do we need this ? */ pthread_mutex_t mutex; uint32_t capabilities; @@ -171,25 +171,25 @@ static void stk_update_frame_format (vo_driver_t *this_gen, vo_frame_t *frame_ge //printf("video_out_stk: update_frame_format()\n"); if ((frame->width != width) || (frame->height != height) || (frame->format != format)) { - lprintf("update_frame_format - %d=%d, %d=%d, %d=%d\n", + lprintf("update_frame_format - %d=%d, %d=%d, %d=%d\n", frame->width, width, frame->height, height, frame->format, format); - lprintf("vo_frame data - width, height, format: %d, %d, %d\n", + lprintf("vo_frame data - width, height, format: %d, %d, %d\n", frame->vo_frame.width, frame->vo_frame.height, frame->vo_frame.format); - + /* (re-) allocate image */ if (frame->overlay) { - stk_overlay_free(frame->overlay); + stk_overlay_free(frame->overlay); frame->overlay = NULL; } if (format == XINE_IMGFMT_YV12) { lprintf ("format YV12\n"); - frame->overlay = stk_surface_create_overlay(this->surface, width, height, + frame->overlay = stk_surface_create_overlay(this->surface, width, height, STK_FORMAT_YV12); } else if (format == XINE_IMGFMT_YUY2) { lprintf("format YUY2\n"); - frame->overlay = stk_surface_create_overlay(this->surface, width, height, + frame->overlay = stk_surface_create_overlay(this->surface, width, height, STK_FORMAT_YUY2); } @@ -197,7 +197,7 @@ static void stk_update_frame_format (vo_driver_t *this_gen, vo_frame_t *frame_ge return; /* From the SDL driver: - * This needs to be done becuase I have found that + * This needs to be done becuase I have found that * pixels isn't setup until this is called. */ stk_overlay_lock(frame->overlay); @@ -224,7 +224,7 @@ static void stk_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_ stk_driver_t* this = (stk_driver_t*)this_gen; stk_frame_t* frame = (stk_frame_t*)frame_gen; //printf("video_out_stk: overlay_blend()\n"); - + this->alphablend_extra_data.offset_x = frame_gen->overlay_offset_x; this->alphablend_extra_data.offset_y = frame_gen->overlay_offset_y; @@ -238,7 +238,7 @@ static void stk_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_ } static void stk_check_events (stk_driver_t* this) { - /* SDL checks for a resize, our video panels aren't resizeable... */ + /* SDL checks for a resize, our video panels aren't resizeable... */ //printf("video_out_stk: check_events()\n"); } @@ -247,7 +247,7 @@ static int stk_redraw_needed (vo_driver_t* this_gen) { stk_driver_t* this = (stk_driver_t*)this_gen; int ret = 0; static int last_gui_width, last_gui_height; - + //printf("video_out_stk: redraw_needed()\n"); if( last_gui_width != this->sc.gui_width || @@ -273,7 +273,7 @@ static void stk_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { stk_frame_t* frame = (stk_frame_t*)frame_gen; //printf("video_out_stk: display_frame()\n"); - + pthread_mutex_lock(&this->mutex); if ( (frame->width != this->sc.delivered_width) @@ -308,7 +308,7 @@ static void stk_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { static int stk_get_property (vo_driver_t* this_gen, int property) { stk_driver_t* this = (stk_driver_t *)this_gen; - + //printf("video_out_stk: get_property()\n"); if (property == VO_PROP_ASPECT_RATIO) @@ -321,7 +321,7 @@ static int stk_set_property (vo_driver_t* this_gen, int property, int value) { stk_driver_t* this = (stk_driver_t*)this_gen; //printf("video_out_stk: set_property()\n"); - + if ( property == VO_PROP_ASPECT_RATIO) { if (value>=XINE_VO_ASPECT_NUM_RATIOS) value = XINE_VO_ASPECT_AUTO; @@ -341,7 +341,7 @@ static void stk_get_property_min_max (vo_driver_t *this_gen, int property, int * //printf("video_out_stk: get_property_min_max()\n"); } -static int stk_gui_data_exchange (vo_driver_t *this_gen, int data_type, void *data) { +static int stk_gui_data_exchange (vo_driver_t *this_gen, int data_type, void *data) { stk_driver_t *this = (stk_driver_t*)this_gen; switch (data_type) @@ -349,9 +349,9 @@ static int stk_gui_data_exchange (vo_driver_t *this_gen, int data_type, void *da case XINE_GUI_SEND_COMPLETION_EVENT: break; - case XINE_GUI_SEND_EXPOSE_EVENT: + case XINE_GUI_SEND_EXPOSE_EVENT: break; - + case XINE_GUI_SEND_DRAWABLE_CHANGED: this->xine_panel = (xine_panel_t*)data; this->surface = stk_xine_panel_surface(this->xine_panel); @@ -365,18 +365,18 @@ static int stk_gui_data_exchange (vo_driver_t *this_gen, int data_type, void *da case XINE_GUI_SEND_TRANSLATE_GUI_TO_VIDEO: break; } - + return 0; } static void stk_dispose (vo_driver_t * this_gen) { stk_driver_t* this = (stk_driver_t*)this_gen; - + //printf("video_out_stk: dispose()\n"); - - /* FIXME: any libstk deleting must be done in the app or library + + /* FIXME: any libstk deleting must be done in the app or library * since we didn't create the surface */ - + _x_alphablend_free(&this->alphablend_extra_data); free(this); @@ -386,9 +386,9 @@ static vo_driver_t *open_plugin(video_driver_class_t *class_gen, const void *vis stk_class_t * class = (stk_class_t *) class_gen; /* allocate the video output driver class */ stk_driver_t* this; - + //printf("video_out_stk: open_plugin()\n"); - + this = calloc(1, sizeof (stk_driver_t)); if (!this) return NULL; @@ -432,7 +432,7 @@ static vo_driver_t *open_plugin(video_driver_class_t *class_gen, const void *vis /* FIXME: move this to the stk SDL driver code */ xine_setenv("SDL_VIDEO_YUV_HWACCEL", "1", 1); xine_setenv("SDL_VIDEO_X11_NODIRECTCOLOR", "1", 1); - + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_stk: warning, xine's STK driver is EXPERIMENTAL\n"); return &this->vo_driver; @@ -460,7 +460,7 @@ static void dispose_class (video_driver_class_t *this_gen) { static void *init_class (xine_t *xine, void *visual_gen) { stk_class_t* this; - + //printf("video_out_stk: init_class()\n"); this = calloc(1, sizeof(stk_class_t)); @@ -469,7 +469,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { this->driver_class.get_identifier = get_identifier; this->driver_class.get_description = get_description; this->driver_class.dispose = dispose_class; - + this->config = xine->config; this->xine = xine; diff --git a/src/video_out/video_out_syncfb.c b/src/video_out/video_out_syncfb.c index f66817f36..aaf7d43c7 100644 --- a/src/video_out/video_out_syncfb.c +++ b/src/video_out/video_out_syncfb.c @@ -7,7 +7,7 @@ * 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. - * + * * xine 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 @@ -18,14 +18,14 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * video_out_syncfb.c, SyncFB (for Matrox G200/G400 cards) interface for xine - * + * * based on video_out_xv.c by (see file for original authors) - * + * * with lot's of code from: * video_out_syncfb.c by Joachim Koenig <joachim.koenig@gmx.net> * and by Matthias Oelmann <mao@well.com> * video_out_mga by Aaron Holtzman <aholtzma@ess.engr.uvic.ca> - * + * * glued together for xine by Matthias Dahl <matthew2k@web.de> */ @@ -133,7 +133,7 @@ typedef struct { /* returns boolean value (1 success, 0 failure) */ static int syncfb_overlay_on(syncfb_driver_t* this) { - if(ioctl(this->fd, SYNCFB_ON)) { + if(ioctl(this->fd, SYNCFB_ON)) { xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_syncfb: error. (on ioctl failed)\n"); return 0; @@ -145,7 +145,7 @@ static int syncfb_overlay_on(syncfb_driver_t* this) /* returns boolean value (1 success, 0 failure) */ static int syncfb_overlay_off(syncfb_driver_t* this) -{ +{ if(ioctl(this->fd, SYNCFB_OFF)) { xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_syncfb: error. (off ioctl failed)\n"); @@ -169,7 +169,7 @@ static void write_frame_YUV422(syncfb_driver_t* this, syncfb_frame_t* frame) for(h = 0; h < (frame->height / 2); h++) { cbp = cb; crp = cr; - + for(w = 0; w < (frame->width / 2); w++) { *dst32++ = (*y) + ((*cb)<<8) + ((*(y+1))<<16) + ((*cr)<<24); y++; y++; cb++; cr++; @@ -181,33 +181,33 @@ static void write_frame_YUV422(syncfb_driver_t* this, syncfb_frame_t* frame) *dst32++ = (*y) + ((*cbp)<<8) + ((*(y+1))<<16) + ((*crp)<<24); y++; y++; cbp++; crp++; } - + dst32 += (this->syncfb_config.src_pitch - frame->width) / 2; } } static void write_frame_YUV420P2(syncfb_driver_t* this, syncfb_frame_t* frame) -{ +{ uint8_t* y = (uint8_t *)frame->vo_frame.base[0]; uint8_t* cb = (uint8_t *)frame->vo_frame.base[1]; uint8_t* cr = (uint8_t *)frame->vo_frame.base[2]; uint8_t* dst8 = this->video_mem + this->bufinfo.offset_p2; - int h, w; - + int h, w; + register uint32_t* tmp32; register uint8_t* rcr; register uint8_t* rcb; rcr = cr; rcb = cb; - + for(h = 0; h < (frame->height / 2); h++) { tmp32 = (uint32_t *)dst8; w = (frame->width / 8) * 2; - + while(w--) { register uint32_t temp; - + temp = (*rcb) | (*rcr << 8); rcr++; rcb++; @@ -217,7 +217,7 @@ static void write_frame_YUV420P2(syncfb_driver_t* this, syncfb_frame_t* frame) *tmp32 = temp; tmp32++; } - + dst8 += this->syncfb_config.src_pitch; } @@ -230,13 +230,13 @@ static void write_frame_YUV420P2(syncfb_driver_t* this, syncfb_frame_t* frame) } static void write_frame_YUV420P3(syncfb_driver_t* this, syncfb_frame_t* frame) -{ +{ uint8_t* y = (uint8_t *)frame->vo_frame.base[0]; uint8_t* cb = (uint8_t *)frame->vo_frame.base[1]; uint8_t* cr = (uint8_t *)frame->vo_frame.base[2]; uint8_t* dst8 = this->video_mem + this->bufinfo.offset; int h, half_width = (frame->width/2); - + for(h = 0; h < frame->height; h++) { xine_fast_memcpy(dst8, y, frame->width); y += frame->width; @@ -247,16 +247,16 @@ static void write_frame_YUV420P3(syncfb_driver_t* this, syncfb_frame_t* frame) for(h = 0; h < (frame->height / 2); h++) { xine_fast_memcpy((dst8 + this->bufinfo.offset_p2), cb, half_width); xine_fast_memcpy((dst8 + this->bufinfo.offset_p3), cr, half_width); - + cb += half_width; cr += half_width; - + dst8 += (this->syncfb_config.src_pitch / 2); } } static void write_frame_YUY2(syncfb_driver_t* this, syncfb_frame_t* frame) -{ +{ uint8_t* src8 = (uint8_t *)frame->vo_frame.base[0]; uint8_t* dst8 = (uint8_t *)(this->video_mem + this->bufinfo.offset); int h, double_width = (frame->width * 2); @@ -271,7 +271,7 @@ static void write_frame_YUY2(syncfb_driver_t* this, syncfb_frame_t* frame) static void write_frame_sfb(syncfb_driver_t* this, syncfb_frame_t* frame) { - switch(frame->format) { + switch(frame->format) { case XINE_IMGFMT_YUY2: if(this->capabilities.palettes & (1<<VIDEO_PALETTE_YUV422)) write_frame_YUY2(this, frame); @@ -279,7 +279,7 @@ static void write_frame_sfb(syncfb_driver_t* this, syncfb_frame_t* frame) xprintf(this->xine, XINE_VERBOSITY_LOG, _("video_out_syncfb: error. (YUY2 not supported by your graphic card)\n")); break; - + case XINE_IMGFMT_YV12: switch(this->yuv_format) { case VIDEO_PALETTE_YUV422: @@ -294,14 +294,14 @@ static void write_frame_sfb(syncfb_driver_t* this, syncfb_frame_t* frame) default: xprintf(this->xine, XINE_VERBOSITY_LOG, _("video_out_syncfb: error. (YV12 not supported by your graphic card)\n")); - } + } break; - + default: xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_syncfb: error. (unknown frame format)\n"); break; } - + frame->vo_frame.free(&frame->vo_frame); } @@ -321,7 +321,7 @@ static void free_framedata(syncfb_frame_t* frame) free(frame->data_mem[2]); frame->data_mem[2] = NULL; }*/ - + if(frame->vo_frame.base[0]) { free(frame->vo_frame.base[0]); frame->vo_frame.base[0] = NULL; @@ -371,24 +371,24 @@ static void syncfb_compute_output_size(syncfb_driver_t *this) * configuring SyncFB module from this point on. */ syncfb_overlay_off(this); - + /* sanity checking - certain situations *may* crash the SyncFB module, so * take care that we always have valid numbers. */ - if(this->sc.output_xoffset >= 0 && this->sc.output_yoffset >= 0 && - this->cur_frame->width > 0 && this->cur_frame->height > 0 && - this->sc.output_width > 0 && this->sc.output_height > 0 && + if(this->sc.output_xoffset >= 0 && this->sc.output_yoffset >= 0 && + this->cur_frame->width > 0 && this->cur_frame->height > 0 && + this->sc.output_width > 0 && this->sc.output_height > 0 && this->cur_frame->format > 0 && this->video_win_visibility) { - + if(ioctl(this->fd, SYNCFB_GET_CONFIG, &this->syncfb_config)) - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_syncfb: error. (get_config ioctl failed)\n"); - + this->syncfb_config.syncfb_mode = SYNCFB_FEATURE_SCALE | SYNCFB_FEATURE_CROP; - + if(this->props[VO_PROP_INTERLACED].value) this->syncfb_config.syncfb_mode |= SYNCFB_FEATURE_DEINTERLACE; - + switch(this->cur_frame->format) { case XINE_IMGFMT_YV12: this->syncfb_config.src_palette = this->yuv_format; @@ -397,33 +397,33 @@ static void syncfb_compute_output_size(syncfb_driver_t *this) this->syncfb_config.src_palette = VIDEO_PALETTE_YUV422; break; default: - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_syncfb: error. (unknown frame format)\n"); this->syncfb_config.src_palette = 0; break; } - + this->syncfb_config.fb_screen_size = this->virtual_screen_width * this->virtual_screen_height * (this->screen_depth / 8) * 2; this->syncfb_config.src_width = this->cur_frame->width; this->syncfb_config.src_height = this->cur_frame->height; - + this->syncfb_config.image_width = this->sc.output_width; this->syncfb_config.image_height = this->sc.output_height; - + this->syncfb_config.image_xorg = this->sc.output_xoffset + this->sc.gui_win_x; this->syncfb_config.image_yorg = this->sc.output_yoffset + this->sc.gui_win_y; - + this->syncfb_config.src_crop_top = this->sc.displayed_yoffset; this->syncfb_config.src_crop_bot = (this->props[VO_PROP_INTERLACED].value && this->sc.displayed_yoffset == 0) ? 1 : this->sc.displayed_yoffset; this->syncfb_config.src_crop_left = this->sc.displayed_xoffset; this->syncfb_config.src_crop_right = this->sc.displayed_xoffset; - + this->syncfb_config.default_repeat = (this->props[VO_PROP_INTERLACED].value) ? 1 : this->default_repeat; - + if(this->capabilities.palettes & (1<<this->syncfb_config.src_palette)) { if(ioctl(this->fd,SYNCFB_SET_CONFIG,&this->syncfb_config)) xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_syncfb: error. (set_config ioctl failed)\n"); - + syncfb_overlay_on(this); } } @@ -438,16 +438,16 @@ static int syncfb_redraw_needed(vo_driver_t* this_gen) syncfb_driver_t* this = (syncfb_driver_t *) this_gen; int ret = 0; - + if( _x_vo_scale_redraw_needed( &this->sc ) ) { syncfb_compute_output_size (this); syncfb_clean_output_area (this); - + ret = 1; } - + return ret; } @@ -466,7 +466,7 @@ static void syncfb_frame_field (vo_frame_t *vo_img, int which_field) static void syncfb_frame_dispose(vo_frame_t* vo_img) { syncfb_frame_t* frame = (syncfb_frame_t *) vo_img; - + if(frame) { free_framedata(frame); free(frame); @@ -477,17 +477,17 @@ static vo_frame_t* syncfb_alloc_frame(vo_driver_t* this_gen) { /* syncfb_driver_t *this = (syncfb_driver_t *) this_gen; */ syncfb_frame_t *frame; - + frame = calloc(1, sizeof(syncfb_frame_t)); if(!frame) return NULL; - + pthread_mutex_init(&frame->vo_frame.mutex, NULL); - + frame->vo_frame.base[0] = NULL; frame->vo_frame.base[1] = NULL; frame->vo_frame.base[2] = NULL; - + /* * supply required functions */ @@ -495,9 +495,9 @@ static vo_frame_t* syncfb_alloc_frame(vo_driver_t* this_gen) frame->vo_frame.proc_frame = NULL; frame->vo_frame.field = syncfb_frame_field; frame->vo_frame.dispose = syncfb_frame_dispose; - + frame->vo_frame.driver = this_gen; - + return (vo_frame_t *) frame; } @@ -509,7 +509,7 @@ static void syncfb_update_frame_format(vo_driver_t* this_gen, syncfb_driver_t *this = (syncfb_driver_t *) this_gen; syncfb_frame_t *frame = (syncfb_frame_t *) frame_gen; /* uint32_t frame_size = width*height; */ - + if((frame->width != width) || (frame->height != height) || (frame->format != format)) { @@ -518,7 +518,7 @@ static void syncfb_update_frame_format(vo_driver_t* this_gen, printf("video_out_syncfb: debug. (update frame format: old values [width=%d, height=%d, format=%04x], new values [width=%d, height=%d, format=%04x])\n", frame->width, frame->height, frame->format, width, height, format); #endif free_framedata(frame); - + frame->width = width; frame->height = height; frame->format = format; @@ -547,14 +547,14 @@ static void syncfb_update_frame_format(vo_driver_t* this_gen, "video_out_syncfb: error. (unable to allocate " "framedata because of unknown frame format: %04x)\n", format); } - + /* if((format == IMGFMT_YV12 && (frame->data_mem[0] == NULL || frame->data_mem[1] == NULL || frame->data_mem[2] == NULL)) || (format == IMGFMT_YUY2 && frame->data_mem[0] == NULL)) {*/ if((format == XINE_IMGFMT_YV12 && (frame->vo_frame.base[0] == NULL || frame->vo_frame.base[1] == NULL || frame->vo_frame.base[2] == NULL)) || (format == XINE_IMGFMT_YUY2 && frame->vo_frame.base[0] == NULL)) { xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_syncfb: error. (framedata allocation failed: out of memory)\n"); - + free_framedata(frame); } } @@ -566,7 +566,7 @@ static void syncfb_overlay_blend(vo_driver_t* this_gen, vo_frame_t* frame_gen, v { syncfb_frame_t* frame = (syncfb_frame_t *) frame_gen; syncfb_driver_t* this = (syncfb_driver_t *) this_gen; - + this->alphablend_extra_data.offset_x = frame_gen->overlay_offset_x; this->alphablend_extra_data.offset_y = frame_gen->overlay_offset_y; @@ -600,23 +600,23 @@ static void syncfb_display_frame(vo_driver_t* this_gen, vo_frame_t* frame_gen) this->sc.delivered_width = frame->width; this->sc.delivered_height = frame->height; this->sc.delivered_ratio = frame->ratio; - + this->sc.crop_left = frame->vo_frame.crop_left; this->sc.crop_right = frame->vo_frame.crop_right; this->sc.crop_top = frame->vo_frame.crop_top; this->sc.crop_bottom = frame->vo_frame.crop_bottom; syncfb_compute_ideal_size(this); - + this->sc.force_redraw = 1; } - /* + /* * tell gui that we are about to display a frame, * ask for offset and output size - */ + */ syncfb_redraw_needed(this_gen); - + /* the rest is only successful and safe, if the overlay is really on */ if(this->overlay_state) { if(this->bufinfo.id != -1) { @@ -626,16 +626,16 @@ static void syncfb_display_frame(vo_driver_t* this_gen, vo_frame_t* frame_gen) return; } - + if(ioctl(this->fd, SYNCFB_REQUEST_BUFFER, &this->bufinfo)) xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_syncfb: error. (request ioctl failed)\n"); - + if(this->bufinfo.id == -1) { - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_syncfb: error. (syncfb module couldn't allocate image buffer)\n"); frame->vo_frame.free(&frame->vo_frame); - - /* + + /* * there are several "fixable" situations when this request will fail. * for example when the screen resolution changes, the kernel module * will get confused - reinitializing everything will fix things for @@ -643,26 +643,26 @@ static void syncfb_display_frame(vo_driver_t* this_gen, vo_frame_t* frame_gen) */ syncfb_compute_ideal_size(this); syncfb_compute_output_size(this); - syncfb_clean_output_area(this); - + syncfb_clean_output_area(this); + return; } - + write_frame_sfb(this, frame); - + if(ioctl(this->fd, SYNCFB_COMMIT_BUFFER, &this->bufinfo)) xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_syncfb: error. (commit ioctl failed)\n"); } else frame->vo_frame.free(&frame->vo_frame); - - this->bufinfo.id = -1; + + this->bufinfo.id = -1; } static int syncfb_get_property(vo_driver_t* this_gen, int property) { syncfb_driver_t* this = (syncfb_driver_t *) this_gen; - + switch (property) { case VO_PROP_WINDOW_WIDTH: this->props[property].value = this->sc.gui_width; @@ -683,28 +683,28 @@ static int syncfb_get_property(vo_driver_t* this_gen, int property) this->props[property].value = this->sc.output_yoffset; break; } - + return this->props[property].value; } static int syncfb_set_property(vo_driver_t* this_gen, int property, int value) { syncfb_driver_t* this = (syncfb_driver_t *) this_gen; - + switch (property) { case VO_PROP_INTERLACED: this->props[property].value = value; #ifdef DEBUG_OUTPUT - printf("video_out_syncfb: debug. (VO_PROP_INTERLACED(%d))\n", + printf("video_out_syncfb: debug. (VO_PROP_INTERLACED(%d))\n", this->props[property].value); #endif - + syncfb_compute_ideal_size(this); syncfb_compute_output_size(this); - syncfb_clean_output_area(this); + syncfb_clean_output_area(this); break; - + case VO_PROP_ASPECT_RATIO: if(value >= XINE_VO_ASPECT_NUM_RATIOS) value = XINE_VO_ASPECT_AUTO; @@ -721,14 +721,14 @@ static int syncfb_set_property(vo_driver_t* this_gen, int property, int value) syncfb_compute_output_size(this); syncfb_clean_output_area(this); break; - + case VO_PROP_ZOOM_X: if ((value >= XINE_VO_ZOOM_MIN) && (value <= XINE_VO_ZOOM_MAX)) { this->props[property].value = value; this->sc.zoom_factor_x = (double)value / (double)XINE_VO_ZOOM_STEP; - + syncfb_compute_ideal_size (this); - + this->sc.force_redraw = 1; } /* @@ -740,16 +740,16 @@ static int syncfb_set_property(vo_driver_t* this_gen, int property, int value) if ((value >= XINE_VO_ZOOM_MIN) && (value <= XINE_VO_ZOOM_MAX)) { this->props[property].value = value; this->sc.zoom_factor_y = (double)value / (double)XINE_VO_ZOOM_STEP; - + syncfb_compute_ideal_size (this); - + this->sc.force_redraw = 1; } /* printf("video_out_syncfb: info. (the zooming feature is not supported at the moment because of a bug with the SyncFB kernel driver, please refer to README.syncfb)\n"); */ break; - + case VO_PROP_CONTRAST: this->props[property].value = value; @@ -764,7 +764,7 @@ static int syncfb_set_property(vo_driver_t* this_gen, int property, int value) this->params.image_height = this->syncfb_config.image_height; this->params.image_xorg = this->syncfb_config.image_xorg; this->params.image_yorg = this->syncfb_config.image_yorg; - + if(ioctl(this->fd,SYNCFB_SET_PARAMS,&this->params)) xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_syncfb: error. (setting of contrast value failed)\n"); @@ -778,25 +778,25 @@ static int syncfb_set_property(vo_driver_t* this_gen, int property, int value) printf("video_out_syncfb: debug. (VO_PROP_BRIGHTNESS(%d))\n", this->props[property].value); #endif - + this->params.brightness = value; this->params.contrast = this->props[VO_PROP_CONTRAST].value; this->params.image_width = this->syncfb_config.image_width; /* FIXME */ this->params.image_height = this->syncfb_config.image_height; this->params.image_xorg = this->syncfb_config.image_xorg; this->params.image_yorg = this->syncfb_config.image_yorg; - + if(ioctl(this->fd,SYNCFB_SET_PARAMS,&this->params)) xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_syncfb: error. (setting of brightness value failed)\n"); - + break; - } + } return value; } -static void syncfb_get_property_min_max(vo_driver_t *this_gen, +static void syncfb_get_property_min_max(vo_driver_t *this_gen, int property, int *min, int *max) { syncfb_driver_t* this = (syncfb_driver_t *) this_gen; @@ -809,7 +809,7 @@ static int syncfb_gui_data_exchange(vo_driver_t* this_gen, int data_type, void *data) { syncfb_driver_t* this = (syncfb_driver_t *) this_gen; - + switch (data_type) { case XINE_GUI_SEND_DRAWABLE_CHANGED: this->drawable = (Drawable) data; @@ -839,8 +839,8 @@ static int syncfb_gui_data_exchange(vo_driver_t* this_gen, int data_type, this->video_win_visibility = (int)(int *)data; syncfb_compute_output_size(this); break; - */ - + */ + default: return -1; } @@ -854,39 +854,39 @@ static void syncfb_dispose(vo_driver_t *this_gen) /* get it off the screen - I wanna see my desktop again :-) */ syncfb_overlay_off(this); - + /* don't know if it is necessary are even right, but anyway...?! */ - munmap(0, this->capabilities.memory_size); - + munmap(0, this->capabilities.memory_size); + close(this->fd); XLockDisplay (this->display); XFreeGC(this->display, this->gc); XUnlockDisplay (this->display); - + _x_alphablend_free(&this->alphablend_extra_data); - + free(this); } static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *visual_gen) { - + syncfb_class_t *class = (syncfb_class_t *) class_gen; config_values_t *config = class->config; syncfb_driver_t* this; - Display* display = NULL; + Display* display = NULL; unsigned int i; x11_visual_t* visual = (x11_visual_t *) visual_gen; XColor dummy; XWindowAttributes attr; display = visual->display; - + if(!(this = calloc(1, sizeof (syncfb_driver_t)))) return NULL; - + _x_alphablend_init(&this->alphablend_extra_data, class->xine); - + /* check for syncfb device */ if((this->fd = open(class->device_name, O_RDWR)) < 0) { xprintf(class->xine, XINE_VERBOSITY_DEBUG, @@ -894,17 +894,17 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi free(this); return NULL; } - + this->xine = class->xine; /* get capabilities from the syncfb module */ if(ioctl(this->fd, SYNCFB_GET_CAPS, &this->capabilities)) { xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_syncfb: aborting. (syncfb_get_caps ioctl failed)\n"); - + close(this->fd); free(this); - + return NULL; } @@ -914,16 +914,16 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi if(this->video_mem == MAP_FAILED) { xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_syncfb: aborting. (mmap of video memory failed)\n"); - + close(this->fd); free(this); - + return NULL; } - + /* * init properties and capabilities - */ + */ for (i = 0; i<VO_NUM_PROPERTIES; i++) { this->props[i].value = 0; this->props[i].min = 0; @@ -953,13 +953,13 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi this->yuv_format = VIDEO_PALETTE_YUV420P2; xprintf(this->xine, XINE_VERBOSITY_LOG, _("video_out_syncfb: info. (SyncFB module supports YUV 4:2:0 (2 plane))\n")); - } else if(this->capabilities.palettes & (1<<VIDEO_PALETTE_YUV422)) { + } else if(this->capabilities.palettes & (1<<VIDEO_PALETTE_YUV422)) { this->supported_capabilities |= VO_CAP_YV12; this->yuv_format = VIDEO_PALETTE_YUV422; xprintf(this->xine, XINE_VERBOSITY_DEBUG, _("video_out_syncfb: info. (SyncFB module supports YUV 4:2:2)\n")); } - + if(this->capabilities.palettes & (1<<VIDEO_PALETTE_YUV422)) { this->supported_capabilities |= VO_CAP_YUY2; xprintf(this->xine, XINE_VERBOSITY_DEBUG, @@ -976,11 +976,11 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi if(!this->supported_capabilities) { xprintf(this->xine, XINE_VERBOSITY_DEBUG, _("video_out_syncfb: aborting. (SyncFB module does not support YV12, YUY2 nor RGB565)\n")); - - munmap(0, this->capabilities.memory_size); + + munmap(0, this->capabilities.memory_size); close(this->fd); free(this); - + return NULL; } @@ -1002,21 +1002,21 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi /* check for virtual screen size and screen depth - this is rather important because that data is later used for free memory calculation */ XGetWindowAttributes(visual->display, DefaultRootWindow(visual->display), &attr); - + this->virtual_screen_height = attr.height; this->virtual_screen_width = attr.width; this->screen_depth = attr.depth; - + /* initialize the rest of the variables now with default values */ this->bufinfo.id = -1; this->config = config; this->cur_frame = NULL; - + /* FIXME: setting the default_repeat to anything higher than 1 will result in a distorted video, so for now, set this manually to 0 until the kernel driver is fixed... */ #if 0 - this->default_repeat = config->register_range(config, + this->default_repeat = config->register_range(config, "video.device.syncfb_default_repeat", 3, 1, 4, _("default number of frame repetitions"), _("This specifies how many times a single video " @@ -1024,7 +1024,7 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi 10, NULL, NULL); #endif this->default_repeat = 0; - + this->display = visual->display; this->drawable = visual->d; this->gc = XCreateGC (this->display, this->drawable, 0, NULL); @@ -1034,9 +1034,9 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi this->sc.user_data = visual->user_data; this->overlay = NULL; - this->screen = visual->screen; + this->screen = visual->screen; this->video_win_visibility = 1; - + XAllocNamedColor(this->display, DefaultColormap(this->display, this->screen), "black", &this->black, &dummy); @@ -1084,7 +1084,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { int fd; device_name = xine->config->register_filename(xine->config, "video.device.syncfb_device", "/dev/syncfb", - XINE_CONFIG_STRING_IS_DEVICE_NAME, + XINE_CONFIG_STRING_IS_DEVICE_NAME, _("SyncFB device name"), _("Specifies the file name for the SyncFB (TeleTux) device " "to be used.\nThis setting is security critical, " @@ -1093,7 +1093,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { "So you should be careful that the value you enter " "really is a proper framebuffer device."), XINE_CONFIG_SECURITY, NULL, NULL); - + /* check for syncfb device */ if((fd = open(device_name, O_RDWR)) < 0) { xprintf(xine, XINE_VERBOSITY_DEBUG, @@ -1101,7 +1101,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { return NULL; } close(fd); - + /* * from this point on, nothing should go wrong anymore */ @@ -1115,7 +1115,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { this->config = xine->config; this->xine = xine; this->device_name = device_name; - + return this; } diff --git a/src/video_out/video_out_syncfb.h b/src/video_out/video_out_syncfb.h index 1fc3df83a..069cbcedc 100644 --- a/src/video_out/video_out_syncfb.h +++ b/src/video_out/video_out_syncfb.h @@ -83,16 +83,16 @@ typedef unsigned char uint_8; #define SYNCFB_FEATURE_SCALE_H 1 #define SYNCFB_FEATURE_SCALE_V 2 #define SYNCFB_FEATURE_SCALE 3 -#define SYNCFB_FEATURE_CROP 4 +#define SYNCFB_FEATURE_CROP 4 #define SYNCFB_FEATURE_OFFSET 8 -#define SYNCFB_FEATURE_DEINTERLACE 16 -#define SYNCFB_FEATURE_PROCAMP 32 -#define SYNCFB_FEATURE_TRANSITIONS 64 -#define SYNCFB_FEATURE_COLKEY 128 -#define SYNCFB_FEATURE_MIRROR_H 256 -#define SYNCFB_FEATURE_MIRROR_V 512 -#define SYNCFB_FEATURE_BLOCK_REQUEST 1024 -#define SYNCFB_FEATURE_FREQDIV2 2048 +#define SYNCFB_FEATURE_DEINTERLACE 16 +#define SYNCFB_FEATURE_PROCAMP 32 +#define SYNCFB_FEATURE_TRANSITIONS 64 +#define SYNCFB_FEATURE_COLKEY 128 +#define SYNCFB_FEATURE_MIRROR_H 256 +#define SYNCFB_FEATURE_MIRROR_V 512 +#define SYNCFB_FEATURE_BLOCK_REQUEST 1024 +#define SYNCFB_FEATURE_FREQDIV2 2048 typedef struct syncfb_config_s @@ -107,7 +107,7 @@ typedef struct syncfb_config_s uint_32 buffers; /* RO, number of available buffers */ uint_32 buffer_size; /* RO, filled in by syncfb */ - uint_32 default_repeat; /* default repeat time for a single frame, can be overridden in syncfb_buffer_info_t */ + uint_32 default_repeat; /* default repeat time for a single frame, can be overridden in syncfb_buffer_info_t */ uint_32 src_width; /* source image width in pixel */ uint_32 src_height; /* source image height in pixel */ @@ -121,7 +121,7 @@ typedef struct syncfb_config_s uint_32 scale_filters; /* 0: no filtering, 255: all filters on */ uint_32 image_width; /* onscreen image width */ uint_32 image_height; /* onscreen image height */ - + /* if syncfb has FEATURE_CROP */ uint_32 src_crop_left; /* */ uint_32 src_crop_right; /* */ @@ -176,8 +176,8 @@ typedef struct syncfb_status_info_s uint_32 skip_field_cnt; /* skipped fields when fifo was about to fill up */ uint_32 request_frames; /* number of request_buffer calls */ - uint_32 commit_frames; /* number of commit_buffer calls */ - + uint_32 commit_frames; /* number of commit_buffer calls */ + uint_32 failed_requests; /* number of calls to request_buffer that failed */ uint_32 buffers_waiting; @@ -188,7 +188,7 @@ typedef struct syncfb_status_info_s -typedef struct syncfb_capability_s +typedef struct syncfb_capability_s { char name[64]; /* A name for the syncfb ... */ uint_32 palettes; /* supported palettes - see videodev.h for palettes, test the corresponding bit here */ diff --git a/src/video_out/video_out_vidix.c b/src/video_out/video_out_vidix.c index 482841a09..618ce1023 100644 --- a/src/video_out/video_out_vidix.c +++ b/src/video_out/video_out_vidix.c @@ -7,7 +7,7 @@ * 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. - * + * * xine 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 @@ -65,7 +65,7 @@ #ifdef HAVE_X11 #include "x11osd.h" #endif - + #define NUM_FRAMES 3 typedef struct vidix_driver_s vidix_driver_t; @@ -109,16 +109,16 @@ struct vidix_driver_s { uint32_t colourkey; int use_doublebuffer; - + int supports_yv12; - + pthread_mutex_t mutex; vidix_property_t props[VO_NUM_PROPERTIES]; uint32_t capabilities; int visual_type; - + /* X11 related stuff */ #ifdef HAVE_X11 Display *display; @@ -128,17 +128,17 @@ struct vidix_driver_s { x11osd *xoverlay; int ovl_changed; #endif - + /* fb related stuff */ int fb_width; int fb_height; - + int depth; vo_scale_t sc; int delivered_format; - + xine_t *xine; alphablend_t alphablend_extra_data; @@ -151,7 +151,7 @@ typedef struct vidix_class_s { VDL_HANDLE vidix_handler; vidix_capability_t vidix_cap; - + xine_t *xine; } vidix_class_t; @@ -175,7 +175,7 @@ static void free_framedata(vidix_frame_t* frame) } static void write_frame_YUV420P2(vidix_driver_t* this, vidix_frame_t* frame) -{ +{ uint8_t* y = frame->vo_frame.base[0] + this->sc.displayed_xoffset + this->sc.displayed_yoffset*frame->vo_frame.pitches[0]; uint8_t* cb = frame->vo_frame.base[1] + this->sc.displayed_xoffset/2 + @@ -183,16 +183,16 @@ static void write_frame_YUV420P2(vidix_driver_t* this, vidix_frame_t* frame) uint8_t* cr = frame->vo_frame.base[2]+this->sc.displayed_xoffset/2 + this->sc.displayed_yoffset*frame->vo_frame.pitches[2]/2; uint8_t* dst8 = (this->vidix_mem + - this->vidix_play.offsets[this->next_frame] + + this->vidix_play.offsets[this->next_frame] + this->vidix_play.offset.y); - int h, w; - + int h, w; + for(h = 0; h < this->sc.displayed_height; h++) { xine_fast_memcpy(dst8, y, this->sc.displayed_width); y += frame->vo_frame.pitches[0]; dst8 += this->dstrides.y; } - + dst8 = (this->vidix_mem + this->vidix_play.offsets[this->next_frame] + this->vidix_play.offset.v); @@ -211,7 +211,7 @@ static void write_frame_sfb(vidix_driver_t* this, vidix_frame_t* frame) { uint8_t *base = this->vidix_mem+this->vidix_play.offsets[this->next_frame]; - switch(frame->format) { + switch(frame->format) { case XINE_IMGFMT_YUY2: yuy2_to_yuy2( /* src */ @@ -223,7 +223,7 @@ static void write_frame_sfb(vidix_driver_t* this, vidix_frame_t* frame) /* width x height */ this->sc.displayed_width, this->sc.displayed_height); break; - + case XINE_IMGFMT_YV12: { uint8_t* y = frame->vo_frame.base[0] + this->sc.displayed_xoffset + this->sc.displayed_yoffset*frame->vo_frame.pitches[0]; @@ -231,7 +231,7 @@ static void write_frame_sfb(vidix_driver_t* this, vidix_frame_t* frame) this->sc.displayed_yoffset*frame->vo_frame.pitches[1]/2; uint8_t* cr = frame->vo_frame.base[2] + this->sc.displayed_xoffset/2 + this->sc.displayed_yoffset*frame->vo_frame.pitches[2]/2; - + if(this->supports_yv12) { if(this->vidix_play.flags & VID_PLAY_INTERLEAVED_UV) write_frame_YUV420P2(this, frame); @@ -262,9 +262,9 @@ static void write_frame_sfb(vidix_driver_t* this, vidix_frame_t* frame) frame->vo_frame.progressive_frame); break; } - + default: - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_vidix: error. (unknown frame format %04x)\n", frame->format); break; } @@ -276,11 +276,11 @@ static void vidix_clean_output_area(vidix_driver_t *this) { if(this->visual_type == XINE_VISUAL_TYPE_X11) { #ifdef HAVE_X11 int i; - - XLockDisplay(this->display); - + + XLockDisplay(this->display); + XSetForeground(this->display, this->gc, BlackPixel(this->display, this->screen)); - + for( i = 0; i < 4; i++ ) { if( this->sc.border[i].w && this->sc.border[i].h ) { XFillRectangle(this->display, this->drawable, this->gc, @@ -288,15 +288,15 @@ static void vidix_clean_output_area(vidix_driver_t *this) { this->sc.border[i].w, this->sc.border[i].h); } } - + XSetForeground(this->display, this->gc, this->colourkey); XFillRectangle(this->display, this->drawable, this->gc, this->sc.output_xoffset, this->sc.output_yoffset, this->sc.output_width, this->sc.output_height); - + if (this->xoverlay) { x11osd_resize (this->xoverlay, this->sc.gui_width, this->sc.gui_height); this->ovl_changed = 1; } - + XFlush(this->display); XUnlockDisplay(this->display); @@ -326,12 +326,12 @@ static void vidix_update_colourkey(vidix_driver_t *this) { default: break; } - + vidix_clean_output_area(this); - + vdlSetGrKeys(this->vidix_handler, &this->vidix_grkey); } - + static uint32_t vidix_get_capabilities (vo_driver_t *this_gen) { @@ -362,7 +362,7 @@ static void vidix_frame_dispose (vo_frame_t *vo_img) { vidix_frame_t *frame = (vidix_frame_t *) vo_img ; - free_framedata(frame); + free_framedata(frame); free (frame); } @@ -375,7 +375,7 @@ static vo_frame_t *vidix_alloc_frame (vo_driver_t *this_gen) { return NULL; pthread_mutex_init (&frame->vo_frame.mutex, NULL); - + frame->vo_frame.base[0] = NULL; frame->vo_frame.base[1] = NULL; frame->vo_frame.base[2] = NULL; @@ -407,33 +407,33 @@ static void vidix_config_playback (vidix_driver_t *this) { uint32_t apitch; int err,i; - + _x_vo_scale_compute_output_size( &this->sc ); - + /* We require that the displayed xoffset and width are even. * To prevent displaying more than we're supposed to we round the * xoffset up and the width down */ this->sc.displayed_xoffset = (this->sc.displayed_xoffset+1) & ~1; this->sc.displayed_width = this->sc.displayed_width & ~1; - + /* For yv12 source displayed yoffset and height need to be even too */ if(this->delivered_format == XINE_IMGFMT_YV12) { this->sc.displayed_yoffset = (this->sc.displayed_yoffset+1) & ~1; this->sc.displayed_height = this->sc.displayed_height & ~1; } - + if( this->vidix_started > 0 ) { lprintf("video_out_vidix: overlay off\n"); vdlPlaybackOff(this->vidix_handler); } memset(&this->vidix_play,0,sizeof(vidix_playback_t)); - + if(this->delivered_format == XINE_IMGFMT_YV12 && this->supports_yv12) this->vidix_play.fourcc = IMGFMT_YV12; else this->vidix_play.fourcc = IMGFMT_YUY2; - + this->vidix_play.capability = this->vidix_cap.flags; /* every ;) */ this->vidix_play.blend_factor = 0; /* for now */ this->vidix_play.src.x = 0; @@ -449,7 +449,7 @@ static void vidix_config_playback (vidix_driver_t *this) { if((err=vdlConfigPlayback(this->vidix_handler,&this->vidix_play))!=0) { - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_vidix: Can't configure playback: %s\n",strerror(err)); this->vidix_started = -1; return; @@ -458,27 +458,27 @@ static void vidix_config_playback (vidix_driver_t *this) { lprintf("video_out_vidix: dga_addr = %p frame_size = %u frames = %u\n", this->vidix_play.dga_addr, this->vidix_play.frame_size, this->vidix_play.num_frames ); - + lprintf("video_out_vidix: offsets[0..2] = %u %u %u\n", this->vidix_play.offsets[0], this->vidix_play.offsets[1], this->vidix_play.offsets[2] ); - + lprintf("video_out_vidix: offset.y/u/v = %u/%u/%u\n", this->vidix_play.offset.y, this->vidix_play.offset.u, this->vidix_play.offset.v ); - + lprintf("video_out_vidix: src.x/y/w/h = %u/%u/%u/%u\n", this->vidix_play.src.x, this->vidix_play.src.y, this->vidix_play.src.w, this->vidix_play.src.h ); - + lprintf("video_out_vidix: dest.x/y/w/h = %u/%u/%u/%u\n", this->vidix_play.dest.x, this->vidix_play.dest.y, this->vidix_play.dest.w, this->vidix_play.dest.h ); - + lprintf("video_out_vidix: dest.pitch.y/u/v = %u/%u/%u\n", this->vidix_play.dest.pitch.y, this->vidix_play.dest.pitch.u, this->vidix_play.dest.pitch.v ); - + this->vidix_mem = this->vidix_play.dga_addr; this->next_frame = 0; @@ -502,7 +502,7 @@ static void vidix_config_playback (vidix_driver_t *this) { this->dstrides.y = (this->sc.displayed_width*2 + apitch) & ~apitch; break; default: - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_vidix: error. (unknown frame format: %04x)\n", this->delivered_format); } @@ -517,7 +517,7 @@ static void vidix_update_frame_format (vo_driver_t *this_gen, double ratio, int format, int flags) { vidix_driver_t *this = (vidix_driver_t *) this_gen; vidix_frame_t *frame = (vidix_frame_t *) frame_gen; - + if ((frame->width != width) || (frame->height != height) || (frame->format != format)) { @@ -525,9 +525,9 @@ static void vidix_update_frame_format (vo_driver_t *this_gen, /* * (re-) allocate image */ - + free_framedata(frame); - + frame->width = width; frame->height = height; frame->format = format; @@ -548,15 +548,15 @@ static void vidix_update_frame_format (vo_driver_t *this_gen, frame->vo_frame.base[2] = NULL; break; default: - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_vidix: error. (unknown frame format: %04x)\n", format); } - + if((format == XINE_IMGFMT_YV12 && (frame->vo_frame.base[0] == NULL || frame->vo_frame.base[1] == NULL || frame->vo_frame.base[2] == NULL)) || (format == XINE_IMGFMT_YUY2 && frame->vo_frame.base[0] == NULL)) { - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_vidix: error. (framedata allocation failed: out of memory)\n"); - + free_framedata(frame); } } @@ -564,7 +564,7 @@ static void vidix_update_frame_format (vo_driver_t *this_gen, frame->ratio = ratio; } -static void vidix_overlay_begin (vo_driver_t *this_gen, +static void vidix_overlay_begin (vo_driver_t *this_gen, vo_frame_t *frame_gen, int changed) { vidix_driver_t *this = (vidix_driver_t *) this_gen; @@ -573,11 +573,11 @@ static void vidix_overlay_begin (vo_driver_t *this_gen, if( this->ovl_changed && this->xoverlay ) { XLockDisplay (this->display); - x11osd_clear(this->xoverlay); + x11osd_clear(this->xoverlay); XUnlockDisplay (this->display); } #endif - + this->alphablend_extra_data.offset_x = frame_gen->overlay_offset_x; this->alphablend_extra_data.offset_y = frame_gen->overlay_offset_y; } @@ -603,17 +603,17 @@ static void vidix_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, v vidix_frame_t *frame = (vidix_frame_t *) frame_gen; vidix_driver_t *this = (vidix_driver_t *) this_gen; - + if (overlay->rle) { if( overlay->unscaled ) { #ifdef HAVE_X11 if( this->ovl_changed && this->xoverlay ) { XLockDisplay (this->display); - x11osd_blend(this->xoverlay, overlay); + x11osd_blend(this->xoverlay, overlay); XUnlockDisplay (this->display); } #endif - } else { + } else { if( frame->format == XINE_IMGFMT_YV12 ) _x_blend_yuv( frame->vo_frame.base, overlay, frame->width, frame->height, frame->vo_frame.pitches, &this->alphablend_extra_data); else @@ -649,25 +649,25 @@ static void vidix_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { if ( (frame->width != this->sc.delivered_width) || (frame->height != this->sc.delivered_height) - || (frame->ratio != this->sc.delivered_ratio) + || (frame->ratio != this->sc.delivered_ratio) || (frame->format != this->delivered_format ) ) { lprintf("video_out_vidix: change frame format\n"); - + this->sc.delivered_width = frame->width; this->sc.delivered_height = frame->height; this->sc.delivered_ratio = frame->ratio; this->delivered_format = frame->format; - + this->sc.crop_left = frame->vo_frame.crop_left; this->sc.crop_right = frame->vo_frame.crop_right; this->sc.crop_top = frame->vo_frame.crop_top; this->sc.crop_bottom = frame->vo_frame.crop_bottom; - + vidix_compute_ideal_size( this ); this->sc.force_redraw = 1; } - - /* + + /* * check if we have to reconfigure vidix because of * format/window position change */ @@ -692,7 +692,7 @@ static void vidix_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { static int vidix_get_property (vo_driver_t *this_gen, int property) { vidix_driver_t *this = (vidix_driver_t *) this_gen; - + switch (property) { case VO_PROP_WINDOW_WIDTH: this->props[property].value = this->sc.gui_width; @@ -713,7 +713,7 @@ static int vidix_get_property (vo_driver_t *this_gen, int property) { this->props[property].value = this->sc.output_yoffset; break; } - + lprintf ("video_out_vidix: property #%d = %d\n", property, this->props[property].value); @@ -726,91 +726,91 @@ static int vidix_set_property (vo_driver_t *this_gen, vidix_driver_t *this = (vidix_driver_t *) this_gen; int err; - + if ((value >= this->props[property].min) && (value <= this->props[property].max)) { this->props[property].value = value; - + if ( property == VO_PROP_ASPECT_RATIO) { lprintf("video_out_vidix: aspect ratio changed to %s\n", _x_vo_scale_aspect_ratio_name(value)); - + if(value == XINE_VO_ASPECT_NUM_RATIOS) value = this->props[property].value = XINE_VO_ASPECT_AUTO; - this->sc.user_ratio = value; + this->sc.user_ratio = value; vidix_compute_ideal_size (this); this->sc.force_redraw = 1; - } + } if ( property == VO_PROP_ZOOM_X ) { this->sc.zoom_factor_x = (double)value / (double)XINE_VO_ZOOM_STEP; vidix_compute_ideal_size (this); this->sc.force_redraw = 1; - } + } if ( property == VO_PROP_ZOOM_Y ) { this->sc.zoom_factor_y = (double)value / (double)XINE_VO_ZOOM_STEP; vidix_compute_ideal_size (this); this->sc.force_redraw = 1; - } - + } + if ( property == VO_PROP_HUE ) { this->vidix_eq.cap = VEQ_CAP_HUE; this->vidix_eq.hue = value; - + if((err = vdlPlaybackSetEq(this->vidix_handler, &this->vidix_eq)) != 0) xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_vidix: can't set hue: %s\n", strerror(err)); } - + if ( property == VO_PROP_SATURATION ) { this->vidix_eq.cap = VEQ_CAP_SATURATION; this->vidix_eq.saturation = value; - + if((err = vdlPlaybackSetEq(this->vidix_handler, &this->vidix_eq)) != 0) xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_vidix: can't set saturation: %s\n", strerror(err)); } - + if ( property == VO_PROP_BRIGHTNESS ) { this->vidix_eq.cap = VEQ_CAP_BRIGHTNESS; this->vidix_eq.brightness = value; - + if((err = vdlPlaybackSetEq(this->vidix_handler, &this->vidix_eq)) != 0) xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_vidix: can't set brightness: %s\n", strerror(err)); } - + if ( property == VO_PROP_CONTRAST ) { this->vidix_eq.cap = VEQ_CAP_CONTRAST; this->vidix_eq.contrast = value; - + if((err = vdlPlaybackSetEq(this->vidix_handler, &this->vidix_eq)) != 0) xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_vidix: can't set contrast: %s\n", strerror(err)); } } - + return value; } static void vidix_ckey_callback(vo_driver_t *this_gen, xine_cfg_entry_t *entry) { - vidix_driver_t *this = (vidix_driver_t *) this_gen; - + vidix_driver_t *this = (vidix_driver_t *) this_gen; + if(strcmp(entry->key, "video.device.vidix_colour_key_red") == 0) { this->vidix_grkey.ckey.red = entry->num_value; } - + if(strcmp(entry->key, "video.device.vidix_colour_key_green") == 0) { this->vidix_grkey.ckey.green = entry->num_value; } - + if(strcmp(entry->key, "video.device.vidix_colour_key_blue") == 0) { this->vidix_grkey.ckey.blue = entry->num_value; } - + vidix_update_colourkey(this); this->sc.force_redraw = 1; } @@ -818,7 +818,7 @@ static void vidix_ckey_callback(vo_driver_t *this_gen, xine_cfg_entry_t *entry) static void vidix_db_callback(vo_driver_t *this_gen, xine_cfg_entry_t *entry) { - vidix_driver_t *this = (vidix_driver_t *) this_gen; + vidix_driver_t *this = (vidix_driver_t *) this_gen; this->use_doublebuffer = entry->num_value; this->sc.force_redraw = 1; @@ -828,16 +828,16 @@ static void vidix_db_callback(vo_driver_t *this_gen, xine_cfg_entry_t *entry) { static void vidix_rgb_callback(vo_driver_t *this_gen, xine_cfg_entry_t *entry) { int err; vidix_driver_t *this = (vidix_driver_t *) this_gen; - + this->vidix_eq.cap = VEQ_CAP_RGB_INTENSITY; - + if(!strcmp(entry->key, "video.output.vidix_red_intensity")) { this->vidix_eq.red_intensity = entry->num_value; } else if(!strcmp(entry->key, "video.output.vidix_green_intensity")) { this->vidix_eq.green_intensity = entry->num_value; } else if(!strcmp(entry->key, "video.output.vidix_blue_intensity")) { this->vidix_eq.blue_intensity = entry->num_value; - } + } if((err = vdlPlaybackSetEq(this->vidix_handler, &this->vidix_eq))) xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_vidix: can't set rgb intensity: %s\n", strerror(err)); @@ -860,12 +860,12 @@ static int vidix_gui_data_exchange (vo_driver_t *this_gen, vidix_driver_t *this = (vidix_driver_t *) this_gen; pthread_mutex_lock(&this->mutex); - + switch (data_type) { case XINE_GUI_SEND_DRAWABLE_CHANGED: lprintf ("video_out_vidix: GUI_DATA_EX_DRAWABLE_CHANGED\n"); - + if(this->visual_type == XINE_VISUAL_TYPE_X11) { #ifdef HAVE_X11 this->drawable = (Drawable) data; @@ -879,7 +879,7 @@ static int vidix_gui_data_exchange (vo_driver_t *this_gen, #endif } break; - + case XINE_GUI_SEND_EXPOSE_EVENT: lprintf ("video_out_vidix: GUI_DATA_EX_EXPOSE_EVENT\n"); vidix_clean_output_area(this); @@ -908,7 +908,7 @@ static int vidix_gui_data_exchange (vo_driver_t *this_gen, rect->h = y2-y1; } break; - + default: ret = -1; } @@ -916,7 +916,7 @@ static int vidix_gui_data_exchange (vo_driver_t *this_gen, return ret; } - + static void vidix_exit (vo_driver_t *this_gen) { vidix_driver_t *this = (vidix_driver_t *) this_gen; @@ -937,7 +937,7 @@ static void vidix_exit (vo_driver_t *this_gen) { #endif _x_alphablend_free(&this->alphablend_extra_data); - + free (this); } @@ -946,30 +946,30 @@ static vidix_driver_t *open_plugin (video_driver_class_t *class_gen) { config_values_t *config = class->config; vidix_driver_t *this; int err; - + this = (vidix_driver_t *) calloc(1, sizeof(vidix_driver_t)); if (!this) return NULL; _x_alphablend_init(&this->alphablend_extra_data, class->xine); - + pthread_mutex_init (&this->mutex, NULL); this->vidix_handler = class->vidix_handler; this->vidix_cap = class->vidix_cap; _x_vo_scale_init( &this->sc, 1, /*this->vidix_cap.flags & FLAG_UPSCALER,*/ 0, config ); - + this->xine = class->xine; this->config = config; - + this->got_frame_data = 0; this->capabilities = VO_CAP_CROP; /* Find what equalizer flags are supported */ if(this->vidix_cap.flags & FLAG_EQUALIZER) { if((err = vdlPlaybackGetEq(this->vidix_handler, &this->vidix_eq)) != 0) { - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_vidix: couldn't get equalizer capabilities: %s\n", strerror(err)); } else { if(this->vidix_eq.cap & VEQ_CAP_BRIGHTNESS) { @@ -977,48 +977,48 @@ static vidix_driver_t *open_plugin (video_driver_class_t *class_gen) { this->props[VO_PROP_BRIGHTNESS].min = -1000; this->props[VO_PROP_BRIGHTNESS].max = 1000; } - + if(this->vidix_eq.cap & VEQ_CAP_CONTRAST) { this->props[VO_PROP_CONTRAST].value = 0; this->props[VO_PROP_CONTRAST].min = -1000; this->props[VO_PROP_CONTRAST].max = 1000; } - + if(this->vidix_eq.cap & VEQ_CAP_SATURATION) { this->props[VO_PROP_SATURATION].value = 0; this->props[VO_PROP_SATURATION].min = -1000; this->props[VO_PROP_SATURATION].max = 1000; } - + if(this->vidix_eq.cap & VEQ_CAP_HUE) { this->props[VO_PROP_HUE].value = 0; this->props[VO_PROP_HUE].min = -1000; this->props[VO_PROP_HUE].max = 1000; } - + if(this->vidix_eq.cap & VEQ_CAP_RGB_INTENSITY) { this->vidix_eq.red_intensity = config->register_range(config, - "video.output.vidix_red_intensity", 0, -1000, 1000, + "video.output.vidix_red_intensity", 0, -1000, 1000, _("red intensity"), _("The intensity of the red colour components."), 10, - (void*) vidix_rgb_callback, this); + (void*) vidix_rgb_callback, this); this->vidix_eq.green_intensity = config->register_range(config, - "video.output.vidix_green_intensity", 0, -1000, 1000, + "video.output.vidix_green_intensity", 0, -1000, 1000, _("green intensity"), _("The intensity of the green colour components."), 10, (void*) vidix_rgb_callback, this); this->vidix_eq.blue_intensity = config->register_range(config, - "video.output.vidix_blue_intensity", 0, -1000, 1000, + "video.output.vidix_blue_intensity", 0, -1000, 1000, _("blue intensity"), _("The intensity of the blue colour components."), 10, (void*) vidix_rgb_callback, this); - + if((err = vdlPlaybackSetEq(this->vidix_handler, &this->vidix_eq))) - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_vidix: can't set rgb intensity: %s\n", strerror(err)); - } + } } } - + /* Configuration for double buffering */ this->use_doublebuffer = config->register_bool(config, "video.device.vidix_double_buffer", 1, _("enable double buffering"), @@ -1026,20 +1026,20 @@ static vidix_driver_t *open_plugin (video_driver_class_t *class_gen) { "screen (\"vertical retrace\"). This eliminates flickering and tearing artifacts, but will use " "more graphics memory."), 20, (void*) vidix_db_callback, this); - + /* Set up remaining props */ this->props[VO_PROP_ASPECT_RATIO].value = XINE_VO_ASPECT_AUTO; this->props[VO_PROP_ASPECT_RATIO].min = 0; this->props[VO_PROP_ASPECT_RATIO].max = XINE_VO_ASPECT_NUM_RATIOS; - + this->props[VO_PROP_ZOOM_X].value = 100; this->props[VO_PROP_ZOOM_X].min = XINE_VO_ZOOM_MIN; this->props[VO_PROP_ZOOM_X].max = XINE_VO_ZOOM_MAX; - + this->props[VO_PROP_ZOOM_Y].value = 100; this->props[VO_PROP_ZOOM_Y].min = XINE_VO_ZOOM_MIN; this->props[VO_PROP_ZOOM_Y].max = XINE_VO_ZOOM_MAX; - + this->vo_driver.get_capabilities = vidix_get_capabilities; this->vo_driver.alloc_frame = vidix_alloc_frame; this->vo_driver.update_frame_format = vidix_update_frame_format; @@ -1060,23 +1060,23 @@ static vidix_driver_t *open_plugin (video_driver_class_t *class_gen) { static void query_fourccs (vidix_driver_t *this) { vidix_fourcc_t vidix_fourcc; int err; - + /* Detect if YUY2 is supported */ memset(&vidix_fourcc, 0, sizeof(vidix_fourcc_t)); vidix_fourcc.fourcc = IMGFMT_YUY2; vidix_fourcc.depth = this->depth; - + if((err = vdlQueryFourcc(this->vidix_handler, &vidix_fourcc)) == 0) { this->capabilities |= VO_CAP_YUY2; xprintf(this->xine, XINE_VERBOSITY_LOG, _("video_out_vidix: adaptor supports the yuy2 format\n")); } - + /* Detect if YV12 is supported - we always support yv12 but we need to know if we have to convert */ this->capabilities |= VO_CAP_YV12; vidix_fourcc.fourcc = IMGFMT_YV12; - + if((err = vdlQueryFourcc(this->vidix_handler, &vidix_fourcc)) == 0) { this->supports_yv12 = 1; xprintf(this->xine, XINE_VERBOSITY_LOG, @@ -1088,14 +1088,14 @@ static void query_fourccs (vidix_driver_t *this) { static void *init_class (xine_t *xine, void *visual_gen) { vidix_class_t *this; int err; - + this = (vidix_class_t *) calloc(1, sizeof(vidix_class_t)); if (!this) return NULL; - + if(vdlGetVersion() != VIDIX_VERSION) { - xprintf(xine, XINE_VERBOSITY_LOG, + xprintf(xine, XINE_VERBOSITY_LOG, _("video_out_vidix: You have wrong version of VIDIX library\n")); free(this); return NULL; @@ -1110,18 +1110,18 @@ static void *init_class (xine_t *xine, void *visual_gen) { } if((err=vdlGetCapability(this->vidix_handler,&this->vidix_cap)) != 0) { - xprintf(xine, XINE_VERBOSITY_DEBUG, + xprintf(xine, XINE_VERBOSITY_DEBUG, "video_out_vidix: Couldn't get capability: %s\n",strerror(err)); free(this); return NULL; } - xprintf(xine, XINE_VERBOSITY_LOG, + xprintf(xine, XINE_VERBOSITY_LOG, _("video_out_vidix: using driver: %s by %s\n"), this->vidix_cap.name, this->vidix_cap.author); this->xine = xine; this->config = xine->config; - + return this; } @@ -1138,63 +1138,63 @@ static vo_driver_t *vidix_open_plugin (video_driver_class_t *class_gen, const vo vidix_driver_t *this = open_plugin(class_gen); config_values_t *config = this->config; x11_visual_t *visual = (x11_visual_t *) visual_gen; - XWindowAttributes window_attributes; - + XWindowAttributes window_attributes; + this->visual_type = XINE_VISUAL_TYPE_X11; - + this->display = visual->display; this->screen = visual->screen; this->drawable = visual->d; this->gc = XCreateGC(this->display, this->drawable, 0, NULL); this->xoverlay = NULL; this->ovl_changed = 0; - + XGetWindowAttributes(this->display, this->drawable, &window_attributes); this->sc.gui_width = window_attributes.width; this->sc.gui_height = window_attributes.height; this->depth = window_attributes.depth; - + this->sc.frame_output_cb = visual->frame_output_cb; this->sc.user_data = visual->user_data; - - /* We'll assume all drivers support colour keying (which they do + + /* We'll assume all drivers support colour keying (which they do at the moment) */ this->vidix_grkey.ckey.op = CKEY_TRUE; - + /* Colour key components */ this->vidix_grkey.ckey.red = config->register_range(config, - "video.device.vidix_colour_key_red", 255, 0, 255, + "video.device.vidix_colour_key_red", 255, 0, 255, _("video overlay colour key red component"), _("The colour key is used to tell the graphics card where to overlay the video image. " "Try different values, if you experience windows becoming transparent."), 20, - (void*) vidix_ckey_callback, this); - + (void*) vidix_ckey_callback, this); + this->vidix_grkey.ckey.green = config->register_range(config, - "video.device.vidix_colour_key_green", 0, 0, 255, + "video.device.vidix_colour_key_green", 0, 0, 255, _("video overlay colour key green component"), _("The colour key is used to tell the graphics card where to overlay the video image. " "Try different values, if you experience windows becoming transparent."), 20, - (void*) vidix_ckey_callback, this); - + (void*) vidix_ckey_callback, this); + this->vidix_grkey.ckey.blue = config->register_range(config, - "video.device.vidix_colour_key_blue", 255, 0, 255, + "video.device.vidix_colour_key_blue", 255, 0, 255, _("video overlay colour key blue component"), _("The colour key is used to tell the graphics card where to overlay the video image. " "Try different values, if you experience windows becoming transparent."), 20, - (void*) vidix_ckey_callback, this); - + (void*) vidix_ckey_callback, this); + vidix_update_colourkey(this); query_fourccs(this); XLockDisplay (this->display); - if(this->colourkey) { + if(this->colourkey) { this->xoverlay = x11osd_create (this->xine, this->display, this->screen, this->drawable, X11OSD_COLORKEY); if(this->xoverlay) x11osd_colorkey(this->xoverlay, this->colourkey, &this->sc); } else { - this->xoverlay = x11osd_create (this->xine, this->display, this->screen, + this->xoverlay = x11osd_create (this->xine, this->display, this->screen, this->drawable, X11OSD_SHAPED); } XUnlockDisplay (this->display); @@ -1216,14 +1216,14 @@ static char* vidix_get_description (video_driver_class_t *this_gen) { static void *vidix_init_class (xine_t *xine, void *visual_gen) { vidix_class_t *this = init_class (xine, visual_gen); - + if(this) { this->driver_class.open_plugin = vidix_open_plugin; this->driver_class.get_identifier = vidix_get_identifier; this->driver_class.get_description = vidix_get_description; this->driver_class.dispose = dispose_class; } - + return this; } @@ -1240,9 +1240,9 @@ static vo_driver_t *vidixfb_open_plugin (video_driver_class_t *class_gen, const char *device; int fd; struct fb_var_screeninfo fb_var; - + this->visual_type = XINE_VISUAL_TYPE_FB; - + /* Register config option for fb device */ device = config->register_filename(config, "video.device.vidixfb_device", "/dev/fb0", XINE_CONFIG_STRING_IS_DEVICE_NAME, _("framebuffer device name"), @@ -1251,45 +1251,45 @@ static vo_driver_t *vidixfb_open_plugin (video_driver_class_t *class_gen, const "can be used to fill this file with arbitrary content. So you should be careful that " "the value you enter really is a proper framebuffer device."), XINE_CONFIG_SECURITY, NULL, NULL); - + /* Open fb device for reading */ if((fd = open("/dev/fb0", O_RDONLY)) < 0) { - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_vidix: unable to open frame buffer device \"%s\": %s\n", device, strerror(errno)); return NULL; } - + /* Read screen info */ if(ioctl(fd, FBIOGET_VSCREENINFO, &fb_var) != 0) { - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_vidix: error in ioctl FBIOGET_VSCREENINFO: %s", strerror(errno)); close(fd); return NULL; } - + /* Store screen bpp and dimensions */ this->depth = fb_var.bits_per_pixel; this->fb_width = fb_var.xres; this->fb_height = fb_var.yres; - + /* Close device */ close(fd); - + this->sc.frame_output_cb = vidixfb_frame_output_cb; this->sc.user_data = this; - + /* Make sure colour keying is turned off */ this->vidix_grkey.ckey.op = CKEY_FALSE; vdlSetGrKeys(this->vidix_handler, &this->vidix_grkey); - + query_fourccs(this); - + return &this->vo_driver; } static char* vidixfb_get_identifier (video_driver_class_t *this_gen) { return "vidixfb"; -} +} static char* vidixfb_get_description (video_driver_class_t *this_gen) { return _("xine video output plugin using libvidix for linux frame buffer"); @@ -1298,14 +1298,14 @@ static char* vidixfb_get_description (video_driver_class_t *this_gen) { static void *vidixfb_init_class (xine_t *xine, void *visual_gen) { vidix_class_t *this = init_class (xine, visual_gen); - + if(this) { this->driver_class.open_plugin = vidixfb_open_plugin; this->driver_class.get_identifier = vidixfb_get_identifier; this->driver_class.get_description = vidixfb_get_description; this->driver_class.dispose = dispose_class; } - + return this; } @@ -1320,7 +1320,7 @@ static const vo_info_t vo_info_vidixfb = { */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ #ifdef HAVE_X11 { PLUGIN_VIDEO_OUT, 21, "vidix", XINE_VERSION_CODE, &vo_info_vidix, vidix_init_class }, #endif diff --git a/src/video_out/video_out_xcbshm.c b/src/video_out/video_out_xcbshm.c index a5282a24f..c93cf8c1e 100644 --- a/src/video_out/video_out_xcbshm.c +++ b/src/video_out/video_out_xcbshm.c @@ -1,13 +1,13 @@ /* * Copyright (C) 2000-2003, 2007 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 @@ -23,7 +23,7 @@ * Aaron Holtzman <aholtzma@ess.engr.uvic.ca> * * xine-specific code by Guenter Bartsch <bartscgr@studbox.uni-stuttgart.de> - * + * * ported to xcb by Christoph Pfister - Feb 2007 */ @@ -71,7 +71,7 @@ typedef struct { int flags; vo_scale_t sc; - + uint8_t *image; int bytes_per_line; xcb_shm_seg_t shmseg; @@ -96,7 +96,7 @@ typedef struct { int bpp; int scanline_pad; int use_shm; - + int yuv2rgb_brightness; int yuv2rgb_contrast; int yuv2rgb_saturation; @@ -104,7 +104,7 @@ typedef struct { yuv2rgb_factory_t *yuv2rgb_factory; vo_scale_t sc; - + xshm_frame_t *cur_frame; xcbosd *xoverlay; int ovl_changed; @@ -126,7 +126,7 @@ typedef struct { /* - * allocate an XImage, try XShm first but fall back to + * allocate an XImage, try XShm first but fall back to * plain X11 if XShm should fail */ static void create_ximage(xshm_driver_t *this, xshm_frame_t *frame, int width, int height) @@ -151,9 +151,9 @@ static void create_ximage(xshm_driver_t *this, xshm_frame_t *frame, int width, i "video_out_xcbshm: => not using MIT Shared Memory extension.\n"), strerror(errno)); goto shm_fail1; } - + frame->image = shmat(shmid, 0, 0); - + if (frame->image == ((void *) -1)) { xprintf(this->xine, XINE_VERBOSITY_LOG, _("video_out_xcbshm: shared memory error (address error) when allocating image \n" @@ -173,10 +173,10 @@ static void create_ximage(xshm_driver_t *this, xshm_frame_t *frame, int width, i goto shm_fail3; } - /* + /* * Now that the Xserver has learned about and attached to the * shared memory segment, delete it. It's actually deleted by - * the kernel when all users of that segment have detached from + * the kernel when all users of that segment have detached from * it. Gives an automatic shared memory cleanup in case we crash. */ @@ -229,10 +229,10 @@ static uint32_t xshm_get_capabilities (vo_driver_t *this_gen) { static void xshm_frame_proc_slice (vo_frame_t *vo_img, uint8_t **src) { xshm_frame_t *frame = (xshm_frame_t *) vo_img ; /*xshm_driver_t *this = (xshm_driver_t *) vo_img->driver; */ - - vo_img->proc_called = 1; - - if( frame->vo_frame.crop_left || frame->vo_frame.crop_top || + + vo_img->proc_called = 1; + + if( frame->vo_frame.crop_left || frame->vo_frame.crop_top || frame->vo_frame.crop_right || frame->vo_frame.crop_bottom ) { /* we don't support crop, so don't even waste cpu cycles. @@ -240,7 +240,7 @@ static void xshm_frame_proc_slice (vo_frame_t *vo_img, uint8_t **src) { */ return; } - + lprintf ("copy... (format %d)\n", frame->format); if (frame->format == XINE_IMGFMT_YV12) @@ -249,7 +249,7 @@ static void xshm_frame_proc_slice (vo_frame_t *vo_img, uint8_t **src) { else frame->yuv2rgb->yuy22rgb_fun (frame->yuv2rgb, frame->rgb_dst, src[0]); - + lprintf ("copy...done\n"); } @@ -306,10 +306,10 @@ static vo_frame_t *xshm_alloc_frame (vo_driver_t *this_gen) { /* * supply required functions/fields */ - + frame->vo_frame.proc_slice = xshm_frame_proc_slice; frame->vo_frame.proc_frame = NULL; - frame->vo_frame.field = xshm_frame_field; + frame->vo_frame.field = xshm_frame_field; frame->vo_frame.dispose = xshm_frame_dispose; frame->vo_frame.driver = this_gen; @@ -369,7 +369,7 @@ static void xshm_update_frame_format (vo_driver_t *this_gen, frame->sc.video_pixel_aspect, &gui_width, &gui_height, &gui_pixel_aspect); - + /* find out if we need to adapt this frame */ do_adapt = 0; @@ -394,7 +394,7 @@ static void xshm_update_frame_format (vo_driver_t *this_gen, frame->sc.user_ratio = this->sc.user_ratio; xshm_compute_ideal_size (this, frame); - + /* now we have updated video_aspect_pixel we use the callback */ /* again to obtain the correct gui_width and gui_height values. */ frame->sc.dest_size_cb (frame->sc.user_data, width, height, @@ -402,20 +402,20 @@ static void xshm_update_frame_format (vo_driver_t *this_gen, &gui_width, &gui_height, &gui_pixel_aspect); } - + if ((frame->sc.gui_width != gui_width) || (frame->sc.gui_height != gui_height) || do_adapt) { - + do_adapt = 1; frame->sc.gui_width = gui_width; frame->sc.gui_height = gui_height; - + xshm_compute_rgb_size (this, frame); - + lprintf ("gui_size has changed => adapt\n"); } - + /* ok, now do what we have to do */ @@ -469,7 +469,7 @@ static void xshm_update_frame_format (vo_driver_t *this_gen, lprintf ("stripe out_ht=%i, deliv_ht=%i\n", frame->sc.output_height, frame->sc.delivered_height); - /* + /* * set up colorspace converter */ @@ -525,7 +525,7 @@ static void xshm_overlay_clut_yuv2rgb(xshm_driver_t *this, vo_overlay_t *overla } } -static void xshm_overlay_begin (vo_driver_t *this_gen, +static void xshm_overlay_begin (vo_driver_t *this_gen, vo_frame_t *frame_gen, int changed) { xshm_driver_t *this = (xshm_driver_t *) this_gen; @@ -536,7 +536,7 @@ static void xshm_overlay_begin (vo_driver_t *this_gen, xcbosd_clear(this->xoverlay); pthread_mutex_unlock(&this->main_mutex); } - + this->alphablend_extra_data.offset_x = frame_gen->overlay_offset_x; this->alphablend_extra_data.offset_y = frame_gen->overlay_offset_y; } @@ -553,7 +553,7 @@ static void xshm_overlay_end (vo_driver_t *this_gen, vo_frame_t *vo_img) { this->ovl_changed = 0; } -static void xshm_overlay_blend (vo_driver_t *this_gen, +static void xshm_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) { xshm_driver_t *this = (xshm_driver_t *) this_gen; xshm_frame_t *frame = (xshm_frame_t *) frame_gen; @@ -569,7 +569,7 @@ static void xshm_overlay_blend (vo_driver_t *this_gen, } else { if (!overlay->rgb_clut || !overlay->hili_rgb_clut) xshm_overlay_clut_yuv2rgb (this, overlay, frame); - + switch (this->bpp) { case 16: _x_blend_rgb16(frame->image, overlay, @@ -590,7 +590,7 @@ static void xshm_overlay_blend (vo_driver_t *this_gen, &this->alphablend_extra_data); break; default: - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "xine-lib:video_out_xcbshm:xshm_overlay_blend: Cannot blend bpp:%i\n", this->bpp); /* it should never get here, unless a user tries to play in bpp:8 */ break; @@ -603,11 +603,11 @@ static void clean_output_area (xshm_driver_t *this, xshm_frame_t *frame) { int i; xcb_rectangle_t rects[4]; int rects_count = 0; - + memcpy( this->sc.border, frame->sc.border, sizeof(this->sc.border) ); - + pthread_mutex_lock(&this->main_mutex); - + for( i = 0; i < 4; i++ ) { if( this->sc.border[i].w && this->sc.border[i].h ) rects[rects_count].x = this->sc.border[i].x; @@ -624,7 +624,7 @@ static void clean_output_area (xshm_driver_t *this, xshm_frame_t *frame) { xcbosd_resize(this->xoverlay, this->sc.gui_width, this->sc.gui_height); this->ovl_changed = 1; } - + pthread_mutex_unlock(&this->main_mutex); } @@ -636,15 +636,15 @@ static int xshm_redraw_needed (vo_driver_t *this_gen) { this->sc.delivered_height = this->cur_frame->sc.delivered_height; this->sc.delivered_width = this->cur_frame->sc.delivered_width; this->sc.video_pixel_aspect = this->cur_frame->sc.video_pixel_aspect; - if( _x_vo_scale_redraw_needed( &this->sc ) ) { + if( _x_vo_scale_redraw_needed( &this->sc ) ) { clean_output_area (this, this->cur_frame); ret = 1; } - } + } else ret = 1; - + return ret; } @@ -657,22 +657,22 @@ static void xshm_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { frame->vo_frame.id, frame->sc.output_width, frame->sc.output_height); - /* + /* * tell gui that we are about to display a frame, * ask for offset */ - + this->sc.delivered_height = frame->sc.delivered_height; this->sc.delivered_width = frame->sc.delivered_width; this->sc.video_pixel_aspect = frame->sc.video_pixel_aspect; - if( _x_vo_scale_redraw_needed( &this->sc ) ) { + if( _x_vo_scale_redraw_needed( &this->sc ) ) { clean_output_area (this, frame); } - + if (this->cur_frame) { - if ( (this->cur_frame->sc.output_width != frame->sc.output_width) + if ( (this->cur_frame->sc.output_width != frame->sc.output_width) || (this->cur_frame->sc.output_height != frame->sc.output_height) || (this->cur_frame->sc.output_xoffset != frame->sc.output_xoffset) || (this->cur_frame->sc.output_yoffset != frame->sc.output_yoffset) ) @@ -682,10 +682,10 @@ static void xshm_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { } this->cur_frame = frame; - + pthread_mutex_lock(&this->main_mutex); lprintf ("display locked...\n"); - + if (frame->shmseg) { lprintf ("put image (shm)\n"); @@ -736,14 +736,14 @@ static int xshm_get_property (vo_driver_t *this_gen, int property) { case VO_PROP_OUTPUT_YOFFSET: return this->cur_frame->sc.output_yoffset; default: - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_xcbshm: tried to get unsupported property %d\n", property); } return 0; } -static int xshm_set_property (vo_driver_t *this_gen, +static int xshm_set_property (vo_driver_t *this_gen, int property, int value) { xshm_driver_t *this = (xshm_driver_t *) this_gen; @@ -752,7 +752,7 @@ static int xshm_set_property (vo_driver_t *this_gen, if (value>=XINE_VO_ASPECT_NUM_RATIOS) value = XINE_VO_ASPECT_AUTO; this->sc.user_ratio = value; - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_xcbshm: aspect ratio changed to %s\n", _x_vo_scale_aspect_ratio_name(value)); } else if (property == VO_PROP_BRIGHTNESS) { @@ -786,7 +786,7 @@ static int xshm_set_property (vo_driver_t *this_gen, this->sc.force_redraw = 1; } else { - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_xcbshm: tried to set unsupported property %d\n", property); } @@ -812,7 +812,7 @@ static void xshm_get_property_min_max (vo_driver_t *this_gen, } } -static int xshm_gui_data_exchange (vo_driver_t *this_gen, +static int xshm_gui_data_exchange (vo_driver_t *this_gen, int data_type, void *data) { xshm_driver_t *this = (xshm_driver_t *) this_gen; @@ -823,17 +823,17 @@ static int xshm_gui_data_exchange (vo_driver_t *this_gen, #endif case XINE_GUI_SEND_EXPOSE_EVENT: - + lprintf ("expose event\n"); if (this->cur_frame) { xcb_expose_event_t *xev = (xcb_expose_event_t *) data; - + if (xev && xev->count == 0) { int i; xcb_rectangle_t rects[4]; int rects_count = 0; - + pthread_mutex_lock(&this->main_mutex); if (this->cur_frame->shmseg) xcb_shm_put_image(this->connection, this->window, this->gc, this->cur_frame->sc.output_width, @@ -868,7 +868,7 @@ static int xshm_gui_data_exchange (vo_driver_t *this_gen, } } break; - + case XINE_GUI_SEND_DRAWABLE_CHANGED: this->window = (xcb_window_t) data; @@ -887,7 +887,7 @@ static int xshm_gui_data_exchange (vo_driver_t *this_gen, if (this->cur_frame) { x11_rectangle_t *rect = data; int x1, y1, x2, y2; - + _x_vo_scale_translate_gui2video(&this->cur_frame->sc, rect->x, rect->y, &x1, &y1); @@ -910,16 +910,16 @@ static int xshm_gui_data_exchange (vo_driver_t *this_gen, static void xshm_dispose (vo_driver_t *this_gen) { xshm_driver_t *this = (xshm_driver_t *) this_gen; - + if (this->cur_frame) this->cur_frame->vo_frame.dispose (&this->cur_frame->vo_frame); this->yuv2rgb_factory->dispose (this->yuv2rgb_factory); - + pthread_mutex_lock(&this->main_mutex); xcb_free_gc(this->connection, this->gc); pthread_mutex_unlock(&this->main_mutex); - + if( this->xoverlay ) { pthread_mutex_lock(&this->main_mutex); xcbosd_destroy(this->xoverlay); @@ -929,7 +929,7 @@ static void xshm_dispose (vo_driver_t *this_gen) { pthread_mutex_destroy(&this->main_mutex); _x_alphablend_free(&this->alphablend_extra_data); - + free (this); } @@ -1014,7 +1014,7 @@ static vo_driver_t *xshm_open_plugin(video_driver_class_t *class_gen, const void xcb_get_geometry_reply_t *geometry_reply; const xcb_query_extension_reply_t *query_extension_reply; - + this = (xshm_driver_t *) calloc(1, sizeof(xshm_driver_t)); if (!this) @@ -1023,7 +1023,7 @@ static vo_driver_t *xshm_open_plugin(video_driver_class_t *class_gen, const void pthread_mutex_init(&this->main_mutex, NULL); _x_alphablend_init(&this->alphablend_extra_data, class->xine); - + this->connection = visual->connection; this->screen = visual->screen; this->window = visual->window; @@ -1032,15 +1032,15 @@ static vo_driver_t *xshm_open_plugin(video_driver_class_t *class_gen, const void this->sc.frame_output_cb = visual->frame_output_cb; this->sc.dest_size_cb = visual->dest_size_cb; this->sc.user_data = visual->user_data; - + this->sc.user_ratio = XINE_VO_ASPECT_AUTO; - + this->cur_frame = NULL; this->gc = xcb_generate_id(this->connection); xcb_create_gc(this->connection, this->gc, this->window, XCB_GC_FOREGROUND, &this->screen->black_pixel); this->xoverlay = NULL; this->ovl_changed = 0; - + this->xine = class->xine; this->vo_driver.get_capabilities = xshm_get_capabilities; @@ -1108,7 +1108,7 @@ static vo_driver_t *xshm_open_plugin(video_driver_class_t *class_gen, const void query_extension_reply = xcb_get_extension_data(this->connection, &xcb_shm_id); if (query_extension_reply && query_extension_reply->present) { this->use_shm = 1; - } + } else { xprintf(this->xine, XINE_VERBOSITY_LOG, _("video_out_xcbshm: MIT shared memory extension not present on display.\n")); @@ -1147,7 +1147,7 @@ static vo_driver_t *xshm_open_plugin(video_driver_class_t *class_gen, const void */ cpu_byte_order = htonl(1) == 1 ? XCB_IMAGE_ORDER_MSB_FIRST : XCB_IMAGE_ORDER_LSB_FIRST; swapped = cpu_byte_order != image_byte_order; - + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_xcbshm: video mode depth is %d (%d bpp), %s, %sswapped,\n" "\tred: %08x, green: %08x, blue: %08x\n", @@ -1209,16 +1209,16 @@ static vo_driver_t *xshm_open_plugin(video_driver_class_t *class_gen, const void } if (!mode) { - xprintf (this->xine, XINE_VERBOSITY_LOG, + xprintf (this->xine, XINE_VERBOSITY_LOG, _("video_out_xcbshm: your video mode was not recognized, sorry :-(\n")); return NULL; } - + this->yuv2rgb_brightness = 0; this->yuv2rgb_contrast = 128; this->yuv2rgb_saturation = 128; - - this->yuv2rgb_factory = yuv2rgb_factory_init (mode, swapped, + + this->yuv2rgb_factory = yuv2rgb_factory_init (mode, swapped, this->yuv2rgb_cmap); this->yuv2rgb_factory->set_csc_levels (this->yuv2rgb_factory, this->yuv2rgb_brightness, @@ -1274,7 +1274,7 @@ static const vo_info_t vo_info_xshm = { */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_VIDEO_OUT, 21, "xshm", XINE_VERSION_CODE, &vo_info_xshm, xshm_init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/video_out/video_out_xcbxv.c b/src/video_out/video_out_xcbxv.c index 1e6e2b663..b3a141e61 100644 --- a/src/video_out/video_out_xcbxv.c +++ b/src/video_out/video_out_xcbxv.c @@ -196,7 +196,7 @@ static vo_frame_t *xv_alloc_frame (vo_driver_t *this_gen) { frame = (xv_frame_t *) calloc(1, sizeof(xv_frame_t)); if (!frame) return NULL; - + pthread_mutex_init (&frame->vo_frame.mutex, NULL); /* @@ -380,7 +380,7 @@ static void xv_update_frame_format (vo_driver_t *this_gen, if(format == XINE_IMGFMT_YUY2) { frame->vo_frame.pitches[0] = frame->xv_pitches[0]; frame->vo_frame.base[0] = frame->image + frame->xv_offsets[0]; - } + } else { frame->vo_frame.pitches[0] = frame->xv_pitches[0]; frame->vo_frame.pitches[1] = frame->xv_pitches[2]; @@ -418,7 +418,7 @@ static void xv_deinterlace_frame (xv_driver_t *this) { if(this->deinterlace_frame.image) dispose_ximage(this, &this->deinterlace_frame); - + create_ximage(this, &this->deinterlace_frame, frame->width, frame->height / xvscaling, frame->format); this->deinterlace_frame.width = frame->width; this->deinterlace_frame.height = frame->height; @@ -539,12 +539,12 @@ static void xv_clean_output_area (xv_driver_t *this) { this->sc.output_width, this->sc.output_height }; xcb_poly_fill_rectangle(this->connection, this->window, this->gc, 1, &rectangle); } - + if (this->xoverlay) { xcbosd_resize(this->xoverlay, this->sc.gui_width, this->sc.gui_height); this->ovl_changed = 1; } - + pthread_mutex_unlock(&this->main_mutex); } @@ -575,7 +575,7 @@ static void xv_compute_output_size (xv_driver_t *this) { } } -static void xv_overlay_begin (vo_driver_t *this_gen, +static void xv_overlay_begin (vo_driver_t *this_gen, vo_frame_t *frame_gen, int changed) { xv_driver_t *this = (xv_driver_t *) this_gen; @@ -586,7 +586,7 @@ static void xv_overlay_begin (vo_driver_t *this_gen, xcbosd_clear(this->xoverlay); pthread_mutex_unlock(&this->main_mutex); } - + this->alphablend_extra_data.offset_x = frame_gen->overlay_offset_x; this->alphablend_extra_data.offset_y = frame_gen->overlay_offset_y; } @@ -603,7 +603,7 @@ static void xv_overlay_end (vo_driver_t *this_gen, vo_frame_t *vo_img) { this->ovl_changed = 0; } -static void xv_overlay_blend (vo_driver_t *this_gen, +static void xv_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) { xv_driver_t *this = (xv_driver_t *) this_gen; xv_frame_t *frame = (xv_frame_t *) frame_gen; @@ -617,11 +617,11 @@ static void xv_overlay_blend (vo_driver_t *this_gen, } } else { if (frame->format == XINE_IMGFMT_YV12) - _x_blend_yuv(frame->vo_frame.base, overlay, + _x_blend_yuv(frame->vo_frame.base, overlay, frame->width, frame->height, frame->vo_frame.pitches, &this->alphablend_extra_data); else - _x_blend_yuy2(frame->vo_frame.base[0], overlay, + _x_blend_yuy2(frame->vo_frame.base[0], overlay, frame->width, frame->height, frame->vo_frame.pitches[0], &this->alphablend_extra_data); } @@ -665,7 +665,7 @@ static int xv_redraw_needed (vo_driver_t *this_gen) { this->sc.delivered_height = this->cur_frame->height; this->sc.delivered_width = this->cur_frame->width; this->sc.delivered_ratio = this->cur_frame->ratio; - + this->sc.crop_left = this->cur_frame->vo_frame.crop_left; this->sc.crop_right = this->cur_frame->vo_frame.crop_right; this->sc.crop_top = this->cur_frame->vo_frame.crop_top; @@ -694,7 +694,7 @@ static void xv_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { /* printf ("video_out_xcbxv: xv_display_frame...\n"); */ - + /* * queue frames (deinterlacing) * free old frames @@ -795,7 +795,7 @@ static int xv_get_property (vo_driver_t *this_gen, int property) { static void xv_property_callback (void *property_gen, xine_cfg_entry_t *entry) { xv_property_t *property = (xv_property_t *) property_gen; xv_driver_t *this = property->this; - + pthread_mutex_lock(&this->main_mutex); xcb_xv_set_port_attribute(this->connection, this->xv_port, property->atom, entry->num_value); @@ -829,7 +829,7 @@ static int xv_set_property (vo_driver_t *this_gen, this->props[property].entry->num_value = this->props[property].value; return this->props[property].value; - } + } else { switch (property) { @@ -843,13 +843,13 @@ static int xv_set_property (vo_driver_t *this_gen, xv_compute_output_size (this); } break; - + case VO_PROP_ASPECT_RATIO: if (value>=XINE_VO_ASPECT_NUM_RATIOS) value = XINE_VO_ASPECT_AUTO; this->props[property].value = value; - xprintf(this->xine, XINE_VERBOSITY_LOG, + xprintf(this->xine, XINE_VERBOSITY_LOG, "video_out_xcbxv: VO_PROP_ASPECT_RATIO(%d)\n", this->props[property].value); this->sc.user_ratio = value; @@ -863,7 +863,7 @@ static int xv_set_property (vo_driver_t *this_gen, this->props[property].value = value; xprintf(this->xine, XINE_VERBOSITY_LOG, "video_out_xcbxv: VO_PROP_ZOOM_X = %d\n", this->props[property].value); - + this->sc.zoom_factor_x = (double)value / (double)XINE_VO_ZOOM_STEP; xv_compute_ideal_size (this); @@ -955,7 +955,7 @@ static int xv_gui_data_exchange (vo_driver_t *this_gen, if(this->xoverlay) xcbosd_expose(this->xoverlay); - + xcb_flush(this->connection); pthread_mutex_unlock(&this->main_mutex); } @@ -1013,7 +1013,7 @@ static void xv_store_port_attribute(xv_driver_t *this, char *name) { xcb_xv_get_port_attribute_cookie_t get_attribute_cookie; xcb_xv_get_port_attribute_reply_t *get_attribute_reply; - + pthread_mutex_lock(&this->main_mutex); atom_cookie = xcb_intern_atom(this->connection, 0, strlen(name), name); atom_reply = xcb_intern_atom_reply(this->connection, atom_cookie, NULL); @@ -1021,7 +1021,7 @@ static void xv_store_port_attribute(xv_driver_t *this, char *name) { get_attribute_reply = xcb_xv_get_port_attribute_reply(this->connection, get_attribute_cookie, NULL); free(atom_reply); pthread_mutex_unlock(&this->main_mutex); - + if (get_attribute_reply != NULL) { xv_portattribute_t *attr; @@ -1039,26 +1039,26 @@ static void xv_restore_port_attributes(xv_driver_t *this) { xcb_intern_atom_cookie_t atom_cookie; xcb_intern_atom_reply_t *atom_reply; - + while ((ite = xine_list_front(this->port_attributes)) != NULL) { xv_portattribute_t *attr = xine_list_get_value(this->port_attributes, ite); xine_list_remove (this->port_attributes, ite); - + pthread_mutex_lock(&this->main_mutex); atom_cookie = xcb_intern_atom(this->connection, 0, strlen(attr->name), attr->name); atom_reply = xcb_intern_atom_reply(this->connection, atom_cookie, NULL); xcb_xv_set_port_attribute(this->connection, this->xv_port, atom_reply->atom, attr->value); free(atom_reply); pthread_mutex_unlock(&this->main_mutex); - + free( attr->name ); free( attr ); } - + pthread_mutex_lock(&this->main_mutex); xcb_flush(this->connection); pthread_mutex_unlock(&this->main_mutex); - + xine_list_delete( this->port_attributes ); } @@ -1068,7 +1068,7 @@ static void xv_dispose (vo_driver_t *this_gen) { /* restore port attributes to their initial values */ xv_restore_port_attributes(this); - + if (this->deinterlace_frame.image) { pthread_mutex_lock(&this->main_mutex); dispose_ximage(this, &this->deinterlace_frame); @@ -1096,7 +1096,7 @@ static void xv_dispose (vo_driver_t *this_gen) { pthread_mutex_destroy(&this->main_mutex); _x_alphablend_free(&this->alphablend_extra_data); - + free (this); } @@ -1111,7 +1111,7 @@ static int xv_check_yv12(xcb_connection_t *connection, xcb_xv_port_t port) { if (!list_formats_reply) return 1; /* no formats listed; probably due to an invalid port no. */ format_it = xcb_xv_list_image_formats_format_iterator(list_formats_reply); - + for (; format_it.rem; xcb_xv_image_format_info_next(&format_it)) if ((format_it.data->id == XINE_IMGFMT_YV12) && (! (strcmp ((char *) format_it.data->guid, "YV12")))) { @@ -1138,7 +1138,7 @@ static void xv_check_capability (xv_driver_t *this, xcb_intern_atom_cookie_t atom_cookie; xcb_intern_atom_reply_t *atom_reply; - + /* * some Xv drivers (Gatos ATI) report some ~0 as max values, this is confusing. */ @@ -1168,7 +1168,7 @@ static void xv_check_capability (xv_driver_t *this, /* might be overridden using config entry */ if(strcmp(str_prop, "XV_AUTOPAINT_COLORKEY") == 0) int_default = 0; - + if (config_name) { /* is this a boolean property ? */ if ((attr->min == 0) && (attr->max == 1)) { @@ -1185,12 +1185,12 @@ static void xv_check_capability (xv_driver_t *this, entry = this->config->lookup_entry (this->config, config_name); - if((entry->num_value < this->props[property].min) || + if((entry->num_value < this->props[property].min) || (entry->num_value > this->props[property].max)) { - this->config->update_num(this->config, config_name, + this->config->update_num(this->config, config_name, ((this->props[property].min + this->props[property].max) >> 1)); - + entry = this->config->lookup_entry (this->config, config_name); } @@ -1339,7 +1339,7 @@ static vo_driver_t *open_plugin(video_driver_class_t *class_gen, const void *vis pthread_mutex_init(&this->main_mutex, NULL); _x_alphablend_init(&this->alphablend_extra_data, class->xine); - + this->connection = visual->connection; this->screen = visual->screen; this->window = visual->window; @@ -1404,16 +1404,16 @@ static vo_driver_t *open_plugin(video_driver_class_t *class_gen, const void *vis xprintf(class->xine, XINE_VERBOSITY_LOG, _("video_out_xcbxv: Xv extension is present but I couldn't find a usable yuv12 port.\n" " Looks like your graphics hardware driver doesn't support Xv?!\n")); - + /* XvFreeAdaptorInfo (adaptor_info); this crashed on me (gb)*/ return NULL; - } + } else xprintf(class->xine, XINE_VERBOSITY_LOG, _("video_out_xcbxv: using Xv port %d from adaptor %s for hardware " "colour space conversion and scaling.\n"), xv_port, xcb_xv_adaptor_info_name(adaptor_it.data)); - + this->xv_port = xv_port; _x_vo_scale_init (&this->sc, 1, 0, config ); @@ -1526,10 +1526,10 @@ static vo_driver_t *open_plugin(video_driver_class_t *class_gen, const void *vis VIDEO_DEVICE_XV_DOUBLE_BUFFER_HELP, 20, xv_update_XV_DOUBLE_BUFFER, this); config->update_num(config,"video.device.xv_double_buffer",xv_double_buffer); - } else if(!strcmp(name, sync_atoms[this->sync_is_vsync = 0]) || - !strcmp(name, sync_atoms[this->sync_is_vsync = 1])) { + } else if(!strcmp(name, sync_atoms[this->sync_is_vsync = 0]) || + !strcmp(name, sync_atoms[this->sync_is_vsync = 1])) { int xv_sync_to_vblank; - xv_sync_to_vblank = + xv_sync_to_vblank = config->register_bool (config, "video.device.xv_sync_to_vblank", 1, _("enable vblank sync"), _("This option will synchronize the update of the video image to the " @@ -1562,10 +1562,10 @@ static vo_driver_t *open_plugin(video_driver_class_t *class_gen, const void *vis list_formats_reply = xcb_xv_list_image_formats_reply(this->connection, list_formats_cookie, NULL); format_it = xcb_xv_list_image_formats_format_iterator(list_formats_reply); - + this->xv_format_yv12 = 0; this->xv_format_yuy2 = 0; - + for (; format_it.rem; xcb_xv_image_format_info_next(&format_it)) { lprintf ("Xv image format: 0x%x (%4.4s) %s\n", format_it.data->id, (char*)&format_it.data->id, @@ -1580,19 +1580,19 @@ static vo_driver_t *open_plugin(video_driver_class_t *class_gen, const void *vis } else if (format_it.data->id == XINE_IMGFMT_YUY2) { this->xv_format_yuy2 = format_it.data->id; this->capabilities |= VO_CAP_YUY2; - xprintf(this->xine, XINE_VERBOSITY_LOG, + xprintf(this->xine, XINE_VERBOSITY_LOG, _("video_out_xcbxv: this adaptor supports the yuy2 format.\n")); } } free(list_formats_reply); - this->use_pitch_alignment = + this->use_pitch_alignment = config->register_bool (config, "video.device.xv_pitch_alignment", 0, VIDEO_DEVICE_XV_PITCH_ALIGNMENT_HELP, 10, xv_update_xv_pitch_alignment, this); - this->deinterlace_method = + this->deinterlace_method = config->register_enum (config, "video.output.xv_deinterlace_method", 4, deinterlace_methods, _("deinterlace method (deprecated)"), @@ -1655,7 +1655,7 @@ static char* get_description (video_driver_class_t *this_gen) { static void dispose_class (video_driver_class_t *this_gen) { xv_class_t *this = (xv_class_t *) this_gen; - + free (this); } diff --git a/src/video_out/video_out_xshm.c b/src/video_out/video_out_xshm.c index 74791f145..3d4dae3f9 100644 --- a/src/video_out/video_out_xshm.c +++ b/src/video_out/video_out_xshm.c @@ -1,13 +1,13 @@ /* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 @@ -76,7 +76,7 @@ typedef struct { int flags; vo_scale_t sc; - + XImage *image; XShmSegmentInfo shminfo; @@ -100,7 +100,7 @@ typedef struct { int depth, bpp, bytes_per_pixel, image_byte_order; int use_shm; XColor black; - + int yuv2rgb_brightness; int yuv2rgb_contrast; int yuv2rgb_saturation; @@ -108,7 +108,7 @@ typedef struct { yuv2rgb_factory_t *yuv2rgb_factory; vo_scale_t sc; - + xshm_frame_t *cur_frame; x11osd *xoverlay; int ovl_changed; @@ -164,11 +164,11 @@ static void x11_DeInstallXErrorHandler (xshm_driver_t *this) { } /* - * allocate an XImage, try XShm first but fall back to + * allocate an XImage, try XShm first but fall back to * plain X11 if XShm should fail */ /* called xlocked */ -static XImage *create_ximage (xshm_driver_t *this, XShmSegmentInfo *shminfo, +static XImage *create_ximage (xshm_driver_t *this, XShmSegmentInfo *shminfo, int width, int height) { XImage *myimage = NULL; @@ -177,16 +177,16 @@ static XImage *create_ximage (xshm_driver_t *this, XShmSegmentInfo *shminfo, /* * try shm */ - + gX11Fail = 0; x11_InstallXErrorHandler (this); - myimage = XShmCreateImage(this->display, + myimage = XShmCreateImage(this->display, this->visual, this->depth, ZPixmap, NULL, shminfo, - width, + width, height); if (myimage == NULL ) { @@ -196,15 +196,15 @@ static XImage *create_ximage (xshm_driver_t *this, XShmSegmentInfo *shminfo, this->use_shm = 0; goto finishShmTesting; } - + this->bpp = myimage->bits_per_pixel; this->bytes_per_pixel = this->bpp / 8; this->image_byte_order = myimage->byte_order; - + shminfo->shmid=shmget(IPC_PRIVATE, - myimage->bytes_per_line * myimage->height, + myimage->bytes_per_line * myimage->height, IPC_CREAT | 0777); - + if (shminfo->shmid < 0 ) { xprintf(this->xine, XINE_VERBOSITY_LOG, _("video_out_xshm: %s: allocating image\n" @@ -212,9 +212,9 @@ static XImage *create_ximage (xshm_driver_t *this, XShmSegmentInfo *shminfo, this->use_shm = 0; goto finishShmTesting; } - + shminfo->shmaddr = (char *) shmat(shminfo->shmid, 0, 0); - + if (shminfo->shmaddr == ((char *) -1)) { xprintf(this->xine, XINE_VERBOSITY_LOG, _("video_out_xshm: shared memory error (address error) when allocating image \n" @@ -224,12 +224,12 @@ static XImage *create_ximage (xshm_driver_t *this, XShmSegmentInfo *shminfo, this->use_shm = 0; goto finishShmTesting; } - + shminfo->readOnly = False; myimage->data = shminfo->shmaddr; - + XShmAttach(this->display, shminfo); - + XSync(this->display, False); if (gX11Fail) { @@ -243,10 +243,10 @@ static XImage *create_ximage (xshm_driver_t *this, XShmSegmentInfo *shminfo, goto finishShmTesting; } - /* + /* * Now that the Xserver has learned about and attached to the * shared memory segment, delete it. It's actually deleted by - * the kernel when all users of that segment have detached from + * the kernel when all users of that segment have detached from * it. Gives an automatic shared memory cleanup in case we crash. */ shmctl (shminfo->shmid, IPC_RMID, 0); @@ -268,7 +268,7 @@ static XImage *create_ximage (xshm_driver_t *this, XShmSegmentInfo *shminfo, this->depth, ZPixmap, 0, NULL, - width, + width, height, 8, 0); @@ -284,8 +284,8 @@ static XImage *create_ximage (xshm_driver_t *this, XShmSegmentInfo *shminfo, } /* called xlocked */ -static void dispose_ximage (xshm_driver_t *this, - XShmSegmentInfo *shminfo, +static void dispose_ximage (xshm_driver_t *this, + XShmSegmentInfo *shminfo, XImage *myimage) { if (this->use_shm) { @@ -298,7 +298,7 @@ static void dispose_ximage (xshm_driver_t *this, shminfo->shmid = -1; } - } + } else XDestroyImage (myimage); } @@ -321,10 +321,10 @@ static uint32_t xshm_get_capabilities (vo_driver_t *this_gen) { static void xshm_frame_proc_slice (vo_frame_t *vo_img, uint8_t **src) { xshm_frame_t *frame = (xshm_frame_t *) vo_img ; /*xshm_driver_t *this = (xshm_driver_t *) vo_img->driver; */ - - vo_img->proc_called = 1; - - if( frame->vo_frame.crop_left || frame->vo_frame.crop_top || + + vo_img->proc_called = 1; + + if( frame->vo_frame.crop_left || frame->vo_frame.crop_top || frame->vo_frame.crop_right || frame->vo_frame.crop_bottom ) { /* we don't support crop, so don't even waste cpu cycles. @@ -332,7 +332,7 @@ static void xshm_frame_proc_slice (vo_frame_t *vo_img, uint8_t **src) { */ return; } - + lprintf ("copy... (format %d)\n", frame->format); if (frame->format == XINE_IMGFMT_YV12) @@ -341,7 +341,7 @@ static void xshm_frame_proc_slice (vo_frame_t *vo_img, uint8_t **src) { else frame->yuv2rgb->yuy22rgb_fun (frame->yuv2rgb, frame->rgb_dst, src[0]); - + lprintf ("copy...done\n"); } @@ -398,10 +398,10 @@ static vo_frame_t *xshm_alloc_frame (vo_driver_t *this_gen) { /* * supply required functions/fields */ - + frame->vo_frame.proc_slice = xshm_frame_proc_slice; frame->vo_frame.proc_frame = NULL; - frame->vo_frame.field = xshm_frame_field; + frame->vo_frame.field = xshm_frame_field; frame->vo_frame.dispose = xshm_frame_dispose; frame->vo_frame.driver = this_gen; @@ -461,7 +461,7 @@ static void xshm_update_frame_format (vo_driver_t *this_gen, frame->sc.video_pixel_aspect, &gui_width, &gui_height, &gui_pixel_aspect); - + /* find out if we need to adapt this frame */ do_adapt = 0; @@ -486,7 +486,7 @@ static void xshm_update_frame_format (vo_driver_t *this_gen, frame->sc.user_ratio = this->sc.user_ratio; xshm_compute_ideal_size (this, frame); - + /* now we have updated video_aspect_pixel we use the callback */ /* again to obtain the correct gui_width and gui_height values. */ frame->sc.dest_size_cb (frame->sc.user_data, width, height, @@ -494,20 +494,20 @@ static void xshm_update_frame_format (vo_driver_t *this_gen, &gui_width, &gui_height, &gui_pixel_aspect); } - + if ((frame->sc.gui_width != gui_width) || (frame->sc.gui_height != gui_height) || do_adapt) { - + do_adapt = 1; frame->sc.gui_width = gui_width; frame->sc.gui_height = gui_height; - + xshm_compute_rgb_size (this, frame); - + lprintf ("gui_size has changed => adapt\n"); } - + /* ok, now do what we have to do */ @@ -564,7 +564,7 @@ static void xshm_update_frame_format (vo_driver_t *this_gen, lprintf ("stripe out_ht=%i, deliv_ht=%i\n", frame->sc.output_height, frame->sc.delivered_height); - /* + /* * set up colorspace converter */ @@ -620,7 +620,7 @@ static void xshm_overlay_clut_yuv2rgb(xshm_driver_t *this, vo_overlay_t *overla } } -static void xshm_overlay_begin (vo_driver_t *this_gen, +static void xshm_overlay_begin (vo_driver_t *this_gen, vo_frame_t *frame_gen, int changed) { xshm_driver_t *this = (xshm_driver_t *) this_gen; @@ -628,10 +628,10 @@ static void xshm_overlay_begin (vo_driver_t *this_gen, if( this->ovl_changed && this->xoverlay ) { LOCK_DISPLAY(this); - x11osd_clear(this->xoverlay); + x11osd_clear(this->xoverlay); UNLOCK_DISPLAY(this); } - + this->alphablend_extra_data.offset_x = frame_gen->overlay_offset_x; this->alphablend_extra_data.offset_y = frame_gen->overlay_offset_y; } @@ -648,7 +648,7 @@ static void xshm_overlay_end (vo_driver_t *this_gen, vo_frame_t *vo_img) { this->ovl_changed = 0; } -static void xshm_overlay_blend (vo_driver_t *this_gen, +static void xshm_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) { xshm_driver_t *this = (xshm_driver_t *) this_gen; xshm_frame_t *frame = (xshm_frame_t *) frame_gen; @@ -658,13 +658,13 @@ static void xshm_overlay_blend (vo_driver_t *this_gen, if( overlay->unscaled ) { if( this->ovl_changed && this->xoverlay ) { LOCK_DISPLAY(this); - x11osd_blend(this->xoverlay, overlay); + x11osd_blend(this->xoverlay, overlay); UNLOCK_DISPLAY(this); } } else { if (!overlay->rgb_clut || !overlay->hili_rgb_clut) xshm_overlay_clut_yuv2rgb (this, overlay, frame); - + switch (this->bpp) { case 16: _x_blend_rgb16 ((uint8_t *)frame->image->data, overlay, @@ -685,7 +685,7 @@ static void xshm_overlay_blend (vo_driver_t *this_gen, &this->alphablend_extra_data); break; default: - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "xine-lib:video_out_xshm:xshm_overlay_blend: Cannot blend bpp:%i\n", this->bpp); /* it should never get here, unless a user tries to play in bpp:8 */ break; @@ -696,12 +696,12 @@ static void xshm_overlay_blend (vo_driver_t *this_gen, static void clean_output_area (xshm_driver_t *this, xshm_frame_t *frame) { int i; - + memcpy( this->sc.border, frame->sc.border, sizeof(this->sc.border) ); - + LOCK_DISPLAY(this); XSetForeground (this->display, this->gc, this->black.pixel); - + for( i = 0; i < 4; i++ ) { if( this->sc.border[i].w && this->sc.border[i].h ) XFillRectangle(this->display, this->drawable, this->gc, @@ -712,7 +712,7 @@ static void clean_output_area (xshm_driver_t *this, xshm_frame_t *frame) { x11osd_resize (this->xoverlay, this->sc.gui_width, this->sc.gui_height); this->ovl_changed = 1; } - + UNLOCK_DISPLAY(this); } @@ -724,15 +724,15 @@ static int xshm_redraw_needed (vo_driver_t *this_gen) { this->sc.delivered_height = this->cur_frame->sc.delivered_height; this->sc.delivered_width = this->cur_frame->sc.delivered_width; this->sc.video_pixel_aspect = this->cur_frame->sc.video_pixel_aspect; - if( _x_vo_scale_redraw_needed( &this->sc ) ) { + if( _x_vo_scale_redraw_needed( &this->sc ) ) { clean_output_area (this, this->cur_frame); ret = 1; } - } + } else ret = 1; - + return ret; } @@ -745,22 +745,22 @@ static void xshm_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { frame->vo_frame.id, frame->sc.output_width, frame->sc.output_height); - /* + /* * tell gui that we are about to display a frame, * ask for offset */ - + this->sc.delivered_height = frame->sc.delivered_height; this->sc.delivered_width = frame->sc.delivered_width; this->sc.video_pixel_aspect = frame->sc.video_pixel_aspect; - if( _x_vo_scale_redraw_needed( &this->sc ) ) { + if( _x_vo_scale_redraw_needed( &this->sc ) ) { clean_output_area (this, frame); } - + if (this->cur_frame) { - if ( (this->cur_frame->sc.output_width != frame->sc.output_width) + if ( (this->cur_frame->sc.output_width != frame->sc.output_width) || (this->cur_frame->sc.output_height != frame->sc.output_height) || (this->cur_frame->sc.output_xoffset != frame->sc.output_xoffset) || (this->cur_frame->sc.output_yoffset != frame->sc.output_yoffset) ) @@ -770,10 +770,10 @@ static void xshm_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { } this->cur_frame = frame; - + LOCK_DISPLAY(this); lprintf ("display locked...\n"); - + if (this->use_shm) { lprintf ("put image (shm)\n"); @@ -824,14 +824,14 @@ static int xshm_get_property (vo_driver_t *this_gen, int property) { case VO_PROP_OUTPUT_YOFFSET: return this->cur_frame->sc.output_yoffset; default: - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_xshm: tried to get unsupported property %d\n", property); } return 0; } -static int xshm_set_property (vo_driver_t *this_gen, +static int xshm_set_property (vo_driver_t *this_gen, int property, int value) { xshm_driver_t *this = (xshm_driver_t *) this_gen; @@ -840,7 +840,7 @@ static int xshm_set_property (vo_driver_t *this_gen, if (value>=XINE_VO_ASPECT_NUM_RATIOS) value = XINE_VO_ASPECT_AUTO; this->sc.user_ratio = value; - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_xshm: aspect ratio changed to %s\n", _x_vo_scale_aspect_ratio_name(value)); } else if (property == VO_PROP_BRIGHTNESS) { @@ -874,7 +874,7 @@ static int xshm_set_property (vo_driver_t *this_gen, this->sc.force_redraw = 1; } else { - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_xshm: tried to set unsupported property %d\n", property); } @@ -900,7 +900,7 @@ static void xshm_get_property_min_max (vo_driver_t *this_gen, } } -static int xshm_gui_data_exchange (vo_driver_t *this_gen, +static int xshm_gui_data_exchange (vo_driver_t *this_gen, int data_type, void *data) { xshm_driver_t *this = (xshm_driver_t *) this_gen; @@ -911,15 +911,15 @@ static int xshm_gui_data_exchange (vo_driver_t *this_gen, #endif case XINE_GUI_SEND_EXPOSE_EVENT: - + lprintf ("expose event\n"); if (this->cur_frame) { XExposeEvent * xev = (XExposeEvent *) data; - + if (xev && xev->count == 0) { int i; - + LOCK_DISPLAY(this); if (this->use_shm) { XShmPutImage(this->display, @@ -929,7 +929,7 @@ static int xshm_gui_data_exchange (vo_driver_t *this_gen, False); } else { - XPutImage(this->display, + XPutImage(this->display, this->drawable, this->gc, this->cur_frame->image, 0, 0, this->cur_frame->sc.output_xoffset, this->cur_frame->sc.output_yoffset, this->cur_frame->sc.output_width, this->cur_frame->sc.output_height); @@ -952,7 +952,7 @@ static int xshm_gui_data_exchange (vo_driver_t *this_gen, } } break; - + case XINE_GUI_SEND_DRAWABLE_CHANGED: this->drawable = (Drawable) data; @@ -970,7 +970,7 @@ static int xshm_gui_data_exchange (vo_driver_t *this_gen, if (this->cur_frame) { x11_rectangle_t *rect = data; int x1, y1, x2, y2; - + _x_vo_scale_translate_gui2video(&this->cur_frame->sc, rect->x, rect->y, &x1, &y1); @@ -993,16 +993,16 @@ static int xshm_gui_data_exchange (vo_driver_t *this_gen, static void xshm_dispose (vo_driver_t *this_gen) { xshm_driver_t *this = (xshm_driver_t *) this_gen; - + if (this->cur_frame) this->cur_frame->vo_frame.dispose (&this->cur_frame->vo_frame); this->yuv2rgb_factory->dispose (this->yuv2rgb_factory); - + LOCK_DISPLAY(this); XFreeGC(this->display, this->gc); UNLOCK_DISPLAY(this); - + if( this->xoverlay ) { LOCK_DISPLAY(this); x11osd_destroy (this->xoverlay); @@ -1010,7 +1010,7 @@ static void xshm_dispose (vo_driver_t *this_gen) { } _x_alphablend_free(&this->alphablend_extra_data); - + free (this); } @@ -1022,7 +1022,7 @@ static int ImlibPaletteLUTGet(xshm_driver_t *this) { int format_ret; long length; Atom to_get; - + retval = NULL; length = 0x7fffffff; to_get = XInternAtom(this->display, "_IMLIB_COLORMAP", False); @@ -1034,7 +1034,7 @@ static int ImlibPaletteLUTGet(xshm_driver_t *this) { if (format_ret == 8) { unsigned int i; unsigned long j; - + j = 1 + retval[0]*4; this->yuv2rgb_cmap = malloc(sizeof(uint8_t) * 32 * 32 * 32); for (i = 0; i < 32 * 32 * 32 && j < num_ret; i++) @@ -1082,14 +1082,14 @@ static vo_driver_t *xshm_open_plugin_2 (video_driver_class_t *class_gen, const v int swapped; int cpu_byte_order; XColor dummy; - + this = (xshm_driver_t *) calloc(1, sizeof(xshm_driver_t)); if (!this) return NULL; _x_alphablend_init(&this->alphablend_extra_data, class->xine); - + this->display = visual->display; this->screen = visual->screen; @@ -1102,9 +1102,9 @@ static vo_driver_t *xshm_open_plugin_2 (video_driver_class_t *class_gen, const v this->sc.frame_output_cb = visual->frame_output_cb; this->sc.dest_size_cb = visual->dest_size_cb; this->sc.user_data = visual->user_data; - + this->sc.user_ratio = XINE_VO_ASPECT_AUTO; - + this->drawable = visual->d; this->cur_frame = NULL; LOCK_DISPLAY(this); @@ -1112,7 +1112,7 @@ static vo_driver_t *xshm_open_plugin_2 (video_driver_class_t *class_gen, const v UNLOCK_DISPLAY(this); this->xoverlay = NULL; this->ovl_changed = 0; - + this->x11_old_error_handler = NULL; this->xine = class->xine; @@ -1129,7 +1129,7 @@ static vo_driver_t *xshm_open_plugin_2 (video_driver_class_t *class_gen, const v this->vo_driver.gui_data_exchange = xshm_gui_data_exchange; this->vo_driver.dispose = xshm_dispose; this->vo_driver.redraw_needed = xshm_redraw_needed; - + LOCK_DISPLAY(this); XAllocNamedColor (this->display, DefaultColormap (this->display, this->screen), @@ -1151,7 +1151,7 @@ static vo_driver_t *xshm_open_plugin_2 (video_driver_class_t *class_gen, const v UNLOCK_DISPLAY(this); this->visual = attribs.visual; this->depth = attribs.depth; - + if (this->depth>16) xprintf(this->xine, XINE_VERBOSITY_LOG, _("\n\nWARNING: current display depth is %d. For better performance\n" @@ -1164,7 +1164,7 @@ static vo_driver_t *xshm_open_plugin_2 (video_driver_class_t *class_gen, const v LOCK_DISPLAY(this); if (XShmQueryExtension(this->display)) { this->use_shm = 1; - } + } else { xprintf(this->xine, XINE_VERBOSITY_LOG, _("video_out_xshm: MIT shared memory extension not present on display.\n")); @@ -1186,7 +1186,7 @@ static vo_driver_t *xshm_open_plugin_2 (video_driver_class_t *class_gen, const v */ cpu_byte_order = htonl(1) == 1 ? MSBFirst : LSBFirst; swapped = cpu_byte_order != this->image_byte_order; - + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_xshm: video mode depth is %d (%d bpp), %s, %sswapped,\n" "\tred: %08lx, green: %08lx, blue: %08lx\n", @@ -1250,16 +1250,16 @@ static vo_driver_t *xshm_open_plugin_2 (video_driver_class_t *class_gen, const v } if (!mode) { - xprintf (this->xine, XINE_VERBOSITY_LOG, + xprintf (this->xine, XINE_VERBOSITY_LOG, _("video_out_xshm: your video mode was not recognized, sorry :-(\n")); return NULL; } - + this->yuv2rgb_brightness = 0; this->yuv2rgb_contrast = 128; this->yuv2rgb_saturation = 128; - - this->yuv2rgb_factory = yuv2rgb_factory_init (mode, swapped, + + this->yuv2rgb_factory = yuv2rgb_factory_init (mode, swapped, this->yuv2rgb_cmap); this->yuv2rgb_factory->set_csc_levels (this->yuv2rgb_factory, this->yuv2rgb_brightness, @@ -1287,7 +1287,7 @@ static vo_driver_t *xshm_open_plugin_old (video_driver_class_t *class_gen, const visual.frame_output_cb = old_visual->frame_output_cb; visual.lock_display = NULL; visual.unlock_display = NULL; - + return xshm_open_plugin_2(class_gen, (void *)&visual); } @@ -1347,7 +1347,7 @@ static const vo_info_t vo_info_xshm_2 = { */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_VIDEO_OUT, 21, "xshm", XINE_VERSION_CODE, &vo_info_xshm, xshm_init_class }, { PLUGIN_VIDEO_OUT, 21, "xshm", XINE_VERSION_CODE, &vo_info_xshm_2, xshm_init_class_2 }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } diff --git a/src/video_out/video_out_xv.c b/src/video_out/video_out_xv.c index f2c47ef7e..65cd29aa4 100644 --- a/src/video_out/video_out_xv.c +++ b/src/video_out/video_out_xv.c @@ -218,7 +218,7 @@ static vo_frame_t *xv_alloc_frame (vo_driver_t *this_gen) { frame = (xv_frame_t *) calloc(1, sizeof(xv_frame_t)); if (!frame) return NULL; - + pthread_mutex_init (&frame->vo_frame.mutex, NULL); /* @@ -235,7 +235,7 @@ static vo_frame_t *xv_alloc_frame (vo_driver_t *this_gen) { static int HandleXError (Display *display, XErrorEvent *xevent) { char str [1024]; - + XGetErrorText (display, xevent->error_code, str, 1024); printf ("received X error event: %s\n", str); gX11Fail = 1; @@ -309,7 +309,7 @@ static XvImage *create_ximage (xv_driver_t *this, XShmSegmentInfo *shminfo, lprintf( "XvImage height %d\n", image->height ); lprintf( "XvImage data_size %d\n", image->data_size ); lprintf( "XvImage num_planes %d\n", image->num_planes ); - + for( q=0; q < image->num_planes; q++) { lprintf( "XvImage pitches[%d] %d\n", q, image->pitches[q] ); @@ -425,10 +425,10 @@ static void dispose_ximage (xv_driver_t *this, shminfo->shmid = -1; } - } + } else { free (myimage->data); - + XFree (myimage); } } @@ -466,7 +466,7 @@ static void xv_update_frame_format (vo_driver_t *this_gen, if(format == XINE_IMGFMT_YUY2) { frame->vo_frame.pitches[0] = frame->image->pitches[0]; frame->vo_frame.base[0] = frame->image->data + frame->image->offsets[0]; - } + } else { frame->vo_frame.pitches[0] = frame->image->pitches[0]; frame->vo_frame.pitches[1] = frame->image->pitches[2]; @@ -505,7 +505,7 @@ static void xv_deinterlace_frame (xv_driver_t *this) { if(this->deinterlace_frame.image) dispose_ximage (this, &this->deinterlace_frame.shminfo, this->deinterlace_frame.image); - + this->deinterlace_frame.image = create_ximage (this, &this->deinterlace_frame.shminfo, frame->width,frame->height / xvscaling, frame->format); @@ -621,12 +621,12 @@ static void xv_clean_output_area (xv_driver_t *this) { this->sc.output_xoffset, this->sc.output_yoffset, this->sc.output_width, this->sc.output_height); } - + if (this->xoverlay) { x11osd_resize (this->xoverlay, this->sc.gui_width, this->sc.gui_height); this->ovl_changed = 1; } - + UNLOCK_DISPLAY(this); } @@ -657,7 +657,7 @@ static void xv_compute_output_size (xv_driver_t *this) { } } -static void xv_overlay_begin (vo_driver_t *this_gen, +static void xv_overlay_begin (vo_driver_t *this_gen, vo_frame_t *frame_gen, int changed) { xv_driver_t *this = (xv_driver_t *) this_gen; @@ -665,10 +665,10 @@ static void xv_overlay_begin (vo_driver_t *this_gen, if( this->ovl_changed && this->xoverlay ) { LOCK_DISPLAY(this); - x11osd_clear(this->xoverlay); + x11osd_clear(this->xoverlay); UNLOCK_DISPLAY(this); } - + this->alphablend_extra_data.offset_x = frame_gen->overlay_offset_x; this->alphablend_extra_data.offset_y = frame_gen->overlay_offset_y; } @@ -685,7 +685,7 @@ static void xv_overlay_end (vo_driver_t *this_gen, vo_frame_t *vo_img) { this->ovl_changed = 0; } -static void xv_overlay_blend (vo_driver_t *this_gen, +static void xv_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) { xv_driver_t *this = (xv_driver_t *) this_gen; xv_frame_t *frame = (xv_frame_t *) frame_gen; @@ -694,16 +694,16 @@ static void xv_overlay_blend (vo_driver_t *this_gen, if( overlay->unscaled ) { if( this->ovl_changed && this->xoverlay ) { LOCK_DISPLAY(this); - x11osd_blend(this->xoverlay, overlay); + x11osd_blend(this->xoverlay, overlay); UNLOCK_DISPLAY(this); } } else { if (frame->format == XINE_IMGFMT_YV12) - _x_blend_yuv(frame->vo_frame.base, overlay, + _x_blend_yuv(frame->vo_frame.base, overlay, frame->width, frame->height, frame->vo_frame.pitches, &this->alphablend_extra_data); else - _x_blend_yuy2(frame->vo_frame.base[0], overlay, + _x_blend_yuy2(frame->vo_frame.base[0], overlay, frame->width, frame->height, frame->vo_frame.pitches[0], &this->alphablend_extra_data); } @@ -747,7 +747,7 @@ static int xv_redraw_needed (vo_driver_t *this_gen) { this->sc.delivered_height = this->cur_frame->height; this->sc.delivered_width = this->cur_frame->width; this->sc.delivered_ratio = this->cur_frame->ratio; - + this->sc.crop_left = this->cur_frame->vo_frame.crop_left; this->sc.crop_right = this->cur_frame->vo_frame.crop_right; this->sc.crop_top = this->cur_frame->vo_frame.crop_top; @@ -786,7 +786,7 @@ static void xv_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { /* printf ("video_out_xv: xv_display_frame...\n"); */ - + /* * queue frames (deinterlacing) * free old frames @@ -858,7 +858,7 @@ static void xv_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { if( factor > 1 ) { - lprintf( "%s PutImage %dX interval (%fs)\n", + lprintf( "%s PutImage %dX interval (%fs)\n", LOG_MODULE, factor, elapse_time ); } } @@ -900,7 +900,7 @@ static int xv_get_property (vo_driver_t *this_gen, int property) { static void xv_property_callback (void *property_gen, xine_cfg_entry_t *entry) { xv_property_t *property = (xv_property_t *) property_gen; xv_driver_t *this = property->this; - + LOCK_DISPLAY(this); XvSetPortAttribute (this->display, this->xv_port, property->atom, @@ -930,7 +930,7 @@ static int xv_set_property (vo_driver_t *this_gen, this->props[property].entry->num_value = this->props[property].value; return this->props[property].value; - } + } else { switch (property) { @@ -944,13 +944,13 @@ static int xv_set_property (vo_driver_t *this_gen, xv_compute_output_size (this); } break; - + case VO_PROP_ASPECT_RATIO: if (value>=XINE_VO_ASPECT_NUM_RATIOS) value = XINE_VO_ASPECT_AUTO; this->props[property].value = value; - xprintf(this->xine, XINE_VERBOSITY_LOG, + xprintf(this->xine, XINE_VERBOSITY_LOG, "video_out_xv: VO_PROP_ASPECT_RATIO(%d)\n", this->props[property].value); this->sc.user_ratio = value; @@ -964,7 +964,7 @@ static int xv_set_property (vo_driver_t *this_gen, this->props[property].value = value; xprintf(this->xine, XINE_VERBOSITY_LOG, "video_out_xv: VO_PROP_ZOOM_X = %d\n", this->props[property].value); - + this->sc.zoom_factor_x = (double)value / (double)XINE_VO_ZOOM_STEP; xv_compute_ideal_size (this); @@ -1046,7 +1046,7 @@ static int xv_gui_data_exchange (vo_driver_t *this_gen, if(this->xoverlay) x11osd_expose(this->xoverlay); - + XSync(this->display, False); UNLOCK_DISPLAY(this); } @@ -1100,39 +1100,39 @@ static int xv_gui_data_exchange (vo_driver_t *this_gen, static void xv_store_port_attribute(xv_driver_t *this, const char *name) { Atom atom; xv_portattribute_t *attr; - + attr = (xv_portattribute_t *)malloc( sizeof(xv_portattribute_t) ); attr->name = strdup(name); - + LOCK_DISPLAY(this); atom = XInternAtom (this->display, attr->name, False); XvGetPortAttribute (this->display, this->xv_port, atom, &attr->value); UNLOCK_DISPLAY(this); - + xine_list_push_back (this->port_attributes, attr); } static void xv_restore_port_attributes(xv_driver_t *this) { Atom atom; xine_list_iterator_t ite; - + while ((ite = xine_list_front(this->port_attributes)) != NULL) { xv_portattribute_t *attr = xine_list_get_value(this->port_attributes, ite); xine_list_remove (this->port_attributes, ite); - + LOCK_DISPLAY(this); atom = XInternAtom (this->display, attr->name, False); XvSetPortAttribute (this->display, this->xv_port, atom, attr->value); UNLOCK_DISPLAY(this); - + free( attr->name ); free( attr ); } - + LOCK_DISPLAY(this); XSync(this->display, False); UNLOCK_DISPLAY(this); - + xine_list_delete( this->port_attributes ); } @@ -1142,7 +1142,7 @@ static void xv_dispose (vo_driver_t *this_gen) { /* restore port attributes to their initial values */ xv_restore_port_attributes(this); - + if (this->deinterlace_frame.image) { LOCK_DISPLAY(this); dispose_ximage (this, &this->deinterlace_frame.shminfo, @@ -1172,7 +1172,7 @@ static void xv_dispose (vo_driver_t *this_gen) { } _x_alphablend_free(&this->alphablend_extra_data); - + free (this); } @@ -1183,7 +1183,7 @@ static int xv_check_yv12 (Display *display, XvPortID port) { int i; formatValues = XvListImageFormats (display, port, &formats); - + for (i = 0; i < formats; i++) if ((formatValues[i].id == XINE_IMGFMT_YV12) && (! (strcmp (formatValues[i].guid, "YV12")))) { @@ -1204,7 +1204,7 @@ static void xv_check_capability (xv_driver_t *this, int int_default; cfg_entry_t *entry; const char *str_prop = attr.name; - + /* * some Xv drivers (Gatos ATI) report some ~0 as max values, this is confusing. */ @@ -1225,7 +1225,7 @@ static void xv_check_capability (xv_driver_t *this, /* might be overridden using config entry */ if(strcmp(str_prop, "XV_AUTOPAINT_COLORKEY") == 0) int_default = 0; - + if (config_name) { /* is this a boolean property ? */ if ((attr.min_value == 0) && (attr.max_value == 1)) { @@ -1242,12 +1242,12 @@ static void xv_check_capability (xv_driver_t *this, entry = this->config->lookup_entry (this->config, config_name); - if((entry->num_value < this->props[property].min) || + if((entry->num_value < this->props[property].min) || (entry->num_value > this->props[property].max)) { - this->config->update_num(this->config, config_name, + this->config->update_num(this->config, config_name, ((this->props[property].min + this->props[property].max) >> 1)); - + entry = this->config->lookup_entry (this->config, config_name); } @@ -1384,7 +1384,7 @@ static vo_driver_t *open_plugin_2 (video_driver_class_t *class_gen, const void * return NULL; _x_alphablend_init(&this->alphablend_extra_data, class->xine); - + this->display = visual->display; this->screen = visual->screen; this->config = config; @@ -1446,19 +1446,19 @@ static vo_driver_t *open_plugin_2 (video_driver_class_t *class_gen, const void * xprintf(class->xine, XINE_VERBOSITY_LOG, _("video_out_xv: Xv extension is present but I couldn't find a usable yuv12 port.\n" " Looks like your graphics hardware driver doesn't support Xv?!\n")); - + /* XvFreeAdaptorInfo (adaptor_info); this crashed on me (gb)*/ UNLOCK_DISPLAY(this); return NULL; - } + } else xprintf(class->xine, XINE_VERBOSITY_LOG, _("video_out_xv: using Xv port %ld from adaptor %s for hardware " "colour space conversion and scaling.\n"), xv_port, adaptor_info[adaptor_num].name); - + UNLOCK_DISPLAY(this); - + this->xv_port = xv_port; _x_vo_scale_init (&this->sc, 1, 0, config ); @@ -1534,7 +1534,7 @@ static vo_driver_t *open_plugin_2 (video_driver_class_t *class_gen, const void * const char *const name = attr[k].name; /* store initial port attribute value */ xv_store_port_attribute(this, name); - + if(!strcmp(name, "XV_HUE")) { if (!strncmp(adaptor_info[adaptor_num].name, "NV", 2)) { xprintf (this->xine, XINE_VERBOSITY_NONE, "video_out_xv: ignoring broken XV_HUE settings on NVidia cards\n"); @@ -1582,7 +1582,7 @@ static vo_driver_t *open_plugin_2 (video_driver_class_t *class_gen, const void * } else if(((this->sync_is_vsync = 0), !strcmp(name, sync_atoms[0])) || ((this->sync_is_vsync = 1), !strcmp(name, sync_atoms[1]))) { int xv_sync_to_vblank; - xv_sync_to_vblank = + xv_sync_to_vblank = config->register_bool (config, "video.device.xv_sync_to_vblank", 1, _("enable vblank sync"), _("This option will synchronize the update of the video image to the " @@ -1613,10 +1613,10 @@ static vo_driver_t *open_plugin_2 (video_driver_class_t *class_gen, const void * fo = XvListImageFormats(this->display, this->xv_port, (int*)&formats); UNLOCK_DISPLAY(this); - + this->xv_format_yv12 = 0; this->xv_format_yuy2 = 0; - + for(i = 0; i < formats; i++) { lprintf ("Xv image format: 0x%x (%4.4s) %s\n", fo[i].id, (char*)&fo[i].id, @@ -1630,7 +1630,7 @@ static vo_driver_t *open_plugin_2 (video_driver_class_t *class_gen, const void * } else if (fo[i].id == XINE_IMGFMT_YUY2) { this->xv_format_yuy2 = fo[i].id; this->capabilities |= VO_CAP_YUY2; - xprintf(this->xine, XINE_VERBOSITY_LOG, + xprintf(this->xine, XINE_VERBOSITY_LOG, _("video_out_xv: this adaptor supports the yuy2 format.\n")); } } @@ -1651,12 +1651,12 @@ static vo_driver_t *open_plugin_2 (video_driver_class_t *class_gen, const void * dispose_ximage (this, &myshminfo, myimage); UNLOCK_DISPLAY(this); - this->use_pitch_alignment = + this->use_pitch_alignment = config->register_bool (config, "video.device.xv_pitch_alignment", 0, VIDEO_DEVICE_XV_PITCH_ALIGNMENT_HELP, 10, xv_update_xv_pitch_alignment, this); - this->deinterlace_method = + this->deinterlace_method = config->register_enum (config, "video.output.xv_deinterlace_method", 4, deinterlace_methods, _("deinterlace method (deprecated)"), @@ -1720,7 +1720,7 @@ static vo_driver_t *open_plugin_old (video_driver_class_t *class_gen, const void visual.frame_output_cb = old_visual->frame_output_cb; visual.lock_display = NULL; visual.unlock_display = NULL; - + return open_plugin_2(class_gen, (void *)&visual); } @@ -1738,7 +1738,7 @@ static char* get_description (video_driver_class_t *this_gen) { static void dispose_class (video_driver_class_t *this_gen) { xv_class_t *this = (xv_class_t *) this_gen; - + free (this); } diff --git a/src/video_out/video_out_xvmc.c b/src/video_out/video_out_xvmc.c index c2560ccc0..aeb536fc1 100644 --- a/src/video_out/video_out_xvmc.c +++ b/src/video_out/video_out_xvmc.c @@ -7,7 +7,7 @@ * 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. - * + * * xine 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 @@ -93,7 +93,7 @@ typedef struct { XvMCMacroBlock *macroblockbaseptr; /* pointer to base MacroBlock in MB array */ XvMCMacroBlockArray *macro_blocks; /* pointer to memory for macroblock array */ int slices; -} xvmc_macroblocks_t; +} xvmc_macroblocks_t; typedef struct { void *xid; @@ -149,8 +149,8 @@ struct xvmc_driver_s { int max_surface_height; int num_frame_buffers; - int surface_width; - int surface_height; + int surface_width; + int surface_height; int surface_ratio; int surface_format; int surface_flags; @@ -168,7 +168,7 @@ struct xvmc_driver_s { /* display anatomy */ double display_ratio; /* given by visual parameter from init function */ - + xvmc_property_t props[VO_NUM_PROPERTIES]; uint32_t capabilities; @@ -181,7 +181,7 @@ struct xvmc_driver_s { /* size / aspect ratio calculations */ - /* + /* * "delivered" size: * frame dimension / aspect as delivered by the decoder * used (among other things) to detect frame size changes @@ -189,7 +189,7 @@ struct xvmc_driver_s { int delivered_duration; - /* + /* * "ideal" size : * displayed width/height corrected by aspect ratio */ @@ -197,19 +197,19 @@ struct xvmc_driver_s { double ratio_factor; /* output frame must fullfill: height = width * ratio_factor */ - + xvmc_frame_t deinterlace_frame; int deinterlace_method; int deinterlace_enabled; /* gui callback */ - + void (*frame_output_cb) (void *user_data, int video_width, int video_height, - int *dest_x, int *dest_y, + int *dest_x, int *dest_y, int *dest_height, int *dest_width, int *win_x, int *win_y); - + int use_colorkey; uint32_t colorkey; @@ -245,19 +245,19 @@ static void xvmc_render_macro_blocks(vo_frame_t *current_image, /**************************************************************************/ -/* +/* * dmvector: differential motion vector * mvx, mvy: decoded mv components (always in field format) */ -static void calc_DMV(int DMV[][2], int *dmvector, +static void calc_DMV(int DMV[][2], int *dmvector, int mvx, int mvy, int picture_structure, int top_field_first) { - + if (picture_structure==VO_BOTH_FIELDS) { if (top_field_first) { /* vector for prediction of top field from bottom field */ DMV[0][0] = ((mvx +(mvx>0))>>1) + dmvector[0]; DMV[0][1] = ((mvy +(mvy>0))>>1) + dmvector[1] - 1; - + /* vector for prediction of bottom field from top field */ DMV[1][0] = ((3*mvx+(mvx>0))>>1) + dmvector[0]; DMV[1][1] = ((3*mvy+(mvy>0))>>1) + dmvector[1] + 1; @@ -266,7 +266,7 @@ static void calc_DMV(int DMV[][2], int *dmvector, /* vector for prediction of top field from bottom field */ DMV[0][0] = ((3*mvx+(mvx>0))>>1) + dmvector[0]; DMV[0][1] = ((3*mvy+(mvy>0))>>1) + dmvector[1] - 1; - + /* vector for prediction of bottom field from top field */ DMV[1][0] = ((mvx +(mvx>0))>>1) + dmvector[0]; DMV[1][1] = ((mvy +(mvy>0))>>1) + dmvector[1] + 1; @@ -276,7 +276,7 @@ static void calc_DMV(int DMV[][2], int *dmvector, /* vector for prediction from field of opposite 'parity' */ DMV[0][0] = ((mvx+(mvx>0))>>1) + dmvector[0]; DMV[0][1] = ((mvy+(mvy>0))>>1) + dmvector[1]; - + /* correct for vertical field shift */ if (picture_structure==VO_TOP_FIELD) DMV[0][1]--; @@ -285,11 +285,11 @@ static void calc_DMV(int DMV[][2], int *dmvector, } } -static void xvmc_proc_macro_block(int x, int y, int mb_type, int motion_type, - int (*mv_field_sel)[2], int *dmvector, int cbp, - int dct_type, vo_frame_t *current_frame, - vo_frame_t *forward_ref_frame, - vo_frame_t *backward_ref_frame, int picture_structure, +static void xvmc_proc_macro_block(int x, int y, int mb_type, int motion_type, + int (*mv_field_sel)[2], int *dmvector, int cbp, + int dct_type, vo_frame_t *current_frame, + vo_frame_t *forward_ref_frame, + vo_frame_t *backward_ref_frame, int picture_structure, int second_field, int (*f_mot_pmv)[2], int (*b_mot_pmv)[2]) { xvmc_driver_t *this = (xvmc_driver_t *) current_frame->driver; xvmc_macroblocks_t *mbs = &this->macroblocks; @@ -298,10 +298,10 @@ static void xvmc_proc_macro_block(int x, int y, int mb_type, int motion_type, mbs->macroblockptr->x = x; mbs->macroblockptr->y = y; - + if(mb_type & XINE_MACROBLOCK_INTRA) { mbs->macroblockptr->macroblock_type = XVMC_MB_TYPE_INTRA; - } + } else { mbs->macroblockptr->macroblock_type = 0; /* XvMC doesn't support skips */ @@ -310,7 +310,7 @@ static void xvmc_proc_macro_block(int x, int y, int mb_type, int motion_type, motion_type = (picture_structure == VO_BOTH_FIELDS) ? XINE_MC_FRAME : XINE_MC_FIELD; mbs->macroblockptr->PMV[0][0][0] = 0; mbs->macroblockptr->PMV[0][0][1] = 0; - } + } else { if(mb_type & XINE_MACROBLOCK_MOTION_BACKWARD) { mbs->macroblockptr->macroblock_type |= XVMC_MB_TYPE_MOTION_BACKWARD; @@ -342,17 +342,17 @@ static void xvmc_proc_macro_block(int x, int y, int mb_type, int motion_type, calc_DMV(DMV,dmvector, f_mot_pmv[0][0], f_mot_pmv[0][1]>>1, picture_structure, top_field_first); - + mbs->macroblockptr->PMV[1][0][0] = DMV[0][0]; mbs->macroblockptr->PMV[1][0][1] = DMV[0][1]; mbs->macroblockptr->PMV[1][1][0] = DMV[1][0]; mbs->macroblockptr->PMV[1][1][1] = DMV[1][1]; - } + } else { calc_DMV(DMV,dmvector, f_mot_pmv[0][0], f_mot_pmv[0][1]>>1, picture_structure, top_field_first); - + mbs->macroblockptr->PMV[0][1][0] = DMV[0][0]; mbs->macroblockptr->PMV[0][1][1] = DMV[0][1]; } @@ -378,7 +378,7 @@ static void xvmc_proc_macro_block(int x, int y, int mb_type, int motion_type, mbs->macroblockptr->dct_type = dct_type; mbs->macroblockptr->coded_block_pattern = cbp; - while(cbp) { + while(cbp) { if(cbp & 1) mbs->macroblockptr->index--; cbp >>= 1; } @@ -446,7 +446,7 @@ static void xvmc_proc_macro_block(int x, int y, int mb_type, int motion_type, picture_structure, second_field ? XVMC_SECOND_FIELD : 0, mbs); - + mbs->num_blocks = 0; mbs->macroblockptr = mbs->macroblockbaseptr; mbs->xine_mc.blockptr = mbs->xine_mc.blockbaseptr; @@ -470,9 +470,9 @@ static void xvmc_frame_dispose (vo_frame_t *vo_img) { lprintf ("xvmc_frame_dispose\n"); - /* + /* * TODO - clean up of images/surfaces and frames - * Note this function is not really needed + * Note this function is not really needed * set_context does the work */ @@ -498,9 +498,9 @@ static void xvmc_render_macro_blocks(vo_frame_t *current_image, (long) forward_frame); /* lprintf ("slices %d 0x%08lx 0x%08lx 0x%08lx\n",macroblocks->slices, (long) current_frame->surface, (long) backward_frame->surface, - (long) forward_frame->surface); + (long) forward_frame->surface); */ - + flags = second_field; if(forward_frame) { @@ -512,7 +512,7 @@ static void xvmc_render_macro_blocks(vo_frame_t *current_image, flags, macroblocks->slices, 0, macroblocks->macro_blocks, macroblocks->blocks); - } + } else { XvMCRenderSurface(this->display, &this->context, picture_structure, ¤t_frame->surface, @@ -522,7 +522,7 @@ static void xvmc_render_macro_blocks(vo_frame_t *current_image, macroblocks->slices, 0, macroblocks->macro_blocks, macroblocks->blocks); } - } + } else { if(backward_frame) { XvMCRenderSurface(this->display, &this->context, picture_structure, @@ -532,7 +532,7 @@ static void xvmc_render_macro_blocks(vo_frame_t *current_image, flags, macroblocks->slices, 0, macroblocks->macro_blocks, macroblocks->blocks); - } + } else { XvMCRenderSurface(this->display, &this->context, picture_structure, ¤t_frame->surface, @@ -564,7 +564,7 @@ static vo_frame_t *xvmc_alloc_frame (vo_driver_t *this_gen) { /* keep track of frames and how many frames alocated. */ this->frames[this->num_frame_buffers++] = frame; - + pthread_mutex_init (&frame->vo_frame.mutex, NULL); /* @@ -591,12 +591,12 @@ static cxid_t *xvmc_set_context (xvmc_driver_t *this, xvmc_macroblocks_t *macroblocks = (xvmc_macroblocks_t *) macro_blocks; lprintf ("xvmc_set_context %dx%d %04x\n",width,height,format); - + /* initialize block & macro block pointers first time */ if(macroblocks->blocks == NULL || macroblocks->macro_blocks == NULL) { macroblocks->blocks = calloc(1, sizeof(XvMCBlockArray)); macroblocks->macro_blocks = calloc(1, sizeof(XvMCMacroBlockArray)); - + lprintf("macroblocks->blocks %lx ->macro_blocks %lx\n", macroblocks->blocks,macroblocks->macro_blocks); } @@ -612,11 +612,11 @@ static cxid_t *xvmc_set_context (xvmc_driver_t *this, return(&this->context_id); - } - else { + } + else { if(this->context_id.xid != NULL) { - /* + /* * flush any drawing and wait till we are done with the old stuff * blow away the old stuff */ @@ -639,8 +639,8 @@ static cxid_t *xvmc_set_context (xvmc_driver_t *this, width,height, this->surface_type_id, (int)this->xv_port); /* now create a new context */ - result = XvMCCreateContext(this->display, this->xv_port, - this->surface_type_id, + result = XvMCCreateContext(this->display, this->xv_port, + this->surface_type_id, width, height, XVMC_DIRECT, &this->context); if(result != Success) { @@ -668,7 +668,7 @@ static cxid_t *xvmc_set_context (xvmc_driver_t *this, slices = (slices * width/16); lprintf("CreateBlocks slices %d\n",slices); - + result = XvMCCreateBlocks(this->display, &this->context, slices * 6, macroblocks->blocks); if(result != Success) { @@ -751,7 +751,7 @@ static XvImage *create_ximage (xvmc_driver_t *this, XShmSegmentInfo *shminfo, static void dispose_ximage (xvmc_driver_t *this, XShmSegmentInfo *shminfo, XvImage *myimage) { - + lprintf ("dispose_ximage\n"); XFree(myimage); } @@ -779,9 +779,9 @@ static void xvmc_update_frame_format (vo_driver_t *this_gen, lprintf ("updating frame to %d x %d (ratio=%f, format=%08x)\n", width, height, ratio, format); - /* Note that since we are rendering in hardware, we do not need to + /* Note that since we are rendering in hardware, we do not need to * allocate any ximage's for the software rendering buffers. - */ + */ frame->width = width; frame->height = height; frame->format = format; @@ -791,7 +791,7 @@ static void xvmc_update_frame_format (vo_driver_t *this_gen, xvmc->macroblocks = (xine_macroblocks_t *)&this->macroblocks; this->macroblocks.num_blocks = 0; this->macroblocks.macroblockptr = this->macroblocks.macroblockbaseptr; - this->macroblocks.xine_mc.blockptr = + this->macroblocks.xine_mc.blockptr = this->macroblocks.xine_mc.blockbaseptr; if( flags & VO_NEW_SEQUENCE_FLAG ) { xvmc_set_context (this, width, height, ratio, format, flags, @@ -806,14 +806,14 @@ static void xvmc_clean_output_area (xvmc_driver_t *this) { XSetForeground (this->display, this->gc, this->black.pixel); XFillRectangle (this->display, this->drawable, this->gc, this->sc.gui_x, this->sc.gui_y, this->sc.gui_width, this->sc.gui_height); - + if (this->use_colorkey) { XSetForeground (this->display, this->gc, this->colorkey); XFillRectangle (this->display, this->drawable, this->gc, - this->sc.output_xoffset, this->sc.output_yoffset, + this->sc.output_xoffset, this->sc.output_yoffset, this->sc.output_width, this->sc.output_height); } - + XUnlockDisplay (this->display); } @@ -834,27 +834,27 @@ static void xvmc_compute_output_size (xvmc_driver_t *this) { _x_vo_scale_compute_output_size( &this->sc ); } -static void xvmc_overlay_blend (vo_driver_t *this_gen, +static void xvmc_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) { xvmc_driver_t *this = (xvmc_driver_t *) this_gen; xvmc_frame_t *frame = (xvmc_frame_t *) frame_gen; lprintf ("xvmc_overlay_blend\n"); - + this->alphablend_extra_data.offset_x = frame_gen->overlay_offset_x; this->alphablend_extra_data.offset_y = frame_gen->overlay_offset_y; /* Alpha Blend here * As XV drivers improve to support Hardware overlay, we will change this function. */ - + if (overlay->rle) { if (frame->format == XINE_IMGFMT_YV12) - _x_blend_yuv(frame->vo_frame.base, overlay, + _x_blend_yuv(frame->vo_frame.base, overlay, frame->width, frame->height, frame->vo_frame.pitches, &this->alphablend_extra_data); else if (frame->format != XINE_IMGFMT_XVMC) - _x_blend_yuy2(frame->vo_frame.base[0], overlay, + _x_blend_yuy2(frame->vo_frame.base[0], overlay, frame->width, frame->height, frame->vo_frame.pitches[0], &this->alphablend_extra_data); else @@ -899,16 +899,16 @@ static int xvmc_redraw_needed (vo_driver_t *this_gen) { int ret = 0; if(this->cur_frame) { - + this->sc.delivered_height = this->cur_frame->height; this->sc.delivered_width = this->cur_frame->width; this->sc.delivered_ratio = this->cur_frame->ratio; - + this->sc.crop_left = this->cur_frame->vo_frame.crop_left; this->sc.crop_right = this->cur_frame->vo_frame.crop_right; this->sc.crop_top = this->cur_frame->vo_frame.crop_top; this->sc.crop_bottom = this->cur_frame->vo_frame.crop_bottom; - + xvmc_compute_ideal_size(this); if(_x_vo_scale_redraw_needed(&this->sc)) { @@ -929,49 +929,49 @@ static void xvmc_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { lprintf ("xvmc_display_frame %d %x\n",frame_gen->id,frame_gen); - /* + /* * queue frames (deinterlacing) * free old frames */ - + xvmc_add_recent_frame (this, frame); /* deinterlacing */ - + this->cur_frame = frame; - + /* * let's see if this frame is different in size / aspect * ratio from the previous one */ - + if ( (frame->width != this->sc.delivered_width) || (frame->height != this->sc.delivered_height) || (frame->ratio != this->sc.delivered_ratio) ) { lprintf("frame format changed\n"); - - /* + + /* this->delivered_width = frame->width; this->delivered_height = frame->height; this->delivered_ratio = frame->ratio; this->delivered_duration = frame->vo_frame.duration; - + xvmc_compute_ideal_size (this); */ /* this->gui_width = 0; */ /* trigger re-calc of output size */ this->sc.force_redraw = 1; /* trigger re-calc of output size */ } - - /* + + /* * tell gui that we are about to display a frame, * ask for offset and output size */ xvmc_redraw_needed (this_gen); - + XLockDisplay (this->display); - /* Make sure the surface has finished rendering before we display */ + /* Make sure the surface has finished rendering before we display */ XvMCSyncSurface(this->display, &this->cur_frame->surface); - + if (this->deinterlace_enabled && (this->deinterlace_method == DEINTERLACE_ONEFIELD)) { XvMCPutSurface(this->display, &this->cur_frame->surface, @@ -990,9 +990,9 @@ static void xvmc_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { this->sc.output_width, this->sc.output_height, XVMC_FRAME_PICTURE); } - + XUnlockDisplay (this->display); - + /* printf ("video_out_xvmc: xvmc_display_frame... done\n"); */ @@ -1002,7 +1002,7 @@ static int xvmc_get_property (vo_driver_t *this_gen, int property) { xvmc_driver_t *this = (xvmc_driver_t *) this_gen; lprintf ("xvmc_get_property\n"); - + switch (property) { case VO_PROP_WINDOW_WIDTH: this->props[property].value = this->sc.gui_width; @@ -1023,7 +1023,7 @@ static int xvmc_get_property (vo_driver_t *this_gen, int property) { this->props[property].value = this->sc.output_yoffset; break; } - + return this->props[property].value; } @@ -1032,7 +1032,7 @@ static void xvmc_property_callback (void *property_gen, xine_cfg_entry_t *entry) xvmc_driver_t *this = property->this; lprintf ("xvmc_property_callback\n"); - + XLockDisplay(this->display); XvSetPortAttribute (this->display, this->xv_port, property->atom, entry->num_value); @@ -1044,7 +1044,7 @@ static int xvmc_set_property (vo_driver_t *this_gen, xvmc_driver_t *this = (xvmc_driver_t *) this_gen; lprintf ("xvmc_set_property %d value %d\n",property,value); - + if (this->props[property].atom != None) { /* value is out of bound */ if((value < this->props[property].min) || (value > this->props[property].max)) @@ -1060,9 +1060,9 @@ static int xvmc_set_property (vo_driver_t *this_gen, if (this->props[property].entry) this->props[property].entry->num_value = this->props[property].value; - + return this->props[property].value; - } + } else { switch (property) { case VO_PROP_INTERLACED: @@ -1081,7 +1081,7 @@ static int xvmc_set_property (vo_driver_t *this_gen, this->props[property].value = value; lprintf("VO_PROP_ASPECT_RATIO(%d)\n", this->props[property].value); - + xvmc_compute_ideal_size (this); xvmc_compute_output_size (this); xvmc_clean_output_area (this); @@ -1091,7 +1091,7 @@ static int xvmc_set_property (vo_driver_t *this_gen, case VO_PROP_ZOOM_X: if ((value >= XINE_VO_ZOOM_MIN) && (value <= XINE_VO_ZOOM_MAX)) { this->props[property].value = value; - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_xvmc: VO_PROP_ZOOM_X = %d\n", this->props[property].value); this->sc.zoom_factor_x = (double)value / (double)XINE_VO_ZOOM_STEP; @@ -1103,7 +1103,7 @@ static int xvmc_set_property (vo_driver_t *this_gen, case VO_PROP_ZOOM_Y: if ((value >= XINE_VO_ZOOM_MIN) && (value <= XINE_VO_ZOOM_MAX)) { this->props[property].value = value; - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_xvmc: VO_PROP_ZOOM_Y = %d\n", this->props[property].value); this->sc.zoom_factor_y = (double)value / (double)XINE_VO_ZOOM_STEP; @@ -1111,7 +1111,7 @@ static int xvmc_set_property (vo_driver_t *this_gen, this->sc.force_redraw = 1; /* trigger re-calc of output size */ } break; - } + } } return value; @@ -1120,9 +1120,9 @@ static int xvmc_set_property (vo_driver_t *this_gen, static void xvmc_get_property_min_max (vo_driver_t *this_gen, int property, int *min, int *max) { xvmc_driver_t *this = (xvmc_driver_t *) this_gen; - + lprintf ("xvmc_get_property_min_max\n"); - + *min = this->props[property].min; *max = this->props[property].max; } @@ -1132,32 +1132,32 @@ static int xvmc_gui_data_exchange (vo_driver_t *this_gen, xvmc_driver_t *this = (xvmc_driver_t *) this_gen; lprintf ("xvmc_gui_data_exchange\n"); - + switch (data_type) { case XINE_GUI_SEND_EXPOSE_EVENT: { /* XExposeEvent * xev = (XExposeEvent *) data; */ /* FIXME : take care of completion events */ lprintf ("XINE_GUI_SEND_EXPOSE_EVENT\n"); - + if (this->cur_frame) { int i; - + XLockDisplay (this->display); - + XSetForeground (this->display, this->gc, this->black.pixel); - + for( i = 0; i < 4; i++ ) { if( this->sc.border[i].w && this->sc.border[i].h ) XFillRectangle(this->display, this->drawable, this->gc, this->sc.border[i].x, this->sc.border[i].y, this->sc.border[i].w, this->sc.border[i].h); } - + if (this->use_colorkey) { XSetForeground (this->display, this->gc, this->colorkey); XFillRectangle (this->display, this->drawable, this->gc, - this->sc.output_xoffset, this->sc.output_yoffset, + this->sc.output_xoffset, this->sc.output_yoffset, this->sc.output_width, this->sc.output_height); } @@ -1168,7 +1168,7 @@ static int xvmc_gui_data_exchange (vo_driver_t *this_gen, this->sc.output_xoffset, this->sc.output_yoffset, this->sc.output_width, this->sc.output_height, XVMC_FRAME_PICTURE); - + XSync(this->display, False); XUnlockDisplay (this->display); } @@ -1187,18 +1187,18 @@ static int xvmc_gui_data_exchange (vo_driver_t *this_gen, int x1, y1, x2, y2; x11_rectangle_t *rect = data; - /* + /* xvmc_translate_gui2video(this, rect->x, rect->y, - &x1, &y1); + &x1, &y1); xvmc_translate_gui2video(this, rect->x + rect->w, rect->y + rect->h, - &x2, &y2); + &x2, &y2); */ - + _x_vo_scale_translate_gui2video(&this->sc, rect->x, rect->y, &x1, &y1); _x_vo_scale_translate_gui2video(&this->sc, rect->x + rect->w, rect->y + rect->h, &x2, &y2); - + rect->x = x1; rect->y = y1; rect->w = x2-x1; @@ -1216,9 +1216,9 @@ static int xvmc_gui_data_exchange (vo_driver_t *this_gen, static void xvmc_dispose (vo_driver_t *this_gen) { xvmc_driver_t *this = (xvmc_driver_t *) this_gen; int i; - + lprintf ("xvmc_dispose\n"); - + if(this->context_id.xid) { XLockDisplay(this->display); for(i = 0; i < this->num_frame_buffers; i++) { @@ -1228,7 +1228,7 @@ static void xvmc_dispose (vo_driver_t *this_gen) { } /* XvMCDestroyBlocks(this->display, ¯oblocks->blocks); */ /* XvMCDestroyMacroBlocks(this->display, ¯oblocks->macro_blocks); */ - XvMCDestroyContext(this->display, &this->context); + XvMCDestroyContext(this->display, &this->context); XUnlockDisplay(this->display); } @@ -1274,16 +1274,16 @@ static void xvmc_check_capability (xvmc_driver_t *this, XvGetPortAttribute (this->display, this->xv_port, this->props[property].atom, &int_default); - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_xvmc: port attribute %s (%d) value is %d\n", str_prop, property, int_default); - + if (config_name) { /* is this a boolean property ? */ if ((attr.min_value == 0) && (attr.max_value == 1)) { this->config->register_bool (this->config, config_name, int_default, config_desc, config_help, 20, xvmc_property_callback, &this->props[property]); - + } else { this->config->register_range (this->config, config_name, int_default, this->props[property].min, this->props[property].max, @@ -1301,7 +1301,7 @@ static void xvmc_check_capability (xvmc_driver_t *this, this->use_colorkey = 1; this->colorkey = entry->num_value; } - } + } else this->props[property].value = int_default; } @@ -1310,7 +1310,7 @@ static void xvmc_update_deinterlace(void *this_gen, xine_cfg_entry_t *entry) { xvmc_driver_t *this = (xvmc_driver_t *) this_gen; lprintf ("xvmc_update_deinterlace method = %d\n",entry->num_value); - + this->deinterlace_method = entry->num_value; } @@ -1319,7 +1319,7 @@ static void xvmc_update_XV_DOUBLE_BUFFER(void *this_gen, xine_cfg_entry_t *entry xvmc_driver_t *this = (xvmc_driver_t *) this_gen; Atom atom; int xvmc_double_buffer; - + xvmc_double_buffer = entry->num_value; XLockDisplay(this->display); @@ -1344,11 +1344,11 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi XvAdaptorInfo *adaptor_info; unsigned int adaptor_num; /* XvImage *myimage; */ - + lprintf ("open_plugin\n"); - + this = calloc(1, sizeof (xvmc_driver_t)); - + if (!this) return NULL; @@ -1425,9 +1425,9 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi /* * check this adaptor's capabilities */ - if(this->acceleration&XINE_VO_IDCT_ACCEL) + if(this->acceleration&XINE_VO_IDCT_ACCEL) this->capabilities |= VO_CAP_XVMC_IDCT; - + XLockDisplay(this->display); attr = XvQueryPortAttributes(this->display, xv_port, &nattr); if(attr && nattr) { @@ -1475,7 +1475,7 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi } } XFree(attr); - } + } else { xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_xvmc: no port attributes defined.\n"); } @@ -1489,12 +1489,12 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi this->xvmc_format_yv12 = 0; this->xvmc_format_yuy2 = 0; - + for(i = 0; i < formats; i++) { lprintf ("XvMC 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 == XINE_IMGFMT_YV12) { this->xvmc_format_yv12 = fo[i].id; this->capabilities |= VO_CAP_YV12; @@ -1519,15 +1519,15 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi */ /* XLockDisplay(this->display); - myimage = create_ximage (this, &myshminfo, 100, 100, + myimage = create_ximage (this, &myshminfo, 100, 100, (this->xvmc_format_yv12 != 0) ? XINE_IMGFMT_YV12 : IMGFMT_YUY2); dispose_ximage (this, &myshminfo, myimage); XUnLockDisplay(this->display); */ - + this->deinterlace_method = config->register_enum (config, "video.output.xv_deinterlace_method", 4, - deinterlace_methods, + deinterlace_methods, _("deinterlace method (deprecated)"), _("This config setting is deprecated. You should use the new deinterlacing " "post processing settings instead.\n\n" @@ -1561,26 +1561,26 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi lprintf("deinterlace_methods %d ",this->deinterlace_method); switch(this->deinterlace_method) { - case DEINTERLACE_NONE: - lprintf("NONE\n"); + case DEINTERLACE_NONE: + lprintf("NONE\n"); break; - case DEINTERLACE_BOB: - lprintf("BOB\n"); + case DEINTERLACE_BOB: + lprintf("BOB\n"); break; - case DEINTERLACE_WEAVE: + case DEINTERLACE_WEAVE: lprintf("WEAVE\n"); break; - case DEINTERLACE_GREEDY: + case DEINTERLACE_GREEDY: lprintf("GREEDY\n"); break; - case DEINTERLACE_ONEFIELD: + case DEINTERLACE_ONEFIELD: lprintf("ONEFIELD\n"); break; - case DEINTERLACE_ONEFIELDXV: + case DEINTERLACE_ONEFIELDXV: lprintf("ONEFIELDXV\n"); break; - case DEINTERLACE_LINEARBLEND: - lprintf("LINEARBLEND\n"); + case DEINTERLACE_LINEARBLEND: + lprintf("LINEARBLEND\n"); break; } @@ -1625,7 +1625,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { int surface_type = 0; display = visual->display; - + /* * check for Xv and XvMC video support */ @@ -1666,20 +1666,20 @@ static void *init_class (xine_t *xine, void *visual_gen) { for(surface_num = 0; surface_num < types; surface_num++) { if((surfaceInfo[surface_num].chroma_format == XVMC_CHROMA_FORMAT_420) && (surfaceInfo[surface_num].mc_type == (XVMC_IDCT | XVMC_MPEG_2))) { - + max_width = surfaceInfo[surface_num].max_width; max_height = surfaceInfo[surface_num].max_height; - + for(j = 0; j < adaptor_info[adaptor_num].num_ports; j++) { /* try to grab a port */ - if(Success == XvGrabPort(display, - adaptor_info[adaptor_num].base_id + j, CurrentTime)) { + if(Success == XvGrabPort(display, + adaptor_info[adaptor_num].base_id + j, CurrentTime)) { xv_port = adaptor_info[adaptor_num].base_id + j; surface_type = surfaceInfo[surface_num].surface_type_id; break; } } - + if(xv_port) break; } @@ -1691,22 +1691,22 @@ static void *init_class (xine_t *xine, void *visual_gen) { for(surface_num = 0; surface_num < types; surface_num++) { if((surfaceInfo[surface_num].chroma_format == XVMC_CHROMA_FORMAT_420) && ((surfaceInfo[surface_num].mc_type == (XVMC_MOCOMP | XVMC_MPEG_2)))) { - + xprintf (xine, XINE_VERBOSITY_DEBUG, "Found XVMC_MOCOMP\n"); max_width = surfaceInfo[surface_num].max_width; max_height = surfaceInfo[surface_num].max_height; for(j = 0; j < adaptor_info[adaptor_num].num_ports; j++) { /* try to grab a port */ - if(Success == XvGrabPort(display, - adaptor_info[adaptor_num].base_id + j, CurrentTime)) { + if(Success == XvGrabPort(display, + adaptor_info[adaptor_num].base_id + j, CurrentTime)) { xv_port = adaptor_info[adaptor_num].base_id + j; surface_type = surfaceInfo[surface_num].surface_type_id; break; } } - if(xv_port) + if(xv_port) break; } } @@ -1714,7 +1714,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { if(xv_port) { lprintf ("port %ld surface %d\n",xv_port,j); - IDCTaccel = 0; + IDCTaccel = 0; if(surfaceInfo[surface_num].flags & XVMC_OVERLAID_SURFACE) useOverlay = 1; if(surfaceInfo[surface_num].flags & XVMC_INTRA_UNSIGNED) @@ -1733,7 +1733,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { } } } /* outer for adaptor_num loop */ - + if (!xv_port) { xprintf (xine, XINE_VERBOSITY_LOG, @@ -1743,13 +1743,13 @@ static void *init_class (xine_t *xine, void *visual_gen) { /* XvFreeAdaptorInfo (adaptor_info); this crashed on me (gb)*/ XUnlockDisplay(display); return NULL; - } + } else { - xprintf (xine, XINE_VERBOSITY_LOG, + xprintf (xine, XINE_VERBOSITY_LOG, _("video_out_xvmc: using Xv port %ld from adaptor %s\n" " for hardware colour space conversion and scaling\n"), xv_port, adaptor_info[adaptor_num].name); - + if(IDCTaccel&XINE_VO_IDCT_ACCEL) xprintf (xine, XINE_VERBOSITY_LOG, _(" idct and motion compensation acceleration \n")); else if (IDCTaccel&XINE_VO_MOTION_ACCEL) @@ -1761,7 +1761,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { } XUnlockDisplay(display); - + this = (xvmc_class_t *) malloc (sizeof (xvmc_class_t)); if (!this) diff --git a/src/video_out/video_out_xxmc.c b/src/video_out/video_out_xxmc.c index 61e0139e3..256e2f5a8 100644 --- a/src/video_out/video_out_xxmc.c +++ b/src/video_out/video_out_xxmc.c @@ -4,7 +4,7 @@ * * This file is part of xine, a free video player. * - * xine is free software; you can redistribute it and/or modify it + * xine 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. @@ -40,7 +40,7 @@ static int gX11Fail; -static void xxmc_frame_updates(xxmc_driver_t *driver, xxmc_frame_t *frame, +static void xxmc_frame_updates(xxmc_driver_t *driver, xxmc_frame_t *frame, int init_macroblocks); static void dispose_ximage (xxmc_driver_t *this, XShmSegmentInfo *shminfo, XvImage *myimage); @@ -69,7 +69,7 @@ static const unsigned int accel_priority[] = { * Additional thread safety, since the plugin may decide to destroy a context * while it's surfaces are still active in the video-out loop. * When / If XvMC libs are reasonably thread-safe, the locks can be made - * more efficient by allowing multiple threads in that do not destroy + * more efficient by allowing multiple threads in that do not destroy * the context or surfaces that may be active in other threads. */ @@ -92,7 +92,7 @@ void xvmc_context_reader_lock(context_lock_t *c) #ifdef XVMC_THREAD_SAFE c->num_readers++; pthread_mutex_unlock(&c->mutex); -#endif +#endif } void xvmc_context_reader_unlock(context_lock_t *c) @@ -103,9 +103,9 @@ void xvmc_context_reader_unlock(context_lock_t *c) if (--(c->num_readers) == 0) { pthread_cond_broadcast(&c->cond); } - } + } #endif - pthread_mutex_unlock(&c->mutex); + pthread_mutex_unlock(&c->mutex); } static void xvmc_context_writer_lock(context_lock_t *c) @@ -115,7 +115,7 @@ static void xvmc_context_writer_lock(context_lock_t *c) while(c->num_readers) { pthread_cond_wait(&c->cond, &c->mutex); } -#endif +#endif } static void xvmc_context_writer_unlock(context_lock_t *c) @@ -131,34 +131,34 @@ static void xvmc_context_writer_unlock(context_lock_t *c) -static void xxmc_xvmc_dump_surfaces(xxmc_driver_t *this ) +static void xxmc_xvmc_dump_surfaces(xxmc_driver_t *this ) { int i; xvmc_surface_handler_t *handler = &this->xvmc_surf_handler; for (i=0; i<XVMC_MAX_SURFACES; ++i) { - xprintf(this->xine, XINE_VERBOSITY_DEBUG, "%d %d;",handler->surfInUse[i], + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "%d %d;",handler->surfInUse[i], handler->surfValid[i]); } - xprintf(this->xine, XINE_VERBOSITY_DEBUG, "\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "\n"); } -static void xxmc_xvmc_dump_subpictures(xxmc_driver_t *this) +static void xxmc_xvmc_dump_subpictures(xxmc_driver_t *this) { int i; xvmc_surface_handler_t *handler = &this->xvmc_surf_handler; for (i=0; i<XVMC_MAX_SUBPICTURES; ++i) { - xprintf(this->xine, XINE_VERBOSITY_DEBUG, "%d %d;",handler->subInUse[i], + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "%d %d;",handler->subInUse[i], handler->subValid[i]); } - xprintf(this->xine, XINE_VERBOSITY_DEBUG, "\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "\n"); } -static void xxmc_xvmc_surface_handler_construct(xxmc_driver_t *this) +static void xxmc_xvmc_surface_handler_construct(xxmc_driver_t *this) { xvmc_surface_handler_t *handler = &this->xvmc_surf_handler; @@ -208,11 +208,11 @@ static void xxmc_xvmc_destroy_subpictures(xxmc_driver_t *this) } pthread_mutex_unlock(&handler->mutex); } - -static XvMCSurface *xxmc_xvmc_alloc_surface(xxmc_driver_t *this, + +static XvMCSurface *xxmc_xvmc_alloc_surface(xxmc_driver_t *this, XvMCContext *context) { - xvmc_surface_handler_t *handler = &this->xvmc_surf_handler; + xvmc_surface_handler_t *handler = &this->xvmc_surf_handler; int i; pthread_mutex_lock(&handler->mutex); @@ -228,7 +228,7 @@ static XvMCSurface *xxmc_xvmc_alloc_surface(xxmc_driver_t *this, for (i=0; i<XVMC_MAX_SURFACES; ++i) { if (!handler->surfInUse[i]) { XVMCLOCKDISPLAY( this->display ); - if (Success != XvMCCreateSurface( this->display, context, + if (Success != XvMCCreateSurface( this->display, context, handler->surfaces + i)) { XVMCUNLOCKDISPLAY( this->display ); pthread_mutex_unlock(&handler->mutex); @@ -247,13 +247,13 @@ static XvMCSurface *xxmc_xvmc_alloc_surface(xxmc_driver_t *this, return NULL; } -static void xxmc_xvmc_free_surface(xxmc_driver_t *this, XvMCSurface *surf) +static void xxmc_xvmc_free_surface(xxmc_driver_t *this, XvMCSurface *surf) { xvmc_surface_handler_t *handler = &this->xvmc_surf_handler; unsigned index = surf - handler->surfaces; - if (index >= XVMC_MAX_SURFACES) return; + if (index >= XVMC_MAX_SURFACES) return; pthread_mutex_lock(&handler->mutex); xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_xxmc: Disposing of surface %d\n",index); @@ -277,7 +277,7 @@ int xxmc_xvmc_surface_valid(xxmc_driver_t *this, XvMCSurface *surf) } static XvMCSubpicture *xxmc_xvmc_alloc_subpicture - (xxmc_driver_t *this, + (xxmc_driver_t *this, XvMCContext *context, unsigned short width, unsigned short height, int xvimage_id) { @@ -290,7 +290,7 @@ static XvMCSubpicture *xxmc_xvmc_alloc_subpicture for (i=0; i<XVMC_MAX_SUBPICTURES; ++i) { if (handler->subValid[i] && !handler->subInUse[i]) { XVMCLOCKDISPLAY( this->display ); - if (XvMCGetSubpictureStatus( this->display, handler->subpictures + i, + if (XvMCGetSubpictureStatus( this->display, handler->subpictures + i, &status)) { XVMCUNLOCKDISPLAY( this->display ); continue; @@ -307,7 +307,7 @@ static XvMCSubpicture *xxmc_xvmc_alloc_subpicture for (i=0; i<XVMC_MAX_SUBPICTURES; ++i) { if (!handler->subInUse[i]) { XVMCLOCKDISPLAY( this->display ); - if (Success != XvMCCreateSubpicture( this->display, context, + if (Success != XvMCCreateSubpicture( this->display, context, handler->subpictures + i, width, height, xvimage_id)) { XVMCUNLOCKDISPLAY( this->display ); @@ -327,14 +327,14 @@ static XvMCSubpicture *xxmc_xvmc_alloc_subpicture return NULL; } -static void xxmc_xvmc_free_subpicture(xxmc_driver_t *this, XvMCSubpicture *sub) +static void xxmc_xvmc_free_subpicture(xxmc_driver_t *this, XvMCSubpicture *sub) { xvmc_surface_handler_t *handler = &this->xvmc_surf_handler; unsigned index = sub - handler->subpictures; - if (index >= XVMC_MAX_SUBPICTURES) return; + if (index >= XVMC_MAX_SUBPICTURES) return; pthread_mutex_lock(&handler->mutex); xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_xxmc: Disposing of subpicture %d\n",index); @@ -346,7 +346,7 @@ static void xxmc_xvmc_free_subpicture(xxmc_driver_t *this, XvMCSubpicture *sub) /* * Callback used by decoder to check that surfaces are still valid, - * and to lock the context so that it won't get destroyed during + * and to lock the context so that it won't get destroyed during * decoding. */ @@ -356,9 +356,9 @@ static int xxmc_lock_and_validate_surfaces(vo_frame_t *cur_frame, vo_frame_t *bw_frame, unsigned pc_type) { - xxmc_driver_t + xxmc_driver_t *driver = (xxmc_driver_t *) cur_frame->driver; - xxmc_frame_t + xxmc_frame_t *frame; xvmc_context_reader_lock( &driver->xvmc_lock ); @@ -377,7 +377,7 @@ static int xxmc_lock_and_validate_surfaces(vo_frame_t *cur_frame, if (!xxmc_xvmc_surface_valid( driver, frame->xvmc_surf)) break; return 0; } - + xvmc_context_reader_unlock( &driver->xvmc_lock ); return -1; } @@ -388,19 +388,19 @@ static int xxmc_lock_and_validate_surfaces(vo_frame_t *cur_frame, static void xxmc_unlock_surfaces(vo_driver_t *this_gen) { - xxmc_driver_t + xxmc_driver_t *driver = (xxmc_driver_t *) this_gen; - + xvmc_context_reader_unlock( &driver->xvmc_lock ); } /* - * Callback for decoder. - * Check that the surface is vaid and + * Callback for decoder. + * Check that the surface is vaid and * flush outstanding rendering requests on this surface. */ -static void xvmc_flush(vo_frame_t *this_gen) +static void xvmc_flush(vo_frame_t *this_gen) { xxmc_frame_t @@ -412,7 +412,7 @@ static void xvmc_flush(vo_frame_t *this_gen) if ( ! xxmc_xvmc_surface_valid( driver, frame->xvmc_surf)) { frame->xxmc_data.result = 128; - xvmc_context_reader_unlock( &driver->xvmc_lock ); + xvmc_context_reader_unlock( &driver->xvmc_lock ); return; } @@ -432,10 +432,10 @@ static void xvmc_flush(vo_frame_t *this_gen) * using a call to XvMCBlendSubpicture2 with a blank subpicture. */ -static void xxmc_duplicate_frame_data(vo_frame_t *this_gen, - vo_frame_t *original) +static void xxmc_duplicate_frame_data(vo_frame_t *this_gen, + vo_frame_t *original) { - xxmc_frame_t *this = (xxmc_frame_t *) this_gen, + xxmc_frame_t *this = (xxmc_frame_t *) this_gen, *orig = (xxmc_frame_t *) original; xxmc_driver_t *driver = (xxmc_driver_t *) this_gen->driver; xine_t *xine = driver->xine; @@ -450,25 +450,25 @@ static void xxmc_duplicate_frame_data(vo_frame_t *this_gen, if (!xxmc_xvmc_surface_valid(driver,orig->xvmc_surf)) { xvmc_context_writer_unlock( &driver->xvmc_lock ); return; - } + } this->xxmc_data = *xxmc; this->width = original->width; this->height = original->height; this->format = original->format; this->ratio = original->ratio; - - xxmc_frame_updates(driver,this,0); + + xxmc_frame_updates(driver,this,0); /* - * Allocate a dummy subpicture and copy using - * XvMCBlendsubpicture2. VLD implementations can do blending with a + * Allocate a dummy subpicture and copy using + * XvMCBlendsubpicture2. VLD implementations can do blending with a * NULL subpicture. Use that if possible. */ need_dummy = (xxmc->acceleration != XINE_XVMC_ACCEL_VLD); tmp = NULL; if (need_dummy) { - tmp = xxmc_xvmc_alloc_subpicture( driver, &driver->context, + tmp = xxmc_xvmc_alloc_subpicture( driver, &driver->context, this->width, this->height, driver->xvmc_cap [driver->xvmc_cur_cap].subPicType.id); @@ -477,20 +477,20 @@ static void xxmc_duplicate_frame_data(vo_frame_t *this_gen, XVMCLOCKDISPLAY( driver->display ); if (tmp) XvMCClearSubpicture(driver->display, tmp , 0,0, this->width, this->height, 0); - if (Success == XvMCBlendSubpicture2( driver->display, orig->xvmc_surf, + if (Success == XvMCBlendSubpicture2( driver->display, orig->xvmc_surf, this->xvmc_surf, tmp, - 0,0,this->width, this->height, + 0,0,this->width, this->height, 0,0,this->width, this->height)) { this->xxmc_data.decoded = 1; } XVMCUNLOCKDISPLAY( driver->display ); if (tmp) xxmc_xvmc_free_subpicture( driver, tmp); } - + xvmc_context_writer_unlock( &driver->xvmc_lock ); xprintf(xine, XINE_VERBOSITY_DEBUG, "Duplicated XvMC frame %d %d.\n", this->width,this->height); -} +} static uint32_t xxmc_get_capabilities (vo_driver_t *this_gen) { xxmc_driver_t *this = (xxmc_driver_t *) this_gen; @@ -499,7 +499,7 @@ static uint32_t xxmc_get_capabilities (vo_driver_t *this_gen) { } -static void xxmc_frame_field (vo_frame_t *vo_img, int which_field) +static void xxmc_frame_field (vo_frame_t *vo_img, int which_field) { lprintf ("xvmc_frame_field\n"); } @@ -544,13 +544,13 @@ static void xxmc_frame_dispose (vo_frame_t *vo_img) { */ static vo_frame_t *xxmc_alloc_frame (vo_driver_t *this_gen) { - xxmc_driver_t *this = (xxmc_driver_t *) this_gen; + xxmc_driver_t *this = (xxmc_driver_t *) this_gen; xxmc_frame_t *frame ; frame = calloc(1, sizeof (xxmc_frame_t)); if (!frame) return NULL; - + pthread_mutex_init (&frame->vo_frame.mutex, NULL); frame->xvmc_surf = NULL; @@ -575,7 +575,7 @@ static vo_frame_t *xxmc_alloc_frame (vo_driver_t *this_gen) { static int HandleXError (Display *display, XErrorEvent *xevent) { char str [1024]; - + XGetErrorText (display, xevent->error_code, str, 1024); printf ("received X error event: %s\n", str); gX11Fail = 1; @@ -607,7 +607,7 @@ static XvImage *create_ximage (xxmc_driver_t *this, XShmSegmentInfo *shminfo, } switch (format) { - case XINE_IMGFMT_YV12: + case XINE_IMGFMT_YV12: xv_format = this->xv_format_yv12; break; case XINE_IMGFMT_YUY2: @@ -753,7 +753,7 @@ static void xxmc_dispose_context(xxmc_driver_t *driver) XvMCDestroyMacroBlocks( driver->display, ¯oblocks->macro_blocks ); XvMCDestroyBlocks( driver->display , ¯oblocks->blocks ); } - + xprintf(driver->xine, XINE_VERBOSITY_LOG, "video_out_xxmc: Freeing up XvMC Surfaces and subpictures.\n"); if (driver->xvmc_palette) free(driver->xvmc_palette); @@ -763,15 +763,15 @@ static void xxmc_dispose_context(xxmc_driver_t *driver) xprintf(driver->xine, XINE_VERBOSITY_LOG, "video_out_xxmc: Freeing up XvMC Context.\n"); XLockDisplay (driver->display); - if (driver->subImage) - dispose_ximage(driver, &driver->subShmInfo, driver->subImage); + if (driver->subImage) + dispose_ximage(driver, &driver->subShmInfo, driver->subImage); driver->subImage = NULL; XUnlockDisplay (driver->display); XVMCLOCKDISPLAY( driver->display ); XvMCDestroyContext( driver->display, &driver->context); XVMCUNLOCKDISPLAY( driver->display ); driver->contextActive = 0; - driver->hwSubpictures = 0; + driver->hwSubpictures = 0; driver->xvmc_accel = 0; } } @@ -779,7 +779,7 @@ static void xxmc_dispose_context(xxmc_driver_t *driver) /* * Find a suitable XvMC Context according to the acceleration request * passed to us in the xxmc variable, and to the acceleration type - * priority set up in this plugin. Result is returned in + * priority set up in this plugin. Result is returned in * driver->xvmc_cur_cap. */ @@ -793,7 +793,7 @@ static int xxmc_find_context(xxmc_driver_t *driver, xine_xxmc_t *xxmc, request_mpeg_flags = xxmc->mpeg; found = 0; curCap = NULL; - + for (k = 0; k < NUM_ACCEL_PRIORITY; ++k) { request_accel_flags = xxmc->acceleration & accel_priority[k]; if (!request_accel_flags) continue; @@ -827,7 +827,7 @@ static int xxmc_find_context(xxmc_driver_t *driver, xine_xxmc_t *xxmc, } driver->xvmc_accel = 0; return 0; -} +} static int xxmc_create_context(xxmc_driver_t *driver, unsigned width, unsigned height) { @@ -837,9 +837,9 @@ static int xxmc_create_context(xxmc_driver_t *driver, unsigned width, unsigned h xprintf(driver->xine, XINE_VERBOSITY_LOG, "video_out_xxmc: Creating new XvMC Context %d\n",curCap->type_id); XVMCLOCKDISPLAY( driver->display ); - if (Success == XvMCCreateContext( driver->display, driver->xv_port, + if (Success == XvMCCreateContext( driver->display, driver->xv_port, curCap->type_id, width, - height, driver->context_flags, + height, driver->context_flags, &driver->context)) { driver->xvmc_mpeg = curCap->mpeg_flags; driver->xvmc_width = width; @@ -860,26 +860,26 @@ static void xxmc_setup_subpictures(xxmc_driver_t *driver, unsigned width, unsign /* * Determine if we can use hardware subpictures, and in that case, set up an * XvImage that we can use for blending. - */ + */ curCap = driver->xvmc_cap + driver->xvmc_cur_cap; - if ((width > curCap->sub_max_width) || + if ((width > curCap->sub_max_width) || (height > curCap->sub_max_height)) return; - if ((driver->xvmc_backend_subpic = (curCap->flags & XVMC_BACKEND_SUBPICTURE))) + if ((driver->xvmc_backend_subpic = (curCap->flags & XVMC_BACKEND_SUBPICTURE))) xprintf(driver->xine, XINE_VERBOSITY_LOG, "video_out_xxmc: Using Backend subpictures.\n"); - + if (!driver->subImage) { /* * Note: If other image formats than xx44 are to be used here, they must be - * translated to XINE_IMGFMT_XXX, since that is what create_ximage + * translated to XINE_IMGFMT_XXX, since that is what create_ximage * expects. */ XLockDisplay (driver->display); - driver->subImage = + driver->subImage = create_ximage(driver, &driver->subShmInfo, width, height, curCap->subPicType.id); XUnlockDisplay (driver->display); if (NULL == driver->subImage) { @@ -889,15 +889,15 @@ static void xxmc_setup_subpictures(xxmc_driver_t *driver, unsigned width, unsign } } - sp = xxmc_xvmc_alloc_subpicture( driver, &driver->context, width, + sp = xxmc_xvmc_alloc_subpicture( driver, &driver->context, width, height, curCap->subPicType.id); if (sp == NULL) return; _x_init_xx44_palette( &driver->palette, sp->num_palette_entries); - driver->xvmc_palette = (char *) xine_xmalloc(sp->num_palette_entries + driver->xvmc_palette = (char *) xine_xmalloc(sp->num_palette_entries * sp->entry_bytes); xxmc_xvmc_free_subpicture( driver, sp); - if (driver->xvmc_palette == NULL) return; + if (driver->xvmc_palette == NULL) return; driver->hwSubpictures = 1; } } @@ -927,8 +927,8 @@ static int xxmc_mocomp_create_macroblocks(xxmc_driver_t *driver, xxmc->xvmc.macroblocks = (xine_macroblocks_t *)macroblocks; return 1; -} - +} + static void xvmc_check_colorkey_properties(xxmc_driver_t *driver) { int num,i; @@ -943,7 +943,7 @@ static void xvmc_check_colorkey_properties(xxmc_driver_t *driver) driver->have_xvmc_autopaint = 0; if (driver->context_flags & XVMC_OVERLAID_SURFACE) { XVMCLOCKDISPLAY( driver->display ); - xvmc_attributes = XvMCQueryAttributes( driver->display, + xvmc_attributes = XvMCQueryAttributes( driver->display, &driver->context, &num); if (xvmc_attributes) { @@ -953,7 +953,7 @@ static void xvmc_check_colorkey_properties(xxmc_driver_t *driver) XvMCSetAttribute(driver->display, &driver->context,ap, driver->props[VO_PROP_AUTOPAINT_COLORKEY].value); driver->have_xvmc_autopaint = 1; - } + } } } XFree(xvmc_attributes); @@ -966,16 +966,16 @@ static void xvmc_check_colorkey_properties(xxmc_driver_t *driver) static int xxmc_xvmc_update_context(xxmc_driver_t *driver, xxmc_frame_t *frame, - uint32_t width, uint32_t height, int frame_format_xxmc) + uint32_t width, uint32_t height, int frame_format_xxmc) { xine_xxmc_t *xxmc = &frame->xxmc_data; /* * Are we at all capable of doing XvMC ? - */ + */ - - if (driver->xvmc_cap == 0) + + if (driver->xvmc_cap == 0) return 0; xprintf(driver->xine, XINE_VERBOSITY_LOG, @@ -986,18 +986,18 @@ static int xxmc_xvmc_update_context(xxmc_driver_t *driver, xxmc_frame_t *frame, " mpeg: %d acceleration: %d", xxmc->mpeg, xxmc->acceleration); } xprintf(driver->xine, XINE_VERBOSITY_LOG, "\n"); - + if (frame->xvmc_surf) xxmc_xvmc_free_surface( driver , frame->xvmc_surf); frame->xvmc_surf = NULL; xxmc_dispose_context( driver ); - + if (frame_format_xxmc && xxmc_find_context( driver, xxmc, width, height )) { xxmc_create_context( driver, width, height); xvmc_check_colorkey_properties( driver ); xxmc_setup_subpictures(driver, width, height); - if ((driver->xvmc_accel & + if ((driver->xvmc_accel & (XINE_XVMC_ACCEL_MOCOMP | XINE_XVMC_ACCEL_IDCT))) { if (!xxmc_mocomp_create_macroblocks(driver, frame, 1)) { lprintf("video_out_xxmc: ERROR: Macroblock allocation failed\n"); @@ -1012,15 +1012,15 @@ static int xxmc_xvmc_update_context(xxmc_driver_t *driver, xxmc_frame_t *frame, } else { printf("video_out_xxmc: Using hardware decoding for this stream.\n"); } - + driver->xvmc_mpeg = xxmc->mpeg; driver->xvmc_width = width; driver->xvmc_height = height; return driver->contextActive; } -static void xxmc_frame_updates(xxmc_driver_t *driver, - xxmc_frame_t *frame, +static void xxmc_frame_updates(xxmc_driver_t *driver, + xxmc_frame_t *frame, int init_macroblocks) { xine_xxmc_t *xxmc = &frame->xxmc_data; @@ -1041,10 +1041,10 @@ static void xxmc_frame_updates(xxmc_driver_t *driver, /* * If it is NULL create a new surface. - */ + */ if (frame->xvmc_surf == NULL) { - if (NULL == (frame->xvmc_surf = + if (NULL == (frame->xvmc_surf = xxmc_xvmc_alloc_surface( driver, &driver->context))) { fprintf(stderr, "video_out_xxmc: ERROR: Accelerated surface allocation failed.\n" "video_out_xxmc: You are probably out of framebuffer memory.\n" @@ -1052,7 +1052,7 @@ static void xxmc_frame_updates(xxmc_driver_t *driver, driver->xvmc_accel = 0; xxmc_dispose_context( driver ); return; - } + } xxmc->xvmc.macroblocks = (xine_macroblocks_t *) &driver->macroblocks; xxmc->xvmc.macroblocks->xvmc_accel = (driver->unsigned_intra) ? 0 : XINE_VO_SIGNED_INTRA; @@ -1071,7 +1071,7 @@ static void xxmc_frame_updates(xxmc_driver_t *driver, xxmc->proc_xxmc_flush = xvmc_flush; xxmc->proc_xxmc_lock_valid = xxmc_lock_and_validate_surfaces; xxmc->proc_xxmc_unlock = xxmc_unlock_surfaces; - + xxmc->xvmc.proc_macro_block = xxmc_xvmc_proc_macro_block; frame->vo_frame.proc_duplicate_frame_data = xxmc_duplicate_frame_data; #ifdef HAVE_VLDXVMC @@ -1083,7 +1083,7 @@ static void xxmc_frame_updates(xxmc_driver_t *driver, if (init_macroblocks) { driver->macroblocks.num_blocks = 0; driver->macroblocks.macroblockptr = driver->macroblocks.macroblockbaseptr; - driver->macroblocks.xine_mc.blockptr = + driver->macroblocks.xine_mc.blockptr = driver->macroblocks.xine_mc.blockbaseptr; } xxmc->acceleration = driver->xvmc_accel; @@ -1105,7 +1105,7 @@ static void dispose_ximage (xxmc_driver_t *this, shminfo->shmid = -1; } - } + } else { if (myimage->data) free(myimage->data); XFree (myimage); @@ -1125,29 +1125,29 @@ static void xxmc_do_update_frame_xv(vo_driver_t *this_gen, if (this->use_pitch_alignment) { width = (width + 7) & ~0x7; } - + if ((frame->width != width) || (frame->height != height) || (frame->last_sw_format != format)) { - + frame->last_sw_format = format; XLockDisplay (this->display); - + /* * (re-) allocate xvimage */ - + if (frame->image) { dispose_ximage (this, &frame->shminfo, frame->image); frame->image = NULL; } - + frame->image = create_ximage (this, &frame->shminfo, width, height, format); - + if(format == XINE_IMGFMT_YUY2) { frame->vo_frame.pitches[0] = frame->image->pitches[0]; frame->vo_frame.base[0] = frame->image->data + frame->image->offsets[0]; - } + } else { frame->vo_frame.pitches[0] = frame->image->pitches[0]; frame->vo_frame.pitches[1] = frame->image->pitches[2]; @@ -1156,14 +1156,14 @@ static void xxmc_do_update_frame_xv(vo_driver_t *this_gen, frame->vo_frame.base[1] = frame->image->data + frame->image->offsets[2]; frame->vo_frame.base[2] = frame->image->data + frame->image->offsets[1]; } - + XUnlockDisplay (this->display); } frame->ratio = ratio; frame->width = width; frame->height = height; - frame->format = format; + frame->format = format; frame->vo_frame.format = frame->format; } @@ -1180,7 +1180,7 @@ static int xxmc_accel_update(xxmc_driver_t *driver, /* * Same acceleration request. No need to change. - */ + */ if (last_request == new_request) return 0; @@ -1199,7 +1199,7 @@ static int xxmc_accel_update(xxmc_driver_t *driver, if (new_request & accel_priority[k]) return 1; } - /* + /* * Should never get here. */ @@ -1229,10 +1229,10 @@ static void xxmc_do_update_frame(vo_driver_t *this_gen, this->last_accel_request = xxmc->acceleration; } - if (this->contextActive) + if (this->contextActive) xxmc_frame_updates(this, frame, 1); - xxmc_do_update_frame_xv(this_gen, frame_gen, width, height, ratio, + xxmc_do_update_frame_xv(this_gen, frame_gen, width, height, ratio, xxmc->fallback_format, flags); if (!this->contextActive) { @@ -1245,7 +1245,7 @@ static void xxmc_do_update_frame(vo_driver_t *this_gen, } xvmc_context_writer_unlock( &this->xvmc_lock); - + } else { /* switch back to an unaccelerated context */ if (this->last_accel_request != 0xFFFFFFFF) { @@ -1253,7 +1253,7 @@ static void xxmc_do_update_frame(vo_driver_t *this_gen, xxmc_xvmc_update_context(this, frame, width, height, 0); } frame->vo_frame.proc_duplicate_frame_data = NULL; - xxmc_do_update_frame_xv(this_gen, frame_gen, width, height, ratio, + xxmc_do_update_frame_xv(this_gen, frame_gen, width, height, ratio, format, flags); } } @@ -1261,7 +1261,7 @@ static void xxmc_do_update_frame(vo_driver_t *this_gen, static void xxmc_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_gen, uint32_t width, uint32_t height, - double ratio, int format, int flags) + double ratio, int format, int flags) { if (format != XINE_IMGFMT_XXMC) { @@ -1279,7 +1279,7 @@ static void xxmc_update_frame_format(vo_driver_t *this_gen, xine_xxmc_t *xxmc = (xine_xxmc_t *)frame_gen->accel_data; xxmc->decoded = 0; xxmc->proc_xxmc_update_frame = xxmc_do_update_frame; - frame_gen->proc_duplicate_frame_data = xxmc_duplicate_frame_data; + frame_gen->proc_duplicate_frame_data = xxmc_duplicate_frame_data; } } @@ -1301,16 +1301,16 @@ static int xxmc_clean_output_area (xxmc_driver_t *this, int xvmc_active) { this->sc.border[i].w, this->sc.border[i].h); } } - + /* * XvMC does not support autopainting regardless of whether there's an - * Xv attribute for it. However, if there is an XvMC attribute for - * autopainting, we should be able to assume it is supported. + * Xv attribute for it. However, if there is an XvMC attribute for + * autopainting, we should be able to assume it is supported. * That support is checked whenever a context is changed. */ - autopainting = (this->props[VO_PROP_AUTOPAINT_COLORKEY].value == 1); - if ((xvmc_active && + autopainting = (this->props[VO_PROP_AUTOPAINT_COLORKEY].value == 1); + if ((xvmc_active && (this->context_flags & XVMC_OVERLAID_SURFACE) && (! this->have_xvmc_autopaint || ! autopainting)) || @@ -1323,12 +1323,12 @@ static int xxmc_clean_output_area (xxmc_driver_t *this, int xvmc_active) { } else { ret = 0; } - + if (this->xoverlay) { x11osd_resize (this->xoverlay, this->sc.gui_width, this->sc.gui_height); this->ovl_changed = 1; } - + XUnlockDisplay (this->display); return ret; } @@ -1354,11 +1354,11 @@ static void xxmc_compute_output_size (xxmc_driver_t *this) { } -static void xxmc_check_xoverlay_type(xxmc_driver_t *driver, xxmc_frame_t *frame) +static void xxmc_check_xoverlay_type(xxmc_driver_t *driver, xxmc_frame_t *frame) { int - new_overlay_type = (frame->format == XINE_IMGFMT_XXMC) ? + new_overlay_type = (frame->format == XINE_IMGFMT_XXMC) ? driver->xvmc_xoverlay_type : driver->xv_xoverlay_type; if (driver->xoverlay_type != new_overlay_type) { printf("Warning! Changing xoverlay\n"); @@ -1371,40 +1371,40 @@ static void xxmc_check_xoverlay_type(xxmc_driver_t *driver, xxmc_frame_t *frame) } -static void xxmc_overlay_begin (vo_driver_t *this_gen, +static void xxmc_overlay_begin (vo_driver_t *this_gen, vo_frame_t *frame_gen, int changed) { xxmc_driver_t *this = (xxmc_driver_t *) this_gen; xxmc_frame_t *frame = (xxmc_frame_t *) frame_gen; this->ovl_changed += changed; - + xvmc_context_reader_lock( &this->xvmc_lock ); - if ((frame->format == XINE_IMGFMT_XXMC) && + if ((frame->format == XINE_IMGFMT_XXMC) && !xxmc_xvmc_surface_valid(this, frame->xvmc_surf)) { xvmc_context_reader_unlock( &this->xvmc_lock ); return; } if( this->ovl_changed && this->xoverlay ) { - + XLockDisplay (this->display); xxmc_check_xoverlay_type(this, frame); - x11osd_clear(this->xoverlay); + x11osd_clear(this->xoverlay); XUnlockDisplay (this->display); - } - if (this->ovl_changed && (frame->format == XINE_IMGFMT_XXMC) && + } + if (this->ovl_changed && (frame->format == XINE_IMGFMT_XXMC) && this->hwSubpictures ) { this->new_subpic = xxmc_xvmc_alloc_subpicture - ( this, &this->context, this->xvmc_width, - this->xvmc_height, + ( this, &this->context, this->xvmc_width, + this->xvmc_height, this->xvmc_cap[this->xvmc_cur_cap].subPicType.id); if (this->new_subpic) { this->first_overlay = 1; XVMCLOCKDISPLAY( this->display ); - XvMCClearSubpicture(this->display, this->new_subpic, 0,0, + XvMCClearSubpicture(this->display, this->new_subpic, 0,0, this->xvmc_width, this->xvmc_height, 0x00); XVMCUNLOCKDISPLAY( this->display ); @@ -1412,22 +1412,22 @@ static void xxmc_overlay_begin (vo_driver_t *this_gen, } } xvmc_context_reader_unlock( &this->xvmc_lock ); - + this->alphablend_extra_data.offset_x = frame_gen->overlay_offset_x; this->alphablend_extra_data.offset_y = frame_gen->overlay_offset_y; } -static void xxmc_overlay_end (vo_driver_t *this_gen, vo_frame_t *vo_img) +static void xxmc_overlay_end (vo_driver_t *this_gen, vo_frame_t *vo_img) { xxmc_driver_t *this = (xxmc_driver_t *) this_gen; xxmc_frame_t *frame = (xxmc_frame_t *) vo_img; - + if( this->ovl_changed && this->xoverlay ) { XLockDisplay (this->display); x11osd_expose(this->xoverlay); XUnlockDisplay (this->display); - } + } if ((frame->format == XINE_IMGFMT_XXMC) && this->hwSubpictures) { LOCK_AND_SURFACE_VALID( this, frame->xvmc_surf ); if (this->ovl_changed) { @@ -1444,7 +1444,7 @@ static void xxmc_overlay_end (vo_driver_t *this_gen, vo_frame_t *vo_img) this->reverse_nvidia_palette ? "YVU" : this->old_subpic->component_order); XVMCLOCKDISPLAY( this->display ); - XvMCSetSubpicturePalette( this->display, this->old_subpic, + XvMCSetSubpicturePalette( this->display, this->old_subpic, this->xvmc_palette); XvMCFlushSubpicture( this->display , this->old_subpic); XvMCSyncSubpicture( this->display, this->old_subpic ); @@ -1455,14 +1455,14 @@ static void xxmc_overlay_end (vo_driver_t *this_gen, vo_frame_t *vo_img) XVMCLOCKDISPLAY( this->display ); if (this->xvmc_backend_subpic ) { XvMCBlendSubpicture( this->display, frame->xvmc_surf, - this->old_subpic,0,0,this->xvmc_width, + this->old_subpic,0,0,this->xvmc_width, this->xvmc_height, 0, 0, this->xvmc_width, this->xvmc_height ); } else { - XvMCBlendSubpicture2( this->display, frame->xvmc_surf, + XvMCBlendSubpicture2( this->display, frame->xvmc_surf, frame->xvmc_surf, - this->old_subpic, 0,0,this->xvmc_width, - this->xvmc_height,0,0,this->xvmc_width, + this->old_subpic, 0,0,this->xvmc_width, + this->xvmc_height,0,0,this->xvmc_width, this->xvmc_height); } XVMCUNLOCKDISPLAY( this->display ); @@ -1473,8 +1473,8 @@ static void xxmc_overlay_end (vo_driver_t *this_gen, vo_frame_t *vo_img) } -static void xxmc_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, - vo_overlay_t *overlay) +static void xxmc_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, + vo_overlay_t *overlay) { xxmc_driver_t *this = (xxmc_driver_t *) this_gen; xxmc_frame_t *frame = (xxmc_frame_t *) frame_gen; @@ -1484,7 +1484,7 @@ static void xxmc_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, if( overlay->unscaled ) { if( this->ovl_changed && this->xoverlay ) { XLockDisplay (this->display); - x11osd_blend(this->xoverlay, overlay); + x11osd_blend(this->xoverlay, overlay); XUnlockDisplay (this->display); } } else if (frame->format == XINE_IMGFMT_XXMC) { @@ -1497,7 +1497,7 @@ static void xxmc_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, this->subImage->height); this->first_overlay = 0; } - _x_blend_xx44(this->subImage->data, overlay, this->subImage->width, + _x_blend_xx44(this->subImage->data, overlay, this->subImage->width, this->subImage->height, this->subImage->width, &this->alphablend_extra_data, &this->palette, (this->subImage->id == FOURCC_IA44)); @@ -1509,7 +1509,7 @@ static void xxmc_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, y1 = y0 + overlay->height; w = this->subImage->width; h = this->subImage->height; - + x0 = (x0 < 0) ? 0 : ((x0 > w) ? w : x0); y0 = (y0 < 0) ? 0 : ((y0 > h) ? h : y0); x1 = (x1 < 0) ? 0 : ((x1 > w) ? w : x1); @@ -1518,22 +1518,22 @@ static void xxmc_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, /* anything left after clipping? */ if (x0 != x1 && y0 != y1) { XVMCLOCKDISPLAY( this->display ); - XvMCCompositeSubpicture( this->display, this->new_subpic, - this->subImage, + XvMCCompositeSubpicture( this->display, this->new_subpic, + this->subImage, x0, y0, x1 - x0, y1 - y0, x0, y0); XVMCUNLOCKDISPLAY( this->display ); } - xvmc_context_reader_unlock( &this->xvmc_lock ); + xvmc_context_reader_unlock( &this->xvmc_lock ); } } - } else { + } else { if (frame->format == XINE_IMGFMT_YV12) { - _x_blend_yuv(frame->vo_frame.base, overlay, + _x_blend_yuv(frame->vo_frame.base, overlay, frame->width, frame->height, frame->vo_frame.pitches, &this->alphablend_extra_data); } else { - _x_blend_yuy2(frame->vo_frame.base[0], overlay, + _x_blend_yuy2(frame->vo_frame.base[0], overlay, frame->width, frame->height, frame->vo_frame.pitches[0], &this->alphablend_extra_data); } @@ -1541,7 +1541,7 @@ static void xxmc_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, } } -static void xxmc_add_recent_frame (xxmc_driver_t *this, xxmc_frame_t *frame) +static void xxmc_add_recent_frame (xxmc_driver_t *this, xxmc_frame_t *frame) { int i; i = VO_NUM_RECENT_FRAMES-1; @@ -1555,11 +1555,11 @@ static void xxmc_add_recent_frame (xxmc_driver_t *this, xxmc_frame_t *frame) this->recent_frames[0] = frame; } -static int xxmc_redraw_needed (vo_driver_t *this_gen) +static int xxmc_redraw_needed (vo_driver_t *this_gen) { xxmc_driver_t *this = (xxmc_driver_t *) this_gen; int ret = 0; - + if( this->cur_frame ) { this->sc.delivered_height = this->cur_frame->height; @@ -1576,8 +1576,8 @@ static int xxmc_redraw_needed (vo_driver_t *this_gen) if( _x_vo_scale_redraw_needed( &this->sc ) ) { xxmc_compute_output_size (this); - - xxmc_clean_output_area + + xxmc_clean_output_area (this, (this->cur_frame->format == XINE_IMGFMT_XXMC)); ret = 1; @@ -1589,7 +1589,7 @@ static int xxmc_redraw_needed (vo_driver_t *this_gen) return ret; } -static void xxmc_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) +static void xxmc_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { xxmc_driver_t *this = (xxmc_driver_t *) this_gen; xxmc_frame_t *frame = (xxmc_frame_t *) frame_gen; @@ -1623,7 +1623,7 @@ static void xxmc_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) * reset this flag now -- it will be set again before the next call to * xxmc_display_frame() as long as there is a scaled OSD active on screen. */ - this->scaled_osd_active = 0; + this->scaled_osd_active = 0; /* * queue frames (deinterlacing) @@ -1681,7 +1681,7 @@ static void xxmc_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) this->sc.displayed_xoffset, this->sc.displayed_yoffset, this->sc.displayed_width, this->sc.displayed_height, this->sc.output_xoffset, this->sc.output_yoffset, - this->sc.output_width, this->sc.output_height, + this->sc.output_width, this->sc.output_height, this->cur_field); XUnlockDisplay( this->display ); /* unblocks XINE_GUI_SEND_DRAWABLE_CHANGED from changing drawable */ XVMCUNLOCKDISPLAY( this->display ); @@ -1717,12 +1717,12 @@ static void xxmc_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) this->sc.displayed_xoffset, this->sc.displayed_yoffset, this->sc.displayed_width, this->sc.displayed_height, this->sc.output_xoffset, this->sc.output_yoffset, - this->sc.output_width, this->sc.output_height, + this->sc.output_width, this->sc.output_height, this->cur_field); XUnlockDisplay( this->display ); /* unblocks XINE_GUI_SEND_DRAWABLE_CHANGED from changing drawable */ XVMCUNLOCKDISPLAY( this->display ); } - } + } } else { XLockDisplay (this->display); if (this->use_shm) { @@ -1789,7 +1789,7 @@ static void xxmc_property_callback (void *property_gen, xine_cfg_entry_t *entry) if (this->contextActive) { XVMCLOCKDISPLAY( this->display ); XvMCSetAttribute(this->display, &this->context, - property->atom, + property->atom, entry->num_value); XVMCUNLOCKDISPLAY( this->display ); } @@ -1809,7 +1809,7 @@ static int xxmc_set_property (vo_driver_t *this_gen, if (this->contextActive) { XVMCLOCKDISPLAY( this->display ); XvMCSetAttribute(this->display, &this->context, - this->props[property].atom, + this->props[property].atom, value); XVMCUNLOCKDISPLAY( this->display ); } @@ -1827,7 +1827,7 @@ static int xxmc_set_property (vo_driver_t *this_gen, this->props[property].entry->num_value = this->props[property].value; return this->props[property].value; - } + } else { switch (property) { @@ -1843,7 +1843,7 @@ static int xxmc_set_property (vo_driver_t *this_gen, value = XINE_VO_ASPECT_AUTO; this->props[property].value = value; - xprintf(this->xine, XINE_VERBOSITY_LOG, + xprintf(this->xine, XINE_VERBOSITY_LOG, "video_out_xxmc: VO_PROP_ASPECT_RATIO(%d)\n", this->props[property].value); this->sc.user_ratio = value; @@ -1857,7 +1857,7 @@ static int xxmc_set_property (vo_driver_t *this_gen, this->props[property].value = value; xprintf(this->xine, XINE_VERBOSITY_LOG, "video_out_xxmc: VO_PROP_ZOOM_X = %d\n", this->props[property].value); - + this->sc.zoom_factor_x = (double)value / (double)XINE_VO_ZOOM_STEP; xxmc_compute_ideal_size (this); @@ -1902,7 +1902,7 @@ static int xxmc_gui_data_exchange (vo_driver_t *this_gen, case XINE_GUI_SEND_COMPLETION_EVENT: break; #endif - + case XINE_GUI_SEND_EXPOSE_EVENT: { /* XExposeEvent * xev = (XExposeEvent *) data; */ @@ -1914,7 +1914,7 @@ static int xxmc_gui_data_exchange (vo_driver_t *this_gen, if ((frame->format == XINE_IMGFMT_XXMC) && (!xxmc->decoded || !xxmc_xvmc_surface_valid(this, frame->xvmc_surf))) { xvmc_context_reader_unlock( &this->xvmc_lock ); - if (! xxmc_redraw_needed (this_gen)) + if (! xxmc_redraw_needed (this_gen)) xxmc_clean_output_area(this, (frame->format == XINE_IMGFMT_XXMC)); break; } @@ -1928,8 +1928,8 @@ static int xxmc_gui_data_exchange (vo_driver_t *this_gen, this->sc.displayed_xoffset, this->sc.displayed_yoffset, this->sc.displayed_width, this->sc.displayed_height, this->sc.output_xoffset, this->sc.output_yoffset, - this->sc.output_width, this->sc.output_height, - this->cur_field); + this->sc.output_width, this->sc.output_height, + this->cur_field); XVMCUNLOCKDISPLAY( this->display ); } else { XLockDisplay (this->display); @@ -1954,10 +1954,10 @@ static int xxmc_gui_data_exchange (vo_driver_t *this_gen, xvmc_context_reader_unlock( &this->xvmc_lock ); } if(this->xoverlay) - x11osd_expose(this->xoverlay); - + x11osd_expose(this->xoverlay); + } - + break; case XINE_GUI_SEND_DRAWABLE_CHANGED: @@ -2000,7 +2000,7 @@ static void xxmc_dispose (vo_driver_t *this_gen) { xxmc_driver_t *this = (xxmc_driver_t *) this_gen; int i; - + if (this->xvmc_cap) { xvmc_context_writer_lock( &this->xvmc_lock ); xxmc_dispose_context( this ); @@ -2037,7 +2037,7 @@ static void xxmc_dispose (vo_driver_t *this_gen) { free_context_lock(&this->xvmc_lock); _x_alphablend_free(&this->alphablend_extra_data); - + free (this); } @@ -2048,7 +2048,7 @@ static int xxmc_check_yv12 (Display *display, XvPortID port) { int i; formatValues = XvListImageFormats (display, port, &formats); - + for (i = 0; i < formats; i++) if ((formatValues[i].id == XINE_IMGFMT_YV12) && (! (strcmp (formatValues[i].guid, "YV12")))) { @@ -2069,7 +2069,7 @@ static void xxmc_check_capability (xxmc_driver_t *this, int int_default; cfg_entry_t *entry; const char *str_prop = attr.name; - + if (VO_PROP_COLORKEY && (attr.max_value == ~0)) attr.max_value = 2147483615; @@ -2088,7 +2088,7 @@ static void xxmc_check_capability (xxmc_driver_t *this, */ if(strcmp(str_prop, "XV_AUTOPAINT_COLORKEY") == 0) int_default = 1; - + if (config_name) { /* is this a boolean property ? */ if ((attr.min_value == 0) && (attr.max_value == 1)) { @@ -2105,12 +2105,12 @@ static void xxmc_check_capability (xxmc_driver_t *this, entry = this->config->lookup_entry (this->config, config_name); - if((entry->num_value < this->props[property].min) || + if((entry->num_value < this->props[property].min) || (entry->num_value > this->props[property].max)) { - this->config->update_num(this->config, config_name, + this->config->update_num(this->config, config_name, ((this->props[property].min + this->props[property].max) >> 1)); - + entry = this->config->lookup_entry (this->config, config_name); } @@ -2118,13 +2118,13 @@ static void xxmc_check_capability (xxmc_driver_t *this, xxmc_set_property (&this->vo_driver, property, entry->num_value); - + if (strcmp(str_prop, "XV_COLORKEY") == 0) { this->use_colorkey |= 1; this->colorkey = entry->num_value; } else if(strcmp(str_prop, "XV_AUTOPAINT_COLORKEY") == 0) { if(entry->num_value==1) - this->use_colorkey |= 2; + this->use_colorkey |= 2; } } else this->props[property].value = int_default; @@ -2241,13 +2241,13 @@ static XvPortID xxmc_autodetect_port(xxmc_driver_t *this, } -static void checkXvMCCap( xxmc_driver_t *this, XvPortID xv_port) +static void checkXvMCCap( xxmc_driver_t *this, XvPortID xv_port) { int numSurf,numSub,i,j; XvMCSurfaceInfo *surfaceInfo,*curInfo; - XvMCContext + XvMCContext c; xvmc_capabilities_t *curCap; @@ -2266,13 +2266,13 @@ static void checkXvMCCap( xxmc_driver_t *this, XvPortID xv_port) XVMCLOCKDISPLAY( this->display ); - if ( !XvMCQueryExtension(this->display, &this->xvmc_eventbase, + if ( !XvMCQueryExtension(this->display, &this->xvmc_eventbase, &this->xvmc_errbase)) { XVMCUNLOCKDISPLAY( this->display ); xvmc_context_writer_unlock( &this->xvmc_lock ); return; } - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_xxmc: XvMC extension present.\n"); surfaceInfo = XvMCListSurfaceTypes(this->display, xv_port, &numSurf); @@ -2288,56 +2288,56 @@ static void checkXvMCCap( xxmc_driver_t *this, XvPortID xv_port) curInfo = surfaceInfo; curCap = this->xvmc_cap; - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_xxmc: Found %d XvMC surface types\n",numSurf); for (i=0; i< numSurf; ++i) { curCap->mpeg_flags = 0; curCap->accel_flags = 0; if (curInfo->chroma_format == XVMC_CHROMA_FORMAT_420) { - curCap->mpeg_flags |= ((curInfo->mc_type & XVMC_MPEG_1) ? - XINE_XVMC_MPEG_1 : 0); - curCap->mpeg_flags |= ((curInfo->mc_type & XVMC_MPEG_2) ? + curCap->mpeg_flags |= ((curInfo->mc_type & XVMC_MPEG_1) ? + XINE_XVMC_MPEG_1 : 0); + curCap->mpeg_flags |= ((curInfo->mc_type & XVMC_MPEG_2) ? XINE_XVMC_MPEG_2 : 0); - curCap->mpeg_flags |= ((curInfo->mc_type & XVMC_MPEG_4) ? + curCap->mpeg_flags |= ((curInfo->mc_type & XVMC_MPEG_4) ? XINE_XVMC_MPEG_4 : 0); - curCap->accel_flags |= ((curInfo->mc_type & XVMC_VLD) ? + curCap->accel_flags |= ((curInfo->mc_type & XVMC_VLD) ? XINE_XVMC_ACCEL_VLD : 0); - curCap->accel_flags |= ((curInfo->mc_type & XVMC_IDCT) ? + curCap->accel_flags |= ((curInfo->mc_type & XVMC_IDCT) ? XINE_XVMC_ACCEL_IDCT : 0); - curCap->accel_flags |= ((curInfo->mc_type & (XVMC_VLD | XVMC_IDCT)) ? + curCap->accel_flags |= ((curInfo->mc_type & (XVMC_VLD | XVMC_IDCT)) ? 0 : XINE_XVMC_ACCEL_MOCOMP); curCap->max_width = curInfo->max_width; curCap->max_height = curInfo->max_height; curCap->sub_max_width = curInfo->subpicture_max_width; curCap->sub_max_height = curInfo->subpicture_max_height; curCap->flags = curInfo->flags; - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_xxmc: Surface type %d: Max size: %d %d.\n", i,curCap->max_width,curCap->max_height); - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_xxmc: Surface type %d: Max subpic size: %d %d.\n", i,curCap->sub_max_width,curCap->sub_max_height); - + curCap->type_id = curInfo->surface_type_id; - formatValues = XvMCListSubpictureTypes( this->display, xv_port, + formatValues = XvMCListSubpictureTypes( this->display, xv_port, curCap->type_id, &numSub); curCap->subPicType.id = 0; if (formatValues) { - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_xxmc: Surface type %d: Found %d XvMC subpicture " "types\n",i,numSub); for (j = 0; j<numSub; ++j) { if (formatValues[j].id == FOURCC_IA44) { curCap->subPicType = formatValues[j]; - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_xxmc: Surface type %d: Detected and using " "IA44 subpicture type.\n",i); /* Prefer IA44 */ break; } else if (formatValues[j].id == FOURCC_AI44) { curCap->subPicType = formatValues[j]; - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_xxmc: Surface type %d: Detected AI44 " "subpicture type.\n",i); } @@ -2347,7 +2347,7 @@ static void checkXvMCCap( xxmc_driver_t *this, XvPortID xv_port) XFree(formatValues); curInfo++; - curCap++; + curCap++; } } XFree(surfaceInfo); @@ -2356,7 +2356,7 @@ static void checkXvMCCap( xxmc_driver_t *this, XvPortID xv_port) * Try to create a direct rendering context. This will fail if we are not * on the displaying computer or an indirect context is not available. */ - + curCap = this->xvmc_cap; if (Success == XvMCCreateContext( this->display, xv_port, curCap->type_id, curCap->max_width,curCap->max_height, @@ -2369,7 +2369,7 @@ static void checkXvMCCap( xxmc_driver_t *this, XvPortID xv_port) } else { free(this->xvmc_cap); this->xvmc_cap = 0; - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_xxmc: Apparent attempt to use a direct XvMC " "context\nvideo_out_xxmc: on a remote display. " "Falling back to XV.\n"); @@ -2387,8 +2387,8 @@ static void checkXvMCCap( xxmc_driver_t *this, XvPortID xv_port) return; } - - + + static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *visual_gen) { @@ -2409,7 +2409,7 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi XvAdaptorInfo *adaptor_info; unsigned int adaptor_num; xv_prefertype prefer_type; - cfg_entry_t *entry; + cfg_entry_t *entry; int use_more_frames; int use_unscaled; @@ -2418,7 +2418,7 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi return NULL; _x_alphablend_init(&this->alphablend_extra_data, class->xine); - + this->display = visual->display; this->screen = visual->screen; this->config = config; @@ -2475,19 +2475,19 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi xprintf(class->xine, XINE_VERBOSITY_LOG, _("video_out_xxmc: Xv extension is present but I couldn't find a usable yuv12 port.\n" " Looks like your graphics hardware driver doesn't support Xv?!\n")); - + /* XvFreeAdaptorInfo (adaptor_info); this crashed on me (gb)*/ XUnlockDisplay(this->display); return NULL; - } + } else xprintf(class->xine, XINE_VERBOSITY_LOG, _("video_out_xxmc: using Xv port %ld from adaptor %s for hardware " "colour space conversion and scaling.\n"), xv_port, adaptor_info[adaptor_num].name); - + XUnlockDisplay(this->display); - + this->xv_port = xv_port; _x_vo_scale_init (&this->sc, 1, 0, config ); @@ -2633,10 +2633,10 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi fo = XvListImageFormats(this->display, this->xv_port, (int*)&formats); XUnlockDisplay (this->display); - + this->xv_format_yv12 = 0; this->xv_format_yuy2 = 0; - + for(i = 0; i < formats; i++) { lprintf ("Xv image format: 0x%x (%4.4s) %s\n", fo[i].id, (char*)&fo[i].id, @@ -2650,7 +2650,7 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi } else if (fo[i].id == XINE_IMGFMT_YUY2) { this->xv_format_yuy2 = fo[i].id; this->capabilities |= VO_CAP_YUY2; - xprintf(this->xine, XINE_VERBOSITY_LOG, + xprintf(this->xine, XINE_VERBOSITY_LOG, _("video_out_xxmc: this adaptor supports the yuy2 format.\n")); } } @@ -2672,19 +2672,19 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi dispose_ximage (this, &myshminfo, myimage); XUnlockDisplay (this->display); - this->use_pitch_alignment = + this->use_pitch_alignment = config->register_bool (config, "video.device.xv_pitch_alignment", 0, VIDEO_DEVICE_XV_PITCH_ALIGNMENT_HELP, 10, xxmc_update_xv_pitch_alignment, this); - use_more_frames= + use_more_frames= config->register_bool (config, "video.device.xvmc_more_frames", 0, _("Make XvMC allocate more frames for better buffering."), _("Some XvMC implementations allow more than 8 frames.\n" "This option, when turned on, makes the driver try to\n" "allocate 15 frames. A must for unichrome and live VDR.\n"), 10, NULL, this); - this->cpu_save_enabled = + this->cpu_save_enabled = config->register_bool (config, "video.device.unichrome_cpu_save", 0, _("Unichrome cpu save"), _("Saves CPU time by sleeping while decoder works.\n" @@ -2723,7 +2723,7 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi #ifdef HAVE_VLDXVMC printf("video_out_xxmc: Unichrome CPU saving is %s.\n", - (this->cpu_save_enabled) ? "on":"off"); + (this->cpu_save_enabled) ? "on":"off"); #else printf("video_out_xxmc: warning - compiled with no vld extensions.\n"); #endif @@ -2752,10 +2752,10 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi } XUnlockDisplay (this->display); } - + if( this->xoverlay ) { this->capabilities |= VO_CAP_UNSCALED_OVERLAY; - } + } return &this->vo_driver; } @@ -2773,7 +2773,7 @@ static char* get_description (video_driver_class_t *this_gen) { static void dispose_class (video_driver_class_t *this_gen) { xxmc_class_t *this = (xxmc_class_t *) this_gen; - + free (this); } @@ -2808,4 +2808,4 @@ const plugin_info_t xine_plugin_info[] EXPORTED = { { PLUGIN_VIDEO_OUT, 21, "xxmc", XINE_VERSION_CODE, &vo_info_xxmc, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; - + diff --git a/src/video_out/vidix/drivers/Makefile.am b/src/video_out/vidix/drivers/Makefile.am index f438dde36..2a90f8591 100644 --- a/src/video_out/vidix/drivers/Makefile.am +++ b/src/video_out/vidix/drivers/Makefile.am @@ -15,7 +15,7 @@ vidix_drivers = \ unichrome_vid.la \ nvidia_vid.la \ sis_vid.la \ - savage_vid.la + savage_vid.la endif vidix_LTLIBRARIES = $(vidix_drivers) diff --git a/src/video_out/x11osd.c b/src/video_out/x11osd.c index 4d0e46287..d6354a6e5 100644 --- a/src/video_out/x11osd.c +++ b/src/video_out/x11osd.c @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2003 the xine project * * This file is part of xine, a free video player. @@ -96,7 +96,7 @@ x11osd_expose (x11osd * osd) assert (osd); lprintf("expose (state:%d)\n", osd->clean ); - + switch (osd->mode) { case X11OSD_SHAPED: XShapeCombineMask (osd->display, osd->u.shaped.window, ShapeBounding, 0, 0, @@ -106,7 +106,7 @@ x11osd_expose (x11osd * osd) if( !osd->u.shaped.mapped ) XMapRaised (osd->display, osd->u.shaped.window); osd->u.shaped.mapped = 1; - + XCopyArea (osd->display, osd->bitmap, osd->u.shaped.window, osd->gc, 0, 0, osd->width, osd->height, 0, 0); } else { @@ -129,7 +129,7 @@ x11osd_resize (x11osd * osd, int width, int height) assert (osd); assert (width); assert (height); - + lprintf("resize old:%dx%d new:%dx%d\n", osd->width, osd->height, width, height ); osd->width = width; @@ -153,7 +153,7 @@ x11osd_resize (x11osd * osd, int width, int height) osd->width, osd->height, osd->depth); break; } - + osd->clean = UNDEFINED; x11osd_clear(osd); } @@ -165,7 +165,7 @@ x11osd_drawable_changed (x11osd * osd, Window window) XWindowAttributes getattr; assert (osd); - + lprintf("drawable changed\n"); /* @@ -183,14 +183,14 @@ x11osd_drawable_changed (x11osd * osd, Window window) XSync (osd->display, False); osd->window = window; - + XGetWindowAttributes (osd->display, osd->window, &getattr); osd->width = getattr.width; osd->height = getattr.height; - + assert(osd->width); assert(osd->height); - + switch(osd->mode) { case X11OSD_SHAPED: XFreePixmap (osd->display, osd->u.shaped.mask_bitmap); @@ -199,8 +199,8 @@ x11osd_drawable_changed (x11osd * osd, Window window) attr.override_redirect = True; attr.background_pixel = BlackPixel (osd->display, osd->screen); osd->u.shaped.window = XCreateWindow(osd->display, osd->window, - 0, 0, osd->width, osd->height, 0, - CopyFromParent, CopyFromParent, CopyFromParent, + 0, 0, osd->width, osd->height, 0, + CopyFromParent, CopyFromParent, CopyFromParent, CWBackPixel | CWOverrideRedirect, &attr); XSelectInput (osd->display, osd->u.shaped.window, ExposureMask); @@ -212,18 +212,18 @@ x11osd_drawable_changed (x11osd * osd, Window window) osd->bitmap = XCreatePixmap (osd->display, osd->u.shaped.window, osd->width, osd->height, osd->depth); - osd->cmap = XCreateColormap(osd->display, osd->u.shaped.window, + osd->cmap = XCreateColormap(osd->display, osd->u.shaped.window, osd->visual, AllocNone); break; case X11OSD_COLORKEY: osd->bitmap = XCreatePixmap (osd->display, osd->window, osd->width, osd->height, osd->depth); - osd->cmap = XCreateColormap(osd->display, osd->window, + osd->cmap = XCreateColormap(osd->display, osd->window, osd->visual, AllocNone); break; } - + osd->clean = UNDEFINED; /* do not x11osd_clear() here: osd->u.colorkey.sc has not being updated yet */ } @@ -260,11 +260,11 @@ x11osd_create (xine_t *xine, Display *display, int screen, Window window, enum x osd->visual = DefaultVisual (osd->display, osd->screen); osd->depth = DefaultDepth (osd->display, osd->screen); - + XGetWindowAttributes (osd->display, osd->window, &getattr); osd->width = getattr.width; osd->height = getattr.height; - + assert(osd->width); assert(osd->height); @@ -278,8 +278,8 @@ x11osd_create (xine_t *xine, Display *display, int screen, Window window, enum x attr.override_redirect = True; attr.background_pixel = BlackPixel (osd->display, osd->screen); osd->u.shaped.window = XCreateWindow(osd->display, osd->window, - 0, 0, osd->width, osd->height, 0, - CopyFromParent, CopyFromParent, CopyFromParent, + 0, 0, osd->width, osd->height, 0, + CopyFromParent, CopyFromParent, CopyFromParent, CWBackPixel | CWOverrideRedirect, &attr); XSync(osd->display, False); @@ -288,7 +288,7 @@ x11osd_create (xine_t *xine, Display *display, int screen, Window window, enum x goto error_window; } - osd->u.shaped.mask_bitmap = XCreatePixmap (osd->display, osd->u.shaped.window, osd->width, + osd->u.shaped.mask_bitmap = XCreatePixmap (osd->display, osd->u.shaped.window, osd->width, osd->height, 1); XSync(osd->display, False); if( x11_error ) { @@ -296,7 +296,7 @@ x11osd_create (xine_t *xine, Display *display, int screen, Window window, enum x goto error_aftermaskbitmap; } - osd->bitmap = XCreatePixmap (osd->display, osd->u.shaped.window, osd->width, + osd->bitmap = XCreatePixmap (osd->display, osd->u.shaped.window, osd->width, osd->height, osd->depth); osd->gc = XCreateGC (osd->display, osd->u.shaped.window, 0, NULL); @@ -315,14 +315,14 @@ x11osd_create (xine_t *xine, Display *display, int screen, Window window, enum x XSelectInput (osd->display, osd->u.shaped.window, ExposureMask); osd->u.shaped.mapped = 0; - osd->cmap = XCreateColormap(osd->display, osd->u.shaped.window, + osd->cmap = XCreateColormap(osd->display, osd->u.shaped.window, osd->visual, AllocNone); break; case X11OSD_COLORKEY: - osd->bitmap = XCreatePixmap (osd->display, osd->window, osd->width, + osd->bitmap = XCreatePixmap (osd->display, osd->window, osd->width, osd->height, osd->depth); osd->gc = XCreateGC (osd->display, osd->window, 0, NULL); - osd->cmap = XCreateColormap(osd->display, osd->window, + osd->cmap = XCreateColormap(osd->display, osd->window, osd->visual, AllocNone); /* FIXME: the expose event doesn't seem to happen? */ /*XSelectInput (osd->display, osd->window, ExposureMask);*/ @@ -342,8 +342,8 @@ x11osd_create (xine_t *xine, Display *display, int screen, Window window, enum x XSetErrorHandler(old_handler); - xprintf(osd->xine, XINE_VERBOSITY_DEBUG, - _("x11osd: unscaled overlay created (%s mode).\n"), + xprintf(osd->xine, XINE_VERBOSITY_DEBUG, + _("x11osd: unscaled overlay created (%s mode).\n"), (mode==X11OSD_SHAPED) ? "XShape" : "Colorkey" ); return osd; @@ -402,9 +402,9 @@ x11osd_destroy (x11osd * osd) void x11osd_clear(x11osd *osd) { int i; - + lprintf("clear (state:%d)\n", osd->clean ); - + if( osd->clean != WIPED ) switch (osd->mode) { case X11OSD_SHAPED: @@ -442,7 +442,7 @@ void x11osd_blend(x11osd *osd, vo_overlay_t *overlay) { if (osd->clean==UNDEFINED) x11osd_clear(osd); /* Workaround. Colorkey mode needs sc data before the clear. */ - + if (overlay->rle) { int i, x, y, len, width; int use_clip_palette, max_palette_colour[2]; @@ -474,7 +474,7 @@ void x11osd_blend(x11osd *osd, vo_overlay_t *overlay) if (x + width - 1 > overlay->hili_right) { width -= overlay->hili_right - x; len += overlay->hili_right - x; - } + } } } @@ -482,7 +482,7 @@ void x11osd_blend(x11osd *osd, vo_overlay_t *overlay) int j; clut_t *src_clut; uint8_t *src_trans; - + if (use_clip_palette) { src_clut = (clut_t *)&overlay->hili_color; src_trans = (uint8_t *)&overlay->hili_trans; @@ -507,7 +507,7 @@ void x11osd_blend(x11osd *osd, vo_overlay_t *overlay) xcolor.green = (65536 * saturate(g, 0, 255)) / 256; b = y + 2 * u - 274; xcolor.blue = (65536 * saturate(b, 0, 255)) / 256; - + xcolor.flags = DoRed | DoBlue | DoGreen; XAllocColor(osd->display, osd->cmap, &xcolor); diff --git a/src/video_out/x11osd.h b/src/video_out/x11osd.h index fe0bf6208..b7726e144 100644 --- a/src/video_out/x11osd.h +++ b/src/video_out/x11osd.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2003 the xine project * * This file is part of xine, a free video player. diff --git a/src/video_out/xcbosd.c b/src/video_out/xcbosd.c index d8cf119a2..ca51664a2 100644 --- a/src/video_out/xcbosd.c +++ b/src/video_out/xcbosd.c @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2003, 2007 the xine project * * This file is part of xine, a free video player. @@ -93,7 +93,7 @@ void xcbosd_expose(xcbosd *osd) assert (osd); lprintf("expose (state:%d)\n", osd->clean ); - + switch (osd->mode) { case XCBOSD_SHAPED: xcb_shape_mask(osd->connection, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING, @@ -106,7 +106,7 @@ void xcbosd_expose(xcbosd *osd) xcb_map_window(osd->connection, osd->u.shaped.window); } osd->u.shaped.mapped = 1; - + xcb_copy_area(osd->connection, osd->bitmap, osd->u.shaped.window, osd->gc, 0, 0, 0, 0, osd->width, osd->height); } else { @@ -128,7 +128,7 @@ void xcbosd_resize(xcbosd *osd, int width, int height) assert (osd); assert (width); assert (height); - + lprintf("resize old:%dx%d new:%dx%d\n", osd->width, osd->height, width, height ); osd->width = width; @@ -151,7 +151,7 @@ void xcbosd_resize(xcbosd *osd, int width, int height) xcb_create_pixmap(osd->connection, osd->depth, osd->bitmap, osd->window, osd->width, osd->height); break; } - + osd->clean = UNDEFINED; xcbosd_clear(osd); } @@ -162,7 +162,7 @@ void xcbosd_drawable_changed(xcbosd *osd, xcb_window_t window) xcb_get_geometry_reply_t *get_geometry_reply; assert (osd); - + lprintf("drawable changed\n"); /* @@ -180,17 +180,17 @@ void xcbosd_drawable_changed(xcbosd *osd, xcb_window_t window) /* XSync (osd->display, False); FIXME don't think that we need that --pfister */ osd->window = window; - + get_geometry_cookie = xcb_get_geometry(osd->connection, osd->window); get_geometry_reply = xcb_get_geometry_reply(osd->connection, get_geometry_cookie, NULL); osd->depth = get_geometry_reply->depth; osd->width = get_geometry_reply->width; osd->height = get_geometry_reply->height; free(get_geometry_reply); - + assert(osd->width); assert(osd->height); - + switch(osd->mode) { case XCBOSD_SHAPED: { xcb_free_pixmap(osd->connection, osd->u.shaped.mask_bitmap); @@ -223,7 +223,7 @@ void xcbosd_drawable_changed(xcbosd *osd, xcb_window_t window) break; } - + osd->clean = UNDEFINED; /* do not xcbosd_clear() here: osd->u.colorkey.sc has not being updated yet */ } @@ -249,14 +249,14 @@ xcbosd *xcbosd_create(xine_t *xine, xcb_connection_t *connection, xcb_screen_t * osd->window = window; osd->visual = osd->screen->root_visual; - + get_geometry_cookie = xcb_get_geometry(osd->connection, osd->window); get_geometry_reply = xcb_get_geometry_reply(osd->connection, get_geometry_cookie, NULL); osd->depth = get_geometry_reply->depth; osd->width = get_geometry_reply->width; osd->height = get_geometry_reply->height; free(get_geometry_reply); - + assert(osd->width); assert(osd->height); @@ -326,8 +326,8 @@ xcbosd *xcbosd_create(xine_t *xine, xcb_connection_t *connection, xcb_screen_t * osd->clean = UNDEFINED; xcbosd_expose(osd); - xprintf(osd->xine, XINE_VERBOSITY_DEBUG, - _("x11osd: unscaled overlay created (%s mode).\n"), + xprintf(osd->xine, XINE_VERBOSITY_DEBUG, + _("x11osd: unscaled overlay created (%s mode).\n"), (mode==XCBOSD_SHAPED) ? "XShape" : "Colorkey" ); return osd; @@ -382,9 +382,9 @@ void xcbosd_destroy(xcbosd *osd) void xcbosd_clear(xcbosd *osd) { int i; - + lprintf("clear (state:%d)\n", osd->clean ); - + if( osd->clean != WIPED ) switch (osd->mode) { case XCBOSD_SHAPED: { @@ -435,7 +435,7 @@ void xcbosd_blend(xcbosd *osd, vo_overlay_t *overlay) if (osd->clean==UNDEFINED) xcbosd_clear(osd); /* Workaround. Colorkey mode needs sc data before the clear. */ - + if (overlay->rle) { int i, x, y, len, width; int use_clip_palette, max_palette_colour[2]; @@ -467,7 +467,7 @@ void xcbosd_blend(xcbosd *osd, vo_overlay_t *overlay) if (x + width - 1 > overlay->hili_right) { width -= overlay->hili_right - x; len += overlay->hili_right - x; - } + } } } @@ -475,7 +475,7 @@ void xcbosd_blend(xcbosd *osd, vo_overlay_t *overlay) int j; clut_t *src_clut; uint8_t *src_trans; - + if (use_clip_palette) { src_clut = (clut_t *)&overlay->hili_color; src_trans = (uint8_t *)&overlay->hili_trans; diff --git a/src/video_out/xcbosd.h b/src/video_out/xcbosd.h index 32af4965e..8b91b1b6e 100644 --- a/src/video_out/xcbosd.h +++ b/src/video_out/xcbosd.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2003, 2007 the xine project * * This file is part of xine, a free video player. diff --git a/src/video_out/xvmc_mocomp.c b/src/video_out/xvmc_mocomp.c index faa2b0010..197037206 100644 --- a/src/video_out/xvmc_mocomp.c +++ b/src/video_out/xvmc_mocomp.c @@ -23,15 +23,15 @@ #include "xxmc.h" -static void calc_DMV(int DMV[][2], int *dmvector, +static void calc_DMV(int DMV[][2], int *dmvector, int mvx, int mvy, int picture_structure, int top_field_first) { - + if (picture_structure==VO_BOTH_FIELDS) { if (top_field_first) { /* vector for prediction of top field from bottom field */ DMV[0][0] = ((mvx +(mvx>0))>>1) + dmvector[0]; DMV[0][1] = ((mvy +(mvy>0))>>1) + dmvector[1] - 1; - + /* vector for prediction of bottom field from top field */ DMV[1][0] = ((3*mvx+(mvx>0))>>1) + dmvector[0]; DMV[1][1] = ((3*mvy+(mvy>0))>>1) + dmvector[1] + 1; @@ -40,7 +40,7 @@ static void calc_DMV(int DMV[][2], int *dmvector, /* vector for prediction of top field from bottom field */ DMV[0][0] = ((3*mvx+(mvx>0))>>1) + dmvector[0]; DMV[0][1] = ((3*mvy+(mvy>0))>>1) + dmvector[1] - 1; - + /* vector for prediction of bottom field from top field */ DMV[1][0] = ((mvx +(mvx>0))>>1) + dmvector[0]; DMV[1][1] = ((mvy +(mvy>0))>>1) + dmvector[1] + 1; @@ -50,13 +50,13 @@ static void calc_DMV(int DMV[][2], int *dmvector, /* vector for prediction from field of opposite 'parity' */ DMV[0][0] = ((mvx+(mvx>0))>>1) + dmvector[0]; DMV[0][1] = ((mvy+(mvy>0))>>1) + dmvector[1]; - + /* correct for vertical field shift */ if (picture_structure==VO_TOP_FIELD) DMV[0][1]--; else DMV[0][1]++; - + } } @@ -96,12 +96,12 @@ static void xvmc_render_macro_blocks(vo_frame_t *current_image, -void xxmc_xvmc_proc_macro_block(int x, int y, int mb_type, int motion_type, - int (*mv_field_sel)[2], int *dmvector, int cbp, - int dct_type, vo_frame_t *current_frame, - vo_frame_t *forward_ref_frame, - vo_frame_t *backward_ref_frame, int picture_structure, - int second_field, int (*f_mot_pmv)[2], int (*b_mot_pmv)[2]) +void xxmc_xvmc_proc_macro_block(int x, int y, int mb_type, int motion_type, + int (*mv_field_sel)[2], int *dmvector, int cbp, + int dct_type, vo_frame_t *current_frame, + vo_frame_t *forward_ref_frame, + vo_frame_t *backward_ref_frame, int picture_structure, + int second_field, int (*f_mot_pmv)[2], int (*b_mot_pmv)[2]) { xxmc_driver_t *this = (xxmc_driver_t *) current_frame->driver; xvmc_macroblocks_t *mbs = &this->macroblocks; @@ -110,10 +110,10 @@ void xxmc_xvmc_proc_macro_block(int x, int y, int mb_type, int motion_type, mbs->macroblockptr->x = x; mbs->macroblockptr->y = y; - + if(mb_type & XINE_MACROBLOCK_INTRA) { mbs->macroblockptr->macroblock_type = XVMC_MB_TYPE_INTRA; - } + } else { mbs->macroblockptr->macroblock_type = 0; /* XvMC doesn't support skips */ @@ -122,7 +122,7 @@ void xxmc_xvmc_proc_macro_block(int x, int y, int mb_type, int motion_type, motion_type = (picture_structure == VO_BOTH_FIELDS) ? XINE_MC_FRAME : XINE_MC_FIELD; mbs->macroblockptr->PMV[0][0][0] = 0; mbs->macroblockptr->PMV[0][0][1] = 0; - } + } else { if(mb_type & XINE_MACROBLOCK_MOTION_BACKWARD) { mbs->macroblockptr->macroblock_type |= XVMC_MB_TYPE_MOTION_BACKWARD; @@ -154,17 +154,17 @@ void xxmc_xvmc_proc_macro_block(int x, int y, int mb_type, int motion_type, calc_DMV(DMV,dmvector, f_mot_pmv[0][0], f_mot_pmv[0][1]>>1, picture_structure, top_field_first); - + mbs->macroblockptr->PMV[1][0][0] = DMV[0][0]; mbs->macroblockptr->PMV[1][0][1] = DMV[0][1]; mbs->macroblockptr->PMV[1][1][0] = DMV[1][0]; mbs->macroblockptr->PMV[1][1][1] = DMV[1][1]; - } + } else { calc_DMV(DMV,dmvector, f_mot_pmv[0][0], f_mot_pmv[0][1]>>1, picture_structure, top_field_first); - + mbs->macroblockptr->PMV[0][1][0] = DMV[0][0]; mbs->macroblockptr->PMV[0][1][1] = DMV[0][1]; } @@ -185,14 +185,14 @@ void xxmc_xvmc_proc_macro_block(int x, int y, int mb_type, int motion_type, mbs->macroblockptr->index = ((unsigned long)mbs->xine_mc.blockptr - (unsigned long)mbs->xine_mc.blockbaseptr) >> 7; - + mbs->macroblockptr->dct_type = dct_type; mbs->macroblockptr->coded_block_pattern = cbp; cbp &= 0x3F; mbs->macroblockptr->coded_block_pattern = cbp; - while(cbp) { + while(cbp) { if(cbp & 1) mbs->macroblockptr->index--; cbp >>= 1; } @@ -238,9 +238,9 @@ void xxmc_xvmc_proc_macro_block(int x, int y, int mb_type, int motion_type, xvmc_render_macro_blocks( current_frame, - (picture_coding_type == XINE_PICT_B_TYPE) ? + (picture_coding_type == XINE_PICT_B_TYPE) ? backward_ref_frame : NULL, - (picture_coding_type != XINE_PICT_I_TYPE) ? + (picture_coding_type != XINE_PICT_I_TYPE) ? forward_ref_frame : NULL, picture_structure, second_field ? XVMC_SECOND_FIELD : 0, diff --git a/src/video_out/xvmc_vld.c b/src/video_out/xvmc_vld.c index b81578276..9eb68972f 100644 --- a/src/video_out/xvmc_vld.c +++ b/src/video_out/xvmc_vld.c @@ -39,7 +39,7 @@ void xvmc_vld_frame(struct vo_frame_s *this_gen) *ff = (xxmc_frame_t *) vft->forward_reference_frame, *bf = (xxmc_frame_t *) vft->backward_reference_frame; XvMCMpegControl ctl; - xxmc_driver_t + xxmc_driver_t *driver = (xxmc_driver_t *) cf->vo_frame.driver; XvMCSurface *fs=0, *bs=0; XvMCQMatrix qmx; @@ -53,21 +53,21 @@ void xvmc_vld_frame(struct vo_frame_s *this_gen) ctl.picture_coding_type = vft->picture_coding_type; ctl.mpeg_coding = (vft->mpeg_coding == 0) ? XVMC_MPEG_1 : XVMC_MPEG_2; ctl.flags = 0; - ctl.flags |= (vft->progressive_sequence) ? + ctl.flags |= (vft->progressive_sequence) ? XVMC_PROGRESSIVE_SEQUENCE : 0 ; - ctl.flags |= (vft->scan) ? + ctl.flags |= (vft->scan) ? XVMC_ALTERNATE_SCAN : XVMC_ZIG_ZAG_SCAN; - ctl.flags |= (vft->pred_dct_frame) ? + ctl.flags |= (vft->pred_dct_frame) ? XVMC_PRED_DCT_FRAME : XVMC_PRED_DCT_FIELD; - ctl.flags |= (this->top_field_first) ? + ctl.flags |= (this->top_field_first) ? XVMC_TOP_FIELD_FIRST : XVMC_BOTTOM_FIELD_FIRST; - ctl.flags |= (vft->concealment_motion_vectors) ? - XVMC_CONCEALMENT_MOTION_VECTORS : 0 ; - ctl.flags |= (vft->q_scale_type) ? + ctl.flags |= (vft->concealment_motion_vectors) ? + XVMC_CONCEALMENT_MOTION_VECTORS : 0 ; + ctl.flags |= (vft->q_scale_type) ? XVMC_Q_SCALE_TYPE : 0; - ctl.flags |= (vft->intra_vlc_format) ? + ctl.flags |= (vft->intra_vlc_format) ? XVMC_INTRA_VLC_FORMAT : 0; - ctl.flags |= (vft->second_field) ? + ctl.flags |= (vft->second_field) ? XVMC_SECOND_FIELD : 0 ; if (ff) fs=ff->xvmc_surf; @@ -79,7 +79,7 @@ void xvmc_vld_frame(struct vo_frame_s *this_gen) if (ctl.picture_coding_type == XVMC_P_PICTURE) bs = cf->xvmc_surf; - + if ((qmx.load_intra_quantiser_matrix = vft->load_intra_quantizer_matrix)) { memcpy(qmx.intra_quantiser_matrix,vft->intra_quantizer_matrix, sizeof(qmx.intra_quantiser_matrix)); @@ -87,13 +87,13 @@ void xvmc_vld_frame(struct vo_frame_s *this_gen) if ((qmx.load_non_intra_quantiser_matrix = vft->load_non_intra_quantizer_matrix)) { memcpy(qmx.non_intra_quantiser_matrix,vft->non_intra_quantizer_matrix, sizeof(qmx.non_intra_quantiser_matrix)); - } - qmx.load_chroma_intra_quantiser_matrix = 0; + } + qmx.load_chroma_intra_quantiser_matrix = 0; qmx.load_chroma_non_intra_quantiser_matrix = 0; XVMCLOCKDISPLAY( driver->display ); - XvMCLoadQMatrix(driver->display, &driver->context, &qmx); - + XvMCLoadQMatrix(driver->display, &driver->context, &qmx); + while((cf->xxmc_data.result = XvMCBeginSurface(driver->display, &driver->context, cf->xvmc_surf, fs, bs, &ctl))); @@ -101,9 +101,9 @@ void xvmc_vld_frame(struct vo_frame_s *this_gen) driver->cpu_saver = 0.; } -void xvmc_vld_slice(vo_frame_t *this_gen) +void xvmc_vld_slice(vo_frame_t *this_gen) { - xxmc_frame_t + xxmc_frame_t *cf = (xxmc_frame_t *) this_gen; xxmc_driver_t *driver = (xxmc_driver_t *) cf->vo_frame.driver; @@ -115,7 +115,7 @@ void xvmc_vld_slice(vo_frame_t *this_gen) /* * If CPU-saving mode is enabled, sleep after every xxmc->sleep slice. This will free * up the cpu while the decoder is working on the slice. The value of xxmc->sleep is calculated - * so that the decoder thread sleeps at most 50% of the frame delay, + * so that the decoder thread sleeps at most 50% of the frame delay, * assuming a 2.6 kernel clock of 1000 Hz. */ @@ -123,7 +123,7 @@ void xvmc_vld_slice(vo_frame_t *this_gen) if (driver->cpu_save_enabled) { driver->cpu_saver += 1.; if (driver->cpu_saver >= cf->xxmc_data.sleep) { - usleep(1); + usleep(1); driver->cpu_saver -= cf->xxmc_data.sleep; } } diff --git a/src/video_out/xxmc.h b/src/video_out/xxmc.h index 03b12c15b..6110978d1 100644 --- a/src/video_out/xxmc.h +++ b/src/video_out/xxmc.h @@ -114,7 +114,7 @@ typedef struct { XvMCMacroBlock *macroblockbaseptr; /* pointer to base MacroBlock in MB array */ XvMCMacroBlockArray macro_blocks; /* pointer to memory for macroblock array */ int slices; -} xvmc_macroblocks_t; +} xvmc_macroblocks_t; typedef struct { @@ -138,7 +138,7 @@ typedef struct { XShmSegmentInfo shminfo; /* XvMC specific stuff */ - + XvMCSurface *xvmc_surf; xine_xxmc_t xxmc_data; int last_sw_format; @@ -155,7 +155,7 @@ typedef struct{ XvImageFormatValues subPicType; int flags; } xvmc_capabilities_t; - + typedef struct xvmc_surface_handler_s { XvMCSurface surfaces[XVMC_MAX_SURFACES]; int surfInUse[XVMC_MAX_SURFACES]; @@ -180,12 +180,12 @@ typedef struct context_lock_s { } #if defined(XVMC_THREAD_SAFE) && defined(XVMC_LOCKDISPLAY_SAFE) -#define XVMCLOCKDISPLAY(display) -#define XVMCUNLOCKDISPLAY(display) +#define XVMCLOCKDISPLAY(display) +#define XVMCUNLOCKDISPLAY(display) #else -#define XVMCLOCKDISPLAY(display) XLockDisplay(display) +#define XVMCLOCKDISPLAY(display) XLockDisplay(display) #define XVMCUNLOCKDISPLAY(display) XUnlockDisplay(display) -#endif +#endif struct xxmc_driver_s { vo_driver_t vo_driver; @@ -227,7 +227,7 @@ struct xxmc_driver_s { int (*x11_old_error_handler) (Display *, XErrorEvent *); xine_t *xine; - /* XvMC related stuff here */ + /* XvMC related stuff here */ xvmc_macroblocks_t macroblocks; xvmc_capabilities_t *xvmc_cap; unsigned xvmc_num_cap; @@ -272,8 +272,8 @@ struct xxmc_driver_s { /* * The mutex below is needed since XlockDisplay wasn't really enough - * to protect the XvMC Calls. - */ + * to protect the XvMC Calls. + */ context_lock_t xvmc_lock; alphablend_t alphablend_extra_data; @@ -293,14 +293,14 @@ extern int xxmc_xvmc_surface_valid(xxmc_driver_t *this, XvMCSurface *surf); extern void xvmc_vld_slice(vo_frame_t *this_gen); extern void xvmc_vld_frame(struct vo_frame_s *this_gen); -extern void xxmc_xvmc_proc_macro_block(int x, int y, int mb_type, int motion_type, - int (*mv_field_sel)[2], int *dmvector, - int cbp, - int dct_type, vo_frame_t *current_frame, - vo_frame_t *forward_ref_frame, - vo_frame_t *backward_ref_frame, - int picture_structure, - int second_field, int (*f_mot_pmv)[2], +extern void xxmc_xvmc_proc_macro_block(int x, int y, int mb_type, int motion_type, + int (*mv_field_sel)[2], int *dmvector, + int cbp, + int dct_type, vo_frame_t *current_frame, + vo_frame_t *forward_ref_frame, + vo_frame_t *backward_ref_frame, + int picture_structure, + int second_field, int (*f_mot_pmv)[2], int (*b_mot_pmv)[2]); #endif diff --git a/src/video_out/yuv2rgb.c b/src/video_out/yuv2rgb.c index fb2d63e6c..b237bfafa 100644 --- a/src/video_out/yuv2rgb.c +++ b/src/video_out/yuv2rgb.c @@ -110,15 +110,15 @@ static void yuv2rgb_dispose (yuv2rgb_t *this) free (this); } -static int yuv2rgb_configure (yuv2rgb_t *this, +static int yuv2rgb_configure (yuv2rgb_t *this, int source_width, int source_height, int y_stride, int uv_stride, int dest_width, int dest_height, int rgb_stride) { -/* +/* printf ("yuv2rgb setup (%d x %d => %d x %d)\n", source_width, source_height, dest_width, dest_height); -*/ +*/ if (prof_scale_line == -1) prof_scale_line = xine_profiler_allocate_slot("xshm scale line"); @@ -161,7 +161,7 @@ static int yuv2rgb_configure (yuv2rgb_t *this, /* printf("yuv2rgb config: src_ht=%i, dst_ht=%i\n",source_height, dest_height); printf("yuv2rgb config: step_dy=%i %f\n",this->step_dy, (float)this->step_dy / 32768.0); -*/ +*/ this->scale_line = find_scale_line_func(this->step_dx); if ((source_width == dest_width) && (source_height == dest_height)) { @@ -183,7 +183,7 @@ static int yuv2rgb_configure (yuv2rgb_t *this, } else { this->do_scale = 1; - + /* * space for two y-lines (for yuv2rgb_mlib) * u,v subsampled 2:1 @@ -209,7 +209,7 @@ static int yuv2rgb_configure (yuv2rgb_t *this, if (!this->mlib_resize_buffer) return 0; } -#endif +#endif } return 1; } @@ -257,7 +257,7 @@ static void scale_line_gen (uint8_t *source, uint8_t *dest, p1 = p2; p2 = *source++; } - + dest ++; width --; } @@ -275,7 +275,7 @@ static void scale_line_gen (uint8_t *source, uint8_t *dest, p1 = p2; p2 = *source++; } - + dest ++; width --; } @@ -1242,7 +1242,7 @@ static void scale_line_1_2 (uint8_t *source, uint8_t *dest, xine_profiler_stop_count(prof_scale_line); } - + /* * Scale line with no horizontal scaling. For NTSC mpeg2 dvd input in * 4:3 output format (720x480 -> 720x540) @@ -1255,7 +1255,7 @@ static void scale_line_1_1 (uint8_t *source, uint8_t *dest, xine_profiler_stop_count(prof_scale_line); } - + static scale_line_func_t find_scale_line_func(int step) { static struct { int src_step; @@ -1400,7 +1400,7 @@ static void scale_line_4 (uint8_t *source, uint8_t *dest, dst_2[6*i+3] = b[Y]; dst_2[6*i+4] = g[Y]; dst_2[6*i+5] = r[Y]; #define DST1CMAP(i) \ - Y = py_1[2*i]; \ + Y = py_1[2*i]; \ dst_1[2*i] = this->cmap[r[Y] + g[Y] + b[Y]]; \ Y = py_1[2*i+1]; \ dst_1[2*i+1] = this->cmap[r[Y] + g[Y] + b[Y]]; @@ -1428,7 +1428,7 @@ static void yuv2rgb_c_32 (yuv2rgb_t *this, uint8_t * _dst, this->dest_width >> 1, this->step_dx); scale_line (_pv, this->v_buffer, this->dest_width >> 1, this->step_dx); - scale_line (_py, this->y_buffer, + scale_line (_py, this->y_buffer, this->dest_width, this->step_dx); dy = 0; @@ -1448,7 +1448,7 @@ static void yuv2rgb_c_32 (yuv2rgb_t *this, uint8_t * _dst, X_RGB(1); DST1(1); - + X_RGB(2); DST1(2); @@ -1466,7 +1466,7 @@ static void yuv2rgb_c_32 (yuv2rgb_t *this, uint8_t * _dst, while (--dst_height > 0 && dy < 32768) { - xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width*4); + xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width*4); dy += this->step_dy; _dst += this->rgb_stride; @@ -1479,18 +1479,18 @@ static void yuv2rgb_c_32 (yuv2rgb_t *this, uint8_t * _dst, dy -= 32768; _py += this->y_stride; - scale_line (_py, this->y_buffer, + scale_line (_py, this->y_buffer, this->dest_width, this->step_dx); if (height & 1) { _pu += this->uv_stride; _pv += this->uv_stride; - + scale_line (_pu, this->u_buffer, this->dest_width >> 1, this->step_dx); scale_line (_pv, this->v_buffer, this->dest_width >> 1, this->step_dx); - + } height++; } while( dy>=32768); @@ -1522,7 +1522,7 @@ static void yuv2rgb_c_32 (yuv2rgb_t *this, uint8_t * _dst, X_RGB(3); DST2(3); DST1(3); - + pu += 4; pv += 4; py_1 += 8; @@ -1531,7 +1531,7 @@ static void yuv2rgb_c_32 (yuv2rgb_t *this, uint8_t * _dst, dst_2 += 8; } while (--width); - _dst += 2 * this->rgb_stride; + _dst += 2 * this->rgb_stride; _py += 2 * this->y_stride; _pu += this->uv_stride; _pv += this->uv_stride; @@ -1559,7 +1559,7 @@ static void yuv2rgb_c_24_rgb (yuv2rgb_t *this, uint8_t * _dst, this->dest_width >> 1, this->step_dx); scale_line (_pv, this->v_buffer, this->dest_width >> 1, this->step_dx); - scale_line (_py, this->y_buffer, + scale_line (_py, this->y_buffer, this->dest_width, this->step_dx); dy = 0; @@ -1579,7 +1579,7 @@ static void yuv2rgb_c_24_rgb (yuv2rgb_t *this, uint8_t * _dst, X_RGB(1); DST1RGB(1); - + X_RGB(2); DST1RGB(2); @@ -1597,7 +1597,7 @@ static void yuv2rgb_c_24_rgb (yuv2rgb_t *this, uint8_t * _dst, while (--dst_height > 0 && dy < 32768) { - xine_fast_memcpy (_dst, _dst-this->rgb_stride, this->dest_width*3); + xine_fast_memcpy (_dst, _dst-this->rgb_stride, this->dest_width*3); dy += this->step_dy; _dst += this->rgb_stride; @@ -1610,18 +1610,18 @@ static void yuv2rgb_c_24_rgb (yuv2rgb_t *this, uint8_t * _dst, dy -= 32768; _py += this->y_stride; - scale_line (_py, this->y_buffer, + scale_line (_py, this->y_buffer, this->dest_width, this->step_dx); if (height & 1) { _pu += this->uv_stride; _pv += this->uv_stride; - + scale_line (_pu, this->u_buffer, this->dest_width >> 1, this->step_dx); scale_line (_pv, this->v_buffer, this->dest_width >> 1, this->step_dx); - + } height++; } while (dy>=32768); @@ -1662,11 +1662,11 @@ static void yuv2rgb_c_24_rgb (yuv2rgb_t *this, uint8_t * _dst, dst_2 += 24; } while (--width); - _dst += 2 * this->rgb_stride; + _dst += 2 * this->rgb_stride; _py += 2 * this->y_stride; _pu += this->uv_stride; _pv += this->uv_stride; - + } while (--height); } } @@ -1690,7 +1690,7 @@ static void yuv2rgb_c_24_bgr (yuv2rgb_t *this, uint8_t * _dst, this->dest_width >> 1, this->step_dx); scale_line (_pv, this->v_buffer, this->dest_width >> 1, this->step_dx); - scale_line (_py, this->y_buffer, + scale_line (_py, this->y_buffer, this->dest_width, this->step_dx); dy = 0; @@ -1710,7 +1710,7 @@ static void yuv2rgb_c_24_bgr (yuv2rgb_t *this, uint8_t * _dst, X_RGB(1); DST1BGR(1); - + X_RGB(2); DST1BGR(2); @@ -1741,18 +1741,18 @@ static void yuv2rgb_c_24_bgr (yuv2rgb_t *this, uint8_t * _dst, dy -= 32768; _py += this->y_stride; - scale_line (_py, this->y_buffer, + scale_line (_py, this->y_buffer, this->dest_width, this->step_dx); if (height & 1) { _pu += this->uv_stride; _pv += this->uv_stride; - + scale_line (_pu, this->u_buffer, this->dest_width >> 1, this->step_dx); scale_line (_pv, this->v_buffer, this->dest_width >> 1, this->step_dx); - + } height++; } while( dy>=32768 ); @@ -1793,7 +1793,7 @@ static void yuv2rgb_c_24_bgr (yuv2rgb_t *this, uint8_t * _dst, dst_2 += 24; } while (--width); - _dst += 2 * this->rgb_stride; + _dst += 2 * this->rgb_stride; _py += 2 * this->y_stride; _pu += this->uv_stride; _pv += this->uv_stride; @@ -1821,7 +1821,7 @@ static void yuv2rgb_c_16 (yuv2rgb_t *this, uint8_t * _dst, this->dest_width >> 1, this->step_dx); scale_line (_pv, this->v_buffer, this->dest_width >> 1, this->step_dx); - scale_line (_py, this->y_buffer, + scale_line (_py, this->y_buffer, this->dest_width, this->step_dx); dy = 0; @@ -1841,7 +1841,7 @@ static void yuv2rgb_c_16 (yuv2rgb_t *this, uint8_t * _dst, X_RGB(1); DST1(1); - + X_RGB(2); DST1(2); @@ -1859,7 +1859,7 @@ static void yuv2rgb_c_16 (yuv2rgb_t *this, uint8_t * _dst, while (--dst_height > 0 && dy < 32768) { - xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width*2); + xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width*2); dy += this->step_dy; _dst += this->rgb_stride; @@ -1872,18 +1872,18 @@ static void yuv2rgb_c_16 (yuv2rgb_t *this, uint8_t * _dst, dy -= 32768; _py += this->y_stride; - scale_line (_py, this->y_buffer, + scale_line (_py, this->y_buffer, this->dest_width, this->step_dx); if (height & 1) { _pu += this->uv_stride; _pv += this->uv_stride; - + scale_line (_pu, this->u_buffer, this->dest_width >> 1, this->step_dx); scale_line (_pv, this->v_buffer, this->dest_width >> 1, this->step_dx); - + } height++; } while( dy>=32768); @@ -1923,7 +1923,7 @@ static void yuv2rgb_c_16 (yuv2rgb_t *this, uint8_t * _dst, dst_2 += 8; } while (--width); - _dst += 2 * this->rgb_stride; + _dst += 2 * this->rgb_stride; _py += 2 * this->y_stride; _pu += this->uv_stride; _pv += this->uv_stride; @@ -1951,7 +1951,7 @@ static void yuv2rgb_c_8 (yuv2rgb_t *this, uint8_t * _dst, this->dest_width >> 1, this->step_dx); scale_line (_pv, this->v_buffer, this->dest_width >> 1, this->step_dx); - scale_line (_py, this->y_buffer, + scale_line (_py, this->y_buffer, this->dest_width, this->step_dx); dy = 0; @@ -1971,7 +1971,7 @@ static void yuv2rgb_c_8 (yuv2rgb_t *this, uint8_t * _dst, X_RGB(1); DST1(1); - + X_RGB(2); DST1(2); @@ -1989,7 +1989,7 @@ static void yuv2rgb_c_8 (yuv2rgb_t *this, uint8_t * _dst, while (--dst_height > 0 && dy < 32768) { - xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width); + xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width); dy += this->step_dy; _dst += this->rgb_stride; @@ -2002,18 +2002,18 @@ static void yuv2rgb_c_8 (yuv2rgb_t *this, uint8_t * _dst, dy -= 32768; _py += this->y_stride; - scale_line (_py, this->y_buffer, + scale_line (_py, this->y_buffer, this->dest_width, this->step_dx); if (height & 1) { _pu += this->uv_stride; _pv += this->uv_stride; - + scale_line (_pu, this->u_buffer, this->dest_width >> 1, this->step_dx); scale_line (_pv, this->v_buffer, this->dest_width >> 1, this->step_dx); - + } height++; } while( dy>=32768 ); @@ -2045,7 +2045,7 @@ static void yuv2rgb_c_8 (yuv2rgb_t *this, uint8_t * _dst, X_RGB(3); DST2(3); DST1(3); - + pu += 4; pv += 4; py_1 += 8; @@ -2054,7 +2054,7 @@ static void yuv2rgb_c_8 (yuv2rgb_t *this, uint8_t * _dst, dst_2 += 8; } while (--width); - _dst += 2 * this->rgb_stride; + _dst += 2 * this->rgb_stride; _py += 2 * this->y_stride; _pu += this->uv_stride; _pv += this->uv_stride; @@ -2084,7 +2084,7 @@ static void yuv2rgb_c_gray (yuv2rgb_t *this, uint8_t * _dst, while (--dst_height > 0 && dy < 32768) { - xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width); + xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width); dy += this->step_dy; _dst += this->rgb_stride; @@ -2095,7 +2095,7 @@ static void yuv2rgb_c_gray (yuv2rgb_t *this, uint8_t * _dst, _py += this->y_stride*(dy>>15); dy &= 32767; - /* dy -= 32768; + /* dy -= 32768; _py += this->y_stride; */ } @@ -2146,7 +2146,7 @@ static void yuv2rgb_c_palette (yuv2rgb_t *this, uint8_t * _dst, X_RGB(1); DST1CMAP(1); - + X_RGB(2); DST1CMAP(2); @@ -2164,7 +2164,7 @@ static void yuv2rgb_c_palette (yuv2rgb_t *this, uint8_t * _dst, while (--dst_height > 0 && dy < 32768) { - xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width); + xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width); dy += this->step_dy; _dst += this->rgb_stride; @@ -2183,12 +2183,12 @@ static void yuv2rgb_c_palette (yuv2rgb_t *this, uint8_t * _dst, if (height & 1) { _pu += this->uv_stride; _pv += this->uv_stride; - + scale_line (_pu, this->u_buffer, this->dest_width >> 1, this->step_dx); scale_line (_pv, this->v_buffer, this->dest_width >> 1, this->step_dx); - + } height++; } while( dy>=32768 ); @@ -2228,7 +2228,7 @@ static void yuv2rgb_c_palette (yuv2rgb_t *this, uint8_t * _dst, dst_2 += 8; } while (--width); - _dst += 2 * this->rgb_stride; + _dst += 2 * this->rgb_stride; _py += 2 * this->y_stride; _pu += this->uv_stride; _pv += this->uv_stride; @@ -2424,7 +2424,7 @@ static void yuv2rgb_set_csc_levels (yuv2rgb_factory_t *this, lprintf ("mode %d not supported by yuv2rgb\n", mode); _x_abort(); } - + for (i = 0; i < 256; i++) { this->table_rV[i] = (((uint8_t *) table_r) + entry_size * div_round (crv * (i-128), 76309)); @@ -2437,7 +2437,7 @@ static void yuv2rgb_set_csc_levels (yuv2rgb_factory_t *this, #if defined(ARCH_X86) || defined(ARCH_X86_64) mmx_yuv2rgb_set_csc_levels (this, brightness, contrast, saturation); -#endif +#endif } static uint32_t yuv2rgb_single_pixel_32 (yuv2rgb_t *this, uint8_t y, uint8_t u, uint8_t v) @@ -2623,10 +2623,10 @@ static void yuy22rgb_c_32 (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p) this->dest_width >> 1, this->step_dx); scale_line_2 (_p, this->y_buffer, this->dest_width, this->step_dx); - + dy = 0; height = this->next_slice (this, &_dst); - + for (;;) { dst_1 = (uint32_t*)_dst; py_1 = this->y_buffer; @@ -2642,10 +2642,10 @@ static void yuy22rgb_c_32 (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p) X_RGB(1); DST1(1); - + X_RGB(2); DST1(2); - + X_RGB(3); DST1(3); @@ -2654,18 +2654,18 @@ static void yuy22rgb_c_32 (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p) py_1 += 8; dst_1 += 8; } while (--width); - + dy += this->step_dy; _dst += this->rgb_stride; - + while (--height > 0 && dy < 32768) { - + xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width*4); - + dy += this->step_dy; _dst += this->rgb_stride; } - + if (height <= 0) break; @@ -2675,12 +2675,12 @@ static void yuy22rgb_c_32 (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p) dy -= 32768; _p += this->y_stride*2; */ - + scale_line_4 (_p+1, this->u_buffer, this->dest_width >> 1, this->step_dx); scale_line_4 (_p+3, this->v_buffer, this->dest_width >> 1, this->step_dx); - scale_line_2 (_p, this->y_buffer, + scale_line_2 (_p, this->y_buffer, this->dest_width, this->step_dx); } } @@ -2700,30 +2700,30 @@ static void yuy22rgb_c_24_rgb (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p) this->dest_width >> 1, this->step_dx); scale_line_4 (_p+3, this->v_buffer, this->dest_width >> 1, this->step_dx); - scale_line_2 (_p, this->y_buffer, + scale_line_2 (_p, this->y_buffer, this->dest_width, this->step_dx); dy = 0; height = this->next_slice (this, &_dst); - + for (;;) { dst_1 = _dst; py_1 = this->y_buffer; pu = this->u_buffer; pv = this->v_buffer; - + width = this->dest_width >> 3; - + do { X_RGB(0); DST1RGB(0); - + X_RGB(1); DST1RGB(1); - + X_RGB(2); DST1RGB(2); - + X_RGB(3); DST1RGB(3); @@ -2735,15 +2735,15 @@ static void yuy22rgb_c_24_rgb (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p) dy += this->step_dy; _dst += this->rgb_stride; - + while (--height > 0 && dy < 32768) { xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width*3); - + dy += this->step_dy; _dst += this->rgb_stride; } - + if (height <= 0) break; @@ -2753,7 +2753,7 @@ static void yuy22rgb_c_24_rgb (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p) dy -= 32768; _p += this->y_stride*2; */ - + scale_line_4 (_p+1, this->u_buffer, this->dest_width >> 1, this->step_dx); scale_line_4 (_p+3, this->v_buffer, @@ -2778,50 +2778,50 @@ static void yuy22rgb_c_24_bgr (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p) this->dest_width >> 1, this->step_dx); scale_line_4 (_p+3, this->v_buffer, this->dest_width >> 1, this->step_dx); - scale_line_2 (_p, this->y_buffer, + scale_line_2 (_p, this->y_buffer, this->dest_width, this->step_dx); dy = 0; height = this->next_slice (this, &_dst); - + for (;;) { dst_1 = _dst; py_1 = this->y_buffer; pu = this->u_buffer; pv = this->v_buffer; - + width = this->dest_width >> 3; - + do { X_RGB(0); DST1BGR(0); - + X_RGB(1); DST1BGR(1); - + X_RGB(2); DST1BGR(2); X_RGB(3); DST1BGR(3); - + pu += 4; pv += 4; py_1 += 8; dst_1 += 24; } while (--width); - + dy += this->step_dy; _dst += this->rgb_stride; - + while (--height > 0 && dy < 32768) { xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width*3); - + dy += this->step_dy; _dst += this->rgb_stride; } - + if (height <= 0) break; @@ -2852,9 +2852,9 @@ static void yuy22rgb_c_16 (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p) this->dest_width >> 1, this->step_dx); scale_line_4 (_p+3, this->v_buffer, this->dest_width >> 1, this->step_dx); - scale_line_2 (_p, this->y_buffer, + scale_line_2 (_p, this->y_buffer, this->dest_width, this->step_dx); - + dy = 0; height = this->next_slice (this, &_dst); @@ -2863,19 +2863,19 @@ static void yuy22rgb_c_16 (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p) py_1 = this->y_buffer; pu = this->u_buffer; pv = this->v_buffer; - + width = this->dest_width >> 3; - + do { X_RGB(0); DST1(0); X_RGB(1); DST1(1); - + X_RGB(2); DST1(2); - + X_RGB(3); DST1(3); @@ -2884,24 +2884,24 @@ static void yuy22rgb_c_16 (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p) py_1 += 8; dst_1 += 8; } while (--width); - + dy += this->step_dy; _dst += this->rgb_stride; while (--height > 0 && dy < 32768) { - - xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width*2); + + xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width*2); dy += this->step_dy; _dst += this->rgb_stride; } - + if (height <= 0) break; _p += this->y_stride*(dy>>15); dy &= 32767; - + scale_line_4 (_p+1, this->u_buffer, this->dest_width >> 1, this->step_dx); scale_line_4 (_p+3, this->v_buffer, @@ -2928,28 +2928,28 @@ static void yuy22rgb_c_8 (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p) this->dest_width >> 1, this->step_dx); scale_line_2 (_p, this->y_buffer, this->dest_width, this->step_dx); - + dy = 0; height = this->next_slice (this, &_dst); - + for (;;) { dst_1 = _dst; py_1 = this->y_buffer; pu = this->u_buffer; pv = this->v_buffer; - + width = this->dest_width >> 3; - + do { X_RGB(0); DST1(0); - + X_RGB(1); DST1(1); X_RGB(2); DST1(2); - + X_RGB(3); DST1(3); @@ -2958,29 +2958,29 @@ static void yuy22rgb_c_8 (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p) py_1 += 8; dst_1 += 8; } while (--width); - + dy += this->step_dy; _dst += this->rgb_stride; - + while (--height > 0 && dy < 32768) { - - xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width); - + + xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width); + dy += this->step_dy; _dst += this->rgb_stride; } - + if (height <= 0) break; _p += this->y_stride*(dy>>15); dy &= 32767; - + scale_line_4 (_p+1, this->u_buffer, this->dest_width >> 1, this->step_dx); scale_line_4 (_p+3, this->v_buffer, this->dest_width >> 1, this->step_dx); - scale_line_2 (_p, this->y_buffer, + scale_line_2 (_p, this->y_buffer, this->dest_width, this->step_dx); } } @@ -2995,21 +2995,21 @@ static void yuy22rgb_c_gray (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p) if (this->do_scale) { dy = 0; height = this->next_slice (this, &_dst); - + for (;;) { scale_line_2 (_p, _dst, this->dest_width, this->step_dx); - + dy += this->step_dy; _dst += this->rgb_stride; - + while (--height > 0 && dy < 32768) { - - xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width); - + + xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width); + dy += this->step_dy; _dst += this->rgb_stride; } - + if (height <= 0) break; @@ -3017,7 +3017,7 @@ static void yuy22rgb_c_gray (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p) dy &= 32767; } } else { - for (height = this->next_slice (this, &_dst); --height >= 0; ) { + for (height = this->next_slice (this, &_dst); --height >= 0; ) { dst = _dst; y = _p; for (width = this->source_width; --width >= 0; ) { @@ -3038,25 +3038,25 @@ static void yuy22rgb_c_palette (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p) uint8_t * dst_1; int width, height; int dy; - + scale_line_4 (_p+1, this->u_buffer, this->dest_width >> 1, this->step_dx); scale_line_4 (_p+3, this->v_buffer, this->dest_width >> 1, this->step_dx); scale_line_2 (_p, this->y_buffer, this->dest_width, this->step_dx); - + dy = 0; height = this->next_slice (this, &_dst); - + for (;;) { dst_1 = _dst; py_1 = this->y_buffer; pu = this->u_buffer; pv = this->v_buffer; - + width = this->dest_width >> 3; - + do { X_RGB(0); DST1CMAP(0); @@ -3176,7 +3176,7 @@ static yuv2rgb_t *yuv2rgb_create_converter (yuv2rgb_factory_t *factory) { } /* - * factory functions + * factory functions */ static void yuv2rgb_factory_dispose (yuv2rgb_factory_t *this) { @@ -3186,7 +3186,7 @@ static void yuv2rgb_factory_dispose (yuv2rgb_factory_t *this) { free (this); } -yuv2rgb_factory_t* yuv2rgb_factory_init (int mode, int swapped, +yuv2rgb_factory_t* yuv2rgb_factory_init (int mode, int swapped, uint8_t *cmap) { yuv2rgb_factory_t *this; diff --git a/src/video_out/yuv2rgb.h b/src/video_out/yuv2rgb.h index dce0ade18..1a1252f40 100644 --- a/src/video_out/yuv2rgb.h +++ b/src/video_out/yuv2rgb.h @@ -114,7 +114,7 @@ struct yuv2rgb_s { void *table_mmx; uint8_t *cmap; - scale_line_func_t scale_line; + scale_line_func_t scale_line; } ; /* @@ -124,7 +124,7 @@ struct yuv2rgb_s { struct yuv2rgb_factory_s { yuv2rgb_t* (*create_converter) (yuv2rgb_factory_t *this); - /* + /* * set color space conversion levels * for all converters produced by this factory */ @@ -160,7 +160,7 @@ struct yuv2rgb_factory_s { yuv2rgb_factory_t *yuv2rgb_factory_init (int mode, int swapped, uint8_t *colormap); - + /* * internal stuff below this line */ diff --git a/src/video_out/yuv2rgb_mlib.c b/src/video_out/yuv2rgb_mlib.c index 22e67efa8..a10503d55 100644 --- a/src/video_out/yuv2rgb_mlib.c +++ b/src/video_out/yuv2rgb_mlib.c @@ -51,7 +51,7 @@ static void mlib_yuv420_rgb24(yuv2rgb_t *this, mlib_s32 resize_stride = this->dest_width << 2; mlib_VideoColorYUV420seq_to_ARGBint((mlib_u32*)this->mlib_buffer, - py, pu, pv, py, 0, + py, pu, pv, py, 0, this->source_width, src_height, this->source_width<<2, @@ -88,7 +88,7 @@ static void mlib_yuv420_argb32(yuv2rgb_t *this, dst_height = this->next_slice(this, &image); if (this->do_scale) { mlib_VideoColorYUV420seq_to_ARGBint((mlib_u32*)this->mlib_buffer, - py, pu, pv, py, 0, + py, pu, pv, py, 0, this->source_width, src_height, this->source_width<<2, @@ -101,7 +101,7 @@ static void mlib_yuv420_argb32(yuv2rgb_t *this, this->mlib_filter_type); } else { mlib_VideoColorYUV420seq_to_ARGBint((mlib_u32*)image, - py, pu, pv, py, 0, + py, pu, pv, py, 0, this->source_width, dst_height, this->rgb_stride, @@ -127,7 +127,7 @@ static void mlib_yuv420_abgr32(yuv2rgb_t *this, dst_height = this->next_slice (this, &image); if (this->do_scale) { mlib_VideoColorYUV420seq_to_ABGRint((mlib_u32*)this->mlib_buffer, - py, pu, pv, py, 0, + py, pu, pv, py, 0, this->source_width, src_height, this->source_width<<2, @@ -141,7 +141,7 @@ static void mlib_yuv420_abgr32(yuv2rgb_t *this, } else { mlib_VideoColorYUV420seq_to_ABGRint((mlib_u32*)image, - py, pu, pv, py, 0, + py, pu, pv, py, 0, this->source_width, dst_height, this->rgb_stride, diff --git a/src/video_out/yuv2rgb_mmx.c b/src/video_out/yuv2rgb_mmx.c index 20a9b5a00..46db48179 100644 --- a/src/video_out/yuv2rgb_mmx.c +++ b/src/video_out/yuv2rgb_mmx.c @@ -175,7 +175,7 @@ static inline void mmx_yuv2rgb (uint8_t * py, uint8_t * pu, uint8_t * pv, mmx_cs pmulhw_m2r (csc->V_green, mm4); // mm4 = v * v_green - + // slot @@ -399,7 +399,7 @@ static inline void mmx_unpack_24rgb (uint8_t * image, int cpu) pand_m2r (mmx_lorgb, mm6); psrlq_i2r (8, mm5); por_r2r(mm6, mm5); /* mm5 = 0x0000R1G1B1R0G0B0 */ - + movq_r2r (mm0, mm6); punpcklbw_r2r (mm2, mm6); punpckhwd_r2r (mm7, mm6); /* mm6 = 0x??R3G3B3??R2G2B2 */ @@ -474,13 +474,13 @@ static inline void yuv420_rgb16 (yuv2rgb_t *this, i = width; img = image; do { mmx_yuv2rgb (py, pu, pv, this->table_mmx); - mmx_unpack_16rgb (img, cpu); + mmx_unpack_16rgb (img, cpu); py += 8; pu += 4; pv += 4; img += 16; } while (--i); - + py += y_stride; image += rgb_stride; if (height & 1) { @@ -502,7 +502,7 @@ static inline void yuv420_rgb16 (yuv2rgb_t *this, this->dest_width >> 1, this->step_dx); scale_line (pv, this->v_buffer, this->dest_width >> 1, this->step_dx); - scale_line (py, this->y_buffer, + scale_line (py, this->y_buffer, this->dest_width, this->step_dx); dst_height = this->next_slice (this, &image); @@ -518,19 +518,19 @@ static inline void yuv420_rgb16 (yuv2rgb_t *this, /* printf ("i : %d\n",i); */ mmx_yuv2rgb (y_buf, u_buf, v_buf, this->table_mmx); - mmx_unpack_16rgb (img, cpu); + mmx_unpack_16rgb (img, cpu); y_buf += 8; u_buf += 4; v_buf += 4; img += 16; } while (--i); - + dy += this->step_dy; image += rgb_stride; while (--dst_height > 0 && dy < 32768) { - xine_fast_memcpy (image, image-rgb_stride, this->dest_width*2); + xine_fast_memcpy (image, image-rgb_stride, this->dest_width*2); dy += this->step_dy; image += rgb_stride; @@ -544,23 +544,23 @@ static inline void yuv420_rgb16 (yuv2rgb_t *this, py += y_stride; - scale_line (py, this->y_buffer, + scale_line (py, this->y_buffer, this->dest_width, this->step_dx); if (height & 1) { pu += uv_stride; pv += uv_stride; - + scale_line (pu, this->u_buffer, this->dest_width >> 1, this->step_dx); scale_line (pv, this->v_buffer, this->dest_width >> 1, this->step_dx); - + } height++; } while( dy>=32768); } - } + } } static inline void yuv420_rgb15 (yuv2rgb_t *this, @@ -587,13 +587,13 @@ static inline void yuv420_rgb15 (yuv2rgb_t *this, i = width; img = image; do { mmx_yuv2rgb (py, pu, pv, this->table_mmx); - mmx_unpack_15rgb (img, cpu); + mmx_unpack_15rgb (img, cpu); py += 8; pu += 4; pv += 4; img += 16; } while (--i); - + py += y_stride; image += rgb_stride; if (height & 1) { @@ -615,11 +615,11 @@ static inline void yuv420_rgb15 (yuv2rgb_t *this, this->dest_width >> 1, this->step_dx); scale_line (pv, this->v_buffer, this->dest_width >> 1, this->step_dx); - scale_line (py, this->y_buffer, + scale_line (py, this->y_buffer, this->dest_width, this->step_dx); - + dst_height = this->next_slice (this, &image); - + for (height = 0;; ) { y_buf = this->y_buffer; @@ -631,19 +631,19 @@ static inline void yuv420_rgb15 (yuv2rgb_t *this, /* printf ("i : %d\n",i); */ mmx_yuv2rgb (y_buf, u_buf, v_buf, this->table_mmx); - mmx_unpack_15rgb (img, cpu); + mmx_unpack_15rgb (img, cpu); y_buf += 8; u_buf += 4; v_buf += 4; img += 16; } while (--i); - + dy += this->step_dy; image += rgb_stride; while (--dst_height > 0 && dy < 32768) { - xine_fast_memcpy (image, image-rgb_stride, this->dest_width*2); + xine_fast_memcpy (image, image-rgb_stride, this->dest_width*2); dy += this->step_dy; image += rgb_stride; @@ -656,23 +656,23 @@ static inline void yuv420_rgb15 (yuv2rgb_t *this, dy -= 32768; py += y_stride; - scale_line (py, this->y_buffer, + scale_line (py, this->y_buffer, this->dest_width, this->step_dx); if (height & 1) { pu += uv_stride; pv += uv_stride; - + scale_line (pu, this->u_buffer, this->dest_width >> 1, this->step_dx); scale_line (pv, this->v_buffer, this->dest_width >> 1, this->step_dx); - + } height++; } while( dy>=32768 ); } - } + } } static inline void yuv420_rgb24 (yuv2rgb_t *this, @@ -725,7 +725,7 @@ static inline void yuv420_rgb24 (yuv2rgb_t *this, this->dest_width >> 1, this->step_dx); scale_line (pv, this->v_buffer, this->dest_width >> 1, this->step_dx); - scale_line (py, this->y_buffer, + scale_line (py, this->y_buffer, this->dest_width, this->step_dx); dst_height = this->next_slice (this, &image); @@ -742,13 +742,13 @@ static inline void yuv420_rgb24 (yuv2rgb_t *this, /* printf ("i : %d\n",i); */ mmx_yuv2rgb (y_buf, u_buf, v_buf, this->table_mmx); - mmx_unpack_24rgb (img, cpu); + mmx_unpack_24rgb (img, cpu); y_buf += 8; u_buf += 4; v_buf += 4; img += 24; } while (--i); - + dy += this->step_dy; image += rgb_stride; @@ -766,14 +766,14 @@ static inline void yuv420_rgb24 (yuv2rgb_t *this, do { dy -= 32768; py += y_stride; - - scale_line (py, this->y_buffer, + + scale_line (py, this->y_buffer, this->dest_width, this->step_dx); if (height & 1) { pu += uv_stride; pv += uv_stride; - + scale_line (pu, this->u_buffer, this->dest_width >> 1, this->step_dx); scale_line (pv, this->v_buffer, @@ -783,7 +783,7 @@ static inline void yuv420_rgb24 (yuv2rgb_t *this, } while( dy>=32768 ); } - + } } @@ -837,11 +837,11 @@ static inline void yuv420_argb32 (yuv2rgb_t *this, this->dest_width >> 1, this->step_dx); scale_line (pv, this->v_buffer, this->dest_width >> 1, this->step_dx); - scale_line (py, this->y_buffer, + scale_line (py, this->y_buffer, this->dest_width, this->step_dx); dst_height = this->next_slice (this, &image); - + for (height = 0;; ) { y_buf = this->y_buffer; @@ -854,19 +854,19 @@ static inline void yuv420_argb32 (yuv2rgb_t *this, /* printf ("i : %d\n",i); */ mmx_yuv2rgb (y_buf, u_buf, v_buf, this->table_mmx); - mmx_unpack_32rgb (img, cpu); + mmx_unpack_32rgb (img, cpu); y_buf += 8; u_buf += 4; v_buf += 4; img += 32; } while (--i); - + dy += this->step_dy; image += rgb_stride; while (--dst_height > 0 && dy < 32768) { - xine_fast_memcpy (image, image-rgb_stride, this->dest_width*4); + xine_fast_memcpy (image, image-rgb_stride, this->dest_width*4); dy += this->step_dy; image += rgb_stride; @@ -878,14 +878,14 @@ static inline void yuv420_argb32 (yuv2rgb_t *this, do { dy -= 32768; py += y_stride; - - scale_line (py, this->y_buffer, + + scale_line (py, this->y_buffer, this->dest_width, this->step_dx); if (height & 1) { pu += uv_stride; pv += uv_stride; - + scale_line (pu, this->u_buffer, this->dest_width >> 1, this->step_dx); scale_line (pv, this->v_buffer, @@ -894,7 +894,7 @@ static inline void yuv420_argb32 (yuv2rgb_t *this, height++; } while( dy>=32768 ); } - + } } @@ -948,11 +948,11 @@ static inline void yuv420_abgr32 (yuv2rgb_t *this, this->dest_width >> 1, this->step_dx); scale_line (pv, this->v_buffer, this->dest_width >> 1, this->step_dx); - scale_line (py, this->y_buffer, + scale_line (py, this->y_buffer, this->dest_width, this->step_dx); dst_height = this->next_slice (this, &image); - + for (height = 0;; ) { y_buf = this->y_buffer; @@ -965,19 +965,19 @@ static inline void yuv420_abgr32 (yuv2rgb_t *this, /* printf ("i : %d\n",i); */ mmx_yuv2rgb (y_buf, u_buf, v_buf, this->table_mmx); - mmx_unpack_32bgr (img, cpu); + mmx_unpack_32bgr (img, cpu); y_buf += 8; u_buf += 4; v_buf += 4; img += 32; } while (--i); - + dy += this->step_dy; image += rgb_stride; while (--dst_height > 0 && dy < 32768) { - xine_fast_memcpy (image, image-rgb_stride, this->dest_width*4); + xine_fast_memcpy (image, image-rgb_stride, this->dest_width*4); dy += this->step_dy; image += rgb_stride; @@ -989,14 +989,14 @@ static inline void yuv420_abgr32 (yuv2rgb_t *this, do { dy -= 32768; py += y_stride; - - scale_line (py, this->y_buffer, + + scale_line (py, this->y_buffer, this->dest_width, this->step_dx); if (height & 1) { pu += uv_stride; pv += uv_stride; - + scale_line (pu, this->u_buffer, this->dest_width >> 1, this->step_dx); scale_line (pv, this->v_buffer, @@ -1006,7 +1006,7 @@ static inline void yuv420_abgr32 (yuv2rgb_t *this, } while( dy>=32768 ); } - + } } @@ -1082,7 +1082,7 @@ static void mmx_abgr32 (yuv2rgb_t *this, uint8_t * image, void yuv2rgb_init_mmxext (yuv2rgb_factory_t *this) { - if (this->swapped) + if (this->swapped) return; /*no swapped pixel output upto now*/ switch (this->mode) { @@ -1106,7 +1106,7 @@ void yuv2rgb_init_mmxext (yuv2rgb_factory_t *this) { void yuv2rgb_init_mmx (yuv2rgb_factory_t *this) { - if (this->swapped) + if (this->swapped) return; /*no swapped pixel output upto now*/ switch (this->mode) { diff --git a/src/xine-engine/accel_xvmc.h b/src/xine-engine/accel_xvmc.h index cec5f9558..197b76050 100644 --- a/src/xine-engine/accel_xvmc.h +++ b/src/xine-engine/accel_xvmc.h @@ -3,23 +3,23 @@ * Copyright (C) 2004 the Unichrome project * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * - * Common acceleration definitions for XvMC. + * Common acceleration definitions for XvMC. * * */ @@ -81,7 +81,7 @@ typedef struct xine_xxmc_s { */ xine_xvmc_t xvmc; - + unsigned mpeg; unsigned acceleration; int fallback_format; @@ -103,7 +103,7 @@ typedef struct xine_xxmc_s { * For thread-safety only. */ - int (*proc_xxmc_lock_valid) (vo_frame_t *cur_frame, vo_frame_t *fw_frame, + int (*proc_xxmc_lock_valid) (vo_frame_t *cur_frame, vo_frame_t *fw_frame, vo_frame_t *bw_frame,unsigned pc_type); void (*proc_xxmc_unlock) (vo_driver_t *this_gen); } xine_xxmc_t; diff --git a/src/xine-engine/alphablend.c b/src/xine-engine/alphablend.c index 1dcd47eb7..4727740bd 100644 --- a/src/xine-engine/alphablend.c +++ b/src/xine-engine/alphablend.c @@ -1,7 +1,7 @@ /* * * Copyright (C) James Courtier-Dutton James@superbug.demon.co.uk - July 2001 - * + * * Copyright (C) 2000 Thomas Mirlacher * 2002-2004 the xine project * @@ -114,7 +114,7 @@ rle_img_advance_line(rle_elem_t *rle, rle_elem_t *rle_limit, int w) /* * heck, this function is overly complicated and currently buggy. - * if James would like to revive it (implementing proper clipping - + * if James would like to revive it (implementing proper clipping - * not to confuse with button highlight) i would have no objections, * but for now i will be using an alternate version based on rgb24. [MF] * @@ -181,7 +181,7 @@ void blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, printf("blend_rgb16: dy_step=%i, x_scale=%i\n", dy_step, x_scale); #endif if (img_width & 1) img_width++; - img_offset = ( ( (y_off * img_height) / dst_height) * img_width) + img_offset = ( ( (y_off * img_height) / dst_height) * img_width) + ( (x_off * img_width) / dst_width); #ifdef LOG_BLEND_RGB16 printf("blend_rgb16: x=%i, y=%i, w=%i, h=%i, img_offset=%lf\n", img_overl->x, img_overl->y, @@ -190,7 +190,7 @@ void blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, img_offset); #endif img_pix = (uint16_t *) img + (int)img_offset; -/* +/* + (y_off * img_height / dst_height) * img_width + (x_off * img_width / dst_width); */ @@ -200,26 +200,26 @@ void blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, clip_right = src_width; else clip_right = dst_width - x_off; - + if( x_off >= 0 ) clip_left = 0; else clip_left = -x_off; - + if( y_off >= 0 ) clip_top = 0; else clip_top = -y_off; - + if( (src_height + y_off) > dst_height ) src_height = dst_height - y_off; - + /* make highlight area fit into clip area */ if( img_overl->hili_right <= clip_right ) hili_right = img_overl->hili_right; else hili_right = clip_right; - + if( img_overl->hili_left >= clip_left ) hili_left = img_overl->hili_left; else @@ -233,7 +233,7 @@ void blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, x = x1_scaled = x2_scaled = 0; #ifdef LOG_BLEND_RGB16 - printf("blend_rgb16 started\n"); + printf("blend_rgb16 started\n"); #endif while (zone_state != 6) { @@ -287,10 +287,10 @@ void blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, mem_blend16(img_pix+x1_scaled, *((uint16_t *)&clut[clr]), o, x2_scaled-x1_scaled); } x += rle_this_bite; - if (x >= src_width ) { + if (x >= src_width ) { x -= src_width; img_pix += img_width; - + dy += dy_step; if (dy >= INT_TO_SCALED(1)) { dy -= INT_TO_SCALED(1); @@ -304,7 +304,7 @@ void blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, } else { rle = rle_start; /* y-scaling, reuse the last rle encoded line */ } - } + } rle_remainder = rlelen = rle->len; clr_next = rle->color; rle++; @@ -345,7 +345,7 @@ void blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, mem_blend16(img_pix+x1_scaled, *((uint16_t *)&clut[clr]), o, x2_scaled-x1_scaled); } x += rle_this_bite; - if (x >= src_width ) { + if (x >= src_width ) { x -= src_width; img_pix += img_width; dy += dy_step; @@ -390,7 +390,7 @@ void blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, mem_blend16(img_pix+x1_scaled, *((uint16_t *)&clut[clr]), o, x2_scaled-x1_scaled); } x += rle_this_bite; - if (x >= src_width ) { + if (x >= src_width ) { x -= src_width; img_pix += img_width; dy += dy_step; @@ -410,7 +410,7 @@ void blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, zone_state = 5; break; } - } + } if (rle >= rle_limit) { zone_state = 6; } @@ -435,7 +435,7 @@ void blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, mem_blend16(img_pix+x1_scaled, *((uint16_t *)&clut[clr]), o, x2_scaled-x1_scaled); } x += rle_this_bite; - if (x >= src_width ) { + if (x >= src_width ) { x -= src_width; img_pix += img_width; dy += dy_step; @@ -455,7 +455,7 @@ void blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, zone_state = 5; break; } - } + } if (rle >= rle_limit) { zone_state = 6; } @@ -473,7 +473,7 @@ void blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, mem_blend16(img_pix+x1_scaled, *((uint16_t *)&clut[clr]), o, x2_scaled-x1_scaled); } x += rle_this_bite; - if (x >= src_width ) { + if (x >= src_width ) { x -= src_width; img_pix += img_width; dy += dy_step; @@ -489,7 +489,7 @@ void blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, } else { rle = rle_start; /* y-scaling, reuse the last rle encoded line */ } - } + } rle_remainder = rlelen = rle->len; clr_next = rle->color; rle++; @@ -513,7 +513,7 @@ void blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, mem_blend16(img_pix+x1_scaled, *((uint16_t *)&clut[clr]), o, x2_scaled-x1_scaled); } x += rle_this_bite; - if (x >= src_width ) { + if (x >= src_width ) { x -= src_width; img_pix += img_width; dy += dy_step; @@ -529,7 +529,7 @@ void blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, } else { rle = rle_start; /* y-scaling, reuse the last rle encoded line */ } - } + } rle_remainder = rlelen = rle->len; clr_next = rle->color; rle++; @@ -544,7 +544,7 @@ void blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, #ifdef LOG_BLEND_RGB16 printf("blend_rgb16 ended\n"); #endif - + } #endif @@ -576,26 +576,26 @@ void _x_blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, clip_right = src_width; else clip_right = dst_width - x_off; - + if( x_off >= 0 ) clip_left = 0; else clip_left = -x_off; - + if( y_off >= 0 ) clip_top = 0; else clip_top = -y_off; - + if( (src_height + y_off) > dst_height ) src_height = dst_height - y_off; - + /* make highlight area fit into clip area */ if( img_overl->hili_right <= clip_right ) hili_right = img_overl->hili_right; else hili_right = clip_right; - + if( img_overl->hili_left >= clip_left ) hili_left = img_overl->hili_left; else @@ -619,7 +619,7 @@ void _x_blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, if (rlelen <= 0) { if (rle >= rle_limit) break; - + rlelen = rle->len; clr = rle->color; rle++; @@ -627,7 +627,7 @@ void _x_blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, if (!mask) { /* above or below highlight area */ - + rle_bite = rlelen; /* choose palette for surrounding area */ colors = (clut_t*)img_overl->color; @@ -646,7 +646,7 @@ void _x_blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, trans = img_overl->trans; } else { /* ends left */ - + rle_bite = rlelen; /* choose palette for surrounding area */ colors = (clut_t*)img_overl->color; @@ -666,25 +666,25 @@ void _x_blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, trans = img_overl->hili_trans; } else { /* starts right */ - + rle_bite = rlelen; /* choose palette for surrounding area */ colors = (clut_t*)img_overl->color; trans = img_overl->trans; - + if( x + rle_bite >= clip_right ) clipped = 1; } } else { /* starts not left and ends not right */ - + rle_bite = rlelen; /* we're in the center area so choose highlight palette */ colors = (clut_t*)img_overl->hili_color; trans = img_overl->hili_trans; } } - + x2_scaled = SCALED_TO_INT((x + rle_bite) * x_scale); o = trans[clr]; @@ -743,26 +743,26 @@ void _x_blend_rgb24 (uint8_t * img, vo_overlay_t * img_overl, clip_right = src_width; else clip_right = dst_width - x_off; - + if( x_off >= 0 ) clip_left = 0; else clip_left = -x_off; - + if( y_off >= 0 ) clip_top = 0; else clip_top = -y_off; - + if( (src_height + y_off) > dst_height ) src_height = dst_height - y_off; - + /* make highlight area fit into clip area */ if( img_overl->hili_right <= clip_right ) hili_right = img_overl->hili_right; else hili_right = clip_right; - + if( img_overl->hili_left >= clip_left ) hili_left = img_overl->hili_left; else @@ -786,7 +786,7 @@ void _x_blend_rgb24 (uint8_t * img, vo_overlay_t * img_overl, if (rlelen <= 0) { if (rle >= rle_limit) break; - + rlelen = rle->len; clr = rle->color; rle++; @@ -794,7 +794,7 @@ void _x_blend_rgb24 (uint8_t * img, vo_overlay_t * img_overl, if (!mask) { /* above or below highlight area */ - + rle_bite = rlelen; /* choose palette for surrounding area */ colors = (clut_t*)img_overl->color; @@ -813,7 +813,7 @@ void _x_blend_rgb24 (uint8_t * img, vo_overlay_t * img_overl, trans = img_overl->trans; } else { /* ends left */ - + rle_bite = rlelen; /* choose palette for surrounding area */ colors = (clut_t*)img_overl->color; @@ -833,25 +833,25 @@ void _x_blend_rgb24 (uint8_t * img, vo_overlay_t * img_overl, trans = img_overl->hili_trans; } else { /* starts right */ - + rle_bite = rlelen; /* choose palette for surrounding area */ colors = (clut_t*)img_overl->color; trans = img_overl->trans; - + if( x + rle_bite >= clip_right ) clipped = 1; } } else { /* starts not left and ends not right */ - + rle_bite = rlelen; /* we're in the center area so choose highlight palette */ colors = (clut_t*)img_overl->hili_color; trans = img_overl->hili_trans; } } - + x2_scaled = SCALED_TO_INT((x + rle_bite) * x_scale); o = trans[clr]; @@ -910,50 +910,50 @@ void _x_blend_rgb32 (uint8_t * img, vo_overlay_t * img_overl, clip_right = src_width; else clip_right = dst_width - x_off; - + if( x_off >= 0 ) clip_left = 0; else clip_left = -x_off; - + if( y_off >= 0 ) clip_top = 0; else clip_top = -y_off; - + if( (src_height + y_off) > dst_height ) src_height = dst_height - y_off; - + /* make highlight area fit into clip area */ if( img_overl->hili_right <= clip_right ) hili_right = img_overl->hili_right; else hili_right = clip_right; - + if( img_overl->hili_left >= clip_left ) hili_left = img_overl->hili_left; else hili_left = clip_left; - + for (y = dy = 0; y < src_height && rle < rle_limit; ) { int mask = !(y < img_overl->hili_top || y >= img_overl->hili_bottom); rle_elem_t *rle_start = rle; int rlelen = 0; uint8_t clr = 0; - + for (x = x1_scaled = 0; x < src_width;) { int rle_bite; clut_t *colors; uint8_t *trans; uint16_t o; int clipped = (y < clip_top); - + /* take next element from rle list everytime an element is finished */ if (rlelen <= 0) { if (rle >= rle_limit) break; - + rlelen = rle->len; clr = rle->color; rle++; @@ -961,7 +961,7 @@ void _x_blend_rgb32 (uint8_t * img, vo_overlay_t * img_overl, if (!mask) { /* above or below highlight area */ - + rle_bite = rlelen; /* choose palette for surrounding area */ colors = (clut_t*)img_overl->color; @@ -980,7 +980,7 @@ void _x_blend_rgb32 (uint8_t * img, vo_overlay_t * img_overl, trans = img_overl->trans; } else { /* ends left */ - + rle_bite = rlelen; /* choose palette for surrounding area */ colors = (clut_t*)img_overl->color; @@ -1000,25 +1000,25 @@ void _x_blend_rgb32 (uint8_t * img, vo_overlay_t * img_overl, trans = img_overl->hili_trans; } else { /* starts right */ - + rle_bite = rlelen; /* choose palette for surrounding area */ colors = (clut_t*)img_overl->color; trans = img_overl->trans; - + if( x + rle_bite >= clip_right ) clipped = 1; } } else { /* starts not left and ends not right */ - + rle_bite = rlelen; /* we're in the center area so choose highlight palette */ colors = (clut_t*)img_overl->hili_color; trans = img_overl->hili_trans; } } - + x2_scaled = SCALED_TO_INT((x + rle_bite) * x_scale); o = trans[clr]; @@ -1056,11 +1056,11 @@ static void mem_blend8(uint8_t *mem, uint8_t val, uint8_t o, size_t sz) } } -static void blend_yuv_exact(uint8_t *dst_cr, uint8_t *dst_cb, int src_width, +static void blend_yuv_exact(uint8_t *dst_cr, uint8_t *dst_cb, int src_width, uint8_t *(*blend_yuv_data)[ 3 ][ 2 ]) { int x; - + for (x = 0; x < src_width; x += 2) { /* get opacity of the 4 pixels that share chroma */ int o00 = (*blend_yuv_data)[ 0 ][ 0 ][ x + 0 ]; @@ -1078,7 +1078,7 @@ static void blend_yuv_exact(uint8_t *dst_cr, uint8_t *dst_cb, int src_width, int cr01 = (*blend_yuv_data)[ 1 ][ 0 ][ x + 1 ]; int cr10 = (*blend_yuv_data)[ 1 ][ 1 ][ x + 0 ]; int cr11 = (*blend_yuv_data)[ 1 ][ 1 ][ x + 1 ]; - + int cb00 = (*blend_yuv_data)[ 2 ][ 0 ][ x + 0 ]; int cb01 = (*blend_yuv_data)[ 2 ][ 0 ][ x + 1 ]; int cb10 = (*blend_yuv_data)[ 2 ][ 1 ][ x + 0 ]; @@ -1113,11 +1113,11 @@ static uint8_t *(*blend_yuv_grow_extra_data(alphablend_t *extra_data, int osd_wi int max_width; uint8_t *data[ 3 ][ 2 ]; } *header = (struct header_s *)extra_data->buffer; - + size_t needed_buffer_size = sizeof (*header) + osd_width * sizeof (uint8_t[ 3 ][ 2 ]); - + if (extra_data->buffer_size < needed_buffer_size) { - + free(extra_data->buffer); header = calloc(1, needed_buffer_size); if (!header) { @@ -1143,7 +1143,7 @@ static uint8_t *(*blend_yuv_grow_extra_data(alphablend_t *extra_data, int osd_wi return &(header->data); } - + void _x_blend_yuv (uint8_t *dst_base[3], vo_overlay_t * img_overl, int dst_width, int dst_height, int dst_pitches[3], alphablend_t *extra_data) @@ -1168,12 +1168,12 @@ void _x_blend_yuv (uint8_t *dst_base[3], vo_overlay_t * img_overl, int hili_right, hili_left; int clip_right, clip_left, clip_top; uint8_t clr=0; - + int any_line_buffered = 0; int exact_blend_width = ((src_width <= (dst_width - x_off)) ? src_width : (dst_width - x_off)); int exact_blend_width_m2 = (x_odd + exact_blend_width + 1) & ~1; /* make it a (larger) multiple of 2 */ uint8_t *(*blend_yuv_data)[ 3 ][ 2 ] = 0; - + uint8_t *dst_y = dst_base[0] + dst_pitches[0] * y_off + x_off; uint8_t *dst_cr = dst_base[2] + (y_off / 2) * dst_pitches[1] + (x_off / 2); uint8_t *dst_cb = dst_base[1] + (y_off / 2) * dst_pitches[2] + (x_off / 2); @@ -1188,26 +1188,26 @@ void _x_blend_yuv (uint8_t *dst_base[3], vo_overlay_t * img_overl, clip_right = src_width; else clip_right = dst_width - x_off; - + if( x_off >= 0 ) clip_left = 0; else clip_left = -x_off; - + if( y_off >= 0 ) clip_top = 0; else clip_top = -y_off; - + if( (src_height + y_off) > dst_height ) src_height = dst_height - y_off; - + /* make highlight area fit into clip area */ if( img_overl->hili_right <= clip_right ) hili_right = img_overl->hili_right; else hili_right = clip_right; - + if( img_overl->hili_left >= clip_left ) hili_left = img_overl->hili_left; else @@ -1219,16 +1219,16 @@ void _x_blend_yuv (uint8_t *dst_base[3], vo_overlay_t * img_overl, if (enable_exact_blending) { if (exact_blend_width <= 0) return; - + blend_yuv_data = blend_yuv_grow_extra_data(extra_data, exact_blend_width_m2); if (!blend_yuv_data) return; - + /* make linebuffer transparent */ memset(&(*blend_yuv_data)[ 0 ][ 0 ][ 0 ], 0, exact_blend_width_m2); memset(&(*blend_yuv_data)[ 0 ][ 1 ][ 0 ], 0, exact_blend_width_m2); } - + rlelen=rle_remainder=0; for (y = 0; y < src_height; y++) { if (rle >= rle_limit) { @@ -1237,7 +1237,7 @@ void _x_blend_yuv (uint8_t *dst_base[3], vo_overlay_t * img_overl, #endif break; } - + ymask = ((y < img_overl->hili_top) || (y >= img_overl->hili_bottom)); xmask = 0; #ifdef LOG_BLEND_YUV @@ -1247,14 +1247,14 @@ void _x_blend_yuv (uint8_t *dst_base[3], vo_overlay_t * img_overl, for (x = 0; x < src_width;) { uint16_t o; int clipped = (y < clip_top); - + if (rle >= rle_limit) { #ifdef LOG_BLEND_YUV printf("x-rle_limit\n"); #endif break; } - + #ifdef LOG_BLEND_YUV printf("1:rle_len=%d, remainder=%d, x=%d\n",rlelen, rle_remainder, x); #endif @@ -1263,7 +1263,7 @@ void _x_blend_yuv (uint8_t *dst_base[3], vo_overlay_t * img_overl, #ifdef LOG_BLEND_YUV printf("alphablend: major bug in blend_yuv < 0\n"); #endif - } + } if (rlelen == 0) { rle_remainder = rlelen = rle->len; clr = rle->color; @@ -1281,11 +1281,11 @@ void _x_blend_yuv (uint8_t *dst_base[3], vo_overlay_t * img_overl, #endif if (ymask == 0) { - if (x < hili_left) { + if (x < hili_left) { /* Starts outside highlight area */ if ((x + rle_remainder) > hili_left ) { #ifdef LOG_BLEND_YUV - printf("Outside highlight left %d, ending inside\n", hili_left); + printf("Outside highlight left %d, ending inside\n", hili_left); #endif /* Cutting needed, starts outside, ends inside */ rle_this_bite = (hili_left - x); @@ -1296,7 +1296,7 @@ void _x_blend_yuv (uint8_t *dst_base[3], vo_overlay_t * img_overl, xmask = 0; } else { #ifdef LOG_BLEND_YUV - printf("Outside highlight left %d, ending outside\n", hili_left); + printf("Outside highlight left %d, ending outside\n", hili_left); #endif /* no cutting needed, starts outside, ends outside */ rle_this_bite = rle_remainder; @@ -1335,7 +1335,7 @@ void _x_blend_yuv (uint8_t *dst_base[3], vo_overlay_t * img_overl, } } else if (x >= hili_right) { /* Starts outside highlight area, ends outside highlight area */ - if ((x + rle_remainder ) > src_width ) { + if ((x + rle_remainder ) > src_width ) { #ifdef LOG_BLEND_YUV printf("Outside highlight right %d, ending eol\n", hili_right); #endif @@ -1381,7 +1381,7 @@ void _x_blend_yuv (uint8_t *dst_base[3], vo_overlay_t * img_overl, /* clip against right edge of destination area */ if ((x + rle_this_bite) > (dst_width - x_off)) { int toClip = (x + rle_this_bite) - (dst_width - x_off); - + rle_this_bite -= toClip; rle_remainder += toClip; rlelen += toClip; @@ -1392,7 +1392,7 @@ void _x_blend_yuv (uint8_t *dst_base[3], vo_overlay_t * img_overl, memset(&(*blend_yuv_data)[ 0 ][ (y + y_odd) & 1 ][ x + x_odd ], o, rle_this_bite); any_line_buffered |= ((y + y_odd) & 1) ? 2 : 1; } - + if (o && !clipped) { if(o >= 15) { memset(dst_y + x, my_clut[clr].y, rle_this_bite); @@ -1434,17 +1434,17 @@ void _x_blend_yuv (uint8_t *dst_base[3], vo_overlay_t * img_overl, /* make second line transparent */ memset(&(*blend_yuv_data)[ 0 ][ 1 ][ 0 ], 0, exact_blend_width_m2); } - + blend_yuv_exact(dst_cr, dst_cb, exact_blend_width, blend_yuv_data); - + any_line_buffered = 0; } } - + dst_cr += dst_pitches[2]; dst_cb += dst_pitches[1]; } - + dst_y += dst_pitches[0]; } @@ -1455,21 +1455,21 @@ void _x_blend_yuv (uint8_t *dst_base[3], vo_overlay_t * img_overl, /* make second line transparent */ memset(&(*blend_yuv_data)[ 0 ][ 1 ][ 0 ], 0, exact_blend_width_m2); } - + blend_yuv_exact(dst_cr, dst_cb, exact_blend_width, blend_yuv_data); } } - + #ifdef LOG_BLEND_YUV printf("overlay_blend ended\n"); #endif } - + static void blend_yuy2_exact(uint8_t *dst_cr, uint8_t *dst_cb, int src_width, uint8_t *(*blend_yuy2_data)[ 3 ]) { int x; - + for (x = 0; x < src_width; x += 2) { /* get opacity of the 2 pixels that share chroma */ int o0 = (*blend_yuy2_data)[ 0 ][ x + 0 ]; @@ -1481,7 +1481,7 @@ static void blend_yuy2_exact(uint8_t *dst_cr, uint8_t *dst_cb, int src_width, /* get the chroma components of the 2 pixels */ int cr0 = (*blend_yuy2_data)[ 1 ][ x + 0 ]; int cr1 = (*blend_yuy2_data)[ 1 ][ x + 1 ]; - + int cb0 = (*blend_yuy2_data)[ 2 ][ x + 0 ]; int cb1 = (*blend_yuy2_data)[ 2 ][ x + 1 ]; @@ -1496,7 +1496,7 @@ static void blend_yuy2_exact(uint8_t *dst_cr, uint8_t *dst_cb, int src_width, /* * No need to adjust chroma values with +/- 128: - * *dst_cb + * *dst_cb * = 128 + ((*dst_cb-128) * t2 + (cb0-128) * o0 + (cb1-128) * o1) / (2 * 0xf); * = 128 + (*dst_cb * t2 + cb0 * o0 + cb1 * o1 + (t2*(-128) - 128*o0 - 128*o1)) / (2 * 0xf); * = 128 + (*dst_cb * t2 + cb0 * o0 + cb1 * o1 + ((2*0xf-o0-o1)*(-128) - 128*o0 - 128*o1)) / (2 * 0xf); @@ -1512,8 +1512,8 @@ static void blend_yuy2_exact(uint8_t *dst_cr, uint8_t *dst_cb, int src_width, * =(almost) X * 0x1112/0x10000 * = (X * 0x1112) >> 16 * - * The tricky point is 0x1111/0xffff --> 0x1112/0x10000. - * All calculations are done using integers and X is in + * The tricky point is 0x1111/0xffff --> 0x1112/0x10000. + * All calculations are done using integers and X is in * range of [0 ... 0xff*0xf*4]. This results in error of * X*0x1112/0x10000 - X/0xf * = X*(0x1112/0x10000 - 1/0xf) @@ -1523,7 +1523,7 @@ static void blend_yuy2_exact(uint8_t *dst_cr, uint8_t *dst_cb, int src_width, * As the error is less than 1 and always positive, whole error * "disappears" during truncation (>>16). Rounding to exact results is * guaranteed by selecting 0x1112 instead of more accurate 0x1111 - * (with 0x1111 error=X*(-0.00001111...)). With 0x1112 error is + * (with 0x1111 error=X*(-0.00001111...)). With 0x1112 error is * always positive, but still less than one. * So, one can forget the "=(almost)" as it is really "=" when source * operands are within 0...0xff (U,V) and 0...0xf (A). @@ -1531,7 +1531,7 @@ static void blend_yuy2_exact(uint8_t *dst_cr, uint8_t *dst_cb, int src_width, * 1/0x10000 (= >>16) was originally selected because of MMX pmullhw * instruction; it makes possible to do whole calculation in MMX using * uint16's (pmullhw is (X*Y)>>16). - * + * * Here X/(2*0xf) = X/0xf/2 = ((X*0x1112)>>16)>>1 = (X*0x1112)>>17 */ @@ -1555,11 +1555,11 @@ static uint8_t *(*blend_yuy2_grow_extra_data(alphablend_t *extra_data, int osd_w int max_width; uint8_t *data[ 3 ]; } *header = (struct header_s *)extra_data->buffer; - + size_t needed_buffer_size = sizeof (*header) + osd_width * sizeof (uint8_t[ 3 ]); - + if (extra_data->buffer_size < needed_buffer_size) { - + free(extra_data->buffer); header = calloc(1, needed_buffer_size); if (!header) { @@ -1619,7 +1619,7 @@ void _x_blend_yuy2 (uint8_t * dst_img, vo_overlay_t * img_overl, int exact_blend_width = ((src_width <= (dst_width - x_off)) ? src_width : (dst_width - x_off)); int exact_blend_width_m2 = (x_odd + exact_blend_width + 1) & ~1; /* make it a (larger) multiple of 2 */ uint8_t *(*blend_yuy2_data)[ 3 ] = 0; - + uint8_t *dst_y = dst_img + dst_pitch * y_off + 2 * x_off; uint8_t *dst; @@ -1631,26 +1631,26 @@ void _x_blend_yuy2 (uint8_t * dst_img, vo_overlay_t * img_overl, clip_right = src_width; else clip_right = dst_width - x_off; - + if( x_off >= 0 ) clip_left = 0; else clip_left = -x_off; - + if( y_off >= 0 ) clip_top = 0; else clip_top = -y_off; - + if( (src_height + y_off) > dst_height ) src_height = dst_height - y_off; - + /* make highlight area fit into clip area */ if( img_overl->hili_right <= clip_right ) hili_right = img_overl->hili_right; else hili_right = clip_right; - + if( img_overl->hili_left >= clip_left ) hili_left = img_overl->hili_left; else @@ -1662,11 +1662,11 @@ void _x_blend_yuy2 (uint8_t * dst_img, vo_overlay_t * img_overl, if (enable_exact_blending) { if (exact_blend_width <= 0) return; - + blend_yuy2_data = blend_yuy2_grow_extra_data(extra_data, exact_blend_width_m2); if (!blend_yuy2_data) return; - + /* make linebuffer transparent */ memset(&(*blend_yuy2_data)[ 0 ][ 0 ], 0, exact_blend_width_m2); } @@ -1675,7 +1675,7 @@ void _x_blend_yuy2 (uint8_t * dst_img, vo_overlay_t * img_overl, for (y = 0; y < src_height; y++) { if (rle >= rle_limit) break; - + ymask = ((y < img_overl->hili_top) || (y >= img_overl->hili_bottom)); dst = dst_y; @@ -1685,12 +1685,12 @@ void _x_blend_yuy2 (uint8_t * dst_img, vo_overlay_t * img_overl, if (rle >= rle_limit) break; - + if ((rlelen < 0) || (rle_remainder < 0)) { #ifdef LOG_BLEND_YUV printf("alphablend: major bug in blend_yuv < 0\n"); #endif - } + } if (rlelen == 0) { rle_remainder = rlelen = rle->len; clr = rle->color; @@ -1708,11 +1708,11 @@ void _x_blend_yuy2 (uint8_t * dst_img, vo_overlay_t * img_overl, #endif if (ymask == 0) { - if (x < hili_left) { + if (x < hili_left) { /* Starts outside highlight area */ if ((x + rle_remainder) > hili_left ) { #ifdef LOG_BLEND_YUV - printf("Outside highlight left %d, ending inside\n", hili_left); + printf("Outside highlight left %d, ending inside\n", hili_left); #endif /* Cutting needed, starts outside, ends inside */ rle_this_bite = (hili_left - x); @@ -1722,7 +1722,7 @@ void _x_blend_yuy2 (uint8_t * dst_img, vo_overlay_t * img_overl, my_trans = img_overl->trans; } else { #ifdef LOG_BLEND_YUV - printf("Outside highlight left %d, ending outside\n", hili_left); + printf("Outside highlight left %d, ending outside\n", hili_left); #endif /* no cutting needed, starts outside, ends outside */ rle_this_bite = rle_remainder; @@ -1758,7 +1758,7 @@ void _x_blend_yuy2 (uint8_t * dst_img, vo_overlay_t * img_overl, } } else if (x >= hili_right) { /* Starts outside highlight area, ends outsite highlight area */ - if ((x + rle_remainder ) > src_width ) { + if ((x + rle_remainder ) > src_width ) { #ifdef LOG_BLEND_YUV printf("Outside highlight right %d, ending eol\n", hili_right); #endif @@ -1798,7 +1798,7 @@ void _x_blend_yuy2 (uint8_t * dst_img, vo_overlay_t * img_overl, /* clip against right edge of destination area */ if ((x + rle_this_bite) > (dst_width - x_off)) { int toClip = (x + rle_this_bite) - (dst_width - x_off); - + rle_this_bite -= toClip; rle_remainder += toClip; rlelen += toClip; @@ -1850,7 +1850,7 @@ void _x_blend_yuy2 (uint8_t * dst_img, vo_overlay_t * img_overl, mem_blend32(dst, &yuy2.b[0], o, l); dst += 4*l; } - + if(rle_this_bite & 1) { *dst = BLEND_BYTE(*dst, yuy2.b[0], o); dst++; @@ -1875,15 +1875,15 @@ void _x_blend_yuy2 (uint8_t * dst_img, vo_overlay_t * img_overl, dst += rle_this_bite*2; } } - + x += rle_this_bite; } - + if (enable_exact_blending) { /* blend buffered line */ if (any_line_buffered) { blend_yuy2_exact(dst_y - x_odd * 2 + 3, dst_y - x_odd * 2 + 1, exact_blend_width, blend_yuy2_data); - + any_line_buffered = 0; } } @@ -1892,7 +1892,7 @@ void _x_blend_yuy2 (uint8_t * dst_img, vo_overlay_t * img_overl, } } -void _x_clear_xx44_palette(xx44_palette_t *p) +void _x_clear_xx44_palette(xx44_palette_t *p) { register int i; register uint32_t *cluts = p->cluts; @@ -1904,20 +1904,20 @@ void _x_clear_xx44_palette(xx44_palette_t *p) i = 2*OVL_PALETTE_SIZE; while(i--) *ids++ = -1; - p->max_used=1; + p->max_used=1; } -void _x_init_xx44_palette(xx44_palette_t *p, unsigned num_entries) +void _x_init_xx44_palette(xx44_palette_t *p, unsigned num_entries) { - p->size = (num_entries > XX44_PALETTE_SIZE) ? XX44_PALETTE_SIZE : num_entries; + p->size = (num_entries > XX44_PALETTE_SIZE) ? XX44_PALETTE_SIZE : num_entries; } -void _x_dispose_xx44_palette(xx44_palette_t *p) +void _x_dispose_xx44_palette(xx44_palette_t *p) { } static void colorToPalette(const uint32_t *icolor, unsigned char *palette_p, - unsigned num_xvmc_components, char *xvmc_components) + unsigned num_xvmc_components, char *xvmc_components) { const clut_t *color = (const clut_t *) icolor; unsigned int i; @@ -1925,7 +1925,7 @@ static void colorToPalette(const uint32_t *icolor, unsigned char *palette_p, switch(xvmc_components[i]) { case 'V': *palette_p = color->cr; break; case 'U': *palette_p = color->cb; break; - case 'Y': + case 'Y': default: *palette_p = color->y; break; } palette_p++; @@ -1935,7 +1935,7 @@ static void colorToPalette(const uint32_t *icolor, unsigned char *palette_p, void _x_xx44_to_xvmc_palette(const xx44_palette_t *p,unsigned char *xvmc_palette, unsigned first_xx44_entry, unsigned num_xx44_entries, - unsigned num_xvmc_components, char *xvmc_components) + unsigned num_xvmc_components, char *xvmc_components) { register unsigned int i; register const uint32_t *cluts = p->cluts + first_xx44_entry; @@ -1946,16 +1946,16 @@ void _x_xx44_to_xvmc_palette(const xx44_palette_t *p,unsigned char *xvmc_palette xvmc_palette += num_xvmc_components; } } -} +} -static int xx44_paletteIndex(xx44_palette_t *p, int color, uint32_t clut) +static int xx44_paletteIndex(xx44_palette_t *p, int color, uint32_t clut) { register unsigned int i; register uint32_t *cluts = p->cluts; register int tmp; - if ((tmp = p->lookup_cache[color]) >= 0) + if ((tmp = p->lookup_cache[color]) >= 0) if (cluts[tmp] == clut) return tmp; for (i=0; i<p->max_used; ++i) { @@ -1972,7 +1972,7 @@ static int xx44_paletteIndex(xx44_palette_t *p, int color, uint32_t clut) static void memblend_xx44(uint8_t *mem,uint8_t val, register size_t size, uint8_t mask) { - register uint8_t + register uint8_t masked_val; if (0 == (masked_val = val & mask)) return; @@ -1984,16 +1984,16 @@ static void memblend_xx44(uint8_t *mem,uint8_t val, register size_t size, uint8_ } void _x_blend_xx44 (uint8_t *dst_img, vo_overlay_t *img_overl, - int dst_width, int dst_height, int dst_pitch, + int dst_width, int dst_height, int dst_pitch, alphablend_t *extra_data, - xx44_palette_t *palette,int ia44) + xx44_palette_t *palette,int ia44) { int src_width, src_height; rle_elem_t *rle, *rle_limit; int mask; int x_off, y_off; int x, y; - uint8_t norm_pixel,hili_pixel; + uint8_t norm_pixel,hili_pixel; uint8_t *dst_y; uint8_t *dst; uint8_t alphamask = (ia44) ? 0x0F : 0xF0; @@ -2017,26 +2017,26 @@ void _x_blend_xx44 (uint8_t *dst_img, vo_overlay_t *img_overl, clip_right = src_width; else clip_right = dst_width - x_off; - + if( x_off >= 0 ) clip_left = 0; else clip_left = -x_off; - + if( y_off >= 0 ) clip_top = 0; else clip_top = -y_off; - + if( (src_height + y_off) > dst_height ) src_height = dst_height - y_off; - + /* make highlight area fit into clip area */ if( img_overl->hili_right <= clip_right ) hili_right = img_overl->hili_right; else hili_right = clip_right; - + if( img_overl->hili_left >= clip_left ) hili_left = img_overl->hili_left; else @@ -2053,10 +2053,10 @@ void _x_blend_xx44 (uint8_t *dst_img, vo_overlay_t *img_overl, if (len > 0) { norm_pixel = (uint8_t)((xx44_paletteIndex(palette,rle->color, - img_overl->color[rle->color]) << 4) | + img_overl->color[rle->color]) << 4) | (img_overl->trans[rle->color] & 0x0F)); hili_pixel = (uint8_t)((xx44_paletteIndex(palette,rle->color+OVL_PALETTE_SIZE, - img_overl->hili_color[rle->color]) << 4) | + img_overl->hili_color[rle->color]) << 4) | (img_overl->hili_trans[rle->color] & 0x0F)); if (!ia44) { norm_pixel = ((norm_pixel & 0x0F) << 4) | ((norm_pixel & 0xF0) >> 4); @@ -2091,7 +2091,7 @@ void _x_blend_xx44 (uint8_t *dst_img, vo_overlay_t *img_overl, dst += len; } } - } else if (x < hili_right) { + } else if (x < hili_right) { if (len <= hili_right - x) { if(!clipped) memblend_xx44(dst,hili_pixel,len, alphamask); @@ -2123,7 +2123,7 @@ void _x_blend_xx44 (uint8_t *dst_img, vo_overlay_t *img_overl, x += rle->len; rle++; if (rle >= rle_limit) break; - } + } if (rle >= rle_limit) break; dst_y += dst_pitch; } @@ -2139,7 +2139,7 @@ static void alphablend_disable_exact_osd_alpha_blending_changed(void *user_data, void _x_alphablend_init(alphablend_t *extra_data, xine_t *xine) { config_values_t *config = xine->config; - + extra_data->buffer = 0; extra_data->buffer_size = 0; extra_data->offset_x = 0; diff --git a/src/xine-engine/alphablend.h b/src/xine-engine/alphablend.h index 7aa63b306..86cc68302 100644 --- a/src/xine-engine/alphablend.h +++ b/src/xine-engine/alphablend.h @@ -97,7 +97,7 @@ void _x_blend_yuy2 (uint8_t * dst_img, vo_overlay_t * img_overl, */ void _x_blend_xx44 (uint8_t *dst_img, vo_overlay_t *img_overl, - int dst_width, int dst_height, int dst_pitch, + int dst_width, int dst_height, int dst_pitch, alphablend_t *extra_data, xx44_palette_t *palette,int ia44) XINE_PROTECTED; diff --git a/src/xine-engine/audio_decoder.c b/src/xine-engine/audio_decoder.c index 855dee372..dd15bf696 100644 --- a/src/xine-engine/audio_decoder.c +++ b/src/xine-engine/audio_decoder.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2005 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -60,18 +60,18 @@ static void *audio_decoder_loop (void *stream_gen) { while (running) { - lprintf ("audio_loop: waiting for package...\n"); + lprintf ("audio_loop: waiting for package...\n"); if( !replaying_headers ) buf = stream->audio_fifo->get (stream->audio_fifo); - lprintf ("audio_loop: got package pts = %"PRId64", type = %08x\n", buf->pts, buf->type); + lprintf ("audio_loop: got package pts = %"PRId64", type = %08x\n", buf->pts, buf->type); _x_extra_info_merge( stream->audio_decoder_extra_info, buf->extra_info ); stream->audio_decoder_extra_info->seek_count = stream->video_seek_count; - + switch (buf->type) { - + case BUF_CONTROL_HEADERS_DONE: pthread_mutex_lock (&stream->counter_lock); stream->header_count_audio++; @@ -85,11 +85,11 @@ static void *audio_decoder_loop (void *stream_gen) { /* decoder dispose might call port functions */ running_ticket->acquire(running_ticket, 0); - + if (stream->audio_decoder_plugin) { lprintf ("close old decoder\n"); - + stream->keep_ao_driver_open = !!(buf->decoder_flags & BUF_FLAG_GAPLESS_SW); _x_free_audio_decoder (stream, stream->audio_decoder_plugin); stream->audio_decoder_plugin = NULL; @@ -97,15 +97,15 @@ static void *audio_decoder_loop (void *stream_gen) { stream->audio_type = 0; stream->keep_ao_driver_open = 0; } - + running_ticket->release(running_ticket, 0); - + if( !(buf->decoder_flags & BUF_FLAG_GAPLESS_SW) ) stream->metronom->handle_audio_discontinuity (stream->metronom, DISC_STREAMSTART, 0); - + buftype_unknown = 0; break; - + case BUF_CONTROL_END: /* free all held header buffers, see comments below */ @@ -128,12 +128,12 @@ static void *audio_decoder_loop (void *stream_gen) { */ while(1) { int num_bufs, num_streams; - + running_ticket->acquire(running_ticket, 0); num_bufs = stream->audio_out->get_property(stream->audio_out, AO_PROP_BUFS_IN_FIFO); num_streams = stream->audio_out->get_property(stream->audio_out, AO_PROP_NUM_STREAMS); running_ticket->release(running_ticket, 0); - + if( num_bufs > 0 && num_streams == 1 && !stream->early_finish_event) xine_usec_sleep (10000); else @@ -144,7 +144,7 @@ static void *audio_decoder_loop (void *stream_gen) { pthread_mutex_lock (&stream->counter_lock); stream->finished_count_audio++; - + lprintf ("reached end marker # %d\n", stream->finished_count_audio); pthread_cond_broadcast (&stream->counter_changed); @@ -164,18 +164,18 @@ static void *audio_decoder_loop (void *stream_gen) { stream->audio_channel_auto = -1; break; - + case BUF_CONTROL_QUIT: /* decoder dispose might call port functions */ running_ticket->acquire(running_ticket, 0); - + if (stream->audio_decoder_plugin) { _x_free_audio_decoder (stream, stream->audio_decoder_plugin); stream->audio_decoder_plugin = NULL; stream->audio_track_map_entries = 0; stream->audio_type = 0; } - + running_ticket->release(running_ticket, 0); running = 0; break; @@ -193,14 +193,14 @@ static void *audio_decoder_loop (void *stream_gen) { running_ticket->release(running_ticket, 0); } break; - + case BUF_CONTROL_DISCONTINUITY: if (stream->audio_decoder_plugin) { running_ticket->acquire(running_ticket, 0); stream->audio_decoder_plugin->discontinuity (stream->audio_decoder_plugin); running_ticket->release(running_ticket, 0); } - + stream->metronom->handle_audio_discontinuity (stream->metronom, DISC_RELATIVE, buf->disc_off); break; @@ -210,7 +210,7 @@ static void *audio_decoder_loop (void *stream_gen) { stream->audio_decoder_plugin->discontinuity (stream->audio_decoder_plugin); running_ticket->release(running_ticket, 0); } - + if (buf->decoder_flags & BUF_FLAG_SEEK) { stream->metronom->handle_audio_discontinuity (stream->metronom, DISC_STREAMSEEK, buf->disc_off); } else { @@ -220,7 +220,7 @@ static void *audio_decoder_loop (void *stream_gen) { case BUF_CONTROL_AUDIO_CHANNEL: { - xprintf(stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "audio_decoder: suggested switching to stream_id %02x\n", buf->decoder_info[0]); stream->audio_channel_auto = buf->decoder_info[0] & 0xff; } @@ -248,27 +248,27 @@ static void *audio_decoder_loop (void *stream_gen) { xine_profiler_start_count (prof_audio_decode); running_ticket->acquire(running_ticket, 0); - + if ( (buf->type & 0xFF000000) == BUF_AUDIO_BASE ) { - + uint32_t audio_type = 0; int i,j; uint32_t chan=buf->type&0x0000FFFF; /* printf("audio_decoder: buf_type=%08x auto=%08x user=%08x\n", - buf->type, + buf->type, stream->audio_channel_auto, audio_channel_user); */ /* update track map */ - + i = 0; - while ( (i<stream->audio_track_map_entries) && ((stream->audio_track_map[i]&0x0000FFFF)<chan) ) + while ( (i<stream->audio_track_map_entries) && ((stream->audio_track_map[i]&0x0000FFFF)<chan) ) i++; - - if ( (i==stream->audio_track_map_entries) + + if ( (i==stream->audio_track_map_entries) || ((stream->audio_track_map[i]&0x0000FFFF)!=chan) ) { xine_event_t ui_event; @@ -304,7 +304,7 @@ static void *audio_decoder_loop (void *stream_gen) { lprintf ("audio_channel_auto = %d\n", stream->audio_channel_auto); if (stream->audio_channel_auto>=0) { - + if ((buf->type & 0xFF) == stream->audio_channel_auto) { audio_type = buf->type; } else @@ -321,30 +321,30 @@ static void *audio_decoder_loop (void *stream_gen) { } /* now, decode stream buffer if it's the right audio type */ - + if (buf->type == audio_type) { - + int streamtype = (buf->type>>16) & 0xFF; /* close old decoder of audio type has changed */ - - if( buf->type != buftype_unknown && + + if( buf->type != buftype_unknown && (stream->audio_decoder_streamtype != streamtype || !stream->audio_decoder_plugin) ) { - + if (stream->audio_decoder_plugin) { _x_free_audio_decoder (stream, stream->audio_decoder_plugin); } - + stream->audio_decoder_streamtype = streamtype; stream->audio_decoder_plugin = _x_get_audio_decoder (stream, streamtype); - + _x_stream_info_set(stream, XINE_STREAM_INFO_AUDIO_HANDLED, (stream->audio_decoder_plugin != NULL)); } - + if (audio_type != stream->audio_type) { - + if (stream->audio_decoder_plugin) { xine_event_t event; @@ -355,23 +355,23 @@ static void *audio_decoder_loop (void *stream_gen) { xine_event_send(stream, &event); } } - + /* finally - decode data */ - - if (stream->audio_decoder_plugin) + + if (stream->audio_decoder_plugin) stream->audio_decoder_plugin->decode_data (stream->audio_decoder_plugin, buf); - - if (buf->type != buftype_unknown && + + if (buf->type != buftype_unknown && !_x_stream_info_get(stream, XINE_STREAM_INFO_AUDIO_HANDLED)) { xine_log (stream->xine, XINE_LOG_MSG, _("audio_decoder: no plugin available to handle '%s'\n"), _x_buf_audio_name( buf->type ) ); - + if( !_x_meta_info_get(stream, XINE_META_INFO_AUDIOCODEC) ) _x_meta_info_set_utf8(stream, XINE_META_INFO_AUDIOCODEC, _x_buf_audio_name( buf->type )); - + buftype_unknown = buf->type; - /* fatal error - dispose plugin */ + /* fatal error - dispose plugin */ if (stream->audio_decoder_plugin) { _x_free_audio_decoder (stream, stream->audio_decoder_plugin); stream->audio_decoder_plugin = NULL; @@ -380,7 +380,7 @@ static void *audio_decoder_loop (void *stream_gen) { } } } else if( buf->type != buftype_unknown ) { - xine_log (stream->xine, XINE_LOG_MSG, + xine_log (stream->xine, XINE_LOG_MSG, _("audio_decoder: error, unknown buffer type: %08x\n"), buf->type ); buftype_unknown = buf->type; } @@ -388,14 +388,14 @@ static void *audio_decoder_loop (void *stream_gen) { if (running_ticket->ticket_revoked) running_ticket->renew(running_ticket, 0); running_ticket->release(running_ticket, 0); - + xine_profiler_stop_count (prof_audio_decode); } /* some decoders require a full reinitialization when audio * channel is changed (rate might be change and even a - * different codec may be used). - * + * different codec may be used). + * * we must close the old decoder and process all the headers * again, since they are needed for decoder initialization. */ @@ -408,7 +408,7 @@ static void *audio_decoder_loop (void *stream_gen) { running_ticket->acquire(running_ticket, 0); _x_free_audio_decoder (stream, stream->audio_decoder_plugin); running_ticket->release(running_ticket, 0); - + stream->audio_decoder_plugin = NULL; stream->audio_track_map_entries = 0; stream->audio_type = 0; @@ -456,7 +456,7 @@ static void *audio_decoder_loop (void *stream_gen) { } first_header = last_header = NULL; } - + return NULL; } @@ -471,7 +471,7 @@ int _x_audio_decoder_init (xine_stream_t *stream) { return 1; } else { int num_buffers; - + /* The fifo size is based on dvd playback where buffers are filled * with 2k of data. With 230 buffers and a typical audio data rate * of 1.8 Mbit/s (four ac3 streams), the fifo can hold about 2 seconds @@ -479,7 +479,7 @@ int _x_audio_decoder_init (xine_stream_t *stream) { * We provide buffers of 8k size instead of 2k for demuxers sending * larger chunks. */ - + num_buffers = stream->xine->config->register_num (stream->xine->config, "engine.buffers.audio_num_buffers", 230, @@ -489,7 +489,7 @@ int _x_audio_decoder_init (xine_stream_t *stream) { "mean smoother playback for unreliable inputs, but " "also increased latency and memory consumption."), 20, NULL, NULL); - + stream->audio_fifo = _x_fifo_buffer_new (num_buffers, 8192); stream->audio_channel_user = -1; stream->audio_channel_auto = -1; @@ -505,17 +505,17 @@ int _x_audio_decoder_init (xine_stream_t *stream) { pth_params.sched_priority = sched_get_priority_min(SCHED_OTHER); pthread_attr_setschedparam(&pth_attrs, &pth_params); pthread_attr_setscope(&pth_attrs, PTHREAD_SCOPE_SYSTEM); - - stream->audio_thread_created = 1; + + stream->audio_thread_created = 1; if ((err = pthread_create (&stream->audio_thread, &pth_attrs, audio_decoder_loop, stream)) != 0) { - xprintf (stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (stream->xine, XINE_VERBOSITY_DEBUG, "audio_decoder: can't create new thread (%s)\n", strerror(err)); stream->audio_thread_created = 0; pthread_attr_destroy(&pth_attrs); return 0; } - + pthread_attr_destroy(&pth_attrs); } return 1; @@ -532,16 +532,16 @@ void _x_audio_decoder_shutdown (xine_stream_t *stream) { buf = stream->audio_fifo->buffer_pool_alloc (stream->audio_fifo); buf->type = BUF_CONTROL_QUIT; stream->audio_fifo->put (stream->audio_fifo, buf); - + pthread_join (stream->audio_thread, &p); stream->audio_thread_created = 0; } - + stream->audio_fifo->dispose (stream->audio_fifo); stream->audio_fifo = NULL; } int _x_get_audio_channel (xine_stream_t *stream) { - return stream->audio_type & 0xFFFF; + return stream->audio_type & 0xFFFF; } diff --git a/src/xine-engine/audio_decoder.h b/src/xine-engine/audio_decoder.h index 8f75ba242..9f695685f 100644 --- a/src/xine-engine/audio_decoder.h +++ b/src/xine-engine/audio_decoder.h @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -46,14 +46,14 @@ struct audio_decoder_class_s { * open a new instance of this plugin class */ audio_decoder_t* (*open_plugin) (audio_decoder_class_t *this, xine_stream_t *stream); - + /* * return short, human readable identifier for this plugin class */ char* (*get_identifier) (audio_decoder_class_t *this); /* - * return human readable (verbose = 1 line) description for + * return human readable (verbose = 1 line) description for * this plugin class */ char* (*get_description) (audio_decoder_class_t *this); @@ -69,8 +69,8 @@ struct audio_decoder_class_s { struct audio_decoder_s { /* - * decode data from buf and feed decoded samples to - * audio output + * decode data from buf and feed decoded samples to + * audio output */ void (*decode_data) (audio_decoder_t *this, buf_element_t *buf); @@ -79,13 +79,13 @@ struct audio_decoder_s { * audio data not related to recently decoded data) */ void (*reset) (audio_decoder_t *this); - + /* * inform decoder that a time reference discontinuity has happened. * that is, it must forget any currently held pts value */ - void (*discontinuity) (audio_decoder_t *this); - + void (*discontinuity) (audio_decoder_t *this); + /* * close down, free all resources */ diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c index a6f83dc9d..601af196a 100644 --- a/src/xine-engine/audio_out.c +++ b/src/xine-engine/audio_out.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2006 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 self program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -22,7 +22,7 @@ * 20-8-2001 First implementation of Audio sync and Audio driver separation. * (c) 2001 James Courtier-Dutton James@superbug.demon.co.uk */ - + /* * General Programming Guidelines: - * New concept of an "audio_frame". @@ -98,7 +98,7 @@ #define ZERO_BUF_SIZE 5000 /* By adding gap errors (difference between reported and expected - * sound card clock) into metronom's vpts_offset we can use its + * sound card clock) into metronom's vpts_offset we can use its * smoothing algorithms to correct sound card clock drifts. * obs: previously this error was added to xine scr. * @@ -154,13 +154,13 @@ typedef struct { #define EQ_BANDS 10 #define EQ_CHANNELS 8 -#define FP_FRBITS 28 +#define FP_FRBITS 28 #define EQ_REAL(x) ((int)((x) * (1 << FP_FRBITS))) typedef struct { int beta; - int alpha; + int alpha; int gamma; } sIIRCoefficients; @@ -193,15 +193,15 @@ static const sIIRCoefficients iir_cf[] = { /* 16k Hz*/ { EQ_REAL(2.4201241845e-01), EQ_REAL(3.7899379077e-01), EQ_REAL(-8.0847117831e-01) }, }; - + typedef struct { - + xine_audio_port_t ao; /* public part */ /* private stuff */ ao_driver_t *driver; pthread_mutex_t driver_lock; - + uint32_t driver_open:1; uint32_t audio_loop_running:1; uint32_t audio_thread_created:1; @@ -226,7 +226,7 @@ typedef struct { int64_t audio_step; /* pts per 32 768 samples (sample = #bytes/2) */ int32_t frames_per_kpts; /* frames per 1024/90000 sec */ - + int av_sync_method_conf; resample_sync_t resample_sync_info; double resample_sync_factor; /* correct buffer length by this factor @@ -249,7 +249,7 @@ typedef struct { /* FIXME: replace all this->clock->speed with this->current_speed. we should make * sure nobody will change speed without going through xine.c:set_speed_internal */ int slow_fast_audio; /* play audio even on slow/fast speeds */ - + int16_t last_sample[RESAMPLE_MAX_CHANNELS]; audio_buffer_t *frame_buf[2]; /* two buffers for "stackable" conversions */ int16_t *zero_space; @@ -275,7 +275,7 @@ typedef struct { int eq_k; sXYData eq_data_history[EQ_BANDS][EQ_CHANNELS]; - + } aos_t; struct audio_fifo_s { @@ -440,7 +440,7 @@ static void fifo_wait_empty (audio_fifo_t *fifo) { } -static void write_pause_burst(aos_t *this, uint32_t num_frames) { +static void write_pause_burst(aos_t *this, uint32_t num_frames) { uint16_t sbuf[4096]; sbuf[0] = 0xf872; @@ -470,7 +470,7 @@ static void ao_fill_gap (aos_t *this, int64_t pts_len) { if ((this->output.mode == AO_CAP_MODE_A52) || (this->output.mode == AO_CAP_MODE_AC5)) { write_pause_burst(this,num_frames); - return; + return; } while (num_frames > 0 && !this->discard_buffers) { @@ -494,7 +494,7 @@ static void ensure_buffer_size (audio_buffer_t *buf, int bytes_per_frame, int frames) { int size = bytes_per_frame * frames; - + if (buf->mem_size < size) { buf->mem = realloc( buf->mem, size ); buf->mem_size = size; @@ -525,7 +525,7 @@ int _x_ao_mode2channels( int mode ) { return 6; } return 0; -} +} int _x_ao_channels2mode( int channels ) { @@ -556,7 +556,7 @@ static void audio_filter_compress (aos_t *this, int16_t *mem, int num_frames) { return; maxs = 0; - + /* measure */ for (i=0; i<num_frames*num_channels; i++) { @@ -572,12 +572,12 @@ static void audio_filter_compress (aos_t *this, int16_t *mem, int num_frames) { this->compression_factor = this->compression_factor * 0.999 + f_max * 0.001; if (this->compression_factor > f_max) this->compression_factor = f_max; - + if (this->compression_factor > this->compression_factor_max) this->compression_factor = this->compression_factor_max; } else f_max = 1.0; - + lprintf ("max=%d f_max=%f compression_factor=%f\n", maxs, f_max, this->compression_factor); /* apply it */ @@ -613,11 +613,11 @@ static void audio_filter_amp (aos_t *this, void *buf, int num_frames) { /* Force limit on amp_factor to prevent clipping */ if (test < INT8_MIN) { this->amp_factor = amp_factor = amp_factor * INT8_MIN / test; - test=INT8_MIN; + test=INT8_MIN; } if (test > INT8_MAX) { this->amp_factor = amp_factor = amp_factor * INT8_MIN / test; - test=INT8_MAX; + test=INT8_MAX; } mem[i] = test; } @@ -630,11 +630,11 @@ static void audio_filter_amp (aos_t *this, void *buf, int num_frames) { /* Force limit on amp_factor to prevent clipping */ if (test < INT16_MIN) { this->amp_factor = amp_factor = amp_factor * INT16_MIN / test; - test=INT16_MIN; + test=INT16_MIN; } if (test > INT16_MAX) { this->amp_factor = amp_factor = amp_factor * INT16_MIN / test; - test=INT16_MAX; + test=INT16_MAX; } mem[i] = test; } @@ -938,7 +938,7 @@ static int resample_rate_adjust(aos_t *this, int64_t gap, audio_buffer_t *buf) { if (gap_diff < RESAMPLE_MAX_GAP_DIFF) { #if LOG_RESAMPLE_SYNC int num_frames; - + /* if we are already resampling to a different output rate, consider * this during calculation */ num_frames = (this->do_resample) ? (buf->num_frames * this->frame_rate_factor) @@ -973,7 +973,7 @@ static int resample_rate_adjust(aos_t *this, int64_t gap, audio_buffer_t *buf) { info->window_duration += buf->vpts - info->last_vpts; info->last_vpts = buf->vpts; info->window++; - } + } return 0; } @@ -981,7 +981,7 @@ static int resample_rate_adjust(aos_t *this, int64_t gap, audio_buffer_t *buf) { static int ao_change_settings(aos_t *this, uint32_t bits, uint32_t rate, int mode); /* Audio output loop: - - * 1) Check for pause. + * 1) Check for pause. * 2) Make sure audio hardware is in RUNNING state. * 3) Get delay * 4) Do drop, 0-fill or output samples. @@ -1009,7 +1009,7 @@ static void *ao_loop (void *this_gen) { /* * get buffer to process for this loop iteration */ - + if (!in_buf) { lprintf ("loop: get buf from fifo\n"); in_buf = fifo_peek (this->out_fifo); @@ -1034,18 +1034,18 @@ static void *ao_loop (void *this_gen) { continue; } pthread_mutex_unlock(&this->flush_audio_driver_lock); - - /* + + /* * wait until user unpauses stream * if we are playing at a different speed (without slow_fast_audio flag) * we must process/free buffers otherwise the entire engine will stop. */ - + pthread_mutex_lock(&this->current_speed_lock); - if ( this->audio_loop_running && - (this->clock->speed == XINE_SPEED_PAUSE || - (this->clock->speed != XINE_FINE_SPEED_NORMAL && + if ( this->audio_loop_running && + (this->clock->speed == XINE_SPEED_PAUSE || + (this->clock->speed != XINE_FINE_SPEED_NORMAL && !this->slow_fast_audio) ) ) { if (this->clock->speed != XINE_SPEED_PAUSE) { @@ -1083,7 +1083,7 @@ static void *ao_loop (void *this_gen) { in_buf->format.rate != this->input.rate || in_buf->format.mode != this->input.mode ) { lprintf("audio format has changed\n"); - if( !in_buf->stream->emergency_brake && + if( !in_buf->stream->emergency_brake && ao_change_settings(this, in_buf->format.bits, in_buf->format.rate, @@ -1107,7 +1107,7 @@ static void *ao_loop (void *this_gen) { delay = 0; pthread_mutex_unlock( &this->driver_lock ); - + if (in_buf && in_buf->num_frames) { xine_list_iterator_t ite; @@ -1127,8 +1127,8 @@ static void *ao_loop (void *this_gen) { } } - cur_time = this->clock->get_current_time (this->clock); - + cur_time = this->clock->get_current_time (this->clock); + /* we update current_extra_info if either there is no video stream that could do that * or if the current_extra_info is getting too much out of date */ if( in_buf && in_buf->stream && (!in_buf->stream->video_decoder_plugin || @@ -1138,9 +1138,9 @@ static void *ao_loop (void *this_gen) { _x_extra_info_merge( in_buf->stream->current_extra_info, in_buf->extra_info ); pthread_mutex_unlock( &in_buf->stream->current_extra_info_lock ); } - + /* - * where, in the timeline is the "end" of the + * where, in the timeline is the "end" of the * hardware audio buffer at the moment? */ @@ -1148,12 +1148,12 @@ static void *ao_loop (void *this_gen) { lprintf ("current delay is %" PRId64 ", current time is %" PRId64 "\n", delay, cur_time); /* External A52 decoder delay correction */ - if ((this->output.mode==AO_CAP_MODE_A52) || (this->output.mode==AO_CAP_MODE_AC5)) + if ((this->output.mode==AO_CAP_MODE_A52) || (this->output.mode==AO_CAP_MODE_AC5)) delay += this->passthrough_offset; if(this->frames_per_kpts) hw_vpts += (delay * 1024) / this->frames_per_kpts; - + /* * calculate gap: */ @@ -1189,13 +1189,13 @@ static void *ao_loop (void *this_gen) { in_buf->vpts, gap); in_buf = NULL; - - /* for small gaps ( tolerance < abs(gap) < AO_MAX_GAP ) + + /* for small gaps ( tolerance < abs(gap) < AO_MAX_GAP ) * feedback them into metronom's vpts_offset (when using * metronom feedback for A/V sync) */ } else if ( abs(gap) < AO_MAX_GAP && abs(gap) > this->gap_tolerance && - cur_time > (last_sync_time + SYNC_TIME_INVERVAL) && + cur_time > (last_sync_time + SYNC_TIME_INVERVAL) && bufs_since_sync >= SYNC_BUF_INTERVAL && !this->resample_sync_method ) { xine_list_iterator_t *ite; @@ -1248,7 +1248,7 @@ static void *ao_loop (void *this_gen) { result = 0; } fifo_remove (this->out_fifo); - + if( result < 0 ) { /* device unplugged. */ xprintf(this->xine, XINE_VERBOSITY_LOG, _("write to sound card failed. Assuming the device was unplugged.\n")); @@ -1272,7 +1272,7 @@ static void *ao_loop (void *this_gen) { pthread_mutex_unlock( &this->driver_lock ); /* closing the driver will result in XINE_MSG_AUDIO_OUT_UNAVAILABLE to be emitted */ } - + lprintf ("loop: next buf from fifo\n"); if (in_buf->stream) _x_refcounter_dec(in_buf->stream->refcounter); @@ -1325,9 +1325,9 @@ int xine_get_next_audio_frame (xine_audio_port_t *this_gen, continue; } stream = xine_list_get_value(this->streams, ite); - + /* FIXME: ugly, use conditions and locks instead? */ - + pthread_mutex_lock (&this->out_fifo->mutex); in_buf = this->out_fifo->first; if (!in_buf) { @@ -1381,10 +1381,10 @@ void xine_free_audio_frame (xine_audio_port_t *this_gen, xine_audio_frame_t *fra } static int ao_update_resample_factor(aos_t *this) { - + if( !this->driver_open ) return 0; - + switch (this->resample_conf) { case 1: /* force off */ this->do_resample = 0; @@ -1409,7 +1409,7 @@ static int ao_update_resample_factor(aos_t *this) { this->frame_rate_factor = ( XINE_FINE_SPEED_NORMAL / (double)this->current_speed ) * ((double)(this->output.rate)) / ((double)(this->input.rate)); this->frames_per_kpts = (this->output.rate * 1024) / 90000; this->audio_step = ((int64_t)90000 * (int64_t)32768) / (int64_t)this->input.rate; - + lprintf ("audio_step %" PRId64 " pts per 32768 frames\n", this->audio_step); return this->output.rate; } @@ -1418,7 +1418,7 @@ static int ao_change_settings(aos_t *this, uint32_t bits, uint32_t rate, int mod int output_sample_rate; if(this->driver_open && !this->grab_only) - this->driver->close(this->driver); + this->driver->close(this->driver); this->driver_open = 0; this->input.mode = mode; @@ -1427,7 +1427,7 @@ static int ao_change_settings(aos_t *this, uint32_t bits, uint32_t rate, int mod if (!this->grab_only) { /* not all drivers/cards support 8 bits */ - if( this->input.bits == 8 && + if( this->input.bits == 8 && !(this->driver->get_capabilities(this->driver) & AO_CAP_8BITS) ) { bits = 16; xprintf (this->xine, XINE_VERBOSITY_LOG, @@ -1447,7 +1447,7 @@ static int ao_change_settings(aos_t *this, uint32_t bits, uint32_t rate, int mod xprintf (this->xine, XINE_VERBOSITY_LOG, _("stereo not supported by driver, converting to mono.\n")); } - + output_sample_rate=(this->driver->open) (this->driver,bits,(this->force_rate ? this->force_rate : rate),mode); } else output_sample_rate = this->input.rate; @@ -1495,7 +1495,7 @@ static inline void dec_num_driver_actions(aos_t *this) { static int ao_open(xine_audio_port_t *this_gen, xine_stream_t *stream, uint32_t bits, uint32_t rate, int mode) { - + aos_t *this = (aos_t *) this_gen; int channels; @@ -1511,7 +1511,7 @@ static int ao_open(xine_audio_port_t *this_gen, xine_stream_t *stream, pthread_mutex_lock( &this->driver_lock ); ret = ao_change_settings(this, bits, rate, mode); pthread_mutex_unlock( &this->driver_lock ); - + if( !ret ) { stream->emergency_brake = 1; _x_message (stream, XINE_MSG_AUDIO_OUT_UNAVAILABLE, NULL); @@ -1522,7 +1522,7 @@ static int ao_open(xine_audio_port_t *this_gen, xine_stream_t *stream, } } - /* + /* * set metainfo */ if (stream) { @@ -1541,7 +1541,7 @@ static int ao_open(xine_audio_port_t *this_gen, xine_stream_t *stream, pthread_mutex_lock(&this->streams_lock); xine_list_push_back(this->streams, stream); pthread_mutex_unlock(&this->streams_lock); - + return this->output.rate; } @@ -1549,18 +1549,18 @@ static audio_buffer_t *ao_get_buffer (xine_audio_port_t *this_gen) { aos_t *this = (aos_t *) this_gen; audio_buffer_t *buf; - + while (!(buf = fifo_remove_nonblock (this->free_fifo))) if (this->xine->port_ticket->ticket_revoked) this->xine->port_ticket->renew(this->xine->port_ticket, 1); - + _x_extra_info_reset( buf->extra_info ); buf->stream = NULL; - + return buf; } -static void ao_put_buffer (xine_audio_port_t *this_gen, +static void ao_put_buffer (xine_audio_port_t *this_gen, audio_buffer_t *buf, xine_stream_t *stream) { aos_t *this = (aos_t *) this_gen; @@ -1573,11 +1573,11 @@ static void ao_put_buffer (xine_audio_port_t *this_gen, /* handle anonymous streams like NULL for easy checking */ if (stream == XINE_ANON_STREAM) stream = NULL; - + buf->stream = stream; - + pts = buf->vpts; - + if (stream) { buf->format.bits = _x_stream_info_get(stream, XINE_STREAM_INFO_AUDIO_BITS); buf->format.rate = _x_stream_info_get(stream, XINE_STREAM_INFO_AUDIO_SAMPLERATE); @@ -1587,7 +1587,7 @@ static void ao_put_buffer (xine_audio_port_t *this_gen, } buf->extra_info->vpts = buf->vpts; - + lprintf ("ao_put_buffer, pts=%" PRId64 ", vpts=%" PRId64 ", flushmode=%d\n", pts, buf->vpts, this->discard_buffers); @@ -1597,7 +1597,7 @@ static void ao_put_buffer (xine_audio_port_t *this_gen, fifo_append (this->out_fifo, buf); } else fifo_append (this->free_fifo, buf); - + this->last_audio_vpts = buf->vpts; lprintf ("ao_put_buffer done\n"); @@ -1620,7 +1620,7 @@ static void ao_close(xine_audio_port_t *this_gen, xine_stream_t *stream) { break; } } - ite = xine_list_front(this->streams); + ite = xine_list_front(this->streams); pthread_mutex_unlock(&this->streams_lock); /* close driver if no streams left */ @@ -1643,7 +1643,7 @@ static void ao_close(xine_audio_port_t *this_gen, xine_stream_t *stream) { pthread_mutex_lock( &this->driver_lock ); if(this->driver_open) - this->driver->close(this->driver); + this->driver->close(this->driver); this->driver_open = 0; pthread_mutex_unlock( &this->driver_lock ); } @@ -1653,7 +1653,7 @@ static void ao_exit(xine_audio_port_t *this_gen) { aos_t *this = (aos_t *) this_gen; int vol; int prop = 0; - + audio_buffer_t *buf, *next; if (this->audio_loop_running) { @@ -1669,15 +1669,15 @@ static void ao_exit(xine_audio_port_t *this_gen) { pthread_join (this->audio_thread, &p); this->audio_thread_created = 0; } - + if (!this->grab_only) { pthread_mutex_lock( &this->driver_lock ); - + if((this->driver->get_capabilities(this->driver)) & AO_CAP_MIXER_VOL) prop = AO_PROP_MIXER_VOL; else if((this->driver->get_capabilities(this->driver)) & AO_CAP_PCM_VOL) prop = AO_PROP_PCM_VOL; - + vol = this->driver->get_property(this->driver, prop); this->xine->config->update_num(this->xine->config, "audio.volume.mixer_volume", vol); if(this->driver_open) @@ -1699,7 +1699,7 @@ static void ao_exit(xine_audio_port_t *this_gen) { free (this->frame_buf[1]->extra_info); free (this->frame_buf[1]); free (this->zero_space); - + pthread_mutex_destroy(&this->current_speed_lock); pthread_mutex_destroy(&this->flush_audio_driver_lock); pthread_cond_destroy(&this->flush_audio_driver_reached); @@ -1733,11 +1733,11 @@ static void ao_exit(xine_audio_port_t *this_gen) { pthread_mutex_destroy(&this->free_fifo->mutex); pthread_cond_destroy(&this->free_fifo->empty); pthread_cond_destroy(&this->free_fifo->not_empty); - + pthread_mutex_destroy(&this->out_fifo->mutex); pthread_cond_destroy(&this->out_fifo->empty); pthread_cond_destroy(&this->out_fifo->not_empty); - + free (this->free_fifo); free (this->out_fifo); free (this); @@ -1746,7 +1746,7 @@ static void ao_exit(xine_audio_port_t *this_gen) { static uint32_t ao_get_capabilities (xine_audio_port_t *this_gen) { aos_t *this = (aos_t *) this_gen; uint32_t result; - + if (this->grab_only) { return AO_CAP_MODE_MONO | AO_CAP_MODE_STEREO ; @@ -1758,7 +1758,7 @@ static uint32_t ao_get_capabilities (xine_audio_port_t *this_gen) { inc_num_driver_actions(this); pthread_mutex_lock( &this->driver_lock ); dec_num_driver_actions(this); - result=this->driver->get_capabilities(this->driver); + result=this->driver->get_capabilities(this->driver); pthread_mutex_unlock( &this->driver_lock ); } return result; @@ -1772,25 +1772,25 @@ static int ao_get_property (xine_audio_port_t *this_gen, int property) { case AO_PROP_COMPRESSOR: ret = this->compression_factor_max*100; break; - + case AO_PROP_BUFS_IN_FIFO: ret = this->audio_loop_running ? this->out_fifo->num_buffers : -1; break; - + case AO_PROP_NUM_STREAMS: pthread_mutex_lock(&this->streams_lock); ret = xine_list_size(this->streams); pthread_mutex_unlock(&this->streams_lock); break; - + case AO_PROP_AMP: ret = this->amp_factor*100; break; - + case AO_PROP_AMP_MUTE: ret = this->amp_mute; break; - + case AO_PROP_EQ_30HZ: case AO_PROP_EQ_60HZ: case AO_PROP_EQ_125HZ: @@ -1800,14 +1800,14 @@ static int ao_get_property (xine_audio_port_t *this_gen, int property) { case AO_PROP_EQ_2000HZ: case AO_PROP_EQ_4000HZ: case AO_PROP_EQ_8000HZ: - case AO_PROP_EQ_16000HZ: + case AO_PROP_EQ_16000HZ: ret = (100.0 * this->eq_gain[property - AO_PROP_EQ_30HZ]) / (1 << FP_FRBITS) ; break; case AO_PROP_DISCARD_BUFFERS: ret = this->discard_buffers; break; - + case AO_PROP_CLOCK_SPEED: ret = this->current_speed; break; @@ -1835,7 +1835,7 @@ static int ao_set_property (xine_audio_port_t *this_gen, int property, int value ret = this->compression_factor_max*100; break; - + case AO_PROP_AMP: this->amp_factor = (double) value / 100.0; @@ -1860,13 +1860,13 @@ static int ao_set_property (xine_audio_port_t *this_gen, int property, int value case AO_PROP_EQ_2000HZ: case AO_PROP_EQ_4000HZ: case AO_PROP_EQ_8000HZ: - case AO_PROP_EQ_16000HZ: + case AO_PROP_EQ_16000HZ: { int min_gain, max_gain, i; this->eq_gain[property - AO_PROP_EQ_30HZ] = EQ_REAL(((float)value / 100.0)) ; - + /* calc pregain, find out if any gain != 0.0 - enable eq if that is the case */ min_gain = EQ_REAL(0.0); max_gain = EQ_REAL(0.0); @@ -1876,7 +1876,7 @@ static int ao_set_property (xine_audio_port_t *this_gen, int property, int value if (this->eq_gain[i] > max_gain) max_gain = this->eq_gain[i]; } - + lprintf ("eq min_gain=%d, max_gain=%d\n", min_gain, max_gain); this->do_equ = ((min_gain != EQ_REAL(0.0)) || (max_gain != EQ_REAL(0.0))); @@ -1884,22 +1884,22 @@ static int ao_set_property (xine_audio_port_t *this_gen, int property, int value ret = value; } break; - + case AO_PROP_DISCARD_BUFFERS: /* recursive discard buffers setting */ if(value) this->discard_buffers++; else this->discard_buffers--; - + ret = this->discard_buffers; - + /* discard buffers here because we have no output thread */ if (this->grab_only && this->discard_buffers) { audio_buffer_t *buf; - + pthread_mutex_lock(&this->out_fifo->mutex); - + while ((buf = this->out_fifo->first)) { lprintf ("flushing out frame\n"); buf = fifo_remove_int (this->out_fifo, 1); @@ -1940,7 +1940,7 @@ static int ao_set_property (xine_audio_port_t *this_gen, int property, int value if( this->slow_fast_audio ) ao_update_resample_factor(this); break; - + default: if (!this->grab_only) { /* Let the sound driver lock it's own mixer */ @@ -1986,7 +1986,7 @@ static void ao_flush (xine_audio_port_t *this_gen) { pthread_mutex_lock(&this->flush_audio_driver_lock); this->discard_buffers++; this->flush_audio_driver++; - + /* do not try this in paused mode */ while( this->flush_audio_driver && this->clock->speed != XINE_SPEED_PAUSE) { struct timeval tv; @@ -2025,7 +2025,7 @@ static int ao_status (xine_audio_port_t *this_gen, xine_stream_t *stream, xine_stream_t *cur; int ret = 0; xine_list_iterator_t ite; - + pthread_mutex_lock(&this->streams_lock); for (ite = xine_list_front(this->streams); ite; ite = xine_list_next(this->streams, ite)) { @@ -2039,8 +2039,8 @@ static int ao_status (xine_audio_port_t *this_gen, xine_stream_t *stream, } } pthread_mutex_unlock(&this->streams_lock); - - return ret; + + return ret; } static void ao_update_av_sync_method(void *this_gen, xine_cfg_entry_t *entry) { @@ -2049,7 +2049,7 @@ static void ao_update_av_sync_method(void *this_gen, xine_cfg_entry_t *entry) { lprintf ("av_sync_method = %d\n", entry->num_value); this->av_sync_method_conf = entry->num_value; - + switch (this->av_sync_method_conf) { case 0: this->resample_sync_method = 0; @@ -2066,7 +2066,7 @@ static void ao_update_av_sync_method(void *this_gen, xine_cfg_entry_t *entry) { xine_audio_port_t *_x_ao_new_port (xine_t *xine, ao_driver_t *driver, int grab_only) { - + config_values_t *config = xine->config; aos_t *this; int i, err; @@ -2082,7 +2082,7 @@ xine_audio_port_t *_x_ao_new_port (xine_t *xine, ao_driver_t *driver, this->clock = xine->clock; this->current_speed = xine->clock->speed; this->streams = xine_list_new(); - + /* warning: driver_lock is a recursive mutex. it must NOT be * used with neither pthread_cond_wait() or pthread_cond_timedwait() */ @@ -2106,13 +2106,13 @@ xine_audio_port_t *_x_ao_new_port (xine_t *xine, ao_driver_t *driver, this->ao.flush = ao_flush; this->ao.status = ao_status; - this->num_driver_actions = 0; + this->num_driver_actions = 0; this->audio_loop_running = 0; this->grab_only = grab_only; this->flush_audio_driver = 0; this->discard_buffers = 0; this->zero_space = calloc (1, ZERO_BUF_SIZE * 4 * 6); /* MAX as 32bit, 6 channels. */ - + pthread_mutex_init( &this->current_speed_lock, NULL ); pthread_mutex_init( &this->flush_audio_driver_lock, NULL ); pthread_cond_init( &this->flush_audio_driver_reached, NULL ); @@ -2148,7 +2148,7 @@ xine_audio_port_t *_x_ao_new_port (xine_t *xine, ao_driver_t *driver, "an external decoder in digital form."), 20, ao_update_av_sync_method, this); config->update_num(config,"audio.synchronization.av_sync_method",this->av_sync_method_conf); - + this->resample_conf = config->register_enum (config, "audio.synchronization.resample_mode", 0, resample_modes, _("enable resampling"), @@ -2175,7 +2175,7 @@ xine_audio_port_t *_x_ao_new_port (xine_t *xine, ao_driver_t *driver, "a fixed offset here to compensate.\nThe unit of " "the value is one PTS tick, which is the 90000th " "part of a second."), 10, NULL, NULL); - + this->slow_fast_audio = config->register_bool (config, "audio.synchronization.slow_fast_audio", 0, @@ -2227,12 +2227,12 @@ xine_audio_port_t *_x_ao_new_port (xine_t *xine, ao_driver_t *driver, buf->mem = calloc (1, AUDIO_BUF_SIZE); buf->mem_size = AUDIO_BUF_SIZE; buf->extra_info = malloc(sizeof(extra_info_t)); - + fifo_append (this->free_fifo, buf); } memset (this->last_sample, 0, sizeof (this->last_sample)); - + /* buffers used for audio conversions */ for (i=0; i<2; i++) { @@ -2251,13 +2251,13 @@ xine_audio_port_t *_x_ao_new_port (xine_t *xine, ao_driver_t *driver, */ if(this->driver){ int vol; - - vol = config->register_range (config, "audio.volume.mixer_volume", - 50, 0, 100, _("startup audio volume"), + + vol = config->register_range (config, "audio.volume.mixer_volume", + 50, 0, 100, _("startup audio volume"), _("The overall audio volume set at xine startup."), 10, NULL, NULL); - + if(config->register_bool (config, "audio.volume.remember_volume", 0, - _("restore volume level at startup"), + _("restore volume level at startup"), _("If disabled, xine will not modify any mixer settings at startup."), 10, NULL, NULL)) { int prop = 0; @@ -2266,34 +2266,34 @@ xine_audio_port_t *_x_ao_new_port (xine_t *xine, ao_driver_t *driver, prop = AO_PROP_MIXER_VOL; else if((ao_get_capabilities(&this->ao)) & AO_CAP_PCM_VOL) prop = AO_PROP_PCM_VOL; - + ao_set_property(&this->ao, prop, vol); } - } - + } + if (!this->grab_only) { /* * start output thread */ - this->audio_loop_running = 1; - + this->audio_loop_running = 1; + pthread_attr_init(&pth_attrs); pthread_attr_setscope(&pth_attrs, PTHREAD_SCOPE_SYSTEM); this->audio_thread_created = 1; if ((err = pthread_create (&this->audio_thread, &pth_attrs, ao_loop, this)) != 0) { - + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_out: can't create thread (%s)\n", strerror(err)); - xprintf (this->xine, XINE_VERBOSITY_LOG, + xprintf (this->xine, XINE_VERBOSITY_LOG, _("audio_out: sorry, this should not happen. please restart xine.\n")); _x_abort(); - + } else xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_out: thread created\n"); - + pthread_attr_destroy(&pth_attrs); } diff --git a/src/xine-engine/audio_out.h b/src/xine-engine/audio_out.h index 5f4420363..832c65a9e 100644 --- a/src/xine-engine/audio_out.h +++ b/src/xine-engine/audio_out.h @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -48,9 +48,9 @@ typedef struct ao_driver_s ao_driver_t; struct ao_driver_s { - /* + /* * - * find out what output modes + capatilities are supported by + * find out what output modes + capatilities are supported by * this plugin (constants for the bit vector to return see above) * * See AO_CAP_* bellow. @@ -58,7 +58,7 @@ struct ao_driver_s { uint32_t (*get_capabilities) (ao_driver_t *); /* - * open the driver and make it ready to receive audio data + * open the driver and make it ready to receive audio data * buffers may be flushed(!) * * return value: 0 : failure, >0 : output sample rate @@ -74,21 +74,21 @@ struct ao_driver_s { */ int (*bytes_per_frame)(ao_driver_t *self_gen); - /* return the delay is frames measured by + /* return the delay is frames measured by * looking at pending samples in the audio output device */ int (*delay)(ao_driver_t *self_gen); - /* + /* * return gap tolerance (in pts) needed for this driver */ int (*get_gap_tolerance) (ao_driver_t *self_gen); /* * write audio data to audio output device - * return value: + * return value: * >0 => audio samples were processed ok - * 0 => audio samples were not yet processed, + * 0 => audio samples were not yet processed, * call write_audio_data with the _same_ samples again */ int (*write)(ao_driver_t *, @@ -152,9 +152,9 @@ struct audio_buffer_s { int64_t vpts; uint32_t frame_header_count; uint32_t first_access_unit; - + /* extra info coming from input or demuxers */ - extra_info_t *extra_info; + extra_info_t *extra_info; xine_stream_t *stream; /* stream that send that buffer */ @@ -179,7 +179,7 @@ struct xine_audio_port_s { int (*get_property) (xine_audio_port_t *, int property); int (*set_property) (xine_audio_port_t *, int property, int value); - /* open audio driver for audio output + /* open audio driver for audio output * return value: 0:failure, >0:output sample rate */ /* when you are not a full-blown stream, but still need to open the port @@ -188,7 +188,7 @@ struct xine_audio_port_s { uint32_t bits, uint32_t rate, int mode); /* - * get a piece of memory for audio data + * get a piece of memory for audio data */ audio_buffer_t * (*get_buffer) (xine_audio_port_t *); @@ -218,7 +218,7 @@ struct xine_audio_port_s { * Flush audio_out fifo. */ void (*flush) (xine_audio_port_t *); - + /* * Check if port is opened for this stream and get parameters. * The stream can be anonymous. @@ -236,14 +236,14 @@ struct audio_driver_class_s { * open a new instance of this plugin class */ ao_driver_t* (*open_plugin) (audio_driver_class_t *, const void *data); - + /* * return short, human readable identifier for this plugin class */ char* (*get_identifier) (audio_driver_class_t *); /* - * return human readable (verbose = 1 line) description for + * return human readable (verbose = 1 line) description for * this plugin class */ char* (*get_description) (audio_driver_class_t *); @@ -255,7 +255,7 @@ struct audio_driver_class_s { void (*dispose) (audio_driver_class_t *); }; -/* +/* * this initiates the audio_out sync routines * found in ./src/xine-engine/audio_out.c */ @@ -331,7 +331,7 @@ int _x_ao_channels2mode( int channels ) XINE_PROTECTED; /* audio device control ops */ #define AO_CTRL_PLAY_PAUSE 0 #define AO_CTRL_PLAY_RESUME 1 -#define AO_CTRL_FLUSH_BUFFERS 2 +#define AO_CTRL_FLUSH_BUFFERS 2 /* above that value audio frames are discarded */ #define AO_MAX_GAP 15000 diff --git a/src/xine-engine/broadcaster.c b/src/xine-engine/broadcaster.c index 81711de49..22390459e 100644 --- a/src/xine-engine/broadcaster.c +++ b/src/xine-engine/broadcaster.c @@ -9,7 +9,7 @@ * 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. - * + * * xine 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 @@ -27,7 +27,7 @@ * - master will wait for connections on specified port, accepting new clients. * - several xine clients may connect to the server as "slaves", using mrl: * slave://master_address:port - * - streams played on master will appear on every slave. + * - streams played on master will appear on every slave. * if master is not meant to use video/audio devices it may be started with * 'xine -V none -A none' */ @@ -73,7 +73,7 @@ struct broadcaster_s { int port; /* server port */ int msock; /* master network socket */ xine_list_t *connections; /* active connections */ - + pthread_t manager_thread; pthread_mutex_t lock; @@ -87,21 +87,21 @@ static int sock_check_opened(int socket) { fd_set readfds, writefds, exceptfds; int retval; struct timeval timeout; - + for(;;) { - FD_ZERO(&readfds); - FD_ZERO(&writefds); + FD_ZERO(&readfds); + FD_ZERO(&writefds); FD_ZERO(&exceptfds); FD_SET(socket, &exceptfds); - - timeout.tv_sec = 0; + + timeout.tv_sec = 0; timeout.tv_usec = 0; - + retval = select(socket + 1, &readfds, &writefds, &exceptfds, &timeout); - + if(retval == -1 && (errno != EAGAIN && errno != EINTR)) return 0; - + if (retval != -1) return 1; } @@ -115,21 +115,21 @@ static int sock_check_opened(int socket) { static int sock_data_write(xine_t *xine, int socket, char *buf, int len) { ssize_t size; int wlen = 0; - + if((socket < 0) || (buf == NULL)) return -1; - + if(!sock_check_opened(socket)) return -1; - + while(len) { size = write(socket, buf, len); - + if(size <= 0) { xprintf(xine, XINE_VERBOSITY_DEBUG, "broadcaster: error writing to socket %d\n",socket); return -1; } - + len -= size; wlen += size; buf += size; @@ -142,20 +142,20 @@ static int XINE_FORMAT_PRINTF(3, 4) sock_string_write(xine_t *xine, int socket, char *msg, ...) { char buf[_BUFSIZ]; va_list args; - + va_start(args, msg); vsnprintf(buf, _BUFSIZ - 1, msg, args); va_end(args); - + /* Each line sent is '\n' terminated */ if((buf[strlen(buf)] == '\0') && (buf[strlen(buf) - 1] != '\n')) strcat(buf, "\n"); - + return sock_data_write(xine, socket, buf, strlen(buf)); } /* - * this is the most important broadcaster function. + * this is the most important broadcaster function. * it sends data to every connected client (slaves). */ static void broadcaster_data_write(broadcaster_t *this, char *buf, int len) { @@ -165,9 +165,9 @@ static void broadcaster_data_write(broadcaster_t *this, char *buf, int len) { while (ite) { int *psock = xine_list_get_value(this->connections, ite); - + ite = xine_list_next(this->connections, ite); - + /* in case of failure remove from list */ if( sock_data_write(this->stream->xine, *psock, buf, len) < 0 ) { @@ -184,15 +184,15 @@ static void XINE_FORMAT_PRINTF(2, 3) broadcaster_string_write(broadcaster_t *this, char *msg, ...) { char buf[_BUFSIZ]; va_list args; - + va_start(args, msg); vsnprintf(buf, _BUFSIZ - 1, msg, args); va_end(args); - + /* Each line sent is '\n' terminated */ if((buf[strlen(buf)] == '\0') && (buf[strlen(buf) - 1] != '\n')) strcat(buf, "\n"); - + broadcaster_data_write(this, buf, strlen(buf)); } @@ -209,40 +209,40 @@ static void *manager_loop (void *this_gen) { socklen_t alen; /* from-address length */ fd_set rfds; /* read file descriptor set */ fd_set efds; /* exception descriptor set */ - + while( this->running ) { FD_ZERO(&rfds); FD_SET(this->msock, &rfds); FD_ZERO(&efds); FD_SET(this->msock, &efds); - + if (select(this->msock+1, &rfds, (fd_set *)0, &efds, (struct timeval *)0) > 0) { - + pthread_mutex_lock( &this->lock ); - + if (FD_ISSET(this->msock, &rfds)) { int ssock; alen = sizeof(fsin.in); - + ssock = accept(this->msock, &(fsin.sa), &alen); if (ssock >= 0) { /* identification string, helps demuxer probing */ if( sock_string_write(this->stream->xine, ssock,"master xine v1") > 0 ) { int *psock = malloc(sizeof(int)); *psock = ssock; - - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "broadcaster: new connection socket %d\n", *psock); xine_list_push_back(this->connections, psock); } } } - + pthread_mutex_unlock( &this->lock ); } } - + return NULL; } @@ -253,7 +253,7 @@ static void *manager_loop (void *this_gen) { */ static void send_buf (broadcaster_t *this, char *from, buf_element_t *buf) { int i; - + /* ignore END buffers since they would stop the slavery */ if( buf->type == BUF_CONTROL_END ) return; @@ -272,7 +272,7 @@ static void send_buf (broadcaster_t *this, char *from, buf_element_t *buf) { broadcaster_data_write(this, buf->decoder_info_ptr[i], buf->decoder_info[i]); } } - + broadcaster_string_write(this, "buffer fifo=%s size=%d type=%u pts=%"PRId64" disc=%"PRId64" flags=%u", from, buf->size, buf->type, buf->pts, buf->disc_off, buf->decoder_flags ); @@ -306,7 +306,7 @@ broadcaster_t *_x_init_broadcaster(xine_stream_t *stream, int port) struct sockaddr sa; } servAddr; int msock, err; - + msock = socket(PF_INET, SOCK_STREAM, 0); if( msock < 0 ) { @@ -324,7 +324,7 @@ broadcaster_t *_x_init_broadcaster(xine_stream_t *stream, int port) } listen(msock,QLEN); - + signal( SIGPIPE, SIG_IGN ); this = calloc(1, sizeof(broadcaster_t)); @@ -332,23 +332,23 @@ broadcaster_t *_x_init_broadcaster(xine_stream_t *stream, int port) this->stream = stream; this->msock = msock; this->connections = xine_list_new(); - + pthread_mutex_init (&this->lock, NULL); - + stream->video_fifo->register_put_cb(stream->video_fifo, video_put_cb, this); if(stream->audio_fifo) stream->audio_fifo->register_put_cb(stream->audio_fifo, audio_put_cb, this); - + this->running = 1; if ((err = pthread_create (&this->manager_thread, NULL, manager_loop, (void *)this)) != 0) { - xprintf (stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (stream->xine, XINE_VERBOSITY_DEBUG, "broadcaster: can't create new thread (%s)\n", strerror(err)); _x_abort(); } - - return this; + + return this; } void _x_close_broadcaster(broadcaster_t *this) @@ -357,15 +357,15 @@ void _x_close_broadcaster(broadcaster_t *this) pthread_cancel(this->manager_thread); pthread_join(this->manager_thread,NULL); close(this->msock); - + if (this->stream->video_fifo) this->stream->video_fifo->unregister_put_cb(this->stream->video_fifo, video_put_cb); if(this->stream->audio_fifo) this->stream->audio_fifo->unregister_put_cb(this->stream->audio_fifo, audio_put_cb); - + xine_list_iterator_t ite; - + while ( (ite = xine_list_front(this->connections)) ) { int *psock = xine_list_get_value(this->connections, ite); xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "broadcaster: closing socket %d\n", *psock); @@ -382,5 +382,5 @@ void _x_close_broadcaster(broadcaster_t *this) int _x_get_broadcaster_port(broadcaster_t *this) { - return this->port; + return this->port; } diff --git a/src/xine-engine/broadcaster.h b/src/xine-engine/broadcaster.h index b59d33349..0cd416cac 100644 --- a/src/xine-engine/broadcaster.h +++ b/src/xine-engine/broadcaster.h @@ -7,7 +7,7 @@ * 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. - * + * * xine 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 diff --git a/src/xine-engine/bswap.h b/src/xine-engine/bswap.h index 635c6ae3a..f58648728 100644 --- a/src/xine-engine/bswap.h +++ b/src/xine-engine/bswap.h @@ -23,7 +23,7 @@ #include "config.h" -#define always_inline inline +#define always_inline inline #include "ffmpeg_bswap.h" @@ -98,7 +98,7 @@ ( (uint32_t)(unsigned char)(ch1) << 8 ) | \ ( (uint32_t)(unsigned char)(ch2) << 16 ) | \ ( (uint32_t)(unsigned char)(ch3) << 24 ) ) - + #ifdef WORDS_BIGENDIAN #define ME_FOURCC BE_FOURCC #else diff --git a/src/xine-engine/buffer.c b/src/xine-engine/buffer.c index 417fee745..77c0abc9d 100644 --- a/src/xine-engine/buffer.c +++ b/src/xine-engine/buffer.c @@ -1,13 +1,13 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 @@ -64,7 +64,7 @@ static void buffer_pool_free (buf_element_t *element) { fprintf(stderr, _("xine-lib: buffer.c: There has been a fatal error: TOO MANY FREE's\n")); _x_abort(); } - + pthread_cond_signal (&this->buffer_pool_cond_not_empty); pthread_mutex_unlock (&this->buffer_pool_mutex); @@ -104,7 +104,7 @@ static buf_element_t *buffer_pool_alloc (fifo_buffer_t *this) { memset(buf->decoder_info, 0, sizeof(buf->decoder_info)); memset(buf->decoder_info_ptr, 0, sizeof(buf->decoder_info_ptr)); _x_extra_info_reset( buf->extra_info ); - + return buf; } @@ -151,7 +151,7 @@ static buf_element_t *buffer_pool_try_alloc (fifo_buffer_t *this) { */ static void fifo_buffer_put (fifo_buffer_t *fifo, buf_element_t *element) { int i; - + pthread_mutex_lock (&fifo->mutex); for(i = 0; fifo->put_cb[i]; i++) @@ -177,7 +177,7 @@ static void fifo_buffer_put (fifo_buffer_t *fifo, buf_element_t *element) { */ static void dummy_fifo_buffer_put (fifo_buffer_t *fifo, buf_element_t *element) { int i; - + pthread_mutex_lock (&fifo->mutex); for(i = 0; fifo->put_cb[i]; i++) @@ -444,7 +444,7 @@ static void fifo_unregister_alloc_cb (fifo_buffer_t *this, this->alloc_cb_data[j] = this->alloc_cb_data[j+1]; } } - } + } pthread_mutex_unlock(&this->mutex); } @@ -465,7 +465,7 @@ static void fifo_unregister_put_cb (fifo_buffer_t *this, this->put_cb_data[j] = this->put_cb_data[j+1]; } } - } + } pthread_mutex_unlock(&this->mutex); } @@ -486,7 +486,7 @@ static void fifo_unregister_get_cb (fifo_buffer_t *this, this->get_cb_data[j] = this->get_cb_data[j+1]; } } - } + } pthread_mutex_unlock(&this->mutex); } diff --git a/src/xine-engine/buffer.h b/src/xine-engine/buffer.h index e0866f549..42302b30f 100644 --- a/src/xine-engine/buffer.h +++ b/src/xine-engine/buffer.h @@ -1,8 +1,8 @@ /* * Copyright (C) 2000-2008 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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 @@ -108,7 +108,7 @@ extern "C" { #define BUF_VIDEO_WMV8 0x02140000 #define BUF_VIDEO_MSVC 0x02150000 #define BUF_VIDEO_DV 0x02160000 -#define BUF_VIDEO_REAL 0x02170000 +#define BUF_VIDEO_REAL 0x02170000 #define BUF_VIDEO_VP31 0x02180000 #define BUF_VIDEO_H263 0x02190000 #define BUF_VIDEO_3IVX 0x021A0000 @@ -209,7 +209,7 @@ extern "C" { #define BUF_AUDIO_VOXWARE 0x030c0000 #define BUF_AUDIO_ACELPNET 0x030d0000 #define BUF_AUDIO_AAC 0x030e0000 -#define BUF_AUDIO_DNET 0x030f0000 +#define BUF_AUDIO_DNET 0x030f0000 #define BUF_AUDIO_VIVOG723 0x03100000 #define BUF_AUDIO_DK3ADPCM 0x03110000 #define BUF_AUDIO_DK4ADPCM 0x03120000 @@ -227,10 +227,10 @@ extern "C" { #define BUF_AUDIO_GSM610 0x031E0000 #define BUF_AUDIO_EA_ADPCM 0x031F0000 #define BUF_AUDIO_WMAV2 0x03200000 -#define BUF_AUDIO_COOK 0x03210000 -#define BUF_AUDIO_ATRK 0x03220000 -#define BUF_AUDIO_14_4 0x03230000 -#define BUF_AUDIO_28_8 0x03240000 +#define BUF_AUDIO_COOK 0x03210000 +#define BUF_AUDIO_ATRK 0x03220000 +#define BUF_AUDIO_14_4 0x03230000 +#define BUF_AUDIO_28_8 0x03240000 #define BUF_AUDIO_SIPRO 0x03250000 #define BUF_AUDIO_WMAV3 0x03260000 #define BUF_AUDIO_INTERPLAY 0x03270000 @@ -284,7 +284,7 @@ typedef struct extra_info_s extra_info_t; * to output frames (past decoder). new data must be added after the existing * fields for backward compatibility. */ - + struct extra_info_s { int input_normpos; /* remember where this buf came from in @@ -293,10 +293,10 @@ struct extra_info_s { int input_time; /* time offset in miliseconds from * beginning of stream */ uint32_t frame_number; /* number of current frame if known */ - + int seek_count; /* internal engine use */ - int64_t vpts; /* set on output layers only */ - + int64_t vpts; /* set on output layers only */ + int invalid; /* do not use this extra info to update anything */ int total_time; /* duration in miliseconds of the stream */ }; @@ -322,7 +322,7 @@ struct buf_element_s { uint32_t decoder_flags; /* stuff like keyframe, is_header ... see below */ /* additional decoder flags and other dec-spec. stuff */ - uint32_t decoder_info[BUF_NUM_DEC_INFO]; + uint32_t decoder_info[BUF_NUM_DEC_INFO]; /* pointers to dec-spec. stuff */ void *decoder_info_ptr[BUF_NUM_DEC_INFO]; @@ -369,7 +369,7 @@ struct buf_element_s { * xine_waveformatex is actually optional since the most important * information for audio init is available from decoder_info[]. * note: BUF_FLAG_HEADER must also be set. */ -#define BUF_FLAG_STDHEADER 0x0400 +#define BUF_FLAG_STDHEADER 0x0400 /* decoder_info[1] carries numerator for display aspect ratio * decoder_info[2] carries denominator for display aspect ratio */ @@ -456,7 +456,7 @@ struct buf_element_s { * four length bytes at the beginning * decoder_info_ptr[2] = pointer to ImageDescription atom, starting with * the codec fourcc - * Some Quicktime decoders need information contained within the + * Some Quicktime decoders need information contained within the * ImageDescription atom inside a Quicktime file's stsd atom. This * special buffer carries the ImageDescription atom from the QT demuxer * to an A/V decoder. @@ -489,7 +489,7 @@ struct buf_element_s { * In a BUF_SPECIAL_SPU_DVD_SUBTYPE: * decoder_info[1] = BUF_SPECIAL_SPU_DVD_SUBTYPE * decoder_info[2] = subtype - * decoder_info[3] = + * decoder_info[3] = * This buffer is pass SPU subtypes from DVDs */ #define BUF_SPECIAL_SPU_DVD_SUBTYPE 8 @@ -529,7 +529,7 @@ struct spu_dvb_descriptor_s long comp_page_id; long aux_page_id; } ; - + typedef struct palette_entry_s palette_entry_t; struct palette_entry_s { @@ -661,7 +661,7 @@ typedef struct XINE_PACKED { int32_t biClrImportant; } xine_bmiheader; -/* this is xine version of WAVEFORMATEX +/* this is xine version of WAVEFORMATEX * (the same comments from xine_bmiheader) */ typedef struct XINE_PACKED { diff --git a/src/xine-engine/buffer_types.c b/src/xine-engine/buffer_types.c index b7571d1d7..51e688f7e 100644 --- a/src/xine-engine/buffer_types.c +++ b/src/xine-engine/buffer_types.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2008 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -20,7 +20,7 @@ * * contents: * - * buffer types management. + * buffer types management. * convert FOURCC and audioformattag to BUF_xxx defines */ @@ -270,7 +270,7 @@ static const video_db_t video_db[] = { "Raw RGB" }, { - { + { /* is this right? copied from demux_qt: else if (!strncasecmp (video, "yuv2", 4)) this->video_type = BUF_VIDEO_YUY2; @@ -885,7 +885,7 @@ static const audio_db_t audio_db[] = { }, { { - 0x02, + 0x02, ME_FOURCC('m', 's', 0, 0x02), 0 }, @@ -909,7 +909,7 @@ static const audio_db_t audio_db[] = { "MS GSM" }, { - { + { /* these formattags are used by Vorbis ACM encoder and supported by NanDub, a variant of VirtualDub. */ 0x674f, 0x676f, 0x6750, 0x6770, 0x6751, 0x6771, @@ -1018,7 +1018,7 @@ static const audio_db_t audio_db[] = { ME_FOURCC('M', 'P', '4', 'A'), ME_FOURCC('r', 'a', 'a', 'c'), ME_FOURCC('r', 'a', 'c', 'p'), - ME_FOURCC('A', 'A', 'C', ' '), + ME_FOURCC('A', 'A', 'C', ' '), 0 }, BUF_AUDIO_AAC, @@ -1187,7 +1187,7 @@ static uint32_t cached_buf_type=0; if( fourcc_int == cached_fourcc ) return cached_buf_type; - + for( i = 0; video_db[i].buf_type; i++ ) { for( j = 0; video_db[i].fourcc[j]; j++ ) { if( fourcc_int == video_db[i].fourcc[j] ) { @@ -1202,9 +1202,9 @@ static uint32_t cached_buf_type=0; const char * _x_buf_video_name( uint32_t buf_type ) { int i; - + buf_type &= 0xffff0000; - + for( i = 0; video_db[i].buf_type; i++ ) { if( buf_type == video_db[i].buf_type ) { return video_db[i].name; @@ -1221,7 +1221,7 @@ static uint32_t cached_buf_type=0; if( formattag == cached_formattag ) return cached_buf_type; - + for( i = 0; audio_db[i].buf_type; i++ ) { for( j = 0; audio_db[i].formattag[j]; j++ ) { if( formattag == audio_db[i].formattag[j] ) { @@ -1236,9 +1236,9 @@ static uint32_t cached_buf_type=0; const char * _x_buf_audio_name( uint32_t buf_type ) { int i; - + buf_type &= 0xffff0000; - + for( i = 0; audio_db[i].buf_type; i++ ) { if( buf_type == audio_db[i].buf_type ) { return audio_db[i].name; @@ -1252,7 +1252,7 @@ void _x_bmiheader_le2me( xine_bmiheader *bih ) { /* OBS: fourcc must be read using machine endianness * so don't play with biCompression here! */ - + bih->biSize = le2me_32(bih->biSize); bih->biWidth = le2me_32(bih->biWidth); bih->biHeight = le2me_32(bih->biHeight); @@ -1266,7 +1266,7 @@ void _x_bmiheader_le2me( xine_bmiheader *bih ) { } void _x_waveformatex_le2me( xine_waveformatex *wavex ) { - + wavex->wFormatTag = le2me_16(wavex->wFormatTag); wavex->nChannels = le2me_16(wavex->nChannels); wavex->nSamplesPerSec = le2me_32(wavex->nSamplesPerSec); diff --git a/src/xine-engine/configfile.c b/src/xine-engine/configfile.c index 81acab348..8b274a801 100644 --- a/src/xine-engine/configfile.c +++ b/src/xine-engine/configfile.c @@ -225,7 +225,7 @@ static int config_section_enum(const char *sect) { NULL }; int i = 0; - + while (known_section[i]) if (strcmp(sect, known_section[i++]) == 0) return i; @@ -234,7 +234,7 @@ static int config_section_enum(const char *sect) { static void config_key_split(const char *key, char **base, char **section, char **subsect, char **name) { char *parse; - + *base = strdup(key); if ((parse = strchr(*base, '.'))) { *section = *base; @@ -259,10 +259,10 @@ static void config_insert(config_values_t *this, cfg_entry_t *new_entry) { cfg_entry_t *cur, *prev; char *new_base, *new_section, *new_subsect, *new_name; char *cur_base, *cur_section, *cur_subsect, *cur_name; - + /* extract parts of the new key */ config_key_split(new_entry->key, &new_base, &new_section, &new_subsect, &new_name); - + /* search right position */ cur_base = NULL; for (cur = this->first, prev = NULL; cur; prev = cur, cur = cur->next) { @@ -270,7 +270,7 @@ static void config_insert(config_values_t *this, cfg_entry_t *new_entry) { if (cur_base) free(cur_base); config_key_split(cur->key, &cur_base, &cur_section, &cur_subsect, &cur_name); - + /* sort by section name */ if (!new_section && cur_section) break; if ( new_section && !cur_section) continue; @@ -302,14 +302,14 @@ static void config_insert(config_values_t *this, cfg_entry_t *new_entry) { if (cmp < 0) break; if (cmp > 0) continue; } - + break; } if (new_base) free(new_base); if (cur_base) free(cur_base); - + new_entry->next = cur; if (!cur) this->last = new_entry; @@ -330,7 +330,7 @@ static cfg_entry_t *XINE_MALLOC config_add (config_values_t *this, const char *k entry->unknown_value = NULL; entry->str_value = NULL; entry->exp_level = exp_level; - + config_insert(this, entry); lprintf ("add entry key=%s\n", key); @@ -397,7 +397,7 @@ static void config_lookup_entry_int (config_values_t *this, const char *key, *prev = *entry; *entry = (*entry)->next; } - + if (*entry) { free(tmp); return; @@ -420,11 +420,11 @@ static void config_lookup_entry_int (config_values_t *this, const char *key, static cfg_entry_t *config_lookup_entry(config_values_t *this, const char *key) { cfg_entry_t *entry, *prev; - + pthread_mutex_lock(&this->config_lock); config_lookup_entry_int(this, key, &entry, &prev); pthread_mutex_unlock(&this->config_lock); - + return entry; } @@ -525,7 +525,7 @@ static cfg_entry_t *config_register_string_internal (config_values_t *this, /* set string */ entry->type = XINE_CONFIG_TYPE_STRING; - + if (entry->unknown_value) entry->str_value = strdup(entry->unknown_value); else @@ -756,7 +756,7 @@ static int config_register_enum (config_values_t *this, entry->num_value = config_parse_enum (entry->unknown_value, (const char **)values); else entry->num_value = def_value; - + /* fill out rest of struct */ entry->num_default = def_value; @@ -806,7 +806,7 @@ static void config_shallow_copy(xine_cfg_entry_t *dest, cfg_entry_t *src) static void config_update_num (config_values_t *this, const char *key, int value) { - + cfg_entry_t *entry; entry = this->lookup_entry (this, key); @@ -835,13 +835,13 @@ static void config_update_num (config_values_t *this, xine_cfg_entry_t cb_entry; config_shallow_copy(&cb_entry, entry); - + /* it is safe to enter the callback from within a locked context * because we use a recursive mutex. */ entry->callback (entry->callback_data, &cb_entry); } - + pthread_mutex_unlock(&this->config_lock); } @@ -863,7 +863,7 @@ static void config_update_string (config_values_t *this, return; } - + /* if an enum is updated with a string, we convert the string to * its index and use update number */ if (entry->type == XINE_CONFIG_TYPE_ENUM) { @@ -887,7 +887,7 @@ static void config_update_string (config_values_t *this, xine_cfg_entry_t cb_entry; config_shallow_copy(&cb_entry, entry); - + /* it is safe to enter the callback from within a locked context * because we use a recursive mutex. */ @@ -929,7 +929,7 @@ void xine_config_load (xine_t *xine, const char *filename) { if (line[0] == '#') continue; - + if (line[0] == '.') { if (strncmp(line, ".version:", 9) == 0) { sscanf(line + 9, "%d", &this->current_version); @@ -1002,32 +1002,32 @@ void xine_config_save (xine_t *xine, const char *filename) { unlink (temp); if (stat(temp, &backup_stat) != 0) { - + lprintf("backing up configfile to %s\n", temp); f_backup = fopen(temp, "w"); f_config = fopen(filename, "r"); - + if (f_config && f_backup && (stat(filename, &config_stat) == 0)) { char *buf = NULL; size_t rlen; - + buf = (char *) malloc(config_stat.st_size + 1); if((rlen = fread(buf, 1, config_stat.st_size, f_config)) && ((off_t)rlen == config_stat.st_size)) { (void) fwrite(buf, 1, rlen, f_backup); } free(buf); - + fclose(f_config); fclose(f_backup); stat(temp, &backup_stat); - + if (config_stat.st_size == backup_stat.st_size) backup = 1; else unlink(temp); - - } + + } else { if (f_config) @@ -1040,17 +1040,17 @@ void xine_config_save (xine_t *xine, const char *filename) { } } - + if (!backup && (stat(filename, &config_stat) == 0)) { xprintf(xine, XINE_VERBOSITY_LOG, _("configfile: WARNING: backing up configfile to %s failed\n"), temp); xprintf(xine, XINE_VERBOSITY_LOG, _("configfile: WARNING: your configuration will not be saved\n")); return; } - + lprintf ("writing config file to %s\n", filename); f_config = fopen(filename, "w"); - + if (f_config) { cfg_entry_t *entry; @@ -1141,7 +1141,7 @@ void xine_config_save (xine_t *xine, const char *filename) { entry = entry->next; } pthread_mutex_unlock(&this->config_lock); - + if (fclose(f_config) != 0) { xprintf(xine, XINE_VERBOSITY_LOG, _("configfile: WARNING: writing configuration to %s failed\n"), filename); xprintf(xine, XINE_VERBOSITY_LOG, _("configfile: WARNING: removing possibly broken config file %s\n"), filename); @@ -1152,7 +1152,7 @@ void xine_config_save (xine_t *xine, const char *filename) { backup = 0; } } - + if (backup) unlink(temp); } @@ -1284,13 +1284,13 @@ int _x_config_change_opt(config_values_t *config, const char *opt) { free(key); return -1; } - + switch(entry->type) { case XINE_CONFIG_TYPE_STRING: config->update_string(config, key, value); handled = 1; break; - + case XINE_CONFIG_TYPE_RANGE: case XINE_CONFIG_TYPE_ENUM: case XINE_CONFIG_TYPE_NUM: @@ -1298,13 +1298,13 @@ int _x_config_change_opt(config_values_t *config, const char *opt) { config->update_num(config, key, (atoi(value))); handled = 1; break; - + case XINE_CONFIG_TYPE_UNKNOWN: entry->unknown_value = strdup(value); handled = 1; break; } - + free(key); return handled; } diff --git a/src/xine-engine/configfile.h b/src/xine-engine/configfile.h index e1dca7b18..4622f87fe 100644 --- a/src/xine-engine/configfile.h +++ b/src/xine-engine/configfile.h @@ -38,11 +38,11 @@ extern "C" { #define CONFIG_FILE_VERSION 2 /* - * config entries above this experience + * config entries above this experience * level must never be changed from MRL */ #define XINE_CONFIG_SECURITY 30 - + typedef struct cfg_entry_s cfg_entry_t; typedef struct config_values_s config_values_t; @@ -190,7 +190,7 @@ struct config_values_s { * mutex for modification to the config */ pthread_mutex_t config_lock; - + /* * current config file's version number */ diff --git a/src/xine-engine/demux.c b/src/xine-engine/demux.c index 98b2e3fd3..bbc130988 100644 --- a/src/xine-engine/demux.c +++ b/src/xine-engine/demux.c @@ -50,7 +50,7 @@ #include <winsock.h> #endif -/* +/* * Flush audio and video buffers. It is called from demuxers on * seek/stop, and may be useful when user input changes a stream and * xine-lib has cached buffers that have yet to be played. @@ -62,10 +62,10 @@ void _x_demux_flush_engine (xine_stream_t *stream) { buf_element_t *buf; - + if( stream->gapless_switch ) return; - + stream->xine->port_ticket->acquire(stream->xine->port_ticket, 1); /* only flush/discard output ports on master streams */ @@ -77,23 +77,23 @@ void _x_demux_flush_engine (xine_stream_t *stream) { stream->audio_out->set_property(stream->audio_out, AO_PROP_DISCARD_BUFFERS, 1); } } - + stream->video_fifo->clear(stream->video_fifo); stream->audio_fifo->clear(stream->audio_fifo); - - pthread_mutex_lock(&stream->demux_mutex); + + pthread_mutex_lock(&stream->demux_mutex); buf = stream->video_fifo->buffer_pool_alloc (stream->video_fifo); buf->type = BUF_CONTROL_RESET_DECODER; stream->video_fifo->put (stream->video_fifo, buf); - + buf = stream->audio_fifo->buffer_pool_alloc (stream->audio_fifo); buf->type = BUF_CONTROL_RESET_DECODER; stream->audio_fifo->put (stream->audio_fifo, buf); - - pthread_mutex_unlock(&stream->demux_mutex); - /* on seeking we must wait decoder fifos to process before doing flush. + pthread_mutex_unlock(&stream->demux_mutex); + + /* on seeking we must wait decoder fifos to process before doing flush. * otherwise we flush too early (before the old data has left decoders) */ _x_demux_control_headers_done (stream); @@ -102,7 +102,7 @@ void _x_demux_flush_engine (xine_stream_t *stream) { video_overlay_manager_t *ovl = stream->video_out->get_overlay_manager(stream->video_out); ovl->flush_events(ovl); } - + /* only flush/discard output ports on master streams */ if( stream->master == stream ) { if (stream->video_out) { @@ -115,7 +115,7 @@ void _x_demux_flush_engine (xine_stream_t *stream) { stream->audio_out->set_property(stream->audio_out, AO_PROP_DISCARD_BUFFERS, 0); } } - + stream->xine->port_ticket->release(stream->xine->port_ticket, 1); } @@ -151,8 +151,8 @@ static struct timespec _x_compute_interval(unsigned int millisecs) { void _x_demux_control_newpts( xine_stream_t *stream, int64_t pts, uint32_t flags ) { buf_element_t *buf; - - pthread_mutex_lock(&stream->demux_mutex); + + pthread_mutex_lock(&stream->demux_mutex); buf = stream->video_fifo->buffer_pool_alloc (stream->video_fifo); buf->type = BUF_CONTROL_NEWPTS; @@ -166,7 +166,7 @@ void _x_demux_control_newpts( xine_stream_t *stream, int64_t pts, uint32_t flags buf->disc_off = pts; stream->audio_fifo->put (stream->audio_fifo, buf); - pthread_mutex_unlock(&stream->demux_mutex); + pthread_mutex_unlock(&stream->demux_mutex); } /* avoid ao_loop being stuck in a pthread_cond_wait, waiting for data; @@ -201,7 +201,7 @@ void _x_demux_control_headers_done (xine_stream_t *stream) { /* we use demux_action_pending to wake up sleeping spu decoders */ stream->demux_action_pending = 1; - + /* allocate the buffers before grabbing the lock to prevent cyclic wait situations */ buf_video = stream->video_fifo->buffer_pool_alloc (stream->video_fifo); buf_audio = stream->audio_fifo->buffer_pool_alloc (stream->audio_fifo); @@ -219,8 +219,8 @@ void _x_demux_control_headers_done (xine_stream_t *stream) { } else { header_count_audio = 0; } - - pthread_mutex_lock(&stream->demux_mutex); + + pthread_mutex_lock(&stream->demux_mutex); buf_video->type = BUF_CONTROL_HEADERS_DONE; stream->video_fifo->put (stream->video_fifo, buf_video); @@ -228,24 +228,24 @@ void _x_demux_control_headers_done (xine_stream_t *stream) { buf_audio->type = BUF_CONTROL_HEADERS_DONE; stream->audio_fifo->put (stream->audio_fifo, buf_audio); - pthread_mutex_unlock(&stream->demux_mutex); + pthread_mutex_unlock(&stream->demux_mutex); unsigned int max_iterations = 0; - while ((stream->header_count_audio < header_count_audio) || + while ((stream->header_count_audio < header_count_audio) || (stream->header_count_video < header_count_video)) { lprintf ("waiting for headers. v:%d %d a:%d %d\n", stream->header_count_video, header_count_video, - stream->header_count_audio, header_count_audio); - - struct timespec ts = _x_compute_interval(1000); + stream->header_count_audio, header_count_audio); + + struct timespec ts = _x_compute_interval(1000); int ret_wait; /* use timedwait to workaround buggy pthread broadcast implementations */ ret_wait = pthread_cond_timedwait (&stream->counter_changed, &stream->counter_lock, &ts); if (ret_wait == ETIMEDOUT && demux_unstick_ao_loop (stream) && ++max_iterations > 4) { - xine_log(stream->xine, + xine_log(stream->xine, XINE_LOG_MSG,_("Stuck in _x_demux_control_headers_done(). Taking the emergency exit\n")); stream->emergency_brake = 1; break; @@ -254,7 +254,7 @@ void _x_demux_control_headers_done (xine_stream_t *stream) { stream->demux_action_pending = 0; pthread_cond_signal(&stream->demux_resume); - + lprintf ("headers processed.\n"); pthread_mutex_unlock (&stream->counter_lock); @@ -265,7 +265,7 @@ void _x_demux_control_start( xine_stream_t *stream ) { buf_element_t *buf; uint32_t flags = (stream->gapless_switch) ? BUF_FLAG_GAPLESS_SW : 0; - pthread_mutex_lock(&stream->demux_mutex); + pthread_mutex_lock(&stream->demux_mutex); buf = stream->video_fifo->buffer_pool_alloc (stream->video_fifo); buf->type = BUF_CONTROL_START; @@ -277,14 +277,14 @@ void _x_demux_control_start( xine_stream_t *stream ) { buf->decoder_flags = flags; stream->audio_fifo->put (stream->audio_fifo, buf); - pthread_mutex_unlock(&stream->demux_mutex); + pthread_mutex_unlock(&stream->demux_mutex); } void _x_demux_control_end( xine_stream_t *stream, uint32_t flags ) { buf_element_t *buf; - pthread_mutex_lock(&stream->demux_mutex); + pthread_mutex_lock(&stream->demux_mutex); buf = stream->video_fifo->buffer_pool_alloc (stream->video_fifo); buf->type = BUF_CONTROL_END; @@ -296,26 +296,26 @@ void _x_demux_control_end( xine_stream_t *stream, uint32_t flags ) { buf->decoder_flags = flags; stream->audio_fifo->put (stream->audio_fifo, buf); - pthread_mutex_unlock(&stream->demux_mutex); + pthread_mutex_unlock(&stream->demux_mutex); } void _x_demux_control_nop( xine_stream_t *stream, uint32_t flags ) { buf_element_t *buf; - pthread_mutex_lock(&stream->demux_mutex); + pthread_mutex_lock(&stream->demux_mutex); buf = stream->video_fifo->buffer_pool_alloc (stream->video_fifo); buf->type = BUF_CONTROL_NOP; buf->decoder_flags = flags; stream->video_fifo->put (stream->video_fifo, buf); - + buf = stream->audio_fifo->buffer_pool_alloc (stream->audio_fifo); buf->type = BUF_CONTROL_NOP; buf->decoder_flags = flags; stream->audio_fifo->put (stream->audio_fifo, buf); - pthread_mutex_unlock(&stream->demux_mutex); + pthread_mutex_unlock(&stream->demux_mutex); } static void *demux_loop (void *stream_gen) { @@ -330,7 +330,7 @@ static void *demux_loop (void *stream_gen) { pthread_mutex_lock( &stream->demux_lock ); stream->emergency_brake = 0; - + /* do-while needed to seek after demux finished */ do { @@ -349,7 +349,7 @@ static void *demux_loop (void *stream_gen) { gettimeofday(&tv, NULL); ts.tv_sec = tv.tv_sec; ts.tv_nsec = (tv.tv_usec + 100000) * 1000; - + pthread_cond_timedwait (&stream->demux_resume, &stream->demux_lock, &ts); } } @@ -398,7 +398,7 @@ static void *demux_loop (void *stream_gen) { /* demux_thread_running is zero if demux loop has been stopped by user */ non_user = stream->demux_thread_running; stream->demux_thread_running = 0; - + _x_demux_control_end(stream, non_user); lprintf ("loop finished, end buffer sent\n"); @@ -409,7 +409,7 @@ static void *demux_loop (void *stream_gen) { struct timespec ts; unsigned int max_iterations = 0; int ret_wait; - while ((stream->finished_count_audio < finished_count_audio) || + while ((stream->finished_count_audio < finished_count_audio) || (stream->finished_count_video < finished_count_video)) { lprintf ("waiting for finisheds.\n"); ts = _x_compute_interval(1000); @@ -423,7 +423,7 @@ static void *demux_loop (void *stream_gen) { } } pthread_mutex_unlock (&stream->counter_lock); - + _x_handle_stream_end(stream, non_user); return NULL; } @@ -431,14 +431,14 @@ static void *demux_loop (void *stream_gen) { int _x_demux_start_thread (xine_stream_t *stream) { int err; - + lprintf ("start thread called\n"); - + stream->demux_action_pending = 1; pthread_mutex_lock( &stream->demux_lock ); stream->demux_action_pending = 0; pthread_cond_signal(&stream->demux_resume); - + if( !stream->demux_thread_running ) { if (stream->demux_thread_created) { @@ -454,17 +454,17 @@ int _x_demux_start_thread (xine_stream_t *stream) { _x_abort(); } } - + pthread_mutex_unlock( &stream->demux_lock ); return 0; } int _x_demux_stop_thread (xine_stream_t *stream) { - + void *p; - + lprintf ("stop thread called\n"); - + stream->demux_action_pending = 1; pthread_mutex_lock( &stream->demux_lock ); stream->demux_thread_running = 0; @@ -478,12 +478,12 @@ int _x_demux_stop_thread (xine_stream_t *stream) { pthread_mutex_unlock( &stream->demux_lock ); lprintf ("joining thread %ld\n", stream->demux_thread ); - + if( stream->demux_thread_created ) { pthread_join (stream->demux_thread, &p); stream->demux_thread_created = 0; } - + /* * Wake up xine_play if it's waiting for a frame */ @@ -621,7 +621,7 @@ int _x_action_pending (xine_stream_t *stream) { * * the other ones help enforcing that demuxers provide the information * they have about the stream, so things like the GUI slider bar can - * work as expected. + * work as expected. */ void _x_demux_send_data(fifo_buffer_t *fifo, uint8_t *data, int size, int64_t pts, uint32_t type, uint32_t decoder_flags, @@ -669,10 +669,10 @@ void _x_demux_send_data(fifo_buffer_t *fifo, uint8_t *data, int size, * * If reading fails, -1 is returned */ -int _x_demux_read_send_data(fifo_buffer_t *fifo, input_plugin_t *input, - int size, int64_t pts, uint32_t type, - uint32_t decoder_flags, off_t input_normpos, - int input_time, int total_time, +int _x_demux_read_send_data(fifo_buffer_t *fifo, input_plugin_t *input, + int size, int64_t pts, uint32_t type, + uint32_t decoder_flags, off_t input_normpos, + int input_time, int total_time, uint32_t frame_number) { buf_element_t *buf; @@ -694,7 +694,7 @@ int _x_demux_read_send_data(fifo_buffer_t *fifo, input_plugin_t *input, if(input->read(input, buf->content, buf->size) < buf->size) { buf->free_buffer(buf); - return -1; + return -1; } size -= buf->size; @@ -710,7 +710,7 @@ int _x_demux_read_send_data(fifo_buffer_t *fifo, input_plugin_t *input, fifo->put (fifo, buf); } - + return 0; } @@ -737,7 +737,7 @@ void _x_demux_send_mrl_reference (xine_stream_t *stream, int alternative, event.data_length = offsetof (xine_mrl_reference_data_ext_t, mrl) + mrl_len + strlen (title) + 2; data.e = event.data = malloc (event.data_length); - + data.e->alternative = alternative; data.e->start_time = start_time; data.e->duration = duration; diff --git a/src/xine-engine/events.c b/src/xine-engine/events.c index f79187682..cf35f96b4 100644 --- a/src/xine-engine/events.c +++ b/src/xine-engine/events.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -94,7 +94,7 @@ void xine_event_send (xine_stream_t *stream, const xine_event_t *event) { cevent->data = NULL; } gettimeofday (&cevent->tv, NULL); - + pthread_mutex_lock (&queue->lock); xine_list_push_back (queue->events, cevent); pthread_cond_signal (&queue->new_event); @@ -135,7 +135,7 @@ void xine_event_dispose_queue (xine_event_queue_t *queue) { xine_event_t *qevent; xine_event_queue_t *q; xine_list_iterator_t ite; - + pthread_mutex_lock (&stream->event_queues_lock); ite = xine_list_front (stream->event_queues); @@ -144,7 +144,7 @@ void xine_event_dispose_queue (xine_event_queue_t *queue) { if ( ite ) { do { q = xine_list_get_value (stream->event_queues, ite); - + if ( q == queue ) break; } while( (ite = xine_list_next (stream->event_queues, ite)) ); @@ -160,17 +160,17 @@ void xine_event_dispose_queue (xine_event_queue_t *queue) { xine_list_remove (stream->event_queues, ite); pthread_mutex_unlock (&stream->event_queues_lock); - /* - * send quit event + /* + * send quit event */ qevent = (xine_event_t *)malloc(sizeof(xine_event_t)); - + qevent->type = XINE_EVENT_QUIT; qevent->stream = stream; qevent->data = NULL; qevent->data_length = 0; gettimeofday (&qevent->tv, NULL); - + pthread_mutex_lock (&queue->lock); xine_list_push_back (queue->events, qevent); pthread_cond_signal (&queue->new_event); @@ -179,15 +179,15 @@ void xine_event_dispose_queue (xine_event_queue_t *queue) { /* * join listener thread, if any */ - + if (queue->listener_thread) { void *p; pthread_join (*queue->listener_thread, &p); free (queue->listener_thread); } - + /* - * clean up pending events + * clean up pending events */ while ( (event = xine_event_get (queue)) ) { @@ -233,7 +233,7 @@ static void *listener_loop (void *queue_gen) { } -void xine_event_create_listener_thread (xine_event_queue_t *queue, +void xine_event_create_listener_thread (xine_event_queue_t *queue, xine_event_listener_cb_t callback, void *user_data) { int err; diff --git a/src/xine-engine/info_helper.c b/src/xine-engine/info_helper.c index 6ce9bcd38..e45336d98 100644 --- a/src/xine-engine/info_helper.c +++ b/src/xine-engine/info_helper.c @@ -40,7 +40,7 @@ /* ******************* Stream Info *************************** */ /* - * Compare stream_info, private and public values, + * Compare stream_info, private and public values, * return 1 if it's identical, otherwirse 0. */ static int stream_info_is_identical(xine_stream_t *stream, int info) { @@ -105,7 +105,7 @@ uint32_t _x_stream_info_get(xine_stream_t *stream, int info) { pthread_mutex_lock(&stream->info_mutex); stream_info = stream->stream_info[info]; pthread_mutex_unlock(&stream->info_mutex); - + return stream_info; } @@ -120,7 +120,7 @@ uint32_t _x_stream_info_get_public(xine_stream_t *stream, int info) { if(info_valid(info) && (!stream_info_is_identical(stream, info))) stream_info = stream->stream_info_public[info] = stream->stream_info[info]; pthread_mutex_unlock(&stream->info_mutex); - + return stream_info; } @@ -137,7 +137,7 @@ static void meta_info_chomp(char *str) { if (!len) return; i = len - 1; - + while ((i >= 0) && ((unsigned char)str[i] <= 32)) { str[i] = 0; i--; @@ -145,13 +145,13 @@ static void meta_info_chomp(char *str) { } /* - * Compare stream_info, public and private values, + * Compare stream_info, public and private values, * return 1 if it's identical, otherwise 0. */ static int meta_info_is_identical(xine_stream_t *stream, int info) { - + if((!(stream->meta_info_public[info] && stream->meta_info[info])) || - ((stream->meta_info_public[info] && stream->meta_info[info]) && + ((stream->meta_info_public[info] && stream->meta_info[info]) && strcmp(stream->meta_info_public[info], stream->meta_info[info]))) return 0; @@ -175,7 +175,7 @@ static int meta_valid(int info) { */ static void meta_info_set_unlocked_utf8(xine_stream_t *stream, int info, const char *value) { if(meta_valid(info)) { - + if(stream->meta_info[info]) free(stream->meta_info[info]); @@ -275,7 +275,7 @@ static void meta_info_set_unlocked_encoding(xine_stream_t *stream, int info, con } } #endif - + meta_info_set_unlocked_utf8(stream, info, value); } @@ -349,7 +349,7 @@ void _x_meta_info_n_set(xine_stream_t *stream, int info, const char *buf, int le pthread_mutex_lock(&stream->meta_mutex); if(meta_valid(info) && len) { char *str = strndup(buf, len); - + meta_info_set_unlocked(stream, info, str); free(str); } @@ -367,7 +367,7 @@ void _x_meta_info_set_multi(xine_stream_t *stream, int info, ...) { char *args[1025]; char *buf; size_t n, len; - + len = n = 0; va_start(ap, info); @@ -377,32 +377,32 @@ void _x_meta_info_set_multi(xine_stream_t *stream, int info, ...) { n++; } va_end(ap); - + args[n] = NULL; - + if(len) { char *p, *meta; - + p = meta = (char *) malloc(len + 1); - + n = 0; while(args[n]) { strcpy(meta, args[n]); meta += strlen(args[n]) + 1; n++; } - + *meta = '\0'; if(stream->meta_info[info]) free(stream->meta_info[info]); - + stream->meta_info[info] = p; - + if(stream->meta_info[info] && strlen(stream->meta_info[info])) meta_info_chomp(stream->meta_info[info]); } - + } pthread_mutex_unlock(&stream->meta_mutex); } @@ -412,11 +412,11 @@ void _x_meta_info_set_multi(xine_stream_t *stream, int info, ...) { */ const char *_x_meta_info_get(xine_stream_t *stream, int info) { const char *meta_info = NULL; - + pthread_mutex_lock(&stream->meta_mutex); meta_info = stream->meta_info[info]; pthread_mutex_unlock(&stream->meta_mutex); - + return meta_info; } @@ -430,13 +430,13 @@ const char *_x_meta_info_get_public(xine_stream_t *stream, int info) { meta_info = stream->meta_info_public[info]; if(meta_valid(info) && (!meta_info_is_identical(stream, info))) { meta_info_public_reset_unlocked(stream, info); - + if(stream->meta_info[info]) stream->meta_info_public[info] = strdup(stream->meta_info[info]); meta_info = stream->meta_info_public[info]; } pthread_mutex_unlock(&stream->meta_mutex); - + return meta_info; } diff --git a/src/xine-engine/info_helper.h b/src/xine-engine/info_helper.h index d4123ba2b..666b94f08 100644 --- a/src/xine-engine/info_helper.h +++ b/src/xine-engine/info_helper.h @@ -20,7 +20,7 @@ * stream metainfo helper functions * hide some xine engine details from demuxers and reduce code duplication * - * $id$ + * $id$ */ #ifndef INFO_HELPER_H diff --git a/src/xine-engine/input_cache.c b/src/xine-engine/input_cache.c index 4eb524af6..e761fed38 100644 --- a/src/xine-engine/input_cache.c +++ b/src/xine-engine/input_cache.c @@ -19,7 +19,7 @@ * * Buffered Input Plugin (request optimizer). * - * The goal of this input plugin is to reduce + * The goal of this input plugin is to reduce * the number of calls to the real input plugin. */ @@ -58,7 +58,7 @@ typedef struct { } cache_input_plugin_t; -/* +/* * read data from input plugin and write it into file */ static off_t cache_plugin_read(input_plugin_t *this_gen, char *buf, off_t len) { @@ -128,13 +128,13 @@ static off_t cache_plugin_read(input_plugin_t *this_gen, char *buf, off_t len) { /* readahead bytes */ main_read = this->main_input_plugin->read(this->main_input_plugin, this->buf, this->buf_size); this->main_read_call++; - + if( main_read >= 0 ) { this->buf_len = main_read; - + if (len > this->buf_len) len = this->buf_len; - + if (len) { xine_fast_memcpy(buf + read_len, this->buf, len); this->buf_pos = len; @@ -148,7 +148,7 @@ static off_t cache_plugin_read(input_plugin_t *this_gen, char *buf, off_t len) { /* direct read */ main_read = this->main_input_plugin->read(this->main_input_plugin, buf + read_len, len); this->main_read_call++; - + if( main_read >= 0 ) read_len += main_read; else @@ -156,7 +156,7 @@ static off_t cache_plugin_read(input_plugin_t *this_gen, char *buf, off_t len) { read_len = main_read; } } - + return read_len; } @@ -190,7 +190,7 @@ static buf_element_t *cache_plugin_read_block(input_plugin_t *this_gen, fifo_buf buf = fifo->buffer_pool_alloc (fifo); if (buf) { buf->type = BUF_DEMUX_BLOCK; - + assert(todo <= buf->max_size); read_len = cache_plugin_read (this_gen, buf->content, todo); buf->size = read_len; @@ -226,11 +226,11 @@ static off_t cache_plugin_seek(input_plugin_t *this_gen, off_t offset, int origi case SEEK_CUR: rel_offset = offset; break; - + case SEEK_SET: rel_offset = offset - cur_pos; break; - + default: /* invalid origin - main input should know better */ cur_pos = this->main_input_plugin->seek(this->main_input_plugin, offset, origin); @@ -238,16 +238,16 @@ static off_t cache_plugin_seek(input_plugin_t *this_gen, off_t offset, int origi this->main_seek_call++; return cur_pos; } - + new_buf_pos = (off_t)this->buf_pos + rel_offset; lprintf("buf_len: %d, rel_offset=%"PRId64", new_buf_pos=%"PRId64"\n", - this->buf_len, rel_offset, new_buf_pos); - + this->buf_len, rel_offset, new_buf_pos); + if ((new_buf_pos < 0) || (new_buf_pos >= this->buf_len)) { if( origin == SEEK_SET ) cur_pos = this->main_input_plugin->seek(this->main_input_plugin, offset, origin); else - cur_pos = this->main_input_plugin->seek(this->main_input_plugin, + cur_pos = this->main_input_plugin->seek(this->main_input_plugin, offset - (this->buf_len - this->buf_pos), origin); this->buf_len = this->buf_pos = 0; this->main_seek_call++; @@ -262,7 +262,7 @@ static off_t cache_plugin_seek(input_plugin_t *this_gen, off_t offset, int origi static off_t cache_plugin_seek_time(input_plugin_t *this_gen, int time_offset, int origin) { cache_input_plugin_t *this = (cache_input_plugin_t *)this_gen; off_t cur_pos; - + lprintf("time_offset: %d, origin: %d\n", time_offset, origin); this->seek_call++; @@ -275,7 +275,7 @@ static off_t cache_plugin_seek_time(input_plugin_t *this_gen, int time_offset, i static off_t cache_plugin_get_current_pos(input_plugin_t *this_gen) { cache_input_plugin_t *this = (cache_input_plugin_t *)this_gen; off_t cur_pos; - + cur_pos = this->main_input_plugin->get_current_pos(this->main_input_plugin); if( this->buf_len ) { if( cur_pos >= (this->buf_len - this->buf_pos) ) @@ -290,7 +290,7 @@ static off_t cache_plugin_get_current_pos(input_plugin_t *this_gen) { static int cache_plugin_get_current_time(input_plugin_t *this_gen) { cache_input_plugin_t *this = (cache_input_plugin_t *)this_gen; int cur_time; - + cur_time = this->main_input_plugin->get_current_time(this->main_input_plugin); return cur_time; @@ -314,7 +314,7 @@ static const char* cache_plugin_get_mrl (input_plugin_t *this_gen) { return this->main_input_plugin->get_mrl(this->main_input_plugin); } -static int cache_plugin_get_optional_data (input_plugin_t *this_gen, +static int cache_plugin_get_optional_data (input_plugin_t *this_gen, void *data, int data_type) { cache_input_plugin_t *this = (cache_input_plugin_t *)this_gen; @@ -322,8 +322,8 @@ static int cache_plugin_get_optional_data (input_plugin_t *this_gen, this->main_input_plugin, data, data_type); } -/* - * dispose main input plugin and self +/* + * dispose main input plugin and self */ static void cache_plugin_dispose(input_plugin_t *this_gen) { cache_input_plugin_t *this = (cache_input_plugin_t *)this_gen; @@ -341,8 +341,8 @@ static void cache_plugin_dispose(input_plugin_t *this_gen) { } -/* - * create self instance, +/* + * create self instance, */ input_plugin_t *_x_cache_plugin_get_instance (xine_stream_t *stream, int readahead_size) { cache_input_plugin_t *this; @@ -359,7 +359,7 @@ input_plugin_t *_x_cache_plugin_get_instance (xine_stream_t *stream, int readahe this = calloc(1, sizeof(cache_input_plugin_t)); if (!this) return NULL; - + this->main_input_plugin = main_plugin; this->stream = stream; diff --git a/src/xine-engine/input_rip.c b/src/xine-engine/input_rip.c index 8db7eaaf5..faeaae62d 100644 --- a/src/xine-engine/input_rip.c +++ b/src/xine-engine/input_rip.c @@ -20,12 +20,12 @@ * Rip Input Plugin for catching streams * * It saves raw data into file as go from input plugins. - * + * * Usage: * * - activation: * xine stream_mrl#save:file.raw - * + * * - it's possible speeder saving streams in the xine without playing: * xine stream_mrl#save:file.raw\;noaudio\;novideo */ @@ -95,7 +95,7 @@ static off_t min_off(off_t a, off_t b) { return a <= b ? a : b; } -/* +/* * read data from input plugin and write it into file */ static off_t rip_plugin_read(input_plugin_t *this_gen, char *buf, off_t len) { @@ -123,7 +123,7 @@ static off_t rip_plugin_read(input_plugin_t *this_gen, char *buf, off_t len) { npreview = 0; nread = min_off(this->savepos - this->curpos, len); } - + /* size to write into file */ nwrite = len - npreview - nread; /* size to read from file */ @@ -149,7 +149,7 @@ static off_t rip_plugin_read(input_plugin_t *this_gen, char *buf, off_t len) { lprintf("%s => returned %"PRId64"" CLR_RST "\n", retlen == nread_orig + nwrite ? "" : CLR_FAIL, retlen); if (retlen < 0) { - xine_log(this->stream->xine, XINE_LOG_MSG, + xine_log(this->stream->xine, XINE_LOG_MSG, _("input_rip: reading by input plugin failed\n")); return -1; } @@ -163,10 +163,10 @@ static off_t rip_plugin_read(input_plugin_t *this_gen, char *buf, off_t len) { } this->savepos += nwrite; lprintf(" => saved %"PRId64" bytes\n", nwrite); - } else + } else nwrite = 0; } - + this->curpos += (npreview + nread + nwrite); return npreview + nread + nwrite; @@ -191,7 +191,7 @@ static uint32_t rip_plugin_get_capabilities(input_plugin_t *this_gen) { uint32_t caps; caps = this->main_input_plugin->get_capabilities(this->main_input_plugin); - + if (this->regular) caps |= INPUT_CAP_SEEKABLE; @@ -199,11 +199,11 @@ static uint32_t rip_plugin_get_capabilities(input_plugin_t *this_gen) { return caps; } -/* +/* * read a block of data from input plugin and write it into file * * This rip plugin returns block unchanged from main input plugin. But special - * cases are reading over preview or reading already saved data - it returns + * cases are reading over preview or reading already saved data - it returns * own allocated block. */ static buf_element_t *rip_plugin_read_block(input_plugin_t *this_gen, fifo_buffer_t *fifo, off_t todo) { @@ -230,7 +230,7 @@ static buf_element_t *rip_plugin_read_block(input_plugin_t *this_gen, fifo_buffe npreview = 0; nread = min_off(this->savepos - this->curpos, todo); } - + /* size to write into file */ nwrite = todo - npreview - nread; /* size to read from file */ @@ -249,7 +249,7 @@ static buf_element_t *rip_plugin_read_block(input_plugin_t *this_gen, fifo_buffe lprintf(" => get %"PRId64" bytes from the preview (block)\n", npreview); memcpy(buf->content, &this->preview[this->curpos], npreview); } - + /* re-reading from the file */ if (nread_file) { lprintf(" => read %"PRId64" bytes from the file (block)\n", nread_file); @@ -286,17 +286,17 @@ static buf_element_t *rip_plugin_read_block(input_plugin_t *this_gen, fifo_buffe if (retlen > nread_orig) { nwrite = retlen - nread_orig; if (fwrite(buf->content + this->savepos - this->curpos, nwrite, 1, this->file) != 1) { - xine_log(this->stream->xine, XINE_LOG_MSG, + xine_log(this->stream->xine, XINE_LOG_MSG, _("input_rip: error writing to file %" PRIdMAX " bytes: %s\n"), (intmax_t)(retlen - nread_orig), strerror(errno)); return NULL; } this->savepos += nwrite; lprintf(" => saved %"PRId64" bytes\n", nwrite); - } else + } else nwrite = 0; } - + this->curpos += (npreview + nread + nwrite); buf->size = npreview + nread + nwrite; @@ -323,11 +323,11 @@ static off_t rip_seek_original(rip_input_plugin_t *this, off_t reqpos) { return pos; } - + /* * seek in RIP - * - * If we are seeking back and we can read from saved file, + * + * If we are seeking back and we can read from saved file, * position of original input plugin isn't changed. */ static off_t rip_plugin_seek(input_plugin_t *this_gen, off_t offset, int origin) { @@ -339,7 +339,7 @@ static off_t rip_plugin_seek(input_plugin_t *this_gen, off_t offset, int origin) double interval = 0; lprintf("seek, offset %"PRId64", origin %d (curpos %"PRId64", savepos %"PRId64")\n", offset, origin, this->curpos, this->savepos); - + switch (origin) { case SEEK_SET: newpos = offset; break; case SEEK_CUR: newpos = this->curpos + offset; break; @@ -376,7 +376,7 @@ static off_t rip_plugin_seek(input_plugin_t *this_gen, off_t offset, int origin) if ((pos = rip_seek_original(this, reqpos)) == -1) return -1; if (pos == reqpos) this->curpos = newpos; } - + return this->curpos; } @@ -393,7 +393,7 @@ static off_t rip_plugin_seek(input_plugin_t *this_gen, off_t offset, int origin) if ((pos = rip_seek_original(this, this->savepos)) == -1) return -1; if (pos > this->savepos) xine_log(this->stream->xine, XINE_LOG_MSG, - _("input_rip: %" PRIdMAX " bytes dropped\n"), + _("input_rip: %" PRIdMAX " bytes dropped\n"), (intmax_t)(pos - this->savepos)); } } @@ -425,13 +425,13 @@ static off_t rip_plugin_seek(input_plugin_t *this_gen, off_t offset, int origin) } lprintf(" => new position %"PRId64"\n", this->curpos); - + return this->curpos; } static off_t rip_plugin_seek_time(input_plugin_t *this_gen, int time_offset, int origin) { rip_input_plugin_t *this = (rip_input_plugin_t *)this_gen; - + lprintf("seek_time, time_offset: %d, origin: %d\n", time_offset, origin); return this->main_input_plugin->seek_time(this->main_input_plugin, time_offset, origin); @@ -451,13 +451,13 @@ static off_t rip_plugin_get_current_pos(input_plugin_t *this_gen) { lprintf(CLR_FAIL "position: computed = %"PRId64", input plugin = %"PRId64"" CLR_RST "\n", this->curpos, pos); } #endif - + return this->curpos; } static int rip_plugin_get_current_time(input_plugin_t *this_gen) { rip_input_plugin_t *this = (rip_input_plugin_t *)this_gen; - + return this->main_input_plugin->get_current_time(this->main_input_plugin); } @@ -484,7 +484,7 @@ static const char* rip_plugin_get_mrl (input_plugin_t *this_gen) { return this->main_input_plugin->get_mrl(this->main_input_plugin); } -static int rip_plugin_get_optional_data (input_plugin_t *this_gen, +static int rip_plugin_get_optional_data (input_plugin_t *this_gen, void *data, int data_type) { rip_input_plugin_t *this = (rip_input_plugin_t *)this_gen; @@ -494,11 +494,11 @@ static int rip_plugin_get_optional_data (input_plugin_t *this_gen, return this->preview_size; } else return this->main_input_plugin->get_optional_data( - this->main_input_plugin, data, data_type); + this->main_input_plugin, data, data_type); } -/* - * dispose main input plugin and self +/* + * dispose main input plugin and self */ static void rip_plugin_dispose(input_plugin_t *this_gen) { rip_input_plugin_t *this = (rip_input_plugin_t *)this_gen; @@ -540,8 +540,8 @@ static int dir_file_concat(char *target, size_t maxlen, const char *dir, const c } -/* - * create self instance, +/* + * create self instance, * target file for writing stream is specified in 'data' */ input_plugin_t *_x_rip_plugin_get_instance (xine_stream_t *stream, const char *filename) { @@ -571,7 +571,7 @@ input_plugin_t *_x_rip_plugin_get_instance (xine_stream_t *stream, const char *f #ifndef SAVING_ALWAYS_PERMIT if ( main_plugin->get_capabilities(main_plugin) & INPUT_CAP_RIP_FORBIDDEN ) { - xine_log(stream->xine, XINE_LOG_MSG, + xine_log(stream->xine, XINE_LOG_MSG, _("input_rip: ripping/caching of this source is not permitted!\n")); _x_message(stream, XINE_MSG_SECURITY, _("xine is not allowed to save from this source. (possibly copyrighted material?)"), NULL); @@ -592,7 +592,7 @@ input_plugin_t *_x_rip_plugin_get_instance (xine_stream_t *stream, const char *f fnc = strdup(filename); target_basename = basename(fnc); - dir_file_concat(target, MAX_TARGET_LEN, stream->xine->save_path, + dir_file_concat(target, MAX_TARGET_LEN, stream->xine->save_path, target_basename); strcpy(target_no, target); @@ -621,7 +621,7 @@ input_plugin_t *_x_rip_plugin_get_instance (xine_stream_t *stream, const char *f lprintf("target file: %s\n", target_no); if ((this->file = fopen(target_no, mode)) == NULL) { - xine_log(this->stream->xine, XINE_LOG_MSG, + xine_log(this->stream->xine, XINE_LOG_MSG, _("input_rip: error opening file %s: %s\n"), target_no, strerror(errno)); free(this); return NULL; @@ -639,7 +639,7 @@ input_plugin_t *_x_rip_plugin_get_instance (xine_stream_t *stream, const char *f this->preview_size = buf->size; this->preview = malloc(this->preview_size); memcpy(this->preview, buf->content, this->preview_size); - + buf->free_buffer(buf); } else { this->preview = malloc(MAX_PREVIEW_SIZE); @@ -651,7 +651,7 @@ input_plugin_t *_x_rip_plugin_get_instance (xine_stream_t *stream, const char *f if (this->preview && this->preview_size) { if (fwrite(this->preview, this->preview_size, 1, this->file) != 1) { - xine_log(this->stream->xine, XINE_LOG_MSG, + xine_log(this->stream->xine, XINE_LOG_MSG, _("input_rip: error writing to file %" PRIdMAX " bytes: %s\n"), (intmax_t)(this->preview_size), strerror(errno)); fclose(this->file); diff --git a/src/xine-engine/io_helper.c b/src/xine-engine/io_helper.c index c3654c762..b06c47709 100644 --- a/src/xine-engine/io_helper.c +++ b/src/xine-engine/io_helper.c @@ -53,14 +53,14 @@ static int _x_io_tcp_connect_ipv4(xine_stream_t *stream, const char *host, int p struct hostent *h; int i, s; - + h = gethostbyname(host); if (h == NULL) { _x_message(stream, XINE_MSG_UNKNOWN_HOST, "unable to resolve", host, NULL); return -1; } - s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); + s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); if (s == -1) { _x_message(stream, XINE_MSG_CONNECTION_REFUSED, "failed to create socket", strerror(errno), NULL); return -1; @@ -88,12 +88,12 @@ static int _x_io_tcp_connect_ipv4(xine_stream_t *stream, const char *host, int p for (i = 0; h->h_addr_list[i]; i++) { struct in_addr ia; struct sockaddr_in sin; - + memcpy (&ia, h->h_addr_list[i], 4); sin.sin_family = AF_INET; sin.sin_addr = ia; sin.sin_port = htons(port); - + #ifndef WIN32 if (connect(s, (struct sockaddr *)&sin, sizeof(sin))==-1 && errno != EINPROGRESS) { #else @@ -106,7 +106,7 @@ static int _x_io_tcp_connect_ipv4(xine_stream_t *stream, const char *host, int p close(s); continue; } - + return s; } return -1; @@ -122,10 +122,10 @@ int _x_io_tcp_connect(xine_stream_t *stream, const char *host, int port) { struct addrinfo hints, *res, *tmpaddr; int error; char strport[16]; - + memset(&hints, 0, sizeof(hints)); hints.ai_socktype = SOCK_STREAM; - hints.ai_family = PF_UNSPEC; + hints.ai_family = PF_UNSPEC; snprintf(strport, sizeof(strport), "%d", port); @@ -135,7 +135,7 @@ int _x_io_tcp_connect(xine_stream_t *stream, const char *host, int port) { error = getaddrinfo(host, strport, &hints, &res); if (error) { - _x_message(stream, XINE_MSG_UNKNOWN_HOST, + _x_message(stream, XINE_MSG_UNKNOWN_HOST, "unable to resolve", host, NULL); return -1; } @@ -143,10 +143,10 @@ int _x_io_tcp_connect(xine_stream_t *stream, const char *host, int port) { tmpaddr = res; while (tmpaddr) { - - s = socket(tmpaddr->ai_family, SOCK_STREAM, IPPROTO_TCP); + + s = socket(tmpaddr->ai_family, SOCK_STREAM, IPPROTO_TCP); if (s == -1) { - _x_message(stream, XINE_MSG_CONNECTION_REFUSED, + _x_message(stream, XINE_MSG_CONNECTION_REFUSED, "failed to create socket", strerror(errno), NULL); tmpaddr = tmpaddr->ai_next; continue; @@ -177,12 +177,12 @@ int _x_io_tcp_connect(xine_stream_t *stream, const char *host, int port) { } #ifndef WIN32 - if (connect(s, tmpaddr->ai_addr, + if (connect(s, tmpaddr->ai_addr, tmpaddr->ai_addrlen)==-1 && errno != EINPROGRESS) { - + #else - if (connect(s, tmpaddr->ai_addr, - tmpaddr->ai_addrlen)==-1 && + if (connect(s, tmpaddr->ai_addr, + tmpaddr->ai_addrlen)==-1 && WSAGetLastError() != WSAEWOULDBLOCK) { if (stream) @@ -196,12 +196,12 @@ int _x_io_tcp_connect(xine_stream_t *stream, const char *host, int port) { } else { return s; } - + tmpaddr = tmpaddr->ai_next; } _x_message(stream, XINE_MSG_CONNECTION_REFUSED, strerror(error), NULL); - + return -1; #endif } @@ -302,14 +302,14 @@ int _x_io_select (xine_stream_t *stream, int fd, int state, int timeout_msec) { */ int _x_io_tcp_connect_finish(xine_stream_t *stream, int fd, int timeout_msec) { int ret; - + ret = _x_io_select(stream, fd, XIO_WRITE_READY, timeout_msec); /* find out, if connection is successfull */ if (ret == XIO_READY) { socklen_t len = sizeof(int); int err; - + if ((getsockopt(fd, SOL_SOCKET, SO_ERROR, (void *)&err, &len)) == -1) { _x_message(stream, XINE_MSG_CONNECTION_REFUSED, _("failed to get status of socket"), strerror(errno), NULL); return XIO_ERROR; @@ -346,14 +346,14 @@ static off_t xio_rw_abort(xine_stream_t *stream, int fd, int cmd, char *buf, off } else { timeout = 30000; /* 30K msecs = 30 secs */ } - + while (total < todo) { sret = _x_io_select(stream, fd, state, timeout); - + if (sret != XIO_READY) return -1; - + switch (cmd) { case XIO_FILE_READ: ret = read(fd, &buf[total], todo - total); @@ -403,7 +403,7 @@ static off_t xio_rw_abort(xine_stream_t *stream, int fd, int cmd, char *buf, off if (stream) xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "io_helper: WSAGetLastError() = %d\n", WSAGetLastError()); #endif - + return ret; } total += ret; diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c index 5128644da..9eb33f8ed 100644 --- a/src/xine-engine/load_plugins.c +++ b/src/xine-engine/load_plugins.c @@ -101,7 +101,7 @@ static const int plugin_iface_versions[] = { SPU_DECODER_IFACE_VERSION, AUDIO_OUT_IFACE_VERSION, VIDEO_OUT_DRIVER_IFACE_VERSION, - POST_PLUGIN_IFACE_VERSION + POST_PLUGIN_IFACE_VERSION }; static void _build_list_typed_plugins(plugin_catalog_t **catalog, xine_sarray_t *type) { @@ -112,7 +112,7 @@ static void _build_list_typed_plugins(plugin_catalog_t **catalog, xine_sarray_t list_size = xine_sarray_size (type); for (list_id = 0, i = 0; list_id < list_size; list_id++) { node = xine_sarray_get(type, list_id); - + /* add only unique ids to the list */ for ( j = 0; j < i; j++ ) { if( !strcmp((*catalog)->ids[j], node->info->id) ) @@ -157,9 +157,9 @@ static int get_decoder_priority(xine_t *this, plugin_node_t *node) { char key[80]; snprintf(key, sizeof(key), "engine.decoder_priorities.%s", node->info->id); - + entry = this->config->lookup_entry(this->config, key); - + if (entry && entry->num_value) /* user given priorities should definitely override defaults, so multiply them */ return entry->num_value * 100; @@ -258,14 +258,14 @@ static plugin_info_t *_get_cached_info (xine_t *this, node->file->filesize == filesize && node->file->filemtime == filemtime && !strcmp( node->file->filename, filename )) { - + return node->info; } - + /* skip previously returned items */ if( node->info == previous_info ) previous_info = NULL; - + } return NULL; } @@ -318,7 +318,7 @@ static void _insert_node (xine_t *this, _x_assert(list); _x_assert(info); if (info->API != api_version) { - xprintf(this, XINE_VERBOSITY_LOG, + xprintf(this, XINE_VERBOSITY_LOG, _("load_plugins: ignoring plugin %s, wrong iface version %d (should be %d)\n"), info->id, info->API, api_version); return; @@ -375,7 +375,7 @@ static void _insert_node (xine_t *this, decoder_new->supported_types = types; } entry->priority = decoder_new->priority = decoder_old->priority; - + snprintf(key, sizeof(key), "engine.decoder_priorities.%s", info->id); /* write the description on the heap because the config system * does not strdup() it, so we have to provide a different pointer @@ -397,23 +397,23 @@ static void _insert_node (xine_t *this, entry->info->special_info = decoder_new; break; - + case PLUGIN_POST: post_old = info->special_info; post_new = calloc(1, sizeof(post_info_t)); post_new->type = post_old->type; entry->info->special_info = post_new; break; - + case PLUGIN_DEMUX: demux_old = info->special_info; demux_new = calloc(1, sizeof(demuxer_info_t)); - + if (demux_old) { entry->priority = demux_new->priority = demux_old->priority; lprintf("demux: %s, priority: %d\n", info->id, entry->priority); } else { - xprintf(this, XINE_VERBOSITY_LOG, + xprintf(this, XINE_VERBOSITY_LOG, _("load_plugins: demuxer plugin %s does not provide a priority," " xine-lib will use the default priority.\n"), info->id); @@ -425,12 +425,12 @@ static void _insert_node (xine_t *this, case PLUGIN_INPUT: input_old = info->special_info; input_new = calloc(1, sizeof(input_info_t)); - + if (input_old) { entry->priority = input_new->priority = input_old->priority; lprintf("input: %s, priority: %d\n", info->id, entry->priority); } else { - xprintf(this, XINE_VERBOSITY_LOG, + xprintf(this, XINE_VERBOSITY_LOG, _("load_plugins: input plugin %s does not provide a priority," " xine-lib will use the default priority.\n"), info->id); @@ -491,7 +491,7 @@ static void _register_plugins_internal(xine_t *this, plugin_file_t *file, plugin else xine_log (this, XINE_LOG_PLUGIN, _("load_plugins: static plugin found\n")); - + if (this->plugin_catalog->plugin_count >= PLUGIN_MAX || (this->plugin_catalog->decoder_count >= DECODER_MAX && info->type >= PLUGIN_AUDIO_DECODER && info->type <= PLUGIN_SPU_DECODER)) { @@ -525,7 +525,7 @@ static void _register_plugins_internal(xine_t *this, plugin_file_t *file, plugin } this->plugin_catalog->plugin_count++; } - + /* get next info */ if( file && !file->lib_handle ) { lprintf("get cached info\n"); @@ -563,7 +563,7 @@ static void collect_plugins(xine_t *this, char *path){ while ((pEntry = readdir (dir)) != NULL) { void *lib = NULL; plugin_info_t *info = NULL; - + struct stat statbuffer; size_t d_len = strlen(pEntry->d_name); @@ -616,7 +616,7 @@ static void collect_plugins(xine_t *this, char *path){ if(!info && (lib = dlopen (str, RTLD_LAZY | RTLD_GLOBAL)) == NULL) { const char *error = dlerror(); /* too noisy -- but good to catch unresolved references */ - xprintf(this, XINE_VERBOSITY_LOG, + xprintf(this, XINE_VERBOSITY_LOG, _("load_plugins: cannot open plugin lib %s:\n%s\n"), str, error); } else { @@ -659,14 +659,14 @@ static void collect_plugins(xine_t *this, char *path){ * generic 2nd stage plugin loader */ -static inline int _plugin_info_equal(const plugin_info_t *a, +static inline int _plugin_info_equal(const plugin_info_t *a, const plugin_info_t *b) { - if (a->type != b->type || + if (a->type != b->type || a->API != b->API || strcasecmp(a->id, b->id) || a->version != b->version) return 0; - + switch (a->type & PLUGIN_TYPE_MASK) { case PLUGIN_VIDEO_OUT: /* FIXME: Could special_info be NULL? */ @@ -675,11 +675,11 @@ static inline int _plugin_info_equal(const plugin_info_t *a, ((vo_info_t*)b->special_info)->visual_type); } break; - + default: break; } - + return 1; } @@ -722,7 +722,7 @@ static int _load_plugin_class(xine_t *this, info++; } lprintf("plugin not found\n"); - + } else { xine_log (this, XINE_LOG_PLUGIN, _("load_plugins: Yikes! %s doesn't contain plugin info.\n"), filename); @@ -790,9 +790,9 @@ static void _load_required_plugins(xine_t *this, xine_sarray_t *list) { list_size = xine_sarray_size(list); while (list_id < list_size) { plugin_node_t *node = xine_sarray_get(list, list_id); - + if( (node->info->type & PLUGIN_MUST_PRELOAD) && !node->plugin_class ) { - + lprintf("preload plugin %s from %s\n", node->info->id, node->file->filename); if (! _load_plugin_class (this, node, NULL)) { @@ -831,7 +831,7 @@ static void save_plugin_list(FILE *fp, xine_sarray_t *list) { const vo_info_t *vo_info; const ao_info_t *ao_info; const post_info_t *post_info; - + int i; int list_id = 0; int list_size; @@ -848,20 +848,20 @@ static void save_plugin_list(FILE *fp, xine_sarray_t *list) { fprintf(fp, "api=%d\n", node->info->API ); fprintf(fp, "id=%s\n", node->info->id ); fprintf(fp, "version=%lu\n", (unsigned long) node->info->version ); - + switch (node->info->type & PLUGIN_TYPE_MASK){ - + case PLUGIN_VIDEO_OUT: vo_info = node->info->special_info; fprintf(fp, "visual_type=%d\n", vo_info->visual_type ); fprintf(fp, "vo_priority=%d\n", vo_info->priority ); break; - + case PLUGIN_AUDIO_OUT: ao_info = node->info->special_info; fprintf(fp, "ao_priority=%d\n", ao_info->priority ); break; - + case PLUGIN_AUDIO_DECODER: case PLUGIN_VIDEO_DECODER: case PLUGIN_SPU_DECODER: @@ -878,7 +878,7 @@ static void save_plugin_list(FILE *fp, xine_sarray_t *list) { demuxer_info = node->info->special_info; fprintf(fp, "demuxer_priority=%d\n", demuxer_info->priority); break; - + case PLUGIN_INPUT: input_info = node->info->special_info; fprintf(fp, "input_priority=%d\n", input_info->priority); @@ -888,8 +888,8 @@ static void save_plugin_list(FILE *fp, xine_sarray_t *list) { post_info = node->info->special_info; fprintf(fp, "post_type=%lu\n", (unsigned long)post_info->type); break; - } - + } + fprintf(fp, "\n"); list_id++; } @@ -914,13 +914,13 @@ static void load_plugin_list(FILE *fp, xine_sarray_t *plugins) { char line[1024]; char *value; int version_ok = 0; - + node = NULL; file = NULL; while (fgets (line, 1023, fp)) { if (line[0] == '#') continue; - + if( (value = strchr(line, '\r')) || (value = strchr(line, '\n')) ) *value = (char) 0; /* eliminate any cr/lf */ @@ -957,7 +957,7 @@ static void load_plugin_list(FILE *fp, xine_sarray_t *plugins) { if( i == CACHE_CATALOG_VERSION ) version_ok = 1; else - return; + return; } } else if (node) { if( !strcmp("size",line) ) { @@ -969,19 +969,19 @@ static void load_plugin_list(FILE *fp, xine_sarray_t *plugins) { } else if( !strcmp("type",line) ) { sscanf(value," %d",&i); node->info->type = i; - + switch (node->info->type & PLUGIN_TYPE_MASK){ - + case PLUGIN_VIDEO_OUT: node->info->special_info = vo_info = calloc(1, sizeof(vo_info_t)); break; - + case PLUGIN_AUDIO_OUT: node->info->special_info = ao_info = calloc(1, sizeof(ao_info_t)); break; - + case PLUGIN_DEMUX: node->info->special_info = demuxer_info = calloc(1, sizeof(demuxer_info_t)); @@ -998,13 +998,13 @@ static void load_plugin_list(FILE *fp, xine_sarray_t *plugins) { node->info->special_info = decoder_info = calloc(1, sizeof(decoder_info_t)); break; - + case PLUGIN_POST: node->info->special_info = post_info = calloc(1, sizeof(post_info_t)); break; - } - + } + } else if( !strcmp("api",line) ) { sscanf(value," %d",&i); node->info->API = i; @@ -1018,7 +1018,7 @@ static void load_plugin_list(FILE *fp, xine_sarray_t *plugins) { vo_info->visual_type = i; } else if( !strcmp("supported_types",line) && decoder_info ) { char *s; - + for( s = value, i = 0; s && sscanf(s," %lu",&lu) > 0; i++ ) { s = strchr(s+1, ' '); } @@ -1049,7 +1049,7 @@ static void load_plugin_list(FILE *fp, xine_sarray_t *plugins) { } } } - + if( node ) { xine_sarray_add (plugins, node); } @@ -1067,10 +1067,10 @@ static void save_catalog (xine_t *this) { const char *dirname = CACHE_CATALOG_DIR; const char *const homedir = xine_get_homedir(); - + asprintf(&cachefile, "%s/%s", homedir, relname); asprintf(&cachefile_new, "%s.new", cachefile); - + /* make sure homedir (~/.xine) exists */ asprintf(&dirfile, "%s/%s", homedir, dirname); mkdir (dirfile, 0755); @@ -1078,7 +1078,7 @@ static void save_catalog (xine_t *this) { if( (fp = fopen(cachefile_new,"w")) != NULL ) { int i; - + fprintf(fp, "# this file is automatically created by xine, do not edit.\n\n"); fprintf(fp, "cache_catalog_version=%d\n\n", CACHE_CATALOG_VERSION); @@ -1116,11 +1116,11 @@ static void save_catalog (xine_t *this) { static void load_cached_catalog (xine_t *this) { FILE *fp; - char *cachefile; + char *cachefile; const char *relname = CACHE_CATALOG_FILE; - + asprintf(&cachefile, "%s/%s", xine_get_homedir(), relname); - + if( (fp = fopen(cachefile,"r")) != NULL ) { load_plugin_list (fp, this->plugin_catalog->cache_list); fclose(fp); @@ -1147,7 +1147,7 @@ void _x_scan_plugins (xine_t *this) { char *homedir, *pluginpath; xine_list_t *plugindirs = xine_list_new (); xine_list_iterator_t iter; - + lprintf("_x_scan_plugins()\n"); if (this == NULL || this->config == NULL) { @@ -1202,7 +1202,7 @@ void _x_scan_plugins (xine_t *this) { free(homedir); save_catalog (this); - + load_required_plugins (this); map_decoders (this); @@ -1232,7 +1232,7 @@ input_plugin_t *_x_find_input_plugin (xine_stream_t *stream, const char *mrl) { plugin->node = node; break; } - } + } } pthread_mutex_unlock (&catalog->lock); @@ -1438,7 +1438,7 @@ demux_plugin_t *_x_find_demux_plugin_last_probe(xine_stream_t *stream, const cha if (strcasecmp(node->info->id, last_demux_name) == 0) { last_demux = node; } else { - xprintf(stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "load_plugin: probing '%s' (method %d)...\n", node->info->id, stream->content_detection_method ); if (node->plugin_class || _load_plugin_class(xine, node, NULL)) { if ((plugin = ((demux_class_t *)node->plugin_class)->open_plugin(node->plugin_class, stream, input))) { @@ -1546,7 +1546,7 @@ const char *const *xine_get_browsable_input_plugin_ids(xine_t *this) { for (list_id = 0; list_id < list_size; list_id++) { input_class_t *ic; - + node = xine_sarray_get(catalog->plugin_lists[PLUGIN_INPUT - 1], list_id); if (node->plugin_class || _load_plugin_class(this, node, NULL)) { @@ -1605,7 +1605,7 @@ vo_driver_t *_x_load_video_output_plugin(xine_t *this, if (id && !strcasecmp(id, "auto")) id = NULL; - + pthread_mutex_lock (&catalog->lock); list_size = xine_sarray_size (catalog->plugin_lists[PLUGIN_VIDEO_OUT - 1]); @@ -1653,7 +1653,7 @@ xine_video_port_t *xine_open_video_driver (xine_t *this, } port = _x_vo_new_port(this, driver, 0); - + return port; } @@ -1692,7 +1692,7 @@ xine_video_port_t *xine_new_framegrab_video_port (xine_t *this) { } port = _x_vo_new_port(this, driver, 1); - + return port; } @@ -1702,7 +1702,7 @@ xine_video_port_t *xine_new_framegrab_video_port (xine_t *this) { const char *const *xine_list_audio_output_plugins (xine_t *xine) { plugin_catalog_t *catalog = xine->plugin_catalog; - + pthread_mutex_lock (&catalog->lock); _build_list_typed_plugins(&catalog, catalog->plugin_lists[PLUGIN_AUDIO_OUT - 1]); pthread_mutex_unlock (&catalog->lock); @@ -1712,7 +1712,7 @@ const char *const *xine_list_audio_output_plugins (xine_t *xine) { const char *const *xine_list_video_output_plugins (xine_t *xine) { plugin_catalog_t *catalog = xine->plugin_catalog; - + pthread_mutex_lock (&catalog->lock); _build_list_typed_plugins(&catalog, catalog->plugin_lists[PLUGIN_VIDEO_OUT - 1]); pthread_mutex_unlock (&catalog->lock); @@ -1725,7 +1725,7 @@ const char *const *xine_list_video_output_plugins_typed(xine_t *xine, uint64_t t plugin_catalog_t *catalog = xine->plugin_catalog; plugin_node_t *node; int list_id, list_size, i; - + pthread_mutex_lock (&catalog->lock); list_size = xine_sarray_size (catalog->plugin_lists[PLUGIN_VIDEO_OUT - 1]); @@ -1812,7 +1812,7 @@ xine_audio_port_t *xine_open_audio_driver (xine_t *this, const char *id, if (id && !strcasecmp(id, "auto") ) id = NULL; - + pthread_mutex_lock (&catalog->lock); driver = NULL; @@ -1838,13 +1838,13 @@ xine_audio_port_t *xine_open_audio_driver (xine_t *this, const char *id, } pthread_mutex_unlock (&catalog->lock); - + if (!driver) { if (id) xprintf (this, XINE_VERBOSITY_LOG, _("load_plugins: failed to load audio output plugin <%s>\n"), id); else - xprintf (this, XINE_VERBOSITY_LOG, + xprintf (this, XINE_VERBOSITY_LOG, _("load_plugins: audio output auto-probing didn't find any usable audio driver.\n")); return NULL; } @@ -1902,7 +1902,7 @@ char **xine_get_autoplay_mrls (xine_t *this, const char *plugin_id, if (node->plugin_class || _load_plugin_class (this, node, NULL)) { ic = (input_class_t *) node->plugin_class; - + if (!ic->get_autoplay_list) return NULL; @@ -1936,7 +1936,7 @@ xine_mrl_t **xine_get_browse_mrls (xine_t *this, const char *plugin_id, if (node->plugin_class || _load_plugin_class (this, node, NULL)) { ic = (input_class_t *) node->plugin_class; - + if (!ic->get_dir) return NULL; @@ -1968,7 +1968,7 @@ video_decoder_t *_x_get_video_decoder (xine_stream_t *stream, uint8_t stream_typ if (!node->plugin_class && !_load_plugin_class (stream->xine, node, NULL)) { /* remove non working plugin from catalog */ - xprintf(stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "load_plugins: plugin %s failed to init its class.\n", node->info->id); for (j = i + 1; j < PLUGINS_PER_TYPE; j++) catalog->video_decoder_map[stream_type][j - 1] = @@ -1984,9 +1984,9 @@ video_decoder_t *_x_get_video_decoder (xine_stream_t *stream, uint8_t stream_typ inc_node_ref(node); vd->node = node; xprintf(stream->xine, XINE_VERBOSITY_DEBUG, - "load_plugins: plugin %s will be used for video streamtype %02x.\n", + "load_plugins: plugin %s will be used for video streamtype %02x.\n", node->info->id, stream_type); - + break; } else { /* remove non working plugin from catalog */ @@ -2039,7 +2039,7 @@ audio_decoder_t *_x_get_audio_decoder (xine_stream_t *stream, uint8_t stream_typ if (!node->plugin_class && !_load_plugin_class (stream->xine, node, NULL)) { /* remove non working plugin from catalog */ - xprintf(stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "load_plugins: plugin %s failed to init its class.\n", node->info->id); for (j = i + 1; j < PLUGINS_PER_TYPE; j++) catalog->audio_decoder_map[stream_type][j - 1] = @@ -2055,7 +2055,7 @@ audio_decoder_t *_x_get_audio_decoder (xine_stream_t *stream, uint8_t stream_typ inc_node_ref(node); ad->node = node; xprintf(stream->xine, XINE_VERBOSITY_DEBUG, - "load_plugins: plugin %s will be used for audio streamtype %02x.\n", + "load_plugins: plugin %s will be used for audio streamtype %02x.\n", node->info->id, stream_type); break; } else { @@ -2095,11 +2095,11 @@ int _x_decoder_available (xine_t *xine, uint32_t buftype) if ( (buftype & 0xFF000000) == BUF_VIDEO_BASE ) { if( catalog->video_decoder_map[stream_type][0] ) return 1; - } else + } else if ( (buftype & 0xFF000000) == BUF_AUDIO_BASE ) { if( catalog->audio_decoder_map[stream_type][0] ) return 1; - } else + } else if ( (buftype & 0xFF000000) == BUF_SPU_BASE ) { if( catalog->spu_decoder_map[stream_type][0] ) return 1; @@ -2126,7 +2126,7 @@ static void _display_file_plugin_list (xine_list_t *list, plugin_file_t *file) { #endif static void _unload_unref_plugins(xine_t *this, xine_sarray_t *list) { - + plugin_node_t *node; int list_id, list_size; @@ -2164,7 +2164,7 @@ void xine_plugins_garbage_collector(xine_t *self) { pthread_mutex_lock (&catalog->lock); for(i = 0; i < PLUGIN_TYPE_MAX; i++) { _unload_unref_plugins(self, self->plugin_catalog->plugin_lists[i]); - } + } #if 0 { @@ -2226,7 +2226,7 @@ spu_decoder_t *_x_get_spu_decoder (xine_stream_t *stream, uint8_t stream_type) { inc_node_ref(node); sd->node = node; xprintf(stream->xine, XINE_VERBOSITY_DEBUG, - "load_plugins: plugin %s will be used for spu streamtype %02x.\n", + "load_plugins: plugin %s will be used for spu streamtype %02x.\n", node->info->id, stream_type); break; } else { @@ -2260,7 +2260,7 @@ void _x_free_spu_decoder (xine_stream_t *stream, spu_decoder_t *sd) { const char *const *xine_list_demuxer_plugins(xine_t *xine) { plugin_catalog_t *catalog = xine->plugin_catalog; - + pthread_mutex_lock (&catalog->lock); _build_list_typed_plugins(&catalog, catalog->plugin_lists[PLUGIN_DEMUX - 1]); pthread_mutex_unlock (&catalog->lock); @@ -2270,7 +2270,7 @@ const char *const *xine_list_demuxer_plugins(xine_t *xine) { const char *const *xine_list_input_plugins(xine_t *xine) { plugin_catalog_t *catalog = xine->plugin_catalog; - + pthread_mutex_lock (&catalog->lock); _build_list_typed_plugins(&catalog, catalog->plugin_lists[PLUGIN_INPUT - 1]); pthread_mutex_unlock (&catalog->lock); @@ -2280,7 +2280,7 @@ const char *const *xine_list_input_plugins(xine_t *xine) { const char *const *xine_list_spu_plugins(xine_t *xine) { plugin_catalog_t *catalog = xine->plugin_catalog; - + pthread_mutex_lock (&catalog->lock); _build_list_typed_plugins(&catalog, catalog->plugin_lists[PLUGIN_SPU_DECODER - 1]); pthread_mutex_unlock (&catalog->lock); @@ -2290,7 +2290,7 @@ const char *const *xine_list_spu_plugins(xine_t *xine) { const char *const *xine_list_audio_decoder_plugins(xine_t *xine) { plugin_catalog_t *catalog = xine->plugin_catalog; - + pthread_mutex_lock (&catalog->lock); _build_list_typed_plugins(&catalog, catalog->plugin_lists[PLUGIN_AUDIO_DECODER - 1]); pthread_mutex_unlock (&catalog->lock); @@ -2300,7 +2300,7 @@ const char *const *xine_list_audio_decoder_plugins(xine_t *xine) { const char *const *xine_list_video_decoder_plugins(xine_t *xine) { plugin_catalog_t *catalog = xine->plugin_catalog; - + pthread_mutex_lock (&catalog->lock); _build_list_typed_plugins(&catalog, catalog->plugin_lists[PLUGIN_VIDEO_DECODER - 1]); pthread_mutex_unlock (&catalog->lock); @@ -2310,7 +2310,7 @@ const char *const *xine_list_video_decoder_plugins(xine_t *xine) { const char *const *xine_list_post_plugins(xine_t *xine) { plugin_catalog_t *catalog = xine->plugin_catalog; - + pthread_mutex_lock (&catalog->lock); _build_list_typed_plugins(&catalog, catalog->plugin_lists[PLUGIN_POST - 1]); pthread_mutex_unlock (&catalog->lock); @@ -2323,7 +2323,7 @@ const char *const *xine_list_post_plugins_typed(xine_t *xine, int type) { plugin_node_t *node; int i; int list_id, list_size; - + pthread_mutex_lock (&catalog->lock); i = 0; @@ -2378,25 +2378,25 @@ xine_post_t *xine_post_init(xine_t *xine, const char *name, int inputs, plugin_node_t *node; post_plugin_t *post = NULL; int list_id, list_size; - + if( !name ) return NULL; - + pthread_mutex_lock(&catalog->lock); - + list_size = xine_sarray_size (catalog->plugin_lists[PLUGIN_POST - 1]); for (list_id = 0; list_id < list_size; list_id++) { node = xine_sarray_get (catalog->plugin_lists[PLUGIN_POST - 1], list_id); - + if (strcmp(node->info->id, name) == 0) { - + if (!node->plugin_class && !_load_plugin_class(xine, node, NULL)) { xprintf(xine, XINE_VERBOSITY_DEBUG, "load_plugins: requested post plugin %s failed to load\n", name); break; } - + post = ((post_class_t *)node->plugin_class)->open_plugin(node->plugin_class, inputs, audio_target, video_target); @@ -2405,12 +2405,12 @@ xine_post_t *xine_post_init(xine_t *xine, const char *name, int inputs, xine_post_out_t *output; xine_list_iterator_t ite; int i; - + post->running_ticket = xine->port_ticket; post->xine = xine; post->node = node; inc_node_ref(node); - + /* init the lists of announced connections */ i = 0; ite = xine_list_front(post->input); @@ -2428,7 +2428,7 @@ xine_post_t *xine_post_init(xine_t *xine, const char *name, int inputs, ite = xine_list_next (post->input, ite); } post->input_ids[i] = NULL; - + i = 0; ite = xine_list_front (post->output); while (ite) { @@ -2445,10 +2445,10 @@ xine_post_t *xine_post_init(xine_t *xine, const char *name, int inputs, ite = xine_list_next (post->output, ite); } post->output_ids[i] = NULL; - + /* copy the post plugin type to the public part */ post->xine_post.type = ((post_info_t *)node->info->special_info)->type; - + break; } else { xprintf(xine, XINE_VERBOSITY_DEBUG, @@ -2457,9 +2457,9 @@ xine_post_t *xine_post_init(xine_t *xine, const char *name, int inputs, } } } - + pthread_mutex_unlock(&catalog->lock); - + if(post) return &post->xine_post; else { @@ -2501,7 +2501,7 @@ static char *_x_concatenate_with_string(char const **strings, size_t count, char } /* get a list of file extensions for file types supported by xine - * the list is separated by spaces + * the list is separated by spaces * * the pointer returned can be free()ed when no longer used */ char *xine_get_file_extensions (xine_t *self) { @@ -2529,7 +2529,7 @@ char *xine_get_file_extensions (xine_t *self) { /* create output string */ char *const result = _x_concatenate_with_string(extensions, list_size, " ", len); free(extensions); - + /* Drop the last whitespace */ result[len-1] = '\0'; @@ -2552,7 +2552,7 @@ char *xine_get_mime_types (xine_t *self) { /* calc length of output string and create an array of strings to concatenate */ - size_t len = 0; + size_t len = 0; const int list_size = xine_sarray_size (catalog->plugin_lists[PLUGIN_DEMUX - 1]); const char **mimetypes = calloc(list_size, sizeof(char*)); @@ -2613,7 +2613,7 @@ static void dispose_plugin_list (xine_sarray_t *list) { int list_id, list_size; if (list) { - + list_size = xine_sarray_size (list); for (list_id = 0; list_id < list_size; list_id++) { @@ -2634,12 +2634,12 @@ static void dispose_plugin_list (xine_sarray_t *list) { decoder_info = (decoder_info_t *)node->info->special_info; free (decoder_info->supported_types); - + default: free ((void *)node->info->special_info); break; } - + /* free info structure and string copies */ free (node->info->id); free (node->info); diff --git a/src/xine-engine/lrb.c b/src/xine-engine/lrb.c index 6f8ac8479..89d4b2654 100644 --- a/src/xine-engine/lrb.c +++ b/src/xine-engine/lrb.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -29,7 +29,7 @@ lrb_t *lrb_new (int max_num_entries, fifo_buffer_t *fifo) { lrb_t *this; - + this = calloc(1, sizeof(lrb_t)); this->max_num_entries = max_num_entries; @@ -42,7 +42,7 @@ lrb_t *lrb_new (int max_num_entries, } void lrb_drop (lrb_t *this) { - + buf_element_t *buf = this->oldest; _x_assert(buf); @@ -67,7 +67,7 @@ void lrb_add (lrb_t *this, buf_element_t *buf) { } else { - if (this->cur_num_entries >= this->max_num_entries) + if (this->cur_num_entries >= this->max_num_entries) lrb_drop (this); buf->next = NULL; @@ -94,7 +94,7 @@ void lrb_feedback (lrb_t *this, fifo_buffer_t *fifo) { if (!fifo->last) fifo->last = buf; - + fifo->fifo_size++; pthread_cond_signal (&fifo->not_empty); @@ -114,6 +114,6 @@ void lrb_feedback (lrb_t *this, fifo_buffer_t *fifo) { } void lrb_flush (lrb_t *this) { - while (this->cur_num_entries) + while (this->cur_num_entries) lrb_drop (this); } diff --git a/src/xine-engine/lrb.h b/src/xine-engine/lrb.h index 491ae8843..f64e50eab 100644 --- a/src/xine-engine/lrb.h +++ b/src/xine-engine/lrb.h @@ -1,18 +1,18 @@ /* * Copyright (C) 2001-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA diff --git a/src/xine-engine/metronom.c b/src/xine-engine/metronom.c index eb9abb84a..a4058bce8 100644 --- a/src/xine-engine/metronom.c +++ b/src/xine-engine/metronom.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -46,7 +46,7 @@ #define MAX_AUDIO_DELTA 1600 #define AUDIO_SAMPLE_NUM 32768 -#define WRAP_THRESHOLD 120000 +#define WRAP_THRESHOLD 120000 #define MAX_NUM_WRAP_DIFF 10 #define MAX_SCR_PROVIDERS 10 #define VIDEO_DRIFT_TOLERANCE 45000 @@ -63,7 +63,7 @@ /* * **************************************** - * primary SCR plugin: + * primary SCR plugin: * unix System Clock Reference * **************************************** */ @@ -88,19 +88,19 @@ static void unixscr_set_pivot (unixscr_t *this) { struct timeval tv; int64_t pts; - double pts_calc; + double pts_calc; xine_monotonic_clock(&tv, NULL); pts_calc = (tv.tv_sec - this->cur_time.tv_sec) * this->speed_factor; pts_calc += (tv.tv_usec - this->cur_time.tv_usec) * this->speed_factor / 1e6; pts = this->cur_pts + pts_calc; -/* This next part introduces a one off inaccuracy - * to the scr due to rounding tv to pts. +/* This next part introduces a one off inaccuracy + * to the scr due to rounding tv to pts. */ this->cur_time.tv_sec=tv.tv_sec; this->cur_time.tv_usec=tv.tv_usec; - this->cur_pts=pts; + this->cur_pts=pts; return ; } @@ -141,7 +141,7 @@ static void unixscr_start (scr_plugin_t *scr, int64_t start_vpts) { this->cur_pts = start_vpts; pthread_mutex_unlock (&this->lock); - + unixscr_set_speed (&this->scr, XINE_FINE_SPEED_NORMAL); } @@ -150,16 +150,16 @@ static int64_t unixscr_get_current (scr_plugin_t *scr) { struct timeval tv; int64_t pts; - double pts_calc; + double pts_calc; pthread_mutex_lock (&this->lock); xine_monotonic_clock(&tv, NULL); - + pts_calc = (tv.tv_sec - this->cur_time.tv_sec) * this->speed_factor; pts_calc += (tv.tv_usec - this->cur_time.tv_usec) * this->speed_factor / 1e6; pts = this->cur_pts + pts_calc; - + pthread_mutex_unlock (&this->lock); return pts; @@ -176,7 +176,7 @@ static scr_plugin_t *XINE_MALLOC unixscr_init () { unixscr_t *this; this = calloc(1, sizeof(unixscr_t)); - + this->scr.interface_version = 3; this->scr.get_priority = unixscr_get_priority; this->scr.set_fine_speed = unixscr_set_speed; @@ -184,15 +184,15 @@ static scr_plugin_t *XINE_MALLOC unixscr_init () { this->scr.start = unixscr_start; this->scr.get_current = unixscr_get_current; this->scr.exit = unixscr_exit; - + pthread_mutex_init (&this->lock, NULL); - + unixscr_set_speed (&this->scr, XINE_SPEED_PAUSE); lprintf("xine-scr_init complete\n"); return &this->scr; } - + /* * **************************************** @@ -208,7 +208,7 @@ static void metronom_start_clock (metronom_clock_t *this, int64_t pts) { for (scr = this->scr_list; scr < this->scr_list+MAX_SCR_PROVIDERS; scr++) if (*scr) (*scr)->start(*scr, pts); - + this->speed = XINE_FINE_SPEED_NORMAL; } @@ -243,7 +243,7 @@ static int metronom_set_speed (metronom_clock_t *this, int speed) { int true_speed; true_speed = this->scr_master->set_fine_speed (this->scr_master, speed); - + this->speed = true_speed; for (scr = this->scr_list; scr < this->scr_list+MAX_SCR_PROVIDERS; scr++) @@ -267,33 +267,33 @@ static int64_t metronom_got_spu_packet (metronom_t *this, int64_t pts) { int64_t vpts; pthread_mutex_lock (&this->lock); - + if (this->master) { metronom_t *master = this->master; - + pthread_mutex_lock(&this->master->lock); pthread_mutex_unlock(&this->lock); - + this->vpts_offset = this->master->vpts_offset; this->spu_offset = this->master->spu_offset; - + /* no recursion, please */ this->master = NULL; vpts = master->got_spu_packet(this, pts); this->master = master; - + pthread_mutex_unlock(&this->master->lock); return vpts; } vpts = pts + this->vpts_offset + this->spu_offset; - + /* no vpts going backwards please */ if( vpts < this->spu_vpts ) vpts = this->spu_vpts; - + this->spu_vpts = vpts; - + pthread_mutex_unlock (&this->lock); return vpts; } @@ -353,7 +353,7 @@ static void metronom_handle_discontinuity (metronom_t *this, int type, this->vpts_offset = this->video_vpts - disc_off; break; } - + this->last_video_pts = 0; this->last_audio_pts = 0; } @@ -368,18 +368,18 @@ static void metronom_handle_video_discontinuity (metronom_t *this, int type, pthread_mutex_unlock(&this->lock); return; } - + this->video_discontinuity_count++; pthread_cond_signal (&this->video_discontinuity_reached); - + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video discontinuity #%d, type is %d, disc_off %" PRId64 "\n", this->video_discontinuity_count, type, disc_off); - + if (this->have_audio) { while (this->audio_discontinuity_count < this->video_discontinuity_count) { - xprintf(this->xine, XINE_VERBOSITY_DEBUG, "waiting for audio discontinuity #%d\n", + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "waiting for audio discontinuity #%d\n", this->video_discontinuity_count); pthread_cond_wait (&this->audio_discontinuity_reached, &this->lock); @@ -399,15 +399,15 @@ static void metronom_got_video_frame (metronom_t *this, vo_frame_t *img) { int64_t vpts; int64_t pts = img->pts; int64_t diff; - + pthread_mutex_lock (&this->lock); if (this->master) { metronom_t *master = this->master; - + pthread_mutex_lock(&this->master->lock); pthread_mutex_unlock(&this->lock); - + if (!this->discontinuity_handled_count) { /* we are not initialized yet */ if (this->master->video_vpts > this->master->audio_vpts) @@ -420,15 +420,15 @@ static void metronom_got_video_frame (metronom_t *this, vo_frame_t *img) { this->force_video_jump = 1; this->discontinuity_handled_count++; } - + this->vpts_offset = this->master->vpts_offset; this->av_offset = this->master->av_offset; - + /* no recursion, please */ this->master = NULL; master->got_video_frame(this, img); this->master = master; - + pthread_mutex_unlock(&this->master->lock); return; } @@ -459,23 +459,23 @@ static void metronom_got_video_frame (metronom_t *this, vo_frame_t *img) { } this->img_cpt = 0; this->last_video_pts = pts; - - + + /* * compare predicted (this->video_vpts) and given (pts+vpts_offset) * pts values - hopefully they will be the same * if not, for small diffs try to interpolate * for big diffs: jump */ - + vpts = pts + this->vpts_offset; if (this->video_mode == VIDEO_PREDICTION_MODE) { - + diff = this->video_vpts - vpts; lprintf("video diff is %" PRId64 " (predicted %" PRId64 ", given %" PRId64 ")\n", diff, this->video_vpts, vpts); - + if ((abs (diff) > VIDEO_DRIFT_TOLERANCE) || (this->force_video_jump)) { this->force_video_jump = 0; @@ -489,7 +489,7 @@ static void metronom_got_video_frame (metronom_t *this, vo_frame_t *img) { this->video_drift = diff; this->video_drift_step = diff / 30; /* this will fix video drift with a constant compensation each - frame for about 1 second of video. */ + frame for about 1 second of video. */ if (diff) lprintf("video drift, drift is %" PRId64 "\n", this->video_drift); } @@ -503,7 +503,7 @@ static void metronom_got_video_frame (metronom_t *this, vo_frame_t *img) { if (this->video_mode == VIDEO_PREDICTION_MODE) { lprintf("video vpts for %10"PRId64" : %10"PRId64" (duration:%d drift:%" PRId64 " step:%" PRId64 ")\n", - pts, this->video_vpts, img->duration, this->video_drift, this->video_drift_step ); + pts, this->video_vpts, img->duration, this->video_drift, this->video_drift_step ); if (this->video_drift * this->video_drift_step > 0) { img->duration -= this->video_drift_step; @@ -516,7 +516,7 @@ static void metronom_got_video_frame (metronom_t *this, vo_frame_t *img) { * this->video_vpts is used as the next frame vpts if next frame pts=0 */ this->video_vpts += this->img_duration; - + pthread_mutex_unlock (&this->lock); } @@ -524,7 +524,7 @@ static void metronom_handle_audio_discontinuity (metronom_t *this, int type, int64_t disc_off) { pthread_mutex_lock (&this->lock); - + if (this->master) { /* slaves are currently not allowed to set discontinuities */ pthread_mutex_unlock(&this->lock); @@ -533,19 +533,19 @@ static void metronom_handle_audio_discontinuity (metronom_t *this, int type, this->audio_discontinuity_count++; pthread_cond_signal (&this->audio_discontinuity_reached); - + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio discontinuity #%d, type is %d, disc_off %" PRId64 "\n", this->audio_discontinuity_count, type, disc_off); if (this->have_video) { - + /* next_vpts_offset, in_discontinuity is handled in expect_video_discontinuity */ while ( this->audio_discontinuity_count > this->discontinuity_handled_count ) { - - xprintf(this->xine, XINE_VERBOSITY_DEBUG, "waiting for in_discontinuity update #%d\n", + + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "waiting for in_discontinuity update #%d\n", this->audio_discontinuity_count); - + pthread_cond_wait (&this->video_discontinuity_reached, &this->lock); } } else { @@ -554,11 +554,11 @@ static void metronom_handle_audio_discontinuity (metronom_t *this, int type, this->audio_samples = 0; this->audio_drift_step = 0; - + pthread_mutex_unlock (&this->lock); } -static int64_t metronom_got_audio_samples (metronom_t *this, int64_t pts, +static int64_t metronom_got_audio_samples (metronom_t *this, int64_t pts, int nsamples) { int64_t vpts; @@ -568,34 +568,34 @@ static int64_t metronom_got_audio_samples (metronom_t *this, int64_t pts, lprintf("AUDIO pts from last= %" PRId64 "\n", pts-this->last_audio_pts); pthread_mutex_lock (&this->lock); - + if (this->master) { metronom_t *master = this->master; - + pthread_mutex_lock(&this->master->lock); pthread_mutex_unlock(&this->lock); - + if (!this->discontinuity_handled_count) { /* we are not initialized yet */ if (this->master->video_vpts > this->master->audio_vpts) this->video_vpts = this->audio_vpts = this->master->video_vpts; else this->video_vpts = this->audio_vpts = this->master->audio_vpts; - this->audio_vpts_rmndr = 0; + this->audio_vpts_rmndr = 0; /* when being attached to the first master, do not drift into * his vpts values but adopt at once */ this->force_audio_jump = 1; this->force_video_jump = 1; this->discontinuity_handled_count++; } - + this->vpts_offset = this->master->vpts_offset; - + /* no recursion, please */ this->master = NULL; vpts = master->got_audio_samples(this, pts, nsamples); this->master = master; - + pthread_mutex_unlock(&this->master->lock); return vpts; } @@ -609,7 +609,7 @@ static int64_t metronom_got_audio_samples (metronom_t *this, int64_t pts, if((abs(diff) > AUDIO_DRIFT_TOLERANCE) || (this->force_audio_jump)) { this->force_audio_jump = 0; this->audio_vpts = vpts; - this->audio_vpts_rmndr = 0; + this->audio_vpts_rmndr = 0; this->audio_drift_step = 0; xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio jump, diff=%" PRId64 "\n", diff); } else { @@ -619,15 +619,15 @@ static int64_t metronom_got_audio_samples (metronom_t *this, int64_t pts, diff *= AUDIO_SAMPLE_NUM; diff /= this->audio_samples * 4; - + /* drift_step is not allowed to change rate by more than 25% */ if( diff > this->pts_per_smpls/4 ) - diff = this->pts_per_smpls/4; + diff = this->pts_per_smpls/4; if( diff < -this->pts_per_smpls/4 ) diff = -this->pts_per_smpls/4; - + this->audio_drift_step = diff; - + lprintf("audio_drift = %" PRId64 ", pts_per_smpls = %" PRId64 "\n", diff, this->pts_per_smpls); } } @@ -635,12 +635,12 @@ static int64_t metronom_got_audio_samples (metronom_t *this, int64_t pts, } vpts = this->audio_vpts; - /* drift here is caused by streams where nominal sample rate differs from + /* drift here is caused by streams where nominal sample rate differs from * the rate of which pts increments. fixing the audio_vpts won't do us any * good because sound card won't play it faster or slower just because * we want. however, adding the error to the vpts_offset will force video * to change it's frame rate to keep in sync with us. - * + * * Since we are using integer division below, it can happen that we lose * precision for the calculated duration in vpts for each audio buffer * (< 1 PTS, e.g. 0.25 PTS during playback of most DVDs with LPCM audio). @@ -658,7 +658,7 @@ static int64_t metronom_got_audio_samples (metronom_t *this, int64_t pts, } this->audio_samples += nsamples; this->vpts_offset += nsamples * this->audio_drift_step / AUDIO_SAMPLE_NUM; - + lprintf("audio vpts for %10"PRId64" : %10"PRId64"\n", pts, vpts); pthread_mutex_unlock (&this->lock); @@ -669,7 +669,7 @@ static int64_t metronom_got_audio_samples (metronom_t *this, int64_t pts, static void metronom_set_option (metronom_t *this, int option, int64_t value) { pthread_mutex_lock (&this->lock); - + if (this->master) { /* pass the option on to the master */ this->master->set_option(this->master, option, value); @@ -725,7 +725,7 @@ static void metronom_clock_set_option (metronom_clock_t *this, } static int64_t metronom_get_option (metronom_t *this, int option) { - + if (this->master) return this->master->get_option(this->master, option); @@ -756,7 +756,7 @@ static int64_t metronom_clock_get_option (metronom_clock_t *this, int option) { static void metronom_set_master(metronom_t *this, metronom_t *master) { metronom_t *old_master = this->master; - + pthread_mutex_lock(&this->lock); /* someone might currently be copying values from the old master, * so we need his lock too */ @@ -774,7 +774,7 @@ static scr_plugin_t* get_master_scr(metronom_clock_t *this) { /* find the SCR provider with the highest priority */ for (i=0; i<MAX_SCR_PROVIDERS; i++) if (this->scr_list[i]) { scr_plugin_t *scr = this->scr_list[i]; - + if (maxprio < scr->get_priority(scr)) { select = i; maxprio = scr->get_priority(scr); @@ -791,7 +791,7 @@ static int metronom_register_scr (metronom_clock_t *this, scr_plugin_t *scr) { int i; if (scr->interface_version != 3) { - xprintf(this->xine, XINE_VERBOSITY_NONE, + xprintf(this->xine, XINE_VERBOSITY_NONE, "wrong interface version for scr provider!\n"); return -1; } @@ -813,19 +813,19 @@ static void metronom_unregister_scr (metronom_clock_t *this, scr_plugin_t *scr) /* never unregister scr_list[0]! */ for (i=1; i<MAX_SCR_PROVIDERS; i++) - if (this->scr_list[i] == scr) + if (this->scr_list[i] == scr) break; if (i >= MAX_SCR_PROVIDERS) return; /* Not found */ - + this->scr_list[i] = NULL; time = this->get_current_time(this); - + /* master could have been adjusted, others must follow now */ for (i=0; i<MAX_SCR_PROVIDERS; i++) if (this->scr_list[i]) this->scr_list[i]->adjust(this->scr_list[i], time); - + this->scr_master = get_master_scr(this); } @@ -835,13 +835,13 @@ static int metronom_sync_loop (metronom_clock_t *this) { struct timespec ts; scr_plugin_t** scr; int64_t pts; - + while (this->thread_running) { /* synchronise every 5 seconds */ pthread_mutex_lock (&this->lock); pts = this->scr_master->get_current(this->scr_master); - + for (scr = this->scr_list; scr < this->scr_list+MAX_SCR_PROVIDERS; scr++) if (*scr && *scr != this->scr_master) (*scr)->adjust(*scr, pts); @@ -869,7 +869,7 @@ static void metronom_clock_exit (metronom_clock_t *this) { scr_plugin_t** scr; this->thread_running = 0; - + pthread_mutex_lock (&this->lock); pthread_cond_signal (&this->cancel); pthread_mutex_unlock (&this->lock); @@ -904,7 +904,7 @@ metronom_t * _x_metronom_init (int have_video, int have_audio, xine_t *xine) { this->xine = xine; this->master = NULL; - + pthread_mutex_init (&this->lock, NULL); this->prebuffer = PREBUFFER_PTS_OFFSET; @@ -913,7 +913,7 @@ metronom_t * _x_metronom_init (int have_video, int have_audio, xine_t *xine) { this->vpts_offset = 0; /* initialize video stuff */ - + this->video_vpts = this->prebuffer; this->video_drift = 0; this->video_drift_step = 0; @@ -924,8 +924,8 @@ metronom_t * _x_metronom_init (int have_video, int have_audio, xine_t *xine) { this->img_cpt = 0; this->last_video_pts = 0; this->last_audio_pts = 0; - - + + /* initialize audio stuff */ this->have_video = have_video; @@ -934,7 +934,7 @@ metronom_t * _x_metronom_init (int have_video, int have_audio, xine_t *xine) { this->audio_vpts_rmndr = 0; this->audio_discontinuity_count = 0; pthread_cond_init (&this->audio_discontinuity_reached, NULL); - + return this; } @@ -944,7 +944,7 @@ metronom_clock_t *_x_metronom_clock_init(xine_t *xine) { metronom_clock_t *this = calloc(1, sizeof(metronom_clock_t)); int err; - + this->set_option = metronom_clock_set_option; this->get_option = metronom_clock_get_option; this->start_clock = metronom_start_clock; @@ -956,19 +956,19 @@ metronom_clock_t *_x_metronom_clock_init(xine_t *xine) this->register_scr = metronom_register_scr; this->unregister_scr = metronom_unregister_scr; this->exit = metronom_clock_exit; - + this->xine = xine; this->scr_adjustable = 1; this->scr_list = calloc(MAX_SCR_PROVIDERS, sizeof(void*)); this->register_scr(this, unixscr_init()); - + pthread_mutex_init (&this->lock, NULL); pthread_cond_init (&this->cancel, NULL); - + this->thread_running = 1; if ((err = pthread_create(&this->sync_thread, NULL, - (void*(*)(void*)) metronom_sync_loop, this)) != 0) + (void*(*)(void*)) metronom_sync_loop, this)) != 0) xprintf(this->xine, XINE_VERBOSITY_NONE, "cannot create sync thread (%s)\n", strerror(err)); diff --git a/src/xine-engine/metronom.h b/src/xine-engine/metronom.h index c7a594d89..946aa0991 100644 --- a/src/xine-engine/metronom.h +++ b/src/xine-engine/metronom.h @@ -1,30 +1,30 @@ -/* +/* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * metronom: general pts => virtual calculation/assoc - * + * * virtual pts: unit 1/90000 sec, always increasing * can be used for synchronization * video/audio frame with same pts also have same vpts * but pts is likely to differ from vpts * - * the basic idea is: + * the basic idea is: * video_pts + video_wrap_offset = video_vpts * audio_pts + audio_wrap_offset = audio_vpts * @@ -67,8 +67,8 @@ typedef struct scr_plugin_s scr_plugin_t; #define PREBUFFER_PTS_OFFSET 12000 /* see below */ -#define DISC_STREAMSTART 0 -#define DISC_RELATIVE 1 +#define DISC_STREAMSTART 0 +#define DISC_RELATIVE 1 #define DISC_ABSOLUTE 2 #define DISC_STREAMSEEK 3 @@ -91,9 +91,9 @@ struct metronom_s { * * this function will also update video_wrap_offset if a discontinuity * is detected (read the comentaries below about discontinuities). - * + * */ - + void (*got_video_frame) (metronom_t *self, vo_frame_t *frame); /* @@ -109,8 +109,8 @@ struct metronom_s { * */ - int64_t (*got_audio_samples) (metronom_t *self, int64_t pts, - int nsamples); + int64_t (*got_audio_samples) (metronom_t *self, int64_t pts, + int nsamples); /* * called by SPU decoder whenever a packet is delivered to it @@ -134,7 +134,7 @@ struct metronom_s { * * DISC_STREAMSTART : new stream starts, expect pts values to start * from zero immediately - * DISC_RELATIVE : typically a wrap-around, expect pts with + * DISC_RELATIVE : typically a wrap-around, expect pts with * a specified offset from the former ones soon * DISC_ABSOLUTE : typically a new menu stream (nav packets) * pts will start from given value soon @@ -152,7 +152,7 @@ struct metronom_s { */ void (*set_option) (metronom_t *self, int option, int64_t value); int64_t (*get_option) (metronom_t *self, int option); - + /* * set a master metronom * this is currently useful to sync independently generated streams @@ -160,7 +160,7 @@ struct metronom_s { * metronom */ void (*set_master) (metronom_t *self, metronom_t *master); - + void (*exit) (metronom_t *self); #ifdef METRONOM_INTERNAL @@ -168,7 +168,7 @@ struct metronom_s { * metronom internal stuff */ xine_t *xine; - + metronom_t *master; int64_t pts_per_smpls; @@ -182,7 +182,7 @@ struct metronom_s { int64_t video_drift; int64_t video_drift_step; - + int audio_samples; int64_t audio_drift_step; @@ -293,9 +293,9 @@ struct metronom_clock_s { #ifdef METRONOM_CLOCK_INTERNAL void (*exit) (metronom_clock_t *self); - + xine_t *xine; - + scr_plugin_t *scr_master; scr_plugin_t **scr_list; pthread_t sync_thread; @@ -310,7 +310,7 @@ struct metronom_clock_s { int dummy10; int dummy11; #endif - + int speed; #ifdef METRONOM_CLOCK_INTERNAL @@ -337,8 +337,8 @@ struct scr_plugin_s int (*get_priority) (scr_plugin_t *self); - /* - * set/get clock speed + /* + * set/get clock speed * * for speed constants see xine_internal.h * returns actual speed diff --git a/src/xine-engine/osd.c b/src/xine-engine/osd.c index af8286831..94fc969bd 100644 --- a/src/xine-engine/osd.c +++ b/src/xine-engine/osd.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2005 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -113,7 +113,7 @@ struct osd_font_s { uint16_t size; uint16_t num_fontchars; uint16_t loaded; -}; +}; #ifdef HAVE_FT2 struct osd_ft2context_s { @@ -147,27 +147,27 @@ static inline void osd_free_ft2 (osd_object_t *osd __attr_unused) {} */ static osd_object_t *XINE_MALLOC osd_new_object (osd_renderer_t *this, int width, int height) { - + osd_object_t *osd; - - pthread_mutex_lock (&this->osd_mutex); - + + pthread_mutex_lock (&this->osd_mutex); + osd = calloc(1, sizeof(osd_object_t)); osd->renderer = this; osd->next = this->osds; this->osds = osd; - + osd->width = width; osd->height = height; osd->area = calloc(width, height); - + osd->x1 = width; osd->y1 = height; osd->x2 = 0; osd->y2 = 0; - memcpy(osd->color, textpalettes_color[0], sizeof(textpalettes_color[0])); - memcpy(osd->trans, textpalettes_trans[0], sizeof(textpalettes_trans[0])); + memcpy(osd->color, textpalettes_color[0], sizeof(textpalettes_color[0])); + memcpy(osd->trans, textpalettes_trans[0], sizeof(textpalettes_trans[0])); osd->handle = -1; @@ -175,11 +175,11 @@ static osd_object_t *XINE_MALLOC osd_new_object (osd_renderer_t *this, int width osd->cd = (iconv_t)-1; osd->encoding = NULL; #endif - - pthread_mutex_unlock (&this->osd_mutex); + + pthread_mutex_unlock (&this->osd_mutex); lprintf("osd=%p size: %dx%d\n", osd, width, height); - + return osd; } @@ -196,7 +196,7 @@ static int _osd_hide (osd_object_t *osd, int64_t vpts); * the object is not changed. there may be subsequent drawing on it. */ static int _osd_show (osd_object_t *osd, int64_t vpts, int unscaled ) { - + osd_renderer_t *this = osd->renderer; video_overlay_manager_t *ovl_manager; rle_elem_t rle, *rle_p=0; @@ -204,21 +204,21 @@ static int _osd_show (osd_object_t *osd, int64_t vpts, int unscaled ) { uint8_t *c; lprintf("osd=%p vpts=%"PRId64"\n", osd, vpts); - + this->stream->xine->port_ticket->acquire(this->stream->xine->port_ticket, 1); - + ovl_manager = this->stream->video_out->get_overlay_manager(this->stream->video_out); - + if( osd->handle < 0 ) { if( (osd->handle = ovl_manager->get_handle(ovl_manager, 0)) == -1 ) { this->stream->xine->port_ticket->release(this->stream->xine->port_ticket, 1); return 0; } } - - pthread_mutex_lock (&this->osd_mutex); - - /* clip update area to allowed range */ + + pthread_mutex_lock (&this->osd_mutex); + + /* clip update area to allowed range */ if(osd->x1 > osd->width) osd->x1 = osd->width; if(osd->x2 > osd->width) @@ -232,13 +232,13 @@ static int _osd_show (osd_object_t *osd, int64_t vpts, int unscaled ) { if(osd->y1 < 0) osd->y1 = 0; if(osd->y2 < 0) osd->y2 = 0; -#ifdef DEBUG_RLE +#ifdef DEBUG_RLE lprintf("osd_show %p rle starts\n", osd); -#endif +#endif /* check if osd is valid (something drawn on it) */ if( osd->x2 > osd->x1 && osd->y2 > osd->y1 ) { - + this->event.object.handle = osd->handle; memset( this->event.object.overlay, 0, sizeof(*this->event.object.overlay) ); @@ -247,25 +247,25 @@ static int _osd_show (osd_object_t *osd, int64_t vpts, int unscaled ) { this->event.object.overlay->y = osd->display_y + osd->y1; this->event.object.overlay->width = osd->x2 - osd->x1; this->event.object.overlay->height = osd->y2 - osd->y1; - + this->event.object.overlay->hili_top = 0; this->event.object.overlay->hili_bottom = this->event.object.overlay->height; this->event.object.overlay->hili_left = 0; this->event.object.overlay->hili_right = this->event.object.overlay->width; - + /* there will be at least that many rle objects (one for each row) */ this->event.object.overlay->num_rle = 0; /* We will never need more rle objects than columns in any row Rely on lazy page allocation to avoid us actually taking up this much RAM */ this->event.object.overlay->data_size = osd->width * osd->height; - rle_p = this->event.object.overlay->rle = + rle_p = this->event.object.overlay->rle = malloc(this->event.object.overlay->data_size * sizeof(rle_elem_t) ); - + for( y = osd->y1; y < osd->y2; y++ ) { -#ifdef DEBUG_RLE +#ifdef DEBUG_RLE lprintf("osd_show %p y = %d: ", osd, y); -#endif +#endif c = osd->area + y * osd->width + osd->x1; /* initialize a rle object with the first pixel's color */ @@ -275,17 +275,17 @@ static int _osd_show (osd_object_t *osd, int64_t vpts, int unscaled ) { /* loop over the remaining pixels in the row */ for( x = osd->x1 + rle.len; x < osd->x2; x++, c++ ) { if( rle.color != *c ) { -#ifdef DEBUG_RLE +#ifdef DEBUG_RLE lprintf("(%d, %d), ", rle.len, rle.color); #endif *rle_p++ = rle; - this->event.object.overlay->num_rle++; + this->event.object.overlay->num_rle++; rle.color = *c; rle.len = 1; } else { rle.len++; - } + } } #ifdef DEBUG_RLE lprintf("(%d, %d)\n", rle.len, rle.color); @@ -297,12 +297,12 @@ static int _osd_show (osd_object_t *osd, int64_t vpts, int unscaled ) { lprintf("osd_show %p rle ends\n", osd); #endif lprintf("num_rle = %d\n", this->event.object.overlay->num_rle); - - memcpy(this->event.object.overlay->hili_color, osd->color, sizeof(osd->color)); - memcpy(this->event.object.overlay->hili_trans, osd->trans, sizeof(osd->trans)); - memcpy(this->event.object.overlay->color, osd->color, sizeof(osd->color)); - memcpy(this->event.object.overlay->trans, osd->trans, sizeof(osd->trans)); - + + memcpy(this->event.object.overlay->hili_color, osd->color, sizeof(osd->color)); + memcpy(this->event.object.overlay->hili_trans, osd->trans, sizeof(osd->trans)); + memcpy(this->event.object.overlay->color, osd->color, sizeof(osd->color)); + memcpy(this->event.object.overlay->trans, osd->trans, sizeof(osd->trans)); + this->event.event_type = OVERLAY_EVENT_SHOW; this->event.vpts = vpts; ovl_manager->add_event(ovl_manager, (void *)&this->event); @@ -310,10 +310,10 @@ static int _osd_show (osd_object_t *osd, int64_t vpts, int unscaled ) { /* osd empty - hide it */ _osd_hide(osd, vpts); } - pthread_mutex_unlock (&this->osd_mutex); - + pthread_mutex_unlock (&this->osd_mutex); + this->stream->xine->port_ticket->release(this->stream->xine->port_ticket, 1); - + return 1; } @@ -335,24 +335,24 @@ static int osd_show_unscaled (osd_object_t *osd, int64_t vpts) { * send event to hide osd at given pts (0=now) * the object is not changed. there may be subsequent drawing on it. */ -static int _osd_hide (osd_object_t *osd, int64_t vpts) { +static int _osd_hide (osd_object_t *osd, int64_t vpts) { osd_renderer_t *this = osd->renderer; video_overlay_manager_t *ovl_manager; - + lprintf("osd=%p vpts=%"PRId64"\n",osd, vpts); - + if( osd->handle < 0 ) return 0; - + this->event.object.handle = osd->handle; - + /* not really needed this, but good pratice to clean it up */ memset( this->event.object.overlay, 0, sizeof(this->event.object.overlay) ); - + this->event.event_type = OVERLAY_EVENT_HIDE; this->event.vpts = vpts; - + ovl_manager = this->stream->video_out->get_overlay_manager(this->stream->video_out); ovl_manager->add_event(ovl_manager, (void *)&this->event); @@ -398,14 +398,14 @@ static void osd_clear (osd_object_t *osd) { static void osd_point (osd_object_t *osd, int x, int y, int color) { uint8_t *c; - + lprintf("osd=%p (%d x %d)\n", osd, x, y); - + if (x < 0 || x >= osd->width) return; if (y < 0 || y >= osd->height) return; - + /* update clipping area */ osd->x1 = MIN(osd->x1, x); osd->x2 = MAX(osd->x2, (x + 1)); @@ -422,14 +422,14 @@ static void osd_point (osd_object_t *osd, int x, int y, int color) { static void osd_line (osd_object_t *osd, int x1, int y1, int x2, int y2, int color) { - + uint8_t *c; int dx, dy, t, inc, d, inc1, inc2; int swap_x = 0; int swap_y = 0; lprintf("osd=%p (%d,%d)-(%d,%d)\n",osd, x1,y1, x2,y2 ); - + /* sort line */ if (x2 < x1) { t = x1; @@ -444,7 +444,7 @@ static void osd_line (osd_object_t *osd, swap_y = 1; } - /* clip line */ + /* clip line */ if (x1 < 0) { y1 = y1 + (y2-y1) * -x1 / (x2-x1); x1 = 0; @@ -461,19 +461,19 @@ static void osd_line (osd_object_t *osd, x2 = x1 + (x2-x1) * (osd->height-y1) / (y2-y1); y2 = osd->height; } - + if (x1 >= osd->width || y1 >= osd->height) return; - + /* update clipping area */ osd->x1 = MIN( osd->x1, x1 ); osd->x2 = MAX( osd->x2, x2 ); osd->y1 = MIN( osd->y1, y1 ); osd->y2 = MAX( osd->y2, y2 ); - + dx = x2 - x1; dy = y2 - y1; - + /* unsort line */ if (swap_x) { t = x1; @@ -492,7 +492,7 @@ static void osd_line (osd_object_t *osd, t = x2; x2 = x1; x1 = t; t = y2; y2 = y1; y1 = t; } - + if( y2 > y1 ) inc = 1; else inc = -1; inc1 = 2*dy; @@ -500,11 +500,11 @@ static void osd_line (osd_object_t *osd, inc2 = 2*(dy-dx); c = osd->area + y1 * osd->width + x1; - + while(x1<x2) { *c++ = color; - + x1++; if( d<0 ) { d+=inc1; @@ -529,8 +529,8 @@ static void osd_line (osd_object_t *osd, c = osd->area + y1 * osd->width + x1; while(y1<y2) { - *c = color; - + *c = color; + c += osd->width; y1++; if( d<0 ) { @@ -555,17 +555,17 @@ static void osd_filled_rect (osd_object_t *osd, int x, y, dx, dy; lprintf("osd=%p (%d,%d)-(%d,%d)\n",osd, x1,y1, x2,y2 ); - + /* sort rectangle */ x = MIN( x1, x2 ); dx = MAX( x1, x2 ); y = MIN( y1, y2 ); dy = MAX( y1, y2 ); - + /* clip rectangle */ if (x >= osd->width || y >= osd->height) return; - + if (x < 0) { dx += x; x = 0; @@ -577,7 +577,7 @@ static void osd_filled_rect (osd_object_t *osd, dx = MIN( dx, osd->width ); dy = MIN( dy, osd->height ); - + /* update clipping area */ osd->x1 = MIN( osd->x1, x ); osd->x2 = MAX( osd->x2, dx ); @@ -603,7 +603,7 @@ static void osd_set_palette(osd_object_t *osd, const uint32_t *color, const uint } /* - * set on existing text palette + * set on existing text palette * (-1 to set user specified palette) */ @@ -622,7 +622,7 @@ static void osd_set_text_palette(osd_object_t *osd, int palette_number, memcpy(&osd->color[color_base], textpalettes_color[palette_number], sizeof(textpalettes_color[palette_number])); memcpy(&osd->trans[color_base], textpalettes_trans[palette_number], - sizeof(textpalettes_trans[palette_number])); + sizeof(textpalettes_trans[palette_number])); } @@ -658,7 +658,7 @@ static uint16_t gzread_i16(gzFile *fp) { } /* - load bitmap font into osd engine + load bitmap font into osd engine */ static int osd_renderer_load_font(osd_renderer_t *this, char *filename) { @@ -666,7 +666,7 @@ static int osd_renderer_load_font(osd_renderer_t *this, char *filename) { gzFile *fp; osd_font_t *font = NULL; int i, ret = 0; - + lprintf("name=%s\n", filename ); /* load quick & dirt font format */ @@ -677,36 +677,36 @@ static int osd_renderer_load_font(osd_renderer_t *this, char *filename) { gzread(fp, font->name, sizeof(font->name) ); font->version = gzread_i16(fp); - + if( font->version == FONT_VERSION ) { - + font->size = gzread_i16(fp); font->num_fontchars = gzread_i16(fp); font->loaded = 1; - + font->fontchar = malloc( sizeof(osd_fontchar_t) * font->num_fontchars ); - + lprintf("font '%s' chars=%d\n", font->name, font->num_fontchars); - + /* load all characters */ for( i = 0; i < font->num_fontchars; i++ ) { font->fontchar[i].code = gzread_i16(fp); font->fontchar[i].width = gzread_i16(fp); font->fontchar[i].height = gzread_i16(fp); font->fontchar[i].bmp = malloc(font->fontchar[i].width*font->fontchar[i].height); - if( gzread(fp, font->fontchar[i].bmp, + if( gzread(fp, font->fontchar[i].bmp, font->fontchar[i].width*font->fontchar[i].height) <= 0 ) break; } - + /* check if all expected characters were loaded */ if( i == font->num_fontchars ) { osd_font_t *known_font; ret = 1; - + lprintf("font '%s' loaded\n",font->name); - - /* check if font is already known to us */ + + /* check if font is already known to us */ known_font = this->fonts; while( known_font ) { if( !strcasecmp(known_font->name,font->name) && @@ -714,16 +714,16 @@ static int osd_renderer_load_font(osd_renderer_t *this, char *filename) { break; known_font = known_font->next; } - + if( !known_font ) { - + /* new font, add it to list */ font->filename = strdup(filename); font->next = this->fonts; this->fonts = font; - + } else { - + if( !known_font->loaded ) { /* the font was preloaded before. * add loaded characters to the existing entry. @@ -734,7 +734,7 @@ static int osd_renderer_load_font(osd_renderer_t *this, char *filename) { known_font->fontchar = font->fontchar; free(font); } else { - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("font '%s-%d' already loaded, weird.\n"), font->name, font->size); while( --i >= 0 ) { free(font->fontchar[i].bmp); @@ -742,13 +742,13 @@ static int osd_renderer_load_font(osd_renderer_t *this, char *filename) { free(font->fontchar); free(font); } - + } } else { - + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("font '%s' loading failed (%d < %d)\n") ,font->name, i, font->num_fontchars); - + while( --i >= 0 ) { free(font->fontchar[i].bmp); } @@ -774,13 +774,13 @@ static int osd_renderer_unload_font(osd_renderer_t *this, char *fontname ) { osd_font_t *font, *last; osd_object_t *osd; int i, ret = 0; - + lprintf("font '%s'\n", fontname); pthread_mutex_lock (&this->osd_mutex); osd = this->osds; - while( osd ) { + while( osd ) { if( !strcasecmp(osd->font->name, fontname) ) osd->font = NULL; osd = osd->next; @@ -792,14 +792,14 @@ static int osd_renderer_unload_font(osd_renderer_t *this, char *fontname ) { if ( !strcasecmp(font->name,fontname) ) { free( font->filename ); - + if( font->loaded ) { for( i = 0; i < font->num_fontchars; i++ ) { free( font->fontchar[i].bmp ); } free( font->fontchar ); } - + if( last ) last->next = font->next; else @@ -835,7 +835,7 @@ static int osd_set_font_freetype2( osd_object_t *osd, const char *fontname, int FT_Done_Face (osd->ft2->face); osd->ft2->face = NULL; } - + #ifdef HAVE_FONTCONFIG do { FcPattern *pat = NULL, *match = NULL; @@ -848,7 +848,7 @@ static int osd_set_font_freetype2( osd_object_t *osd, const char *fontname, int match = FcFontMatch(NULL, pat, &result); FcPatternDestroy(pat); - + if ( ! match ) { FcFontSetDestroy(fs); xprintf(osd->renderer->stream->xine, XINE_VERBOSITY_LOG, @@ -878,7 +878,7 @@ static int osd_set_font_freetype2( osd_object_t *osd, const char *fontname, int /* try load font from current directory */ if ( !FT_New_Face(osd->ft2->library, fontname, 0, &osd->ft2->face) ) goto end; - + /* try load font from home directory */ snprintf(pathname, 1024, "%s/.xine/fonts/%s", xine_get_homedir(), fontname); if ( !FT_New_Face(osd->ft2->library, pathname, 0, &osd->ft2->face) ) @@ -889,7 +889,7 @@ static int osd_set_font_freetype2( osd_object_t *osd, const char *fontname, int if ( !FT_New_Face(osd->ft2->library, pathname, 0, &osd->ft2->face) ) goto end; - xprintf(osd->renderer->stream->xine, XINE_VERBOSITY_LOG, + xprintf(osd->renderer->stream->xine, XINE_VERBOSITY_LOG, _("osd: error loading font %s with ft2\n"), fontname); } @@ -913,11 +913,11 @@ static int osd_set_font_freetype2( osd_object_t *osd, const char *fontname, int set the font of osd object */ -static int osd_set_font( osd_object_t *osd, const char *fontname, int size) { +static int osd_set_font( osd_object_t *osd, const char *fontname, int size) { int ret = 1; lprintf("osd=%p font '%s'\n", osd, fontname); - + pthread_mutex_lock (&osd->renderer->osd_mutex); #ifdef HAVE_FT2 @@ -932,7 +932,7 @@ static int osd_set_font( osd_object_t *osd, const char *fontname, int size) { font = osd->renderer->fonts; while( font ) { - if( !strcasecmp(font->name, fontname) && (size>=font->size) + if( !strcasecmp(font->name, fontname) && (size>=font->size) && (best<font->size)) { ret = 1; osd->font = font; @@ -948,7 +948,7 @@ static int osd_set_font( osd_object_t *osd, const char *fontname, int size) { ret = osd_renderer_load_font(osd->renderer, osd->font->filename); if(!ret) osd->font = NULL; - } + } } pthread_mutex_unlock (&osd->renderer->osd_mutex); @@ -978,29 +978,29 @@ static int osd_search(osd_fontchar_t *array, size_t n, uint16_t code) { if (array[right].code == code) return right; - else + else return ALIAS_CHARACTER_FONT < n ? ALIAS_CHARACTER_FONT : n; #else size_t i; - + for( i = 0; i < n; i++ ) { if( font->fontchar[i].code == unicode ) break; } - if (i < n) + if (i < n) return i; - else + else return ALIAS_CHARACTER_FONT < n ? ALIAS_CHARACTER_FONT : n; #endif } #ifdef HAVE_ICONV -/* - * get next unicode value +/* + * get next unicode value */ -static uint16_t osd_iconv_getunicode(xine_t *xine, +static uint16_t osd_iconv_getunicode(xine_t *xine, iconv_t cd, const char *encoding, ICONV_CONST char **inbuf, size_t *inbytesleft) { uint16_t unicode; @@ -1052,7 +1052,7 @@ static void osd_free_encoding(osd_object_t *osd) { /* - * set encoding of text + * set encoding of text * * NULL ... no conversion (iso-8859-1) * "" ... locale encoding @@ -1117,7 +1117,7 @@ static int osd_render_text (osd_object_t *osd, int x1, int y1, #endif lprintf("osd=%p (%d,%d) \"%s\"\n", osd, x1, y1, text); - + /* some sanity checks for the color indices */ if( color_base < 0 ) color_base = 0; @@ -1133,7 +1133,7 @@ static int osd_render_text (osd_object_t *osd, int x1, int y1, #ifdef HAVE_FT2 if (osd->ft2) proceed = 1; #endif - + if (proceed == 0) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("osd: font isn't defined\n")); pthread_mutex_unlock(&this->osd_mutex); @@ -1146,10 +1146,10 @@ static int osd_render_text (osd_object_t *osd, int x1, int y1, inbuf = text; inbytesleft = strlen(text); - + while( inbytesleft ) { #ifdef HAVE_ICONV - unicode = osd_iconv_getunicode(this->stream->xine, osd->cd, osd->encoding, + unicode = osd_iconv_getunicode(this->stream->xine, osd->cd, osd->encoding, (ICONV_CONST char **)&inbuf, &inbytesleft); #else unicode = inbuf[0]; @@ -1207,7 +1207,7 @@ static int osd_render_text (osd_object_t *osd, int x1, int y1, while (s < src + slot->bitmap.width) { if ((d >= dst) && (d < dst + osd->width) && *s) *d = (uint8_t)(*s/25) + (uint8_t) color_base; - + d++; s++; } @@ -1226,15 +1226,15 @@ static int osd_render_text (osd_object_t *osd, int x1, int y1, #endif i = osd_search(font->fontchar, font->num_fontchars, unicode); - - lprintf("font '%s' [%d, U+%04X == U+%04X] %dx%d -> %d,%d\n", font->name, i, - unicode, font->fontchar[i].code, font->fontchar[i].width, + + lprintf("font '%s' [%d, U+%04X == U+%04X] %dx%d -> %d,%d\n", font->name, i, + unicode, font->fontchar[i].code, font->fontchar[i].width, font->fontchar[i].height, x1, y1); - + if ( i != font->num_fontchars ) { dst = osd->area + y1 * osd->width; src = font->fontchar[i].bmp; - + for( y = 0; y < font->fontchar[i].height; y++ ) { uint8_t *s = src; uint8_t *d = dst + x1; @@ -1246,7 +1246,7 @@ static int osd_render_text (osd_object_t *osd, int x1, int y1, while (s < src + font->fontchar[i].width) { if((d >= dst) && (d < dst + osd->width) && (*s > 1)) /* skip drawing transparency */ *d = *s + (uint8_t) color_base; - + d++; s++; } @@ -1254,12 +1254,12 @@ static int osd_render_text (osd_object_t *osd, int x1, int y1, dst += osd->width; } x1 += font->fontchar[i].width - (font->fontchar[i].width * FONT_OVERLAP); - + if( x1 > osd->x2 ) osd->x2 = x1; - if( y1 + font->fontchar[i].height > osd->y2 ) + if( y1 + font->fontchar[i].height > osd->y2 ) osd->y2 = y1 + font->fontchar[i].height; } - + #ifdef HAVE_FT2 } /* !(osd->ft2) */ #endif @@ -1291,7 +1291,7 @@ static int osd_get_text_size(osd_object_t *osd, const char *text, int *width, in #endif lprintf("osd=%p \"%s\"\n", osd, text); - + pthread_mutex_lock (&this->osd_mutex); { @@ -1301,7 +1301,7 @@ static int osd_get_text_size(osd_object_t *osd, const char *text, int *width, in #ifdef HAVE_FT2 if (osd->ft2) proceed = 1; #endif - + if (proceed == 0) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("osd: font isn't defined\n")); pthread_mutex_unlock(&this->osd_mutex); @@ -1314,10 +1314,10 @@ static int osd_get_text_size(osd_object_t *osd, const char *text, int *width, in inbuf = text; inbytesleft = strlen(text); - + while( inbytesleft ) { #ifdef HAVE_ICONV - unicode = osd_iconv_getunicode(this->stream->xine, osd->cd, osd->encoding, + unicode = osd_iconv_getunicode(this->stream->xine, osd->cd, osd->encoding, (ICONV_CONST char **)&inbuf, &inbytesleft); #else unicode = inbuf[0]; @@ -1408,7 +1408,7 @@ static void osd_preload_fonts (osd_renderer_t *this, char *path) { int len; len = strlen (entry->d_name); - + if ( (len > 12) && !strncmp (&entry->d_name[len-12], ".xinefont.gz", 12)) { s = strdup(entry->d_name); @@ -1419,15 +1419,15 @@ static void osd_preload_fonts (osd_renderer_t *this, char *path) { *p++ = '\0'; font = calloc(1, sizeof(osd_font_t) ); - + strncpy(font->name, s, sizeof(font->name)); font->size = atoi(p); - lprintf("font '%s' size %d is preloaded\n", + lprintf("font '%s' size %d is preloaded\n", font->name, font->size); asprintf (&font->filename, "%s/%s", path, entry->d_name); - + font->next = this->fonts; this->fonts = font; } @@ -1444,30 +1444,30 @@ static void osd_preload_fonts (osd_renderer_t *this, char *path) { */ static void osd_free_object (osd_object_t *osd_to_close) { - + osd_renderer_t *this = osd_to_close->renderer; video_overlay_manager_t *ovl_manager; osd_object_t *osd, *last; if( osd_to_close->handle >= 0 ) { osd_hide(osd_to_close,0); - + this->event.object.handle = osd_to_close->handle; - + /* not really needed this, but good pratice to clean it up */ memset( this->event.object.overlay, 0, sizeof(this->event.object.overlay) ); this->event.event_type = OVERLAY_EVENT_FREE_HANDLE; this->event.vpts = 0; - + this->stream->xine->port_ticket->acquire(this->stream->xine->port_ticket, 1); ovl_manager = this->stream->video_out->get_overlay_manager(this->stream->video_out); ovl_manager->add_event(ovl_manager, (void *)&this->event); this->stream->xine->port_ticket->release(this->stream->xine->port_ticket, 1); - + osd_to_close->handle = -1; /* handle will be freed */ } - - pthread_mutex_lock (&this->osd_mutex); + + pthread_mutex_lock (&this->osd_mutex); last = NULL; osd = this->osds; @@ -1477,7 +1477,7 @@ static void osd_free_object (osd_object_t *osd_to_close) { osd_free_ft2 (osd); osd_free_encoding(osd); - + if( last ) last->next = osd->next; else @@ -1489,7 +1489,7 @@ static void osd_free_object (osd_object_t *osd_to_close) { last = osd; osd = osd->next; } - pthread_mutex_unlock (&this->osd_mutex); + pthread_mutex_unlock (&this->osd_mutex); } static void osd_renderer_close (osd_renderer_t *this) { @@ -1547,7 +1547,7 @@ static void osd_draw_bitmap(osd_object_t *osd, uint8_t *bitmap, } static uint32_t osd_get_capabilities (osd_object_t *osd) { - + osd_renderer_t *this = osd->renderer; uint32_t capabilities = 0; @@ -1560,8 +1560,8 @@ static uint32_t osd_get_capabilities (osd_object_t *osd) { VO_CAP_UNSCALED_OVERLAY) capabilities |= XINE_OSD_CAP_UNSCALED; this->stream->xine->port_ticket->release(this->stream->xine->port_ticket, 1); - - return capabilities; + + return capabilities; } @@ -1574,7 +1574,7 @@ osd_renderer_t *_x_osd_renderer_init( xine_stream_t *stream ) { osd_renderer_t *this; char str[1024]; - this = calloc(1, sizeof(osd_renderer_t)); + this = calloc(1, sizeof(osd_renderer_t)); this->stream = stream; this->event.object.overlay = calloc(1, sizeof(vo_overlay_t)); @@ -1592,13 +1592,13 @@ osd_renderer_t *_x_osd_renderer_init( xine_stream_t *stream ) { this->textpalette = this->stream->xine->config->register_enum (this->stream->xine->config, "ui.osd.text_palette", 0, - textpalettes_str, + textpalettes_str, _("palette (foreground-border-background) to use for subtitles and OSD"), _("The palette for on-screen-display and some subtitle formats that do " "not specify any colouring themselves. The palettes are listed in the " "form: foreground-border-background."), 10, update_text_palette, this); - + /* * set up function pointer */ diff --git a/src/xine-engine/osd.h b/src/xine-engine/osd.h index 70193a2ea..768fcb418 100644 --- a/src/xine-engine/osd.h +++ b/src/xine-engine/osd.h @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -48,11 +48,11 @@ struct osd_object_s { int width, height; /* work area dimentions */ uint8_t *area; /* work area */ int display_x,display_y; /* where to display it in screen */ - + /* clipping box inside work area */ int x1, y1; int x2, y2; - + uint32_t color[OVL_PALETTE_SIZE]; /* color lookup table */ uint8_t trans[OVL_PALETTE_SIZE]; /* mixer key table */ @@ -62,7 +62,7 @@ struct osd_object_s { iconv_t cd; /* iconv handle of encoding */ char *encoding; /* name of encoding */ #endif - + osd_font_t *font; osd_ft2context_t *ft2; }; @@ -102,17 +102,17 @@ struct osd_renderer_s { */ int (*hide) (osd_object_t *osd, int64_t vpts ); - /* + /* * draw point. */ void (*point) (osd_object_t *osd, int x, int y, int color); - + /* * Bresenham line implementation on osd object */ void (*line) (osd_object_t *osd, int x1, int y1, int x2, int y2, int color ); - + /* * filled rectangle */ @@ -125,7 +125,7 @@ struct osd_renderer_s { void (*set_palette) (osd_object_t *osd, const uint32_t *color, const uint8_t *trans ); /* - * set on existing text palette + * set on existing text palette * (-1 to set used specified palette) * * color_base specifies the first color index to use for this text @@ -136,11 +136,11 @@ struct osd_renderer_s { */ void (*set_text_palette) (osd_object_t *osd, int palette_number, int color_base ); - + /* * get palette (color and transparency) */ - void (*get_palette) (osd_object_t *osd, uint32_t *color, + void (*get_palette) (osd_object_t *osd, uint32_t *color, uint8_t *trans); /* @@ -167,20 +167,20 @@ struct osd_renderer_s { * no \n yet * * The text is assigned the colors starting at the index specified by - * color_base up to the size of the text palette. + * color_base up to the size of the text palette. * * Use OSD_TEXT1, OSD_TEXT2, ... for some preasssigned color indices. */ - int (*render_text) (osd_object_t *osd, int x1, int y1, + int (*render_text) (osd_object_t *osd, int x1, int y1, const char *text, int color_base); /* * get width and height of how text will be renderized */ - int (*get_text_size) (osd_object_t *osd, const char *text, + int (*get_text_size) (osd_object_t *osd, const char *text, int *width, int *height); - /* + /* * close osd rendering engine * loaded fonts are unloaded * osd objects are closed @@ -191,7 +191,7 @@ struct osd_renderer_s { * clear an osd object (empty drawing area) */ void (*clear) (osd_object_t *osd ); - + /* * paste a bitmap with optional palette mapping */ @@ -210,7 +210,7 @@ struct osd_renderer_s { * see xine.h for defined XINE_OSD_CAP_ values. */ uint32_t (*get_capabilities) (osd_object_t *osd); - + /* private stuff */ pthread_mutex_t osd_mutex; @@ -218,7 +218,7 @@ struct osd_renderer_s { osd_object_t *osds; /* instances of osd */ osd_font_t *fonts; /* loaded fonts */ int textpalette; /* default textpalette */ - + xine_stream_t *stream; }; @@ -230,7 +230,7 @@ osd_renderer_t *_x_osd_renderer_init( xine_stream_t *stream ) XINE_MALLOC; /* - * The size of a text palette + * The size of a text palette */ #define TEXT_PALETTE_SIZE 11 @@ -251,29 +251,29 @@ osd_renderer_t *_x_osd_renderer_init( xine_stream_t *stream ) XINE_MALLOC; #define OSD_TEXT9 (8 * TEXT_PALETTE_SIZE) #define OSD_TEXT10 (9 * TEXT_PALETTE_SIZE) -/* +/* * Defined palettes for rendering osd text * (more can be added later) - */ + */ #define NUMBER_OF_TEXT_PALETTES 4 #define TEXTPALETTE_WHITE_BLACK_TRANSPARENT 0 #define TEXTPALETTE_WHITE_NONE_TRANSPARENT 1 #define TEXTPALETTE_WHITE_NONE_TRANSLUCID 2 #define TEXTPALETTE_YELLOW_BLACK_TRANSPARENT 3 - + #ifdef __OSD_C__ - + /* This text descriptions are used for config screen */ static const char *textpalettes_str[NUMBER_OF_TEXT_PALETTES+1] = { "white-black-transparent", "white-none-transparent", "white-none-translucid", - "yellow-black-transparent", + "yellow-black-transparent", NULL}; -/* +/* Palette entries as used by osd fonts: 0: not used by font, always transparent @@ -284,10 +284,10 @@ static const char *textpalettes_str[NUMBER_OF_TEXT_PALETTES+1] = { 6: font border. if the font is to be displayed without border this will probably be adjusted to font background or near. 7-9: transition between border and foreground - 10: font color (foreground) + 10: font color (foreground) */ -/* +/* The palettes below were made by hand, ie, i just throw values that seemed to do the transitions i wanted. This can surelly be improved a lot. [Miguel] diff --git a/src/xine-engine/plugin_catalog.h b/src/xine-engine/plugin_catalog.h index a28321760..010ec53bb 100644 --- a/src/xine-engine/plugin_catalog.h +++ b/src/xine-engine/plugin_catalog.h @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -60,16 +60,16 @@ typedef struct { struct plugin_catalog_s { xine_sarray_t *plugin_lists[PLUGIN_TYPE_MAX]; - + xine_sarray_t *cache_list; xine_list_t *file_list; plugin_node_t *audio_decoder_map[DECODER_MAX][PLUGINS_PER_TYPE]; plugin_node_t *video_decoder_map[DECODER_MAX][PLUGINS_PER_TYPE]; plugin_node_t *spu_decoder_map[DECODER_MAX][PLUGINS_PER_TYPE]; - + const char *ids[PLUGIN_MAX]; - + /* memory block for the decoder priority config entry descriptions */ char *prio_desc[DECODER_MAX]; diff --git a/src/xine-engine/post.c b/src/xine-engine/post.c index aa182d627..276934788 100644 --- a/src/xine-engine/post.c +++ b/src/xine-engine/post.c @@ -1,23 +1,23 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA */ - + /* * some helper functions for post plugins */ @@ -41,7 +41,7 @@ void _x_post_init(post_plugin_t *post, int num_audio_inputs, int num_video_input static uint32_t post_video_get_capabilities(xine_video_port_t *port_gen) { post_video_port_t *port = (post_video_port_t *)port_gen; uint32_t caps; - + if (port->port_lock) pthread_mutex_lock(port->port_lock); caps = port->original_port->get_capabilities(port->original_port); if (port->port_lock) pthread_mutex_unlock(port->port_lock); @@ -50,7 +50,7 @@ static uint32_t post_video_get_capabilities(xine_video_port_t *port_gen) { static void post_video_open(xine_video_port_t *port_gen, xine_stream_t *stream) { post_video_port_t *port = (post_video_port_t *)port_gen; - + _x_post_rewire(port->post); _x_post_inc_usage(port); if (port->port_lock) pthread_mutex_lock(port->port_lock); @@ -59,31 +59,31 @@ static void post_video_open(xine_video_port_t *port_gen, xine_stream_t *stream) port->stream = stream; } -static vo_frame_t *post_video_get_frame(xine_video_port_t *port_gen, uint32_t width, +static vo_frame_t *post_video_get_frame(xine_video_port_t *port_gen, uint32_t width, uint32_t height, double ratio, int format, int flags) { post_video_port_t *port = (post_video_port_t *)port_gen; vo_frame_t *frame; - + _x_post_rewire(port->post); if (port->port_lock) pthread_mutex_lock(port->port_lock); frame = port->original_port->get_frame(port->original_port, width, height, ratio, format, flags); if (port->port_lock) pthread_mutex_unlock(port->port_lock); - + if (frame && (!port->intercept_frame || port->intercept_frame(port, frame))) { _x_post_inc_usage(port); if (port->frame_lock) pthread_mutex_lock(port->frame_lock); frame = _x_post_intercept_video_frame(frame, port); if (port->frame_lock) pthread_mutex_unlock(port->frame_lock); } - + return frame; } static vo_frame_t *post_video_get_last_frame(xine_video_port_t *port_gen) { post_video_port_t *port = (post_video_port_t *)port_gen; vo_frame_t *frame; - + if (port->port_lock) pthread_mutex_lock(port->port_lock); frame = port->original_port->get_last_frame(port->original_port); if (port->port_lock) pthread_mutex_unlock(port->port_lock); @@ -92,15 +92,15 @@ static vo_frame_t *post_video_get_last_frame(xine_video_port_t *port_gen) { static void post_video_enable_ovl(xine_video_port_t *port_gen, int ovl_enable) { post_video_port_t *port = (post_video_port_t *)port_gen; - + if (port->port_lock) pthread_mutex_lock(port->port_lock); port->original_port->enable_ovl(port->original_port, ovl_enable); if (port->port_lock) pthread_mutex_unlock(port->port_lock); } - + static void post_video_close(xine_video_port_t *port_gen, xine_stream_t *stream) { post_video_port_t *port = (post_video_port_t *)port_gen; - + if (port->port_lock) pthread_mutex_lock(port->port_lock); port->original_port->close(port->original_port, stream); if (port->port_lock) pthread_mutex_unlock(port->port_lock); @@ -110,7 +110,7 @@ static void post_video_close(xine_video_port_t *port_gen, xine_stream_t *stream) static void post_video_exit(xine_video_port_t *port_gen) { post_video_port_t *port = (post_video_port_t *)port_gen; - + if (port->port_lock) pthread_mutex_lock(port->port_lock); port->original_port->exit(port->original_port); if (port->port_lock) pthread_mutex_unlock(port->port_lock); @@ -119,11 +119,11 @@ static void post_video_exit(xine_video_port_t *port_gen) { static video_overlay_manager_t *post_video_get_overlay_manager(xine_video_port_t *port_gen) { post_video_port_t *port = (post_video_port_t *)port_gen; video_overlay_manager_t *manager; - + if (port->port_lock) pthread_mutex_lock(port->port_lock); manager = port->original_port->get_overlay_manager(port->original_port); if (port->port_lock) pthread_mutex_unlock(port->port_lock); - + if (port->intercept_ovl && port->intercept_ovl(port)) { if (manager && !port->original_manager) /* this is the first access to overlay manager */ @@ -138,7 +138,7 @@ static video_overlay_manager_t *post_video_get_overlay_manager(xine_video_port_t static void post_video_flush(xine_video_port_t *port_gen) { post_video_port_t *port = (post_video_port_t *)port_gen; - + if (port->port_lock) pthread_mutex_lock(port->port_lock); port->original_port->flush(port->original_port); if (port->port_lock) pthread_mutex_unlock(port->port_lock); @@ -148,7 +148,7 @@ static int post_video_status(xine_video_port_t *port_gen, xine_stream_t *stream, int *width, int *height, int64_t *img_duration) { post_video_port_t *port = (post_video_port_t *)port_gen; int status; - + if (port->port_lock) pthread_mutex_lock(port->port_lock); status = port->original_port->status(port->original_port, stream, width, height, img_duration); if (port->port_lock) pthread_mutex_unlock(port->port_lock); @@ -158,7 +158,7 @@ static int post_video_status(xine_video_port_t *port_gen, xine_stream_t *stream, static int post_video_get_property(xine_video_port_t *port_gen, int property) { post_video_port_t *port = (post_video_port_t *)port_gen; int prop; - + if (port->port_lock) pthread_mutex_lock(port->port_lock); prop = port->original_port->get_property(port->original_port, property); if (port->port_lock) pthread_mutex_unlock(port->port_lock); @@ -168,7 +168,7 @@ static int post_video_get_property(xine_video_port_t *port_gen, int property) { static int post_video_set_property(xine_video_port_t *port_gen, int property, int value) { post_video_port_t *port = (post_video_port_t *)port_gen; int val; - + if (port->port_lock) pthread_mutex_lock(port->port_lock); val = port->original_port->set_property(port->original_port, property, value); if (port->port_lock) pthread_mutex_unlock(port->port_lock); @@ -183,21 +183,21 @@ static int post_video_rewire(xine_post_out_t *output_gen, void *data) { post_plugin_t *this = output->post; int64_t img_duration; int width, height; - + if (!new_port) return 0; - + this->running_ticket->revoke(this->running_ticket, 1); - + if (input_port->original_port->status(input_port->original_port, input_port->stream, &width, &height, &img_duration)) { (new_port->open) (new_port, input_port->stream); input_port->original_port->close(input_port->original_port, input_port->stream); } input_port->original_port = new_port; - + this->running_ticket->issue(this->running_ticket, 1); - + return 1; } @@ -205,10 +205,10 @@ static int post_video_rewire(xine_post_out_t *output_gen, void *data) { post_video_port_t *_x_post_intercept_video_port(post_plugin_t *post, xine_video_port_t *original, post_in_t **input, post_out_t **output) { post_video_port_t *port = calloc(1, sizeof(post_video_port_t)); - + if (!port) return NULL; - + port->new_port.get_capabilities = post_video_get_capabilities; port->new_port.open = post_video_open; port->new_port.get_frame = post_video_get_frame; @@ -222,15 +222,15 @@ post_video_port_t *_x_post_intercept_video_port(post_plugin_t *post, xine_video_ port->new_port.get_property = post_video_get_property; port->new_port.set_property = post_video_set_property; port->new_port.driver = original->driver; - + port->original_port = original; port->new_frame = &port->frame_storage; port->new_manager = &port->manager_storage; port->post = post; - + pthread_mutex_init(&port->usage_lock, NULL); pthread_mutex_init(&port->free_frames_lock, NULL); - + if (input) { *input = calloc(1, sizeof(post_in_t)); if (!*input) return port; @@ -240,7 +240,7 @@ post_video_port_t *_x_post_intercept_video_port(post_plugin_t *post, xine_video_ (*input)->post = post; xine_list_push_back(post->input, *input); } - + if (output) { *output = calloc(1, sizeof(post_out_t)); if (!*output) return port; @@ -252,7 +252,7 @@ post_video_port_t *_x_post_intercept_video_port(post_plugin_t *post, xine_video_ (*output)->user_data = port; xine_list_push_back(post->output, *output); } - + return port; } @@ -260,7 +260,7 @@ post_video_port_t *_x_post_intercept_video_port(post_plugin_t *post, xine_video_ /* dummy intercept functions for frames */ static void post_frame_free(vo_frame_t *vo_img) { post_video_port_t *port = _x_post_video_frame_to_port(vo_img); - + if (port->frame_lock) pthread_mutex_lock(port->frame_lock); if (--vo_img->lock_counter == 0) { /* this frame is free */ @@ -279,7 +279,7 @@ static void post_frame_free(vo_frame_t *vo_img) { static void post_frame_proc_slice(vo_frame_t *vo_img, uint8_t **src) { post_video_port_t *port = _x_post_video_frame_to_port(vo_img); - + if (port->frame_lock) pthread_mutex_lock(port->frame_lock); _x_post_frame_copy_down(vo_img, vo_img->next); vo_img->next->proc_slice(vo_img->next, src); @@ -289,7 +289,7 @@ static void post_frame_proc_slice(vo_frame_t *vo_img, uint8_t **src) { static void post_frame_proc_frame(vo_frame_t *vo_img) { post_video_port_t *port = _x_post_video_frame_to_port(vo_img); - + if (port->frame_lock) pthread_mutex_lock(port->frame_lock); _x_post_frame_copy_down(vo_img, vo_img->next); vo_img->next->proc_frame(vo_img->next); @@ -299,7 +299,7 @@ static void post_frame_proc_frame(vo_frame_t *vo_img) { static void post_frame_field(vo_frame_t *vo_img, int which_field) { post_video_port_t *port = _x_post_video_frame_to_port(vo_img); - + if (port->frame_lock) pthread_mutex_lock(port->frame_lock); _x_post_frame_copy_down(vo_img, vo_img->next); vo_img->next->field(vo_img->next, which_field); @@ -310,7 +310,7 @@ static void post_frame_field(vo_frame_t *vo_img, int which_field) { static int post_frame_draw(vo_frame_t *vo_img, xine_stream_t *stream) { post_video_port_t *port = _x_post_video_frame_to_port(vo_img); int skip; - + if (port->frame_lock) pthread_mutex_lock(port->frame_lock); _x_post_frame_copy_down(vo_img, vo_img->next); skip = vo_img->next->draw(vo_img->next, stream); @@ -321,7 +321,7 @@ static int post_frame_draw(vo_frame_t *vo_img, xine_stream_t *stream) { static void post_frame_lock(vo_frame_t *vo_img) { post_video_port_t *port = _x_post_video_frame_to_port(vo_img); - + if (port->frame_lock) pthread_mutex_lock(port->frame_lock); _x_post_frame_copy_down(vo_img, vo_img->next); vo_img->lock_counter++; @@ -332,7 +332,7 @@ static void post_frame_lock(vo_frame_t *vo_img) { static void post_frame_dispose(vo_frame_t *vo_img) { post_video_port_t *port = _x_post_video_frame_to_port(vo_img); - + if (port->frame_lock) pthread_mutex_lock(port->frame_lock); vo_img = _x_post_restore_video_frame(vo_img, port); vo_img->dispose(vo_img); @@ -343,7 +343,7 @@ static void post_frame_dispose(vo_frame_t *vo_img) { vo_frame_t *_x_post_intercept_video_frame(vo_frame_t *frame, post_video_port_t *port) { vo_frame_t *new_frame; - + /* get a free frame slot */ pthread_mutex_lock(&port->free_frames_lock); if (port->free_frame_slots) { @@ -353,14 +353,14 @@ vo_frame_t *_x_post_intercept_video_frame(vo_frame_t *frame, post_video_port_t * new_frame = calloc(1, sizeof(vo_frame_t)); } pthread_mutex_unlock(&port->free_frames_lock); - + /* make a copy and attach the original */ xine_fast_memcpy(new_frame, frame, sizeof(vo_frame_t)); new_frame->next = frame; if (new_frame->stream) _x_refcounter_inc(new_frame->stream->refcounter); - + /* modify the frame with the intercept functions */ new_frame->port = &port->new_port; new_frame->proc_frame = @@ -377,7 +377,7 @@ vo_frame_t *_x_post_intercept_video_frame(vo_frame_t *frame, post_video_port_t * port->new_frame->free ? port->new_frame->free : post_frame_free; new_frame->dispose = port->new_frame->dispose ? port->new_frame->dispose : post_frame_dispose; - + if (!port->new_frame->draw) { /* draw will most likely modify the frame, so the decoder * should only request preprocessing when there is no new draw */ @@ -386,17 +386,17 @@ vo_frame_t *_x_post_intercept_video_frame(vo_frame_t *frame, post_video_port_t * if (frame->proc_slice && !new_frame->proc_slice) new_frame->proc_slice = post_frame_proc_slice; } - + return new_frame; } vo_frame_t *_x_post_restore_video_frame(vo_frame_t *frame, post_video_port_t *port) { /* the first attched context is the original frame */ vo_frame_t *original = frame->next; - + /* propagate any changes */ _x_post_frame_copy_down(frame, original); - + if (frame->stream) _x_refcounter_dec(frame->stream->refcounter); @@ -405,7 +405,7 @@ vo_frame_t *_x_post_restore_video_frame(vo_frame_t *frame, post_video_port_t *po frame->next = port->free_frame_slots; port->free_frame_slots = frame; pthread_mutex_unlock(&port->free_frames_lock); - + return original; } @@ -446,7 +446,7 @@ void _x_post_frame_copy_up(vo_frame_t *to, vo_frame_t *from) { to->vpts = from->vpts; to->duration = from->duration; to->stream = from->stream; - + if (to->extra_info != from->extra_info) _x_extra_info_merge(to->extra_info, from->extra_info); } @@ -462,14 +462,14 @@ void _x_post_frame_u_turn(vo_frame_t *frame, xine_stream_t *stream) { if (stream) { _x_extra_info_merge(frame->extra_info, stream->video_decoder_extra_info); stream->metronom->got_video_frame(stream->metronom, frame); - } + } } /* dummy intercept functions that just pass the call on to the original overlay manager */ static void post_overlay_init(video_overlay_manager_t *ovl_gen) { post_video_port_t *port = _x_post_ovl_manager_to_port(ovl_gen); - + if (port->manager_lock) pthread_mutex_lock(port->manager_lock); port->original_manager->init(port->original_manager); if (port->manager_lock) pthread_mutex_unlock(port->manager_lock); @@ -477,7 +477,7 @@ static void post_overlay_init(video_overlay_manager_t *ovl_gen) { static void post_overlay_dispose(video_overlay_manager_t *ovl_gen) { post_video_port_t *port = _x_post_ovl_manager_to_port(ovl_gen); - + if (port->manager_lock) pthread_mutex_lock(port->manager_lock); port->original_manager->dispose(port->original_manager); if (port->manager_lock) pthread_mutex_unlock(port->manager_lock); @@ -486,7 +486,7 @@ static void post_overlay_dispose(video_overlay_manager_t *ovl_gen) { static int32_t post_overlay_get_handle(video_overlay_manager_t *ovl_gen, int object_type) { post_video_port_t *port = _x_post_ovl_manager_to_port(ovl_gen); int32_t handle; - + if (port->manager_lock) pthread_mutex_lock(port->manager_lock); handle = port->original_manager->get_handle(port->original_manager, object_type); if (port->manager_lock) pthread_mutex_unlock(port->manager_lock); @@ -495,7 +495,7 @@ static int32_t post_overlay_get_handle(video_overlay_manager_t *ovl_gen, int obj static void post_overlay_free_handle(video_overlay_manager_t *ovl_gen, int32_t handle) { post_video_port_t *port = _x_post_ovl_manager_to_port(ovl_gen); - + if (port->manager_lock) pthread_mutex_lock(port->manager_lock); port->original_manager->free_handle(port->original_manager, handle); if (port->manager_lock) pthread_mutex_unlock(port->manager_lock); @@ -504,7 +504,7 @@ static void post_overlay_free_handle(video_overlay_manager_t *ovl_gen, int32_t h static int32_t post_overlay_add_event(video_overlay_manager_t *ovl_gen, void *event) { post_video_port_t *port = _x_post_ovl_manager_to_port(ovl_gen); int32_t result; - + if (port->manager_lock) pthread_mutex_lock(port->manager_lock); result = port->original_manager->add_event(port->original_manager, event); if (port->manager_lock) pthread_mutex_unlock(port->manager_lock); @@ -513,7 +513,7 @@ static int32_t post_overlay_add_event(video_overlay_manager_t *ovl_gen, void *ev static void post_overlay_flush_events(video_overlay_manager_t *ovl_gen) { post_video_port_t *port = _x_post_ovl_manager_to_port(ovl_gen); - + if (port->manager_lock) pthread_mutex_lock(port->manager_lock); port->original_manager->flush_events(port->original_manager); if (port->manager_lock) pthread_mutex_unlock(port->manager_lock); @@ -522,17 +522,17 @@ static void post_overlay_flush_events(video_overlay_manager_t *ovl_gen) { static int post_overlay_redraw_needed(video_overlay_manager_t *ovl_gen, int64_t vpts) { post_video_port_t *port = _x_post_ovl_manager_to_port(ovl_gen); int redraw; - + if (port->manager_lock) pthread_mutex_lock(port->manager_lock); redraw = port->original_manager->redraw_needed(port->original_manager, vpts); if (port->manager_lock) pthread_mutex_unlock(port->manager_lock); return redraw; } -static void post_overlay_multiple_overlay_blend(video_overlay_manager_t *ovl_gen, int64_t vpts, +static void post_overlay_multiple_overlay_blend(video_overlay_manager_t *ovl_gen, int64_t vpts, vo_driver_t *output, vo_frame_t *vo_img, int enabled) { post_video_port_t *port = _x_post_ovl_manager_to_port(ovl_gen); - + if (port->manager_lock) pthread_mutex_lock(port->manager_lock); port->original_manager->multiple_overlay_blend(port->original_manager, vpts, output, vo_img, enabled); if (port->manager_lock) pthread_mutex_unlock(port->manager_lock); @@ -556,7 +556,7 @@ void _x_post_intercept_overlay_manager(video_overlay_manager_t *original, post_v port->new_manager->redraw_needed = post_overlay_redraw_needed; if (!port->new_manager->multiple_overlay_blend) port->new_manager->multiple_overlay_blend = post_overlay_multiple_overlay_blend; - + port->original_manager = original; } @@ -565,7 +565,7 @@ void _x_post_intercept_overlay_manager(video_overlay_manager_t *original, post_v static uint32_t post_audio_get_capabilities(xine_audio_port_t *port_gen) { post_audio_port_t *port = (post_audio_port_t *)port_gen; uint32_t caps; - + if (port->port_lock) pthread_mutex_lock(port->port_lock); caps = port->original_port->get_capabilities(port->original_port); if (port->port_lock) pthread_mutex_unlock(port->port_lock); @@ -575,7 +575,7 @@ static uint32_t post_audio_get_capabilities(xine_audio_port_t *port_gen) { static int post_audio_get_property(xine_audio_port_t *port_gen, int property) { post_audio_port_t *port = (post_audio_port_t *)port_gen; int prop; - + if (port->port_lock) pthread_mutex_lock(port->port_lock); prop = port->original_port->get_property(port->original_port, property); if (port->port_lock) pthread_mutex_unlock(port->port_lock); @@ -585,7 +585,7 @@ static int post_audio_get_property(xine_audio_port_t *port_gen, int property) { static int post_audio_set_property(xine_audio_port_t *port_gen, int property, int value) { post_audio_port_t *port = (post_audio_port_t *)port_gen; int val; - + if (port->port_lock) pthread_mutex_lock(port->port_lock); val = port->original_port->set_property(port->original_port, property, value); if (port->port_lock) pthread_mutex_unlock(port->port_lock); @@ -596,7 +596,7 @@ static int post_audio_open(xine_audio_port_t *port_gen, xine_stream_t *stream, uint32_t bits, uint32_t rate, int mode) { post_audio_port_t *port = (post_audio_port_t *)port_gen; int result; - + _x_post_rewire(port->post); _x_post_inc_usage(port); if (port->port_lock) pthread_mutex_lock(port->port_lock); @@ -612,7 +612,7 @@ static int post_audio_open(xine_audio_port_t *port_gen, xine_stream_t *stream, static audio_buffer_t *post_audio_get_buffer(xine_audio_port_t *port_gen) { post_audio_port_t *port = (post_audio_port_t *)port_gen; audio_buffer_t *buf; - + _x_post_rewire(port->post); if (port->port_lock) pthread_mutex_lock(port->port_lock); buf = port->original_port->get_buffer(port->original_port); @@ -623,15 +623,15 @@ static audio_buffer_t *post_audio_get_buffer(xine_audio_port_t *port_gen) { static void post_audio_put_buffer(xine_audio_port_t *port_gen, audio_buffer_t *buf, xine_stream_t *stream) { post_audio_port_t *port = (post_audio_port_t *)port_gen; - + if (port->port_lock) pthread_mutex_lock(port->port_lock); port->original_port->put_buffer(port->original_port, buf, stream); if (port->port_lock) pthread_mutex_unlock(port->port_lock); } - + static void post_audio_close(xine_audio_port_t *port_gen, xine_stream_t *stream) { post_audio_port_t *port = (post_audio_port_t *)port_gen; - + if (port->port_lock) pthread_mutex_lock(port->port_lock); port->original_port->close(port->original_port, stream); if (port->port_lock) pthread_mutex_unlock(port->port_lock); @@ -641,7 +641,7 @@ static void post_audio_close(xine_audio_port_t *port_gen, xine_stream_t *stream) static void post_audio_exit(xine_audio_port_t *port_gen) { post_audio_port_t *port = (post_audio_port_t *)port_gen; - + if (port->port_lock) pthread_mutex_lock(port->port_lock); port->original_port->exit(port->original_port); if (port->port_lock) pthread_mutex_unlock(port->port_lock); @@ -665,7 +665,7 @@ static int post_audio_control(xine_audio_port_t *port_gen, int cmd, ...) { static void post_audio_flush(xine_audio_port_t *port_gen) { post_audio_port_t *port = (post_audio_port_t *)port_gen; - + if (port->port_lock) pthread_mutex_lock(port->port_lock); port->original_port->flush(port->original_port); if (port->port_lock) pthread_mutex_unlock(port->port_lock); @@ -675,7 +675,7 @@ static int post_audio_status(xine_audio_port_t *port_gen, xine_stream_t *stream, uint32_t *bits, uint32_t *rate, int *mode) { post_audio_port_t *port = (post_audio_port_t *)port_gen; int result; - + if (port->port_lock) pthread_mutex_lock(port->port_lock); result = port->original_port->status(port->original_port, stream, bits, rate, mode); *bits = port->bits; @@ -693,31 +693,31 @@ static int post_audio_rewire(xine_post_out_t *output_gen, void *data) { post_plugin_t *this = output->post; uint32_t bits, rate; int mode; - + if (!new_port) return 0; - + this->running_ticket->revoke(this->running_ticket, 1); - + if (input_port->original_port->status(input_port->original_port, input_port->stream, &bits, &rate, &mode)) { (new_port->open) (new_port, input_port->stream, bits, rate, mode); input_port->original_port->close(input_port->original_port, input_port->stream); } input_port->original_port = new_port; - + this->running_ticket->issue(this->running_ticket, 1); - + return 1; } post_audio_port_t *_x_post_intercept_audio_port(post_plugin_t *post, xine_audio_port_t *original, post_in_t **input, post_out_t **output) { post_audio_port_t *port = calloc(1, sizeof(post_audio_port_t)); - + if (!port) return NULL; - + port->new_port.open = post_audio_open; port->new_port.get_buffer = post_audio_get_buffer; port->new_port.put_buffer = post_audio_put_buffer; @@ -729,12 +729,12 @@ post_audio_port_t *_x_post_intercept_audio_port(post_plugin_t *post, xine_audio_ port->new_port.control = post_audio_control; port->new_port.flush = post_audio_flush; port->new_port.status = post_audio_status; - + port->original_port = original; port->post = post; - + pthread_mutex_init(&port->usage_lock, NULL); - + if (input) { *input = calloc(1, sizeof(post_in_t)); if (!*input) return port; @@ -744,7 +744,7 @@ post_audio_port_t *_x_post_intercept_audio_port(post_plugin_t *post, xine_audio_ (*input)->post = post; xine_list_push_back(post->input, *input); } - + if (output) { *output = calloc(1, sizeof(post_out_t)); if (!*output) return port; @@ -756,14 +756,14 @@ post_audio_port_t *_x_post_intercept_audio_port(post_plugin_t *post, xine_audio_ (*output)->user_data = port; xine_list_push_back(post->output, *output); } - + return port; } int _x_post_dispose(post_plugin_t *this) { int i, in_use = 0; - + /* acquire all usage locks */ for (i = 0; this->xine_post.audio_input[i]; i++) { post_audio_port_t *port = (post_audio_port_t *)this->xine_post.audio_input[i]; @@ -773,11 +773,11 @@ int _x_post_dispose(post_plugin_t *this) { post_video_port_t *port = (post_video_port_t *)this->xine_post.video_input[i]; pthread_mutex_lock(&port->usage_lock); } - + /* we can set this witout harm, because it is always checked with * usage lock held */ this->dispose_pending = 1; - + /* check counters */ for (i = 0; this->xine_post.audio_input[i]; i++) { post_audio_port_t *port = (post_audio_port_t *)this->xine_post.audio_input[i]; @@ -793,7 +793,7 @@ int _x_post_dispose(post_plugin_t *this) { break; } } - + /* free the locks */ for (i = 0; this->xine_post.audio_input[i]; i++) { post_audio_port_t *port = (post_audio_port_t *)this->xine_post.audio_input[i]; @@ -803,20 +803,20 @@ int _x_post_dispose(post_plugin_t *this) { post_video_port_t *port = (post_video_port_t *)this->xine_post.video_input[i]; pthread_mutex_unlock(&port->usage_lock); } - + if (!in_use) { xine_post_in_t *input; xine_post_out_t *output; xine_list_iterator_t ite; - + /* we can really dispose it */ - + free(this->xine_post.audio_input); free(this->xine_post.video_input); /* these were allocated in the plugin loader */ free(this->input_ids); free(this->output_ids); - + for (ite = xine_list_front(this->input); ite; ite = xine_list_next(this->input, ite)) { input = xine_list_get_value(this->input, ite); @@ -825,16 +825,16 @@ int _x_post_dispose(post_plugin_t *this) { { post_video_port_t *port = (post_video_port_t *)input->data; vo_frame_t *first, *second; - + pthread_mutex_destroy(&port->usage_lock); pthread_mutex_destroy(&port->free_frames_lock); - + second = NULL; for (first = port->free_frame_slots; first; second = first, first = first->next) free(second); free(second); - + free(port); free(input); } @@ -842,9 +842,9 @@ int _x_post_dispose(post_plugin_t *this) { case XINE_POST_DATA_AUDIO: { post_audio_port_t *port = (post_audio_port_t *)input->data; - + pthread_mutex_destroy(&port->usage_lock); - + free(port); free(input); } @@ -867,18 +867,18 @@ int _x_post_dispose(post_plugin_t *this) { break; } } - + xine_list_delete(this->input); xine_list_delete(this->output); - + /* since the plugin loader does not know, when the plugin gets disposed, * we have to handle the reference counter here */ pthread_mutex_lock(&this->xine->plugin_catalog->lock); ((plugin_node_t *)this->node)->ref--; pthread_mutex_unlock(&this->xine->plugin_catalog->lock); - + return 1; } - + return 0; } diff --git a/src/xine-engine/post.h b/src/xine-engine/post.h index b06c7930a..d37c52908 100644 --- a/src/xine-engine/post.h +++ b/src/xine-engine/post.h @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -53,14 +53,14 @@ struct post_class_s { post_plugin_t* (*open_plugin) (post_class_t *this, int inputs, xine_audio_port_t **audio_target, xine_video_port_t **video_target); - + /* * return short, human readable identifier for this plugin class */ char* (*get_identifier) (post_class_t *this); /* - * return human readable (verbose = 1 line) description for + * return human readable (verbose = 1 line) description for * this plugin class */ char* (*get_description) (post_class_t *this); @@ -76,25 +76,25 @@ struct post_plugin_s { /* public part of the plugin */ xine_post_t xine_post; - + /* * the connections announced by the plugin * the plugin must fill these with xine_post_{in,out}_t on init */ xine_list_t *input; xine_list_t *output; - + /* * close down, free all resources */ void (*dispose) (post_plugin_t *this); - + /* has dispose been called */ int dispose_pending; - + /* plugins don't have to init the stuff below */ - - /* + + /* * the running ticket * * the plugin must assure to check for ticket revocation in @@ -105,11 +105,11 @@ struct post_plugin_s { * the running ticket is assigned to you by the engine */ xine_ticket_t *running_ticket; - + /* this is needed by the engine to decrement the reference counter * on disposal of the plugin, but since this is useful, we expose it */ xine_t *xine; - + /* used when the user requests a list of all inputs/outputs */ const char **input_ids; const char **output_ids; @@ -125,10 +125,10 @@ struct post_in_s { /* public part of the input */ xine_post_in_t xine_in; - + /* backward reference so that you have access to the post plugin */ post_plugin_t *post; - + /* you can fill this to your liking */ void *user_data; }; @@ -137,10 +137,10 @@ struct post_out_s { /* public part of the output */ xine_post_out_t xine_out; - + /* backward reference so that you have access to the post plugin */ post_plugin_t *post; - + /* you can fill this to your liking */ void *user_data; }; @@ -164,52 +164,52 @@ struct post_video_port_s { /* the new public port with replaced function pointers */ xine_video_port_t new_port; - + /* the original port to call its functions from inside yours */ xine_video_port_t *original_port; - + /* if you want to decide yourself, whether a given frame should * be intercepted, fill in this function; get_frame() acts as * a template method and asks your function; return a boolean; * the default is to intercept all frames */ int (*intercept_frame)(post_video_port_t *self, vo_frame_t *frame); - + /* the new frame function pointers */ vo_frame_t *new_frame; - + /* if you want to decide yourself, whether the overlay manager should * be intercepted, fill in this function; get_overlay_manager() acts as * a template method and asks your function; return a boolean; * the default is _not_ to intercept the overlay manager */ int (*intercept_ovl)(post_video_port_t *self); - + /* the new public overlay manager with replaced function pointers */ video_overlay_manager_t *new_manager; - + /* the original manager to call its functions from inside yours */ video_overlay_manager_t *original_manager; - + /* usage counter: how many objects are floating around that need * these pointers to exist */ int usage_count; pthread_mutex_t usage_lock; - + /* the stream we are being fed by; NULL means no stream is connected; * this may be an anonymous stream */ xine_stream_t *stream; - + /* point to a mutex here, if you need some synchronization */ pthread_mutex_t *port_lock; pthread_mutex_t *frame_lock; pthread_mutex_t *manager_lock; - + /* backward reference so that you have access to the post plugin * when the call only gives you the port */ post_plugin_t *post; - + /* you can fill this to your liking */ void *user_data; - + #ifdef POST_INTERNAL /* some of the above members are to be directly included here, but * adding the structures would mean that post_video_port_t becomes @@ -217,13 +217,13 @@ struct post_video_port_s { * above and have them point into the memory provided here; * note that the overlay manager needs to be first so that we can * reconstruct the post_video_port_t* from overlay manager calls */ - + /* any change here requires a change in _x_post_ovl_manager_to_port() * below! */ - + video_overlay_manager_t manager_storage; vo_frame_t frame_storage; - + /* this is used to keep a linked list of free vo_frame_t's */ vo_frame_t *free_frame_slots; pthread_mutex_t free_frames_lock; @@ -283,31 +283,31 @@ struct post_audio_port_s { /* the new public port with replaced function pointers */ xine_audio_port_t new_port; - + /* the original port to call its functions from inside yours */ xine_audio_port_t *original_port; - + /* usage counter: how many objects are floating around that need * these pointers to exist */ int usage_count; pthread_mutex_t usage_lock; - + /* the stream we are being fed by; NULL means no stream is connected; * this may be an anonymous stream */ xine_stream_t *stream; - + /* some values remembered by port->open() */ uint32_t bits; uint32_t rate; uint32_t mode; - + /* point to a mutex here, if you need some synchronization */ pthread_mutex_t *port_lock; - + /* backward reference so that you have access to the post plugin * when the call only gives you the port */ post_plugin_t *post; - + /* you can fill this to your liking */ void *user_data; }; @@ -369,7 +369,7 @@ do { \ } while(0) -/* macros to create parameter descriptors */ +/* macros to create parameter descriptors */ #define START_PARAM_DESCR( param_t ) \ static param_t temp_s; \ diff --git a/src/xine-engine/refcounter.c b/src/xine-engine/refcounter.c index 384bdf5ed..23da4bdbc 100644 --- a/src/xine-engine/refcounter.c +++ b/src/xine-engine/refcounter.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -27,7 +27,7 @@ /* #define LOG */ - + #include "xine_internal.h" #include "refcounter.h" @@ -53,7 +53,7 @@ int _x_refcounter_inc(refcounter_t *refcounter) _x_abort(); res = ++refcounter->count; pthread_mutex_unlock(&refcounter->lock); - + return res; } @@ -68,7 +68,7 @@ int _x_refcounter_dec(refcounter_t *refcounter) lprintf("calling destructor of object %p\n", refcounter->object); refcounter->destructor(refcounter->object); } - + return res; } diff --git a/src/xine-engine/refcounter.h b/src/xine-engine/refcounter.h index b3ddd71fc..f157d8b6c 100644 --- a/src/xine-engine/refcounter.h +++ b/src/xine-engine/refcounter.h @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA diff --git a/src/xine-engine/resample.c b/src/xine-engine/resample.c index 43911c401..dcf14a215 100644 --- a/src/xine-engine/resample.c +++ b/src/xine-engine/resample.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -30,7 +30,7 @@ /* contributed by paul flinders */ void _x_audio_out_resample_mono(int16_t *last_sample, - int16_t* input_samples, uint32_t in_samples, + int16_t* input_samples, uint32_t in_samples, int16_t* output_samples, uint32_t out_samples) { unsigned int osample; @@ -54,11 +54,11 @@ void _x_audio_out_resample_mono(int16_t *last_sample, int s2; int16_t os; uint32_t t = isample&0xffff; - + /* don't "optimize" the (isample >> 16)*2 to (isample >> 15) */ s1 = input_samples[(isample >> 16)]; s2 = input_samples[(isample >> 16)+1]; - + os = (s1 * (0x10000-t)+ s2 * t) >> 16; output_samples[osample] = os; @@ -68,7 +68,7 @@ void _x_audio_out_resample_mono(int16_t *last_sample, } void _x_audio_out_resample_stereo(int16_t *last_sample, - int16_t* input_samples, uint32_t in_samples, + int16_t* input_samples, uint32_t in_samples, int16_t* output_samples, uint32_t out_samples) { unsigned int osample; @@ -93,17 +93,17 @@ void _x_audio_out_resample_stereo(int16_t *last_sample, int s2; int16_t os; uint32_t t = isample&0xffff; - + /* don't "optimize" the (isample >> 16)*2 to (isample >> 15) */ s1 = input_samples[(isample >> 16)*2]; s2 = input_samples[(isample >> 16)*2+2]; - + os = (s1 * (0x10000-t)+ s2 * t) >> 16; output_samples[osample * 2] = os; s1 = input_samples[(isample >> 16)*2+1]; s2 = input_samples[(isample >> 16)*2+3]; - + os = (s1 * (0x10000-t)+ s2 * t) >> 16; output_samples[(osample * 2 )+1] = os; isample += istep; @@ -113,7 +113,7 @@ void _x_audio_out_resample_stereo(int16_t *last_sample, void _x_audio_out_resample_4channel(int16_t *last_sample, - int16_t* input_samples, uint32_t in_samples, + int16_t* input_samples, uint32_t in_samples, int16_t* output_samples, uint32_t out_samples) { unsigned int osample; @@ -140,29 +140,29 @@ void _x_audio_out_resample_4channel(int16_t *last_sample, int s2; int16_t os; uint32_t t = isample&0xffff; - + /* don't "optimize" the (isample >> 16)*2 to (isample >> 15) */ s1 = input_samples[(isample >> 16)*4]; s2 = input_samples[(isample >> 16)*4+4]; - + os = (s1 * (0x10000-t)+ s2 * t) >> 16; output_samples[osample * 4] = os; s1 = input_samples[(isample >> 16)*4+1]; s2 = input_samples[(isample >> 16)*4+5]; - + os = (s1 * (0x10000-t)+ s2 * t) >> 16; output_samples[(osample * 4 )+1] = os; s1 = input_samples[(isample >> 16)*4+2]; s2 = input_samples[(isample >> 16)*4+6]; - + os = (s1 * (0x10000-t)+ s2 * t) >> 16; output_samples[(osample * 4 )+2] = os; s1 = input_samples[(isample >> 16)*4+3]; s2 = input_samples[(isample >> 16)*4+7]; - + os = (s1 * (0x10000-t)+ s2 * t) >> 16; output_samples[(osample * 4 )+3] = os; @@ -173,7 +173,7 @@ void _x_audio_out_resample_4channel(int16_t *last_sample, void _x_audio_out_resample_5channel(int16_t *last_sample, - int16_t* input_samples, uint32_t in_samples, + int16_t* input_samples, uint32_t in_samples, int16_t* output_samples, uint32_t out_samples) { unsigned int osample; @@ -201,35 +201,35 @@ void _x_audio_out_resample_5channel(int16_t *last_sample, int s2; int16_t os; uint32_t t = isample&0xffff; - + /* don't "optimize" the (isample >> 16)*2 to (isample >> 15) */ s1 = input_samples[(isample >> 16)*5]; s2 = input_samples[(isample >> 16)*5+5]; - + os = (s1 * (0x10000-t)+ s2 * t) >> 16; output_samples[osample * 5] = os; s1 = input_samples[(isample >> 16)*5+1]; s2 = input_samples[(isample >> 16)*5+6]; - + os = (s1 * (0x10000-t)+ s2 * t) >> 16; output_samples[(osample * 5 )+1] = os; s1 = input_samples[(isample >> 16)*5+2]; s2 = input_samples[(isample >> 16)*5+7]; - + os = (s1 * (0x10000-t)+ s2 * t) >> 16; output_samples[(osample * 5 )+2] = os; s1 = input_samples[(isample >> 16)*5+3]; s2 = input_samples[(isample >> 16)*5+8]; - + os = (s1 * (0x10000-t)+ s2 * t) >> 16; output_samples[(osample * 5 )+3] = os; s1 = input_samples[(isample >> 16)*5+4]; s2 = input_samples[(isample >> 16)*5+9]; - + os = (s1 * (0x10000-t)+ s2 * t) >> 16; output_samples[(osample * 5 )+4] = os; @@ -240,7 +240,7 @@ void _x_audio_out_resample_5channel(int16_t *last_sample, void _x_audio_out_resample_6channel(int16_t *last_sample, - int16_t* input_samples, uint32_t in_samples, + int16_t* input_samples, uint32_t in_samples, int16_t* output_samples, uint32_t out_samples) { unsigned int osample; @@ -269,41 +269,41 @@ void _x_audio_out_resample_6channel(int16_t *last_sample, int s2; int16_t os; uint32_t t = isample&0xffff; - + /* don't "optimize" the (isample >> 16)*2 to (isample >> 15) */ s1 = input_samples[(isample >> 16)*6]; s2 = input_samples[(isample >> 16)*6+6]; - + os = (s1 * (0x10000-t)+ s2 * t) >> 16; output_samples[osample * 6] = os; s1 = input_samples[(isample >> 16)*6+1]; s2 = input_samples[(isample >> 16)*6+7]; - + os = (s1 * (0x10000-t)+ s2 * t) >> 16; output_samples[(osample * 6 )+1] = os; s1 = input_samples[(isample >> 16)*6+2]; s2 = input_samples[(isample >> 16)*6+8]; - + os = (s1 * (0x10000-t)+ s2 * t) >> 16; output_samples[(osample * 6 )+2] = os; s1 = input_samples[(isample >> 16)*6+3]; s2 = input_samples[(isample >> 16)*6+9]; - + os = (s1 * (0x10000-t)+ s2 * t) >> 16; output_samples[(osample * 6 )+3] = os; s1 = input_samples[(isample >> 16)*6+4]; s2 = input_samples[(isample >> 16)*6+10]; - + os = (s1 * (0x10000-t)+ s2 * t) >> 16; output_samples[(osample * 6 )+4] = os; s1 = input_samples[(isample >> 16)*6+5]; s2 = input_samples[(isample >> 16)*6+11]; - + os = (s1 * (0x10000-t)+ s2 * t) >> 16; output_samples[(osample * 6 )+5] = os; @@ -312,48 +312,48 @@ void _x_audio_out_resample_6channel(int16_t *last_sample, memcpy (last_sample, &input_samples[in_samples*6-6], 6 * sizeof (last_sample[0])); } -void _x_audio_out_resample_8to16(int8_t* input_samples, +void _x_audio_out_resample_8to16(int8_t* input_samples, int16_t* output_samples, uint32_t samples) { while( samples-- ) { int16_t os; - + os = *input_samples++; os = (os - 0x80) << 8; *output_samples++ = os; } } -void _x_audio_out_resample_16to8(int16_t* input_samples, +void _x_audio_out_resample_16to8(int16_t* input_samples, int8_t* output_samples, uint32_t samples) { while( samples-- ) { int16_t os; - + os = *input_samples++; os = (os >> 8) + 0x80; *output_samples++ = os; } } -void _x_audio_out_resample_monotostereo(int16_t* input_samples, +void _x_audio_out_resample_monotostereo(int16_t* input_samples, int16_t* output_samples, uint32_t frames) { while( frames-- ) { int16_t os; - + os = *input_samples++; *output_samples++ = os; *output_samples++ = os; } } -void _x_audio_out_resample_stereotomono(int16_t* input_samples, +void _x_audio_out_resample_stereotomono(int16_t* input_samples, int16_t* output_samples, uint32_t frames) { while( frames-- ) { int16_t os; - + os = (*input_samples++)>>1; os += (*input_samples++)>>1; *output_samples++ = os; diff --git a/src/xine-engine/resample.h b/src/xine-engine/resample.h index 40b4de486..842434cf0 100644 --- a/src/xine-engine/resample.h +++ b/src/xine-engine/resample.h @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -28,35 +28,35 @@ #define RESAMPLE_MAX_CHANNELS 6 void _x_audio_out_resample_stereo(int16_t* last_sample, - int16_t* input_samples, uint32_t in_samples, + int16_t* input_samples, uint32_t in_samples, int16_t* output_samples, uint32_t out_samples) XINE_PROTECTED; void _x_audio_out_resample_mono(int16_t* last_sample, - int16_t* input_samples, uint32_t in_samples, + int16_t* input_samples, uint32_t in_samples, int16_t* output_samples, uint32_t out_samples) XINE_PROTECTED; void _x_audio_out_resample_4channel(int16_t* last_sample, - int16_t* input_samples, uint32_t in_samples, + int16_t* input_samples, uint32_t in_samples, int16_t* output_samples, uint32_t out_samples) XINE_PROTECTED; void _x_audio_out_resample_5channel(int16_t* last_sample, - int16_t* input_samples, uint32_t in_samples, + int16_t* input_samples, uint32_t in_samples, int16_t* output_samples, uint32_t out_samples) XINE_PROTECTED; void _x_audio_out_resample_6channel(int16_t* last_sample, - int16_t* input_samples, uint32_t in_samples, + int16_t* input_samples, uint32_t in_samples, int16_t* output_samples, uint32_t out_samples) XINE_PROTECTED; -void _x_audio_out_resample_8to16(int8_t* input_samples, +void _x_audio_out_resample_8to16(int8_t* input_samples, int16_t* output_samples, uint32_t samples) XINE_PROTECTED; -void _x_audio_out_resample_16to8(int16_t* input_samples, +void _x_audio_out_resample_16to8(int16_t* input_samples, int8_t* output_samples, uint32_t samples) XINE_PROTECTED; -void _x_audio_out_resample_monotostereo(int16_t* input_samples, +void _x_audio_out_resample_monotostereo(int16_t* input_samples, int16_t* output_samples, uint32_t frames) XINE_PROTECTED; -void _x_audio_out_resample_stereotomono(int16_t* input_samples, +void _x_audio_out_resample_stereotomono(int16_t* input_samples, int16_t* output_samples, uint32_t frames) XINE_PROTECTED; - + #endif diff --git a/src/xine-engine/scratch.c b/src/xine-engine/scratch.c index 980af2f71..39bb5927a 100644 --- a/src/xine-engine/scratch.c +++ b/src/xine-engine/scratch.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -85,14 +85,14 @@ static char **scratch_get_content (scratch_buffer_t *this) { static void scratch_dispose (scratch_buffer_t *this) { int i; - + pthread_mutex_lock (&this->lock); for(i = 0; i < this->num_lines; i++ ) { free(this->ordered[i]); free(this->lines[i]); } - + free (this->lines); free (this->ordered); diff --git a/src/xine-engine/scratch.h b/src/xine-engine/scratch.h index c45af198f..c0c927b97 100644 --- a/src/xine-engine/scratch.h +++ b/src/xine-engine/scratch.h @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2006 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA diff --git a/src/xine-engine/spu_decoder.h b/src/xine-engine/spu_decoder.h index 66ab5e54a..4897a32a2 100644 --- a/src/xine-engine/spu_decoder.h +++ b/src/xine-engine/spu_decoder.h @@ -4,7 +4,7 @@ * Copyright (C) James Courtier-Dutton James@superbug.demon.co.uk - July 2001 * * This file is part of xine, a unix video player. - * + * * xine 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 @@ -14,10 +14,10 @@ * 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, + * the Free Software Foundation, * */ @@ -47,30 +47,30 @@ struct spu_decoder_class_s { * open a new instance of this plugin class */ spu_decoder_t* (*open_plugin) (spu_decoder_class_t *this, xine_stream_t *stream); - + /* * return short, human readable identifier for this plugin class */ char* (*get_identifier) (spu_decoder_class_t *this); /* - * return human readable (verbose = 1 line) description for + * return human readable (verbose = 1 line) description for * this plugin class */ char* (*get_description) (spu_decoder_class_t *this); - + /* * free all class-related resources */ void (*dispose) (spu_decoder_class_t *this); }; - - + + struct spu_decoder_s { /* * decode data from buf and feed the overlay to overlay manager - */ + */ void (*decode_data) (spu_decoder_t *this, buf_element_t *buf); /* @@ -78,7 +78,7 @@ struct spu_decoder_s { * SPU data not related to recently decoded data) */ void (*reset) (spu_decoder_t *this); - + /* * inform decoder that a time reference discontinuity has happened. * that is, it must forget any currently held pts value diff --git a/src/xine-engine/tvmode.c b/src/xine-engine/tvmode.c index 099bdb808..1d6660f4f 100644 --- a/src/xine-engine/tvmode.c +++ b/src/xine-engine/tvmode.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA diff --git a/src/xine-engine/video_decoder.c b/src/xine-engine/video_decoder.c index d3c9e0d34..0756fc5b2 100644 --- a/src/xine-engine/video_decoder.c +++ b/src/xine-engine/video_decoder.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2005 the xine project * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -45,13 +45,13 @@ static void update_spu_decoder (xine_stream_t *stream, int type) { int streamtype = (type>>16) & 0xFF; - + if( stream->spu_decoder_streamtype != streamtype || !stream->spu_decoder_plugin ) { - + if (stream->spu_decoder_plugin) _x_free_spu_decoder (stream, stream->spu_decoder_plugin); - + stream->spu_decoder_streamtype = streamtype; stream->spu_decoder_plugin = _x_get_spu_decoder (stream, streamtype); @@ -63,27 +63,27 @@ int _x_spu_decoder_sleep(xine_stream_t *stream, int64_t next_spu_vpts) { int64_t time, wait; int thread_vacant = 1; - + /* we wait until one second before the next SPU is due */ next_spu_vpts -= 90000; - + do { if (next_spu_vpts) time = stream->xine->clock->get_current_time(stream->xine->clock); else time = 0; - + /* wait in pieces of one half second */ if (next_spu_vpts - time < SPU_SLEEP_INTERVAL) wait = next_spu_vpts - time; else wait = SPU_SLEEP_INTERVAL; - + if (wait > 0) xine_usec_sleep(wait * 11); - + if (stream->xine->port_ticket->ticket_revoked) stream->xine->port_ticket->renew(stream->xine->port_ticket, 0); - + /* never wait, if we share the thread with a video decoder */ thread_vacant = !stream->video_decoder_plugin; /* we have to return if video out calls for the decoder */ @@ -92,9 +92,9 @@ int _x_spu_decoder_sleep(xine_stream_t *stream, int64_t next_spu_vpts) /* we have to return if the demuxer needs us to release a buffer */ if (thread_vacant) thread_vacant = !stream->demux_action_pending; - + } while (wait == SPU_SLEEP_INTERVAL && thread_vacant); - + return thread_vacant; } @@ -117,7 +117,7 @@ static void *video_decoder_loop (void *stream_gen) { */ nice(-1); #endif /* WIN32 */ - + if (prof_video_decode == -1) prof_video_decode = xine_profiler_allocate_slot ("video decoder"); if (prof_spu_decode == -1) @@ -125,15 +125,15 @@ static void *video_decoder_loop (void *stream_gen) { while (running) { - lprintf ("getting buffer...\n"); + lprintf ("getting buffer...\n"); buf = stream->video_fifo->get (stream->video_fifo); - + _x_extra_info_merge( stream->video_decoder_extra_info, buf->extra_info ); stream->video_decoder_extra_info->seek_count = stream->video_seek_count; - - lprintf ("got buffer 0x%08x\n", buf->type); - + + lprintf ("got buffer 0x%08x\n", buf->type); + switch (buf->type & 0xffff0000) { case BUF_CONTROL_HEADERS_DONE: pthread_mutex_lock (&stream->counter_lock); @@ -143,34 +143,34 @@ static void *video_decoder_loop (void *stream_gen) { break; case BUF_CONTROL_START: - + /* decoder dispose might call port functions */ running_ticket->acquire(running_ticket, 0); - + if (stream->video_decoder_plugin) { _x_free_video_decoder (stream, stream->video_decoder_plugin); stream->video_decoder_plugin = NULL; } - + if (stream->spu_decoder_plugin) { _x_free_spu_decoder (stream, stream->spu_decoder_plugin); stream->spu_decoder_plugin = NULL; stream->spu_track_map_entries = 0; } - + running_ticket->release(running_ticket, 0); - + if( !(buf->decoder_flags & BUF_FLAG_GAPLESS_SW) ) - stream->metronom->handle_video_discontinuity (stream->metronom, + stream->metronom->handle_video_discontinuity (stream->metronom, DISC_STREAMSTART, 0); - + buftype_unknown = 0; break; case BUF_CONTROL_SPU_CHANNEL: { xine_event_t ui_event; - + /* We use widescreen spu as the auto selection, because widescreen * display is common. SPU decoders can choose differently if it suits * them. */ @@ -179,7 +179,7 @@ static void *video_decoder_loop (void *stream_gen) { stream->spu_channel_pan_scan = buf->decoder_info[2]; if (stream->spu_channel_user == -1) stream->spu_channel = stream->spu_channel_auto; - + /* Inform UI of SPU channel changes */ ui_event.type = XINE_EVENT_UI_CHANNELS_CHANGED; ui_event.data_length = 0; @@ -189,7 +189,7 @@ static void *video_decoder_loop (void *stream_gen) { break; case BUF_CONTROL_END: - + /* flush decoder frames if stream finished naturally (non-user stop) */ if( buf->decoder_flags ) { running_ticket->acquire(running_ticket, 0); @@ -210,12 +210,12 @@ static void *video_decoder_loop (void *stream_gen) { */ while(1) { int num_bufs, num_streams; - + running_ticket->acquire(running_ticket, 0); num_bufs = stream->video_out->get_property(stream->video_out, VO_PROP_BUFS_IN_FIFO); num_streams = stream->video_out->get_property(stream->video_out, VO_PROP_NUM_STREAMS); running_ticket->release(running_ticket, 0); - + if( num_bufs > 0 && num_streams == 1 && !stream->early_finish_event && stream->master == stream ) xine_usec_sleep (10000); @@ -229,7 +229,7 @@ static void *video_decoder_loop (void *stream_gen) { stream->finished_count_video++; - lprintf ("reached end marker # %d\n", + lprintf ("reached end marker # %d\n", stream->finished_count_video); pthread_cond_broadcast (&stream->counter_changed); @@ -246,7 +246,7 @@ static void *video_decoder_loop (void *stream_gen) { pthread_cond_timedwait (&stream->counter_changed, &stream->counter_lock, &ts); } } - + pthread_mutex_unlock (&stream->counter_lock); /* Wake up xine_play if it's waiting for a frame */ @@ -261,7 +261,7 @@ static void *video_decoder_loop (void *stream_gen) { case BUF_CONTROL_QUIT: /* decoder dispose might call port functions */ running_ticket->acquire(running_ticket, 0); - + if (stream->video_decoder_plugin) { _x_free_video_decoder (stream, stream->video_decoder_plugin); stream->video_decoder_plugin = NULL; @@ -297,7 +297,7 @@ static void *video_decoder_loop (void *stream_gen) { running_ticket->release(running_ticket, 0); } break; - + case BUF_CONTROL_DISCONTINUITY: lprintf ("discontinuity ahead\n"); @@ -309,11 +309,11 @@ static void *video_decoder_loop (void *stream_gen) { stream->video_decoder_plugin->discontinuity (stream->video_decoder_plugin); running_ticket->release(running_ticket, 0); } - + stream->metronom->handle_video_discontinuity (stream->metronom, DISC_RELATIVE, buf->disc_off); break; - + case BUF_CONTROL_NEWPTS: lprintf ("new pts %"PRId64"\n", buf->disc_off); @@ -325,14 +325,14 @@ static void *video_decoder_loop (void *stream_gen) { stream->video_decoder_plugin->discontinuity (stream->video_decoder_plugin); running_ticket->release(running_ticket, 0); } - + if (buf->decoder_flags & BUF_FLAG_SEEK) { stream->metronom->handle_video_discontinuity (stream->metronom, DISC_STREAMSEEK, buf->disc_off); } else { stream->metronom->handle_video_discontinuity (stream->metronom, DISC_ABSOLUTE, buf->disc_off); - } + } break; - + case BUF_CONTROL_AUDIO_CHANNEL: { xine_event_t ui_event; @@ -345,7 +345,7 @@ static void *video_decoder_loop (void *stream_gen) { case BUF_CONTROL_NOP: break; - + default: if ( (buf->type & 0xFF000000) == BUF_VIDEO_BASE ) { @@ -354,43 +354,43 @@ static void *video_decoder_loop (void *stream_gen) { break; xine_profiler_start_count (prof_video_decode); - + running_ticket->acquire(running_ticket, 0); - + /* - printf ("video_decoder: got package %d, decoder_info[0]:%d\n", + printf ("video_decoder: got package %d, decoder_info[0]:%d\n", buf, buf->decoder_info[0]); - */ - + */ + streamtype = (buf->type>>16) & 0xFF; - + if( buf->type != buftype_unknown && (stream->video_decoder_streamtype != streamtype || !stream->video_decoder_plugin) ) { - + if (stream->video_decoder_plugin) { _x_free_video_decoder (stream, stream->video_decoder_plugin); } - + stream->video_decoder_streamtype = streamtype; stream->video_decoder_plugin = _x_get_video_decoder (stream, streamtype); - + _x_stream_info_set(stream, XINE_STREAM_INFO_VIDEO_HANDLED, (stream->video_decoder_plugin != NULL)); } if (stream->video_decoder_plugin) - stream->video_decoder_plugin->decode_data (stream->video_decoder_plugin, buf); - - if (buf->type != buftype_unknown && + stream->video_decoder_plugin->decode_data (stream->video_decoder_plugin, buf); + + if (buf->type != buftype_unknown && !_x_stream_info_get(stream, XINE_STREAM_INFO_VIDEO_HANDLED)) { - xine_log (stream->xine, XINE_LOG_MSG, + xine_log (stream->xine, XINE_LOG_MSG, _("video_decoder: no plugin available to handle '%s'\n"), _x_buf_video_name( buf->type ) ); - + if( !_x_meta_info_get(stream, XINE_META_INFO_VIDEOCODEC)) _x_meta_info_set_utf8(stream, XINE_META_INFO_VIDEOCODEC, _x_buf_video_name( buf->type )); - + buftype_unknown = buf->type; - + /* fatal error - dispose plugin */ if (stream->video_decoder_plugin) { _x_free_video_decoder (stream, stream->video_decoder_plugin); @@ -401,7 +401,7 @@ static void *video_decoder_loop (void *stream_gen) { if (running_ticket->ticket_revoked) running_ticket->renew(running_ticket, 0); running_ticket->release(running_ticket, 0); - + xine_profiler_stop_count (prof_video_decode); } else if ( (buf->type & 0xFF000000) == BUF_SPU_BASE ) { @@ -414,15 +414,15 @@ static void *video_decoder_loop (void *stream_gen) { xine_profiler_start_count (prof_spu_decode); running_ticket->acquire(running_ticket, 0); - + update_spu_decoder(stream, buf->type); /* update track map */ i = 0; - while ( (i<stream->spu_track_map_entries) && (stream->spu_track_map[i]<buf->type) ) + while ( (i<stream->spu_track_map_entries) && (stream->spu_track_map[i]<buf->type) ) i++; - + if ( (i==stream->spu_track_map_entries) || (stream->spu_track_map[i] != buf->type) ) { xine_event_t ui_event; @@ -458,15 +458,15 @@ static void *video_decoder_loop (void *stream_gen) { if (running_ticket->ticket_revoked) running_ticket->renew(running_ticket, 0); running_ticket->release(running_ticket, 0); - + xine_profiler_stop_count (prof_spu_decode); } else if (buf->type != buftype_unknown) { - xine_log (stream->xine, XINE_LOG_MSG, + xine_log (stream->xine, XINE_LOG_MSG, _("video_decoder: error, unknown buffer type: %08x\n"), buf->type ); buftype_unknown = buf->type; } - + break; } @@ -478,13 +478,13 @@ static void *video_decoder_loop (void *stream_gen) { } int _x_video_decoder_init (xine_stream_t *stream) { - + if (stream->video_out == NULL) { stream->video_fifo = _x_dummy_fifo_buffer_new (5, 8192); stream->spu_track_map_entries = 0; return 1; } else { - + pthread_attr_t pth_attrs; struct sched_param pth_params; int err, num_buffers; @@ -495,7 +495,7 @@ int _x_video_decoder_init (xine_stream_t *stream) { * We provide buffers of 8k size instead of 2k for demuxers sending * larger chunks. */ - + num_buffers = stream->xine->config->register_num (stream->xine->config, "engine.buffers.video_num_buffers", 500, @@ -505,15 +505,15 @@ int _x_video_decoder_init (xine_stream_t *stream) { "mean smoother playback for unreliable inputs, but " "also increased latency and memory consumption."), 20, NULL, NULL); - + stream->video_fifo = _x_fifo_buffer_new (num_buffers, 8192); if (stream->video_fifo == NULL) { xine_log(stream->xine, XINE_LOG_MSG, "video_decoder: can't allocated video fifo\n"); return 0; } - + stream->spu_track_map_entries = 0; - + pthread_attr_init(&pth_attrs); pthread_attr_getschedparam(&pth_attrs, &pth_params); pth_params.sched_priority = sched_get_priority_min(SCHED_OTHER); @@ -529,7 +529,7 @@ int _x_video_decoder_init (xine_stream_t *stream) { pthread_attr_destroy(&pth_attrs); return 0; } - + pthread_attr_destroy(&pth_attrs); } return 1; @@ -561,7 +561,7 @@ void _x_video_decoder_shutdown (xine_stream_t *stream) { lprintf ("shutdown...4\n"); } - + stream->video_fifo->dispose (stream->video_fifo); stream->video_fifo = NULL; } diff --git a/src/xine-engine/video_decoder.h b/src/xine-engine/video_decoder.h index 7b13159a3..f7068cc13 100644 --- a/src/xine-engine/video_decoder.h +++ b/src/xine-engine/video_decoder.h @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -47,14 +47,14 @@ struct video_decoder_class_s { * open a new instance of this plugin class */ video_decoder_t* (*open_plugin) (video_decoder_class_t *this, xine_stream_t *stream); - + /* * return short, human readable identifier for this plugin class */ char* (*get_identifier) (video_decoder_class_t *this); /* - * return human readable (verbose = 1 line) description for + * return human readable (verbose = 1 line) description for * this plugin class */ char* (*get_description) (video_decoder_class_t *this); @@ -69,8 +69,8 @@ struct video_decoder_class_s { struct video_decoder_s { /* - * decode data from buf and feed decoded frames to - * video output + * decode data from buf and feed decoded frames to + * video output */ void (*decode_data) (video_decoder_t *this, buf_element_t *buf); @@ -79,13 +79,13 @@ struct video_decoder_s { * video data not related to recently decoded data) */ void (*reset) (video_decoder_t *this); - + /* * inform decoder that a time reference discontinuity has happened. * that is, it must forget any currently held pts value */ void (*discontinuity) (video_decoder_t *this); - + /* * flush out any frames that are still stored in the decoder */ @@ -94,7 +94,7 @@ struct video_decoder_s { /* * close down, free all resources */ - void (*dispose) (video_decoder_t *this); + void (*dispose) (video_decoder_t *this); void *node; /*used by plugin loader */ diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c index be062cc5d..1ecd59225 100644 --- a/src/xine-engine/video_out.c +++ b/src/xine-engine/video_out.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -57,10 +57,10 @@ #define FIRST_FRAME_POLL_DELAY 3000 #define FIRST_FRAME_MAX_POLL 10 /* poll n times at most */ -/* experimental optimization: try to allocate frames from free queue +/* experimental optimization: try to allocate frames from free queue * in the same format as requested (avoid unnecessary free/alloc in * vo driver). up to 25% less cpu load using deinterlace with film mode. - */ + */ #define EXPERIMENTAL_FRAME_QUEUE_OPTIMIZATION 1 static vo_frame_t * crop_frame( xine_video_port_t *this_gen, vo_frame_t *img ); @@ -77,7 +77,7 @@ typedef struct { } img_buf_fifo_t; typedef struct { - + xine_video_port_t vo; /* public part */ vo_driver_t *driver; @@ -86,7 +86,7 @@ typedef struct { metronom_clock_t *clock; xine_list_t *streams; pthread_mutex_t streams_lock; - + img_buf_fifo_t *free_img_buf_queue; img_buf_fifo_t *display_img_buf_queue; @@ -105,7 +105,7 @@ typedef struct { uint32_t redraw_needed:3; int discard_frames; - + pthread_t video_thread; int num_frames_delivered; @@ -118,7 +118,7 @@ typedef struct { int warn_threshold_exceeded; /* pts value when decoder delivered last video frame */ - int64_t last_delivery_pts; + int64_t last_delivery_pts; video_overlay_manager_t *overlay_source; @@ -215,7 +215,7 @@ static vo_frame_t *vo_remove_from_img_buf_queue_int (img_buf_fifo_t *queue, int img = img->next; i++; } - + if( width && height ) { if( !img ) { if( queue->num_buffers == 1 && !blocking && queue->num_buffers_max > 8) { @@ -263,7 +263,7 @@ static vo_frame_t *vo_remove_from_img_buf_queue_int (img_buf_fifo_t *queue, int if( img == queue->last ) queue->last = previous; } - + img->next = NULL; if (!queue->first) { queue->last = NULL; @@ -272,7 +272,7 @@ static vo_frame_t *vo_remove_from_img_buf_queue_int (img_buf_fifo_t *queue, int queue->num_buffers--; } } - + return img; } @@ -303,7 +303,7 @@ static vo_frame_t *vo_remove_from_img_buf_queue_nonblock (img_buf_fifo_t *queue, * functions to maintain lock_counter */ static void vo_frame_inc_lock (vo_frame_t *img) { - + pthread_mutex_lock (&img->mutex); img->lock_counter++; @@ -312,11 +312,11 @@ static void vo_frame_inc_lock (vo_frame_t *img) { } static void vo_frame_dec_lock (vo_frame_t *img) { - + pthread_mutex_lock (&img->mutex); img->lock_counter--; - if (!img->lock_counter) { + if (!img->lock_counter) { vos_t *this = (vos_t *) img->port; if (img->stream) _x_refcounter_dec(img->stream->refcounter); @@ -333,11 +333,11 @@ static void vo_frame_driver_proc(vo_frame_t *img) img->proc_frame(img); } if (img->proc_called) return; - + if (img->proc_slice) { int height = img->height; uint8_t* src[3]; - + switch (img->format) { case XINE_IMGFMT_YV12: src[0] = img->base[0]; @@ -362,7 +362,7 @@ static void vo_frame_driver_proc(vo_frame_t *img) } /* - * + * * functions called by video decoder: * * get_frame => alloc frame for rendering @@ -393,7 +393,7 @@ static vo_frame_t *vo_get_frame (xine_video_port_t *this_gen, /* some decoders report strange ratios */ if (ratio <= 0.0) ratio = (double)width / (double)height; - + pthread_mutex_lock (&img->mutex); img->lock_counter = 1; img->width = width; @@ -418,11 +418,11 @@ static vo_frame_t *vo_get_frame (xine_video_port_t *this_gen, /* let driver ensure this image has the right format */ - this->driver->update_frame_format (this->driver, img, width, height, + this->driver->update_frame_format (this->driver, img, width, height, ratio, format, flags); pthread_mutex_unlock (&img->mutex); - + lprintf ("get_frame (%d x %d) done\n", width, height); return img; @@ -439,11 +439,11 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) { /* handle anonymous streams like NULL for easy checking */ if (stream == XINE_ANON_STREAM) stream = NULL; - + img->stream = stream; this->current_width = img->width; this->current_height = img->height; - + if (stream) { _x_refcounter_inc(stream->refcounter); _x_extra_info_merge( img->extra_info, stream->video_decoder_extra_info ); @@ -465,13 +465,13 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) { this->num_frames_delivered++; diff = pic_vpts - cur_vpts; - + /* avoid division by zero */ if( img->duration <= 0 ) duration = DEFAULT_FRAME_DURATION; else duration = img->duration; - + /* Frame dropping slow start: * The engine starts to drop frames if there are less than frame_drop_limit * frames in advance. There might be a problem just after a seek because @@ -497,7 +497,7 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) { if (this->display_img_buf_queue->num_buffers >= this->frame_drop_limit || frames_to_skip < 0) frames_to_skip = 0; - + /* Do not drop frames immediately, but remember this as suggestion and give * decoder a further chance to supply frames. * This avoids unnecessary frame drops in situations where there is only @@ -515,7 +515,7 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) { lprintf ("delivery diff : %" PRId64 ", current vpts is %" PRId64 ", %d frames to skip\n", diff, cur_vpts, frames_to_skip); - + } else { frames_to_skip = 0; @@ -528,18 +528,18 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) { if (!img->bad_frame) { - + int img_already_locked = 0; xine_list_iterator_t ite; - + /* add cropping requested by frontend */ img->crop_left += this->crop_left; img->crop_right += this->crop_right; img->crop_top += this->crop_top; img->crop_bottom += this->crop_bottom; - + /* perform cropping when vo driver does not support it */ - if( (img->crop_left || img->crop_top || + if( (img->crop_left || img->crop_top || img->crop_right || img->crop_bottom) && (this->grab_only || !(this->driver->get_capabilities (this->driver) & VO_CAP_CROP)) ) { @@ -556,11 +556,11 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) { img->crop_bottom = 0; } } - + /* do not call proc_*() for frames that will be dropped */ if( !frames_to_skip && !img->proc_called ) vo_frame_driver_proc(img); - + /* * put frame into FIFO-Buffer */ @@ -594,7 +594,7 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) { if (!img_already_locked) vo_frame_inc_lock( img ); vo_append_to_img_buf_queue (this->display_img_buf_queue, img); - + } else { lprintf ("bad_frame\n"); @@ -626,7 +626,7 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) { /* make sure threshold has being consistently exceeded - 5 times in a row * (that is, this is not just a small burst of dropped frames). */ - send_event = (this->warn_threshold_exceeded == 5 && + send_event = (this->warn_threshold_exceeded == 5 && !this->warn_threshold_event_sent); this->warn_threshold_event_sent = send_event; @@ -635,7 +635,7 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) { ite = xine_list_next(this->streams, ite)) { stream = xine_list_get_value(this->streams, ite); if (stream == XINE_ANON_STREAM) continue; - _x_stream_info_set(stream, XINE_STREAM_INFO_SKIPPED_FRAMES, + _x_stream_info_set(stream, XINE_STREAM_INFO_SKIPPED_FRAMES, 1000 * this->num_frames_skipped / this->num_frames_delivered); _x_stream_info_set(stream, XINE_STREAM_INFO_DISCARDED_FRAMES, 1000 * this->num_frames_discarded / this->num_frames_delivered); @@ -663,8 +663,8 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) { if( this->num_frames_skipped || this->num_frames_discarded ) { xine_log(this->xine, XINE_LOG_MSG, - _("%d frames delivered, %d frames skipped, %d frames discarded\n"), - this->num_frames_delivered, + _("%d frames delivered, %d frames skipped, %d frames discarded\n"), + this->num_frames_delivered, this->num_frames_skipped, this->num_frames_discarded); } @@ -672,7 +672,7 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) { this->num_frames_discarded = 0; this->num_frames_skipped = 0; } - + return frames_to_skip; } @@ -682,9 +682,9 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) { * */ -/* duplicate_frame(): this function is used to keep playing frames - * while video is still or player paused. - * +/* duplicate_frame(): this function is used to keep playing frames + * while video is still or player paused. + * * frame allocation inside vo loop is dangerous: * we must never wait for a free frame -> deadlock condition. * to avoid deadlocks we don't use vo_remove_from_img_buf_queue() @@ -709,7 +709,7 @@ static vo_frame_t * duplicate_frame( vos_t *this, vo_frame_t *img ) { else { this->free_img_buf_queue->num_buffers--; } - + pthread_mutex_lock (&dupl->mutex); dupl->lock_counter = 1; dupl->width = img->width; @@ -726,16 +726,16 @@ static vo_frame_t * duplicate_frame( vos_t *this, vo_frame_t *img ) { dupl->crop_bottom = img->crop_bottom; dupl->overlay_offset_x = img->overlay_offset_x; dupl->overlay_offset_y = img->overlay_offset_y; - - this->driver->update_frame_format (this->driver, dupl, dupl->width, dupl->height, + + this->driver->update_frame_format (this->driver, dupl, dupl->width, dupl->height, dupl->ratio, dupl->format, dupl->flags); pthread_mutex_unlock (&dupl->mutex); - + if (dupl->proc_duplicate_frame_data) { dupl->proc_duplicate_frame_data(dupl,img); } else { - + switch (img->format) { case XINE_IMGFMT_YV12: yv12_to_yv12( @@ -761,8 +761,8 @@ static vo_frame_t * duplicate_frame( vos_t *this, vo_frame_t *img ) { img->width, img->height); break; } - } - + } + dupl->bad_frame = 0; dupl->pts = 0; dupl->vpts = 0; @@ -773,10 +773,10 @@ static vo_frame_t * duplicate_frame( vos_t *this, vo_frame_t *img ) { dupl->stream = NULL; memcpy( dupl->extra_info, img->extra_info, sizeof(extra_info_t) ); - + /* delay frame processing for now, we might not even need it (eg. frame will be discarded) */ /* vo_frame_driver_proc(dupl); */ - + return dupl; } @@ -789,7 +789,7 @@ static void expire_frames (vos_t *this, int64_t cur_vpts) { int duration; pthread_mutex_lock(&this->display_img_buf_queue->mutex); - + img = this->display_img_buf_queue->first; /* @@ -806,7 +806,7 @@ static void expire_frames (vos_t *this, int64_t cur_vpts) { /* * before displaying the first frame without - * "metronom prebuffering" we should make sure it's + * "metronom prebuffering" we should make sure it's * not used as a decoder reference anymore. */ if( img->lock_counter == 1 ) { @@ -828,21 +828,21 @@ static void expire_frames (vos_t *this, int64_t cur_vpts) { duration = DEFAULT_FRAME_DURATION; } else duration = img->duration; - + pts = img->vpts; diff = cur_vpts - pts; - + if (diff > duration || this->discard_frames) { - + if( !this->discard_frames ) { xine_log(this->xine, XINE_LOG_MSG, _("video_out: throwing away image with pts %" PRId64 " because it's too old (diff : %" PRId64 ").\n"), pts, diff); this->num_frames_discarded++; } - + img = vo_remove_from_img_buf_queue_int (this->display_img_buf_queue, 1, 0, 0, 0, 0, 0); - + if (img->stream) { pthread_mutex_lock( &img->stream->current_extra_info_lock ); _x_extra_info_merge( img->stream->current_extra_info, img->extra_info ); @@ -851,21 +851,21 @@ static void expire_frames (vos_t *this, int64_t cur_vpts) { /* when flushing frames, keep the first one as backup */ if( this->discard_frames ) { - + if (!this->img_backup) { this->img_backup = img; } else { vo_frame_dec_lock( img ); - } - + } + } else { /* - * last frame? back it up for + * last frame? back it up for * still frame creation */ - + if (!this->display_img_buf_queue->first) { - + if (this->img_backup) { lprintf("overwriting frame backup\n"); @@ -875,20 +875,20 @@ static void expire_frames (vos_t *this, int64_t cur_vpts) { lprintf("possible still frame (old)\n"); this->img_backup = img; - - /* wait 4 frames before drawing this one. + + /* wait 4 frames before drawing this one. this allow slower systems to recover. */ - this->redraw_needed = 4; + this->redraw_needed = 4; } else { vo_frame_dec_lock( img ); } } img = this->display_img_buf_queue->first; - + } else break; } - + pthread_mutex_unlock(&this->display_img_buf_queue->mutex); } @@ -897,16 +897,16 @@ static void expire_frames (vos_t *this, int64_t cur_vpts) { */ static vo_frame_t *get_next_frame (vos_t *this, int64_t cur_vpts, int64_t *next_frame_vpts) { - + vo_frame_t *img; pthread_mutex_lock(&this->display_img_buf_queue->mutex); - + img = this->display_img_buf_queue->first; *next_frame_vpts = 0; - /* + /* * still frame detection: */ @@ -931,11 +931,11 @@ static vo_frame_t *get_next_frame (vos_t *this, int64_t cur_vpts, /* extra info of the backup is thrown away, because it is not up to date */ _x_extra_info_reset(img->extra_info); } - + return img; } else { - + if( this->redraw_needed ) this->redraw_needed--; @@ -967,13 +967,13 @@ static vo_frame_t *get_next_frame (vos_t *this, int64_t cur_vpts, vo_frame_dec_lock( this->img_backup ); this->img_backup = NULL; } - - /* - * last frame? make backup for possible still image + + /* + * last frame? make backup for possible still image */ pthread_mutex_lock( &this->free_img_buf_queue->mutex ); if (img && !img->next) { - + if (!img->stream || _x_stream_info_get(img->stream, XINE_STREAM_INFO_VIDEO_HAS_STILL) || !img->stream->video_fifo || @@ -989,7 +989,7 @@ static vo_frame_t *get_next_frame (vos_t *this, int64_t cur_vpts, /* * remove frame from display queue and show it */ - + img = vo_remove_from_img_buf_queue_int (this->display_img_buf_queue, 1, 0, 0, 0, 0, 0); pthread_mutex_unlock(&this->display_img_buf_queue->mutex); @@ -997,7 +997,7 @@ static vo_frame_t *get_next_frame (vos_t *this, int64_t cur_vpts, } } -static void overlay_and_display_frame (vos_t *this, +static void overlay_and_display_frame (vos_t *this, vo_frame_t *img, int64_t vpts) { xine_stream_t *stream; xine_list_iterator_t ite; @@ -1009,19 +1009,19 @@ static void overlay_and_display_frame (vos_t *this, */ if(!img->proc_called ) vo_frame_driver_proc(img); - + if (img->stream) { int64_t diff; pthread_mutex_lock( &img->stream->current_extra_info_lock ); diff = img->extra_info->vpts - img->stream->current_extra_info->vpts; - if ((diff > 3000) || (diff<-300000)) + if ((diff > 3000) || (diff<-300000)) _x_extra_info_merge( img->stream->current_extra_info, img->extra_info ); pthread_mutex_unlock( &img->stream->current_extra_info_lock ); } if (this->overlay_source) { - this->overlay_source->multiple_overlay_blend (this->overlay_source, - vpts, + this->overlay_source->multiple_overlay_blend (this->overlay_source, + vpts, this->driver, img, this->video_loop_running && this->overlay_enabled); } @@ -1034,7 +1034,7 @@ static void overlay_and_display_frame (vos_t *this, this->last_frame = img; this->driver->display_frame (this->driver, img); - + /* * Wake up xine_play if it's waiting for a frame */ @@ -1054,16 +1054,16 @@ static void overlay_and_display_frame (vos_t *this, pthread_mutex_unlock(&this->streams_lock); } - this->redraw_needed = 0; + this->redraw_needed = 0; } static void check_redraw_needed (vos_t *this, int64_t vpts) { if (this->overlay_source) { if( this->overlay_source->redraw_needed (this->overlay_source, vpts) ) - this->redraw_needed = 1; + this->redraw_needed = 1; } - + if( this->driver->redraw_needed (this->driver) ) this->redraw_needed = 1; } @@ -1071,36 +1071,36 @@ static void check_redraw_needed (vos_t *this, int64_t vpts) { /* special loop for paused mode * needed to update screen due overlay changes, resize, window * movement, brightness adjusting etc. - */ + */ static void paused_loop( vos_t *this, int64_t vpts ) { vo_frame_t *img; - + pthread_mutex_lock( &this->free_img_buf_queue->mutex ); /* prevent decoder thread from allocating new frames */ this->free_img_buf_queue->locked_for_read = 1; - + while (this->clock->speed == XINE_SPEED_PAUSE && this->video_loop_running) { - + /* we need at least one free frame to keep going */ if( this->display_img_buf_queue->first && !this->free_img_buf_queue->first ) { - + img = vo_remove_from_img_buf_queue (this->display_img_buf_queue); img->next = NULL; this->free_img_buf_queue->first = img; this->free_img_buf_queue->last = img; this->free_img_buf_queue->num_buffers = 1; } - + /* set img_backup to play the same frame several times */ if( this->display_img_buf_queue->first && !this->img_backup ) { this->img_backup = vo_remove_from_img_buf_queue (this->display_img_buf_queue); this->redraw_needed = 1; } - + check_redraw_needed( this, vpts ); - + if( this->redraw_needed && this->img_backup ) { img = duplicate_frame (this, this->img_backup ); if( img ) { @@ -1109,16 +1109,16 @@ static void paused_loop( vos_t *this, int64_t vpts ) pthread_mutex_unlock( &this->free_img_buf_queue->mutex ); overlay_and_display_frame (this, img, vpts); pthread_mutex_lock( &this->free_img_buf_queue->mutex ); - } + } } - + pthread_mutex_unlock( &this->free_img_buf_queue->mutex ); xine_usec_sleep (20000); pthread_mutex_lock( &this->free_img_buf_queue->mutex ); } - + this->free_img_buf_queue->locked_for_read = 0; - + if( this->free_img_buf_queue->first ) pthread_cond_signal (&this->free_img_buf_queue->not_empty); pthread_mutex_unlock( &this->free_img_buf_queue->mutex ); @@ -1131,7 +1131,7 @@ static void *video_out_loop (void *this_gen) { vos_t *this = (vos_t *) this_gen; int64_t next_frame_vpts = 0; int64_t usec_to_sleep; - + #ifndef WIN32 /* nice(-value) will fail silently for normal users. * however when running as root this may provide smoother @@ -1145,7 +1145,7 @@ static void *video_out_loop (void *this_gen) { * here it is - the heart of xine (or rather: one of the hearts * of xine) : the video output loop */ - + lprintf ("loop starting...\n"); while ( this->video_loop_running ) { @@ -1185,7 +1185,7 @@ static void *video_out_loop (void *this_gen) { diff = vpts - this->last_delivery_pts; if (diff > 30000 && !this->display_img_buf_queue->first) { xine_list_iterator_t ite; - + pthread_mutex_lock(&this->streams_lock); for (ite = xine_list_front(this->streams); ite; ite = xine_list_next(this->streams, ite)) { @@ -1193,9 +1193,9 @@ static void *video_out_loop (void *this_gen) { if (stream == XINE_ANON_STREAM) continue; if (stream->video_decoder_plugin && stream->video_fifo) { buf_element_t *buf; - + lprintf ("flushing current video decoder plugin\n"); - + buf = stream->video_fifo->buffer_pool_try_alloc (stream->video_fifo); if( buf ) { buf->type = BUF_CONTROL_FLUSH_DECODER; @@ -1215,12 +1215,12 @@ static void *video_out_loop (void *this_gen) { next_frame_vpts = img->vpts + img->duration; } /* else next_frame_vpts is returned by get_next_frame */ - + lprintf ("next_frame_vpts is %" PRId64 "\n", next_frame_vpts); - + do { vpts = this->clock->get_current_time (this->clock); - + if (this->clock->speed == XINE_SPEED_PAUSE) paused_loop (this, vpts); @@ -1237,11 +1237,11 @@ static void *video_out_loop (void *this_gen) { usec_to_sleep = MAX_USEC_TO_SLEEP; lprintf ("%" PRId64 " usec to sleep at master vpts %" PRId64 "\n", usec_to_sleep, vpts); - + if ( (next_frame_vpts - vpts) > 2*90000 ) xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out: vpts/clock error, next_vpts=%" PRId64 " cur_vpts=%" PRId64 "\n", next_frame_vpts,vpts); - + if (usec_to_sleep > 0) xine_usec_sleep (usec_to_sleep); @@ -1254,7 +1254,7 @@ static void *video_out_loop (void *this_gen) { /* * throw away undisplayed frames */ - + pthread_mutex_lock(&this->display_img_buf_queue->mutex); img = this->display_img_buf_queue->first; while (img) { @@ -1297,9 +1297,9 @@ int xine_get_next_video_frame (xine_video_port_t *this_gen, xine_usec_sleep (5000); continue; } - + /* FIXME: ugly, use conditions and locks instead? */ - + pthread_mutex_lock(&this->display_img_buf_queue->mutex); img = this->display_img_buf_queue->first; if (!img) { @@ -1316,7 +1316,7 @@ int xine_get_next_video_frame (xine_video_port_t *this_gen, /* * remove frame from display queue and show it */ - + img = vo_remove_from_img_buf_queue_int (this->display_img_buf_queue, 1, 0, 0, 0, 0, 0); pthread_mutex_unlock(&this->display_img_buf_queue->mutex); @@ -1335,7 +1335,7 @@ int xine_get_next_video_frame (xine_video_port_t *this_gen, return 1; } -void xine_free_video_frame (xine_video_port_t *port, +void xine_free_video_frame (xine_video_port_t *port, xine_video_frame_t *frame) { vo_frame_t *img = (vo_frame_t *) frame->xine_frame; @@ -1377,7 +1377,7 @@ static void vo_close (xine_video_port_t *this_gen, xine_stream_t *stream) { this->overlay_source->flush_events (this->overlay_source); this->video_opened = 0; - + /* unregister stream */ pthread_mutex_lock(&this->streams_lock); for (ite = xine_list_front(this->streams); ite; @@ -1400,17 +1400,17 @@ static int vo_get_property (xine_video_port_t *this_gen, int property) { case VO_PROP_DISCARD_FRAMES: ret = this->discard_frames; break; - + case VO_PROP_BUFS_IN_FIFO: ret = this->video_loop_running ? this->display_img_buf_queue->num_buffers : -1; break; - + case VO_PROP_NUM_STREAMS: pthread_mutex_lock(&this->streams_lock); ret = xine_list_size(this->streams); pthread_mutex_unlock(&this->streams_lock); break; - + /* * handle XINE_PARAM_xxx properties (convert from driver's range) */ @@ -1426,7 +1426,7 @@ static int vo_get_property (xine_video_port_t *this_gen, int property) { case XINE_PARAM_VO_CROP_BOTTOM: ret = this->crop_bottom; break; - + case XINE_PARAM_VO_HUE: case XINE_PARAM_VO_SATURATION: case XINE_PARAM_VO_CONTRAST: @@ -1444,12 +1444,12 @@ static int vo_get_property (xine_video_port_t *this_gen, int property) { if (range_v > 0) ret = ((v-min_v) * 65536 + 32768) / range_v; - else + else ret = 0; pthread_mutex_unlock( &this->driver_lock ); } break; - + default: pthread_mutex_lock( &this->driver_lock ); ret = this->driver->get_property(this->driver, property & 0xffffff); @@ -1463,7 +1463,7 @@ static int vo_set_property (xine_video_port_t *this_gen, int property, int value int ret; switch (property) { - + case VO_PROP_DISCARD_FRAMES: /* recursive discard frames setting */ pthread_mutex_lock(&this->display_img_buf_queue->mutex); @@ -1473,19 +1473,19 @@ static int vo_set_property (xine_video_port_t *this_gen, int property, int value this->discard_frames--; pthread_mutex_unlock(&this->display_img_buf_queue->mutex); ret = this->discard_frames; - + /* discard buffers here because we have no output thread */ if (this->grab_only && this->discard_frames) { vo_frame_t *img; - + pthread_mutex_lock(&this->display_img_buf_queue->mutex); - + while ((img = this->display_img_buf_queue->first)) { - + lprintf ("flushing out frame\n"); - + img = vo_remove_from_img_buf_queue_int (this->display_img_buf_queue, 1, 0, 0, 0, 0, 0); - + vo_frame_dec_lock (img); } pthread_mutex_unlock(&this->display_img_buf_queue->mutex); @@ -1515,32 +1515,32 @@ static int vo_set_property (xine_video_port_t *this_gen, int property, int value value = 0; ret = this->crop_bottom = value; break; - + case XINE_PARAM_VO_HUE: case XINE_PARAM_VO_SATURATION: case XINE_PARAM_VO_CONTRAST: case XINE_PARAM_VO_BRIGHTNESS: if (!this->grab_only) { int v, min_v, max_v, range_v; - + pthread_mutex_lock( &this->driver_lock ); - + this->driver->get_property_min_max (this->driver, - property & 0xffffff, - &min_v, &max_v); - + property & 0xffffff, + &min_v, &max_v); + range_v = max_v - min_v + 1; - + v = (value * range_v + (range_v/2)) / 65536 + min_v; - + this->driver->set_property(this->driver, property & 0xffffff, v); pthread_mutex_unlock( &this->driver_lock ); ret = value; } else ret = 0; break; - - + + default: if (!this->grab_only) { pthread_mutex_lock( &this->driver_lock ); @@ -1574,7 +1574,7 @@ static int vo_status (xine_video_port_t *this_gen, xine_stream_t *stream, } } pthread_mutex_unlock(&this->streams_lock); - + return ret; } @@ -1619,7 +1619,7 @@ static void vo_exit (xine_video_port_t *this_gen) { if (this->overlay_source) { this->overlay_source->dispose (this->overlay_source); } - + xine_list_delete(this->streams); pthread_mutex_destroy(&this->streams_lock); @@ -1635,7 +1635,7 @@ static vo_frame_t *vo_get_last_frame (xine_video_port_t *this_gen) { } /* - * overlay stuff + * overlay stuff */ static video_overlay_manager_t *vo_get_overlay_manager (xine_video_port_t *this_gen) { @@ -1645,7 +1645,7 @@ static video_overlay_manager_t *vo_get_overlay_manager (xine_video_port_t *this_ static void vo_enable_overlay (xine_video_port_t *this_gen, int overlay_enabled) { vos_t *this = (vos_t *) this_gen; - + if (overlay_enabled) { /* we always ENable ... */ this->overlay_enabled = 1; @@ -1678,7 +1678,7 @@ static void vo_flush (xine_video_port_t *this_gen) { pthread_mutex_lock(&this->display_img_buf_queue->mutex); this->discard_frames++; pthread_mutex_unlock(&this->display_img_buf_queue->mutex); - + /* do not try this in paused mode */ while(this->clock->speed != XINE_SPEED_PAUSE) { pthread_mutex_lock(&this->display_img_buf_queue->mutex); @@ -1688,7 +1688,7 @@ static void vo_flush (xine_video_port_t *this_gen) { break; xine_usec_sleep (20000); /* pthread_cond_t could be used here */ } - + pthread_mutex_lock(&this->display_img_buf_queue->mutex); this->discard_frames--; pthread_mutex_unlock(&this->display_img_buf_queue->mutex); @@ -1703,29 +1703,29 @@ static vo_frame_t * crop_frame( xine_video_port_t *this_gen, vo_frame_t *img ) { vo_frame_t *dupl; dupl = vo_get_frame ( this_gen, - img->width - img->crop_left - img->crop_right, + img->width - img->crop_left - img->crop_right, img->height - img->crop_top - img->crop_bottom, img->ratio, img->format, img->flags | VO_BOTH_FIELDS); - + dupl->progressive_frame = img->progressive_frame; dupl->repeat_first_field = img->repeat_first_field; dupl->top_field_first = img->top_field_first; dupl->overlay_offset_x = img->overlay_offset_x; dupl->overlay_offset_y = img->overlay_offset_y; - + switch (img->format) { case XINE_IMGFMT_YV12: yv12_to_yv12( /* Y */ - img->base[0] + img->crop_top * img->pitches[0] + + img->base[0] + img->crop_top * img->pitches[0] + img->crop_left, img->pitches[0], dupl->base[0], dupl->pitches[0], /* U */ - img->base[1] + img->crop_top/2 * img->pitches[1] + + img->base[1] + img->crop_top/2 * img->pitches[1] + img->crop_left/2, img->pitches[1], dupl->base[1], dupl->pitches[1], /* V */ - img->base[2] + img->crop_top/2 * img->pitches[2] + + img->base[2] + img->crop_top/2 * img->pitches[2] + img->crop_left/2, img->pitches[2], dupl->base[2], dupl->pitches[2], /* width x height */ @@ -1742,7 +1742,7 @@ static vo_frame_t * crop_frame( xine_video_port_t *this_gen, vo_frame_t *img ) { dupl->width, dupl->height); break; } - + dupl->bad_frame = 0; dupl->pts = img->pts; dupl->vpts = img->vpts; @@ -1755,10 +1755,10 @@ static vo_frame_t * crop_frame( xine_video_port_t *this_gen, vo_frame_t *img ) { if (img->stream) _x_refcounter_inc(img->stream->refcounter); memcpy( dupl->extra_info, img->extra_info, sizeof(extra_info_t) ); - + /* delay frame processing for now, we might not even need it (eg. frame will be discarded) */ /* vo_frame_driver_proc(dupl); */ - + return dupl; } @@ -1777,10 +1777,10 @@ xine_video_port_t *_x_vo_new_port (xine_t *xine, vo_driver_t *driver, int grabon this->clock = xine->clock; this->driver = driver; this->streams = xine_list_new(); - + pthread_mutex_init(&this->streams_lock, NULL); pthread_mutex_init(&this->driver_lock, NULL ); - + this->vo.open = vo_open; this->vo.get_frame = vo_get_frame; this->vo.get_last_frame = vo_get_last_frame; @@ -1804,7 +1804,7 @@ xine_video_port_t *_x_vo_new_port (xine_t *xine, vo_driver_t *driver, int grabon this->last_frame = NULL; this->img_backup = NULL; - + this->overlay_source = _x_video_overlay_new_manager(xine); this->overlay_source->init (this->overlay_source); this->overlay_enabled = 1; @@ -1826,7 +1826,7 @@ xine_video_port_t *_x_vo_new_port (xine_t *xine, vo_driver_t *driver, int grabon num_frame_buffers = i; /* we need at least 5 frames */ - if (num_frame_buffers<5) + if (num_frame_buffers<5) num_frame_buffers = 5; /* Choose a frame_drop_limit which matches num_frame_buffers. @@ -1858,7 +1858,7 @@ xine_video_port_t *_x_vo_new_port (xine_t *xine, vo_driver_t *driver, int grabon img->proc_duplicate_frame_data = NULL; img->id = i; - + img->port = &this->vo; img->free = vo_frame_dec_lock; img->lock = vo_frame_inc_lock; @@ -1870,13 +1870,13 @@ xine_video_port_t *_x_vo_new_port (xine_t *xine, vo_driver_t *driver, int grabon img); } - this->warn_skipped_threshold = + this->warn_skipped_threshold = xine->config->register_num (xine->config, "engine.performance.warn_skipped_threshold", 10, _("percentage of skipped frames to tolerate"), _("When more than this percentage of frames are not shown, because they " "were not decoded in time, xine sends a notification."), 20, NULL, NULL); - this->warn_discarded_threshold = + this->warn_discarded_threshold = xine->config->register_num (xine->config, "engine.performance.warn_discarded_threshold", 10, _("percentage of discarded frames to tolerate"), _("When more than this percentage of frames are not shown, because they " @@ -1903,10 +1903,10 @@ xine_video_port_t *_x_vo_new_port (xine_t *xine, vo_driver_t *driver, int grabon this->video_loop_running = 1; this->video_opened = 0; this->grab_only = 0; - + pthread_attr_init(&pth_attrs); pthread_attr_setscope(&pth_attrs, PTHREAD_SCOPE_SYSTEM); - + if ((err = pthread_create (&this->video_thread, &pth_attrs, video_out_loop, this)) != 0) { @@ -1918,7 +1918,7 @@ xine_video_port_t *_x_vo_new_port (xine_t *xine, vo_driver_t *driver, int grabon } else xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out: thread created\n"); - + pthread_attr_destroy(&pth_attrs); } diff --git a/src/xine-engine/video_out.h b/src/xine-engine/video_out.h index 9a2ba06c6..b1a517565 100644 --- a/src/xine-engine/video_out.h +++ b/src/xine-engine/video_out.h @@ -1,24 +1,24 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * - * xine version of video_out.h + * xine version of video_out.h * * vo_frame : frame containing yuv data and timing info, * transferred between video_decoder and video_output @@ -47,7 +47,7 @@ extern "C" { #endif -typedef struct vo_frame_s vo_frame_t; +typedef struct vo_frame_s vo_frame_t; typedef struct vo_driver_s vo_driver_t; typedef struct video_driver_class_s video_driver_class_t; typedef struct vo_overlay_s vo_overlay_t; @@ -80,7 +80,7 @@ struct vo_frame_s { /* tell video driver that the decoder starts a new field */ void (*field) (vo_frame_t *vo_img, int which_field); - /* append this frame to the display queue, + /* append this frame to the display queue, returns number of frames to skip if decoder is late */ /* when the frame does not originate from a stream, it is legal to pass an anonymous stream */ int (*draw) (vo_frame_t *vo_img, xine_stream_t *stream); @@ -108,7 +108,7 @@ struct vo_frame_s { /* yv12 (planar) base[0]: y, base[1]: u, base[2]: v */ /* yuy2 (interleaved) base[0]: yuyv..., base[1]: --, base[2]: -- */ - uint8_t *base[3]; + uint8_t *base[3]; int pitches[3]; /* info that can be used for interlaced output (e.g. tv-out) */ @@ -119,13 +119,13 @@ struct vo_frame_s { */ int progressive_frame; int picture_coding_type; - + /* cropping to be done */ int crop_left, crop_right, crop_top, crop_bottom; /* extra info coming from input or demuxers */ - extra_info_t *extra_info; - + extra_info_t *extra_info; + /* additional information to be able to duplicate frames: */ int width, height; double ratio; /* aspect ratio */ @@ -134,7 +134,7 @@ struct vo_frame_s { int drawn; /* used by decoder, frame has already been drawn */ int flags; /* remember the frame flags */ int proc_called; /* track use of proc_*() methods */ - + /* Used to carry private data for accelerated plugins.*/ void *accel_data; @@ -142,18 +142,18 @@ struct vo_frame_s { xine_video_port_t *port; vo_driver_t *driver; xine_stream_t *stream; - + /* displacement for overlays */ int overlay_offset_x, overlay_offset_y; - - /* + + /* * that part is used only by video_out.c for frame management * obs: changing anything here will require recompiling vo drivers */ struct vo_frame_s *next; int lock_counter; pthread_mutex_t mutex; /* protect access to lock_count */ - + int id; /* debugging - track this frame */ int is_first; }; @@ -173,8 +173,8 @@ struct xine_video_port_s { * (e.g. you are a post plugin) it is legal to pass an anonymous stream */ void (*open) (xine_video_port_t *self, xine_stream_t *stream); - /* - * get_frame - allocate an image buffer from display driver + /* + * get_frame - allocate an image buffer from display driver * * params : width == width of video to display. * height == height of video to display. @@ -182,16 +182,16 @@ struct xine_video_port_s { * format == FOURCC descriptor of image format * flags == field/prediction flags */ - vo_frame_t* (*get_frame) (xine_video_port_t *self, uint32_t width, - uint32_t height, double ratio, + vo_frame_t* (*get_frame) (xine_video_port_t *self, uint32_t width, + uint32_t height, double ratio, int format, int flags); /* retrieves the last displayed frame (useful for taking snapshots) */ vo_frame_t* (*get_last_frame) (xine_video_port_t *self); - + /* overlay stuff */ void (*enable_ovl) (xine_video_port_t *self, int ovl_enable); - + /* get overlay manager */ video_overlay_manager_t* (*get_overlay_manager) (xine_video_port_t *self); @@ -204,11 +204,11 @@ struct xine_video_port_s { */ int (*get_property) (xine_video_port_t *self, int property); int (*set_property) (xine_video_port_t *self, int property, int value); - + /* return true if port is opened for this stream, stream can be anonymous */ - int (*status) (xine_video_port_t *self, xine_stream_t *stream, + int (*status) (xine_video_port_t *self, xine_stream_t *stream, int *width, int *height, int64_t *img_duration); - + /* video driver is no longer used by decoder => close */ /* when you are not a full-blown stream, but still need to close the port * (e.g. you are a post plugin) it is legal to pass an anonymous stream */ @@ -231,9 +231,9 @@ struct xine_video_port_s { #define VO_PROP_BRIGHTNESS 5 #define VO_PROP_COLORKEY 6 #define VO_PROP_AUTOPAINT_COLORKEY 7 -#define VO_PROP_ZOOM_X 8 -#define VO_PROP_PAN_SCAN 9 -#define VO_PROP_TVMODE 10 +#define VO_PROP_ZOOM_X 8 +#define VO_PROP_PAN_SCAN 9 +#define VO_PROP_TVMODE 10 #define VO_PROP_MAX_NUM_FRAMES 11 #define VO_PROP_ZOOM_Y 13 #define VO_PROP_DISCARD_FRAMES 14 /* not used by drivers */ @@ -299,7 +299,7 @@ struct vo_driver_s { */ vo_frame_t* (*alloc_frame) (vo_driver_t *self); - /* + /* * check if the given image fullfills the format specified * (re-)allocate memory if necessary */ @@ -330,7 +330,7 @@ struct vo_driver_s { * these can be used by the gui directly: */ int (*get_property) (vo_driver_t *self, int property); - int (*set_property) (vo_driver_t *self, + int (*set_property) (vo_driver_t *self, int property, int value); void (*get_property_min_max) (vo_driver_t *self, int property, int *min, int *max); @@ -345,7 +345,7 @@ struct vo_driver_s { void *data); /* check if a redraw is needed (due to resize) - * this is only used for still frames, normal video playback + * this is only used for still frames, normal video playback * must call that inside display_frame() function. */ int (*redraw_needed) (vo_driver_t *self); @@ -354,7 +354,7 @@ struct vo_driver_s { * free all resources, close driver */ void (*dispose) (vo_driver_t *self); - + void *node; /* needed by plugin_loader */ }; @@ -364,14 +364,14 @@ struct video_driver_class_s { * open a new instance of this plugin class */ vo_driver_t* (*open_plugin) (video_driver_class_t *self, const void *visual); - + /* * return short, human readable identifier for this plugin class */ char* (*get_identifier) (video_driver_class_t *self); /* - * return human readable (verbose = 1 line) description for + * return human readable (verbose = 1 line) description for * this plugin class */ char* (*get_description) (video_driver_class_t *self); @@ -397,7 +397,7 @@ struct vo_overlay_s { int y; /* y start of subpicture area */ int width; /* width of subpicture area */ int height; /* height of subpicture area */ - + uint32_t color[OVL_PALETTE_SIZE]; /* color lookup table */ uint8_t trans[OVL_PALETTE_SIZE]; /* mixer key table */ int rgb_clut; /* true if clut was converted to rgb */ @@ -410,7 +410,7 @@ struct vo_overlay_s { uint32_t hili_color[OVL_PALETTE_SIZE]; uint8_t hili_trans[OVL_PALETTE_SIZE]; int hili_rgb_clut; /* true if clut was converted to rgb */ - + int unscaled; /* true if it should be blended unscaled */ }; @@ -423,20 +423,20 @@ struct vo_overlay_s { */ struct video_overlay_manager_s { void (*init) (video_overlay_manager_t *this_gen); - + void (*dispose) (video_overlay_manager_t *this_gen); - + int32_t (*get_handle) (video_overlay_manager_t *this_gen, int object_type ); - + void (*free_handle) (video_overlay_manager_t *this_gen, int32_t handle); - + int32_t (*add_event) (video_overlay_manager_t *this_gen, void *event); - + void (*flush_events) (video_overlay_manager_t *this_gen ); - + int (*redraw_needed) (video_overlay_manager_t *this_gen, int64_t vpts ); - - void (*multiple_overlay_blend) (video_overlay_manager_t *this_gen, int64_t vpts, + + void (*multiple_overlay_blend) (video_overlay_manager_t *this_gen, int64_t vpts, vo_driver_t *output, vo_frame_t *vo_img, int enabled); }; diff --git a/src/xine-engine/video_overlay.c b/src/xine-engine/video_overlay.c index b88f10c11..3216950e8 100644 --- a/src/xine-engine/video_overlay.c +++ b/src/xine-engine/video_overlay.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2006 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -51,15 +51,15 @@ typedef struct video_overlay_showing_s { typedef struct video_overlay_s { video_overlay_manager_t video_overlay; - + xine_t *xine; - pthread_mutex_t events_mutex; + pthread_mutex_t events_mutex; video_overlay_events_t events[MAX_EVENTS]; - pthread_mutex_t objects_mutex; + pthread_mutex_t objects_mutex; video_overlay_object_t objects[MAX_OBJECTS]; pthread_mutex_t showing_mutex; - video_overlay_showing_t showing[MAX_SHOWING]; + video_overlay_showing_t showing[MAX_SHOWING]; int showing_changed; } video_overlay_t; @@ -67,24 +67,24 @@ typedef struct video_overlay_s { static void add_showing_handle( video_overlay_t *this, int32_t handle ) { int i; - + pthread_mutex_lock( &this->showing_mutex ); this->showing_changed++; - + for( i = 0; i < MAX_SHOWING; i++ ) if( this->showing[i].handle == handle ) break; /* already showing */ - + if( i == MAX_SHOWING ) { for( i = 0; i < MAX_SHOWING && this->showing[i].handle >= 0; i++ ) ; - + if( i != MAX_SHOWING ) this->showing[i].handle = handle; else xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_overlay: error: no showing slots available\n"); } - + pthread_mutex_unlock( &this->showing_mutex ); } @@ -94,13 +94,13 @@ static void remove_showing_handle( video_overlay_t *this, int32_t handle ) pthread_mutex_lock( &this->showing_mutex ); this->showing_changed++; - + for( i = 0; i < MAX_SHOWING; i++ ) { if( this->showing[i].handle == handle ) { this->showing[i].handle = -1; } } - + pthread_mutex_unlock( &this->showing_mutex ); } @@ -110,34 +110,34 @@ static void remove_events_handle( video_overlay_t *this, int32_t handle, int loc if( lock ) pthread_mutex_lock( &this->events_mutex ); - + this_event=0; do { last_event=this_event; this_event=this->events[last_event].next_event; - - while( this_event && + + while( this_event && this->events[this_event].event->object.handle == handle ) { /* remove event from pts list */ this->events[last_event].next_event= this->events[this_event].next_event; - /* free its overlay */ - if( this->events[this_event].event->object.overlay ) { + /* free its overlay */ + if( this->events[this_event].event->object.overlay ) { if( this->events[this_event].event->object.overlay->rle ) free( this->events[this_event].event->object.overlay->rle ); free(this->events[this_event].event->object.overlay); this->events[this_event].event->object.overlay = NULL; } - + /* mark as free */ this->events[this_event].next_event = 0; this->events[this_event].event->event_type = OVERLAY_EVENT_NULL; - + this_event=this->events[last_event].next_event; } } while ( this_event ); - + if( lock ) pthread_mutex_unlock( &this->events_mutex ); } @@ -149,35 +149,35 @@ static void remove_events_handle( video_overlay_t *this, int32_t handle, int loc static int32_t video_overlay_get_handle(video_overlay_manager_t *this_gen, int object_type ) { video_overlay_t *this = (video_overlay_t *) this_gen; int n; - + pthread_mutex_lock( &this->objects_mutex ); - + for( n=0; n < MAX_OBJECTS && this->objects[n].handle > -1; n++ ) ; - + if (n == MAX_OBJECTS) { n = -1; } else { this->objects[n].handle = n; this->objects[n].object_type = object_type; } - + pthread_mutex_unlock( &this->objects_mutex ); return n; } -/* +/* free a handle from the object pool (internal function) */ static void internal_video_overlay_free_handle(video_overlay_t *this, int32_t handle) { - + pthread_mutex_lock( &this->objects_mutex ); if( this->objects[handle].overlay ) { if( this->objects[handle].overlay->rle ) free( this->objects[handle].overlay->rle ); free( this->objects[handle].overlay ); - this->objects[handle].overlay = NULL; + this->objects[handle].overlay = NULL; } this->objects[handle].handle = -1; @@ -199,7 +199,7 @@ static void video_overlay_free_handle(video_overlay_manager_t *this_gen, int32_t static void video_overlay_reset (video_overlay_t *this) { int i; - + pthread_mutex_lock (&this->events_mutex); for (i=0; i < MAX_EVENTS; i++) { if (this->events[i].event == NULL) { @@ -212,17 +212,17 @@ static void video_overlay_reset (video_overlay_t *this) { #endif } this->events[i].event->event_type = 0; /* Empty slot */ - this->events[i].next_event = 0; + this->events[i].next_event = 0; } pthread_mutex_unlock (&this->events_mutex); - + for( i = 0; i < MAX_SHOWING; i++ ) this->showing[i].handle = -1; - + for (i=0; i < MAX_OBJECTS; i++) { internal_video_overlay_free_handle(this, i); } - + this->showing_changed = 0; } @@ -234,7 +234,7 @@ static void video_overlay_init (video_overlay_manager_t *this_gen) { pthread_mutex_init (&this->events_mutex,NULL); pthread_mutex_init (&this->objects_mutex,NULL); pthread_mutex_init (&this->showing_mutex,NULL); - + video_overlay_reset(this); } @@ -256,13 +256,13 @@ static int32_t video_overlay_add_event(video_overlay_manager_t *this_gen, void uint32_t last_event,this_event,new_event; pthread_mutex_lock (&this->events_mutex); - + /* We skip the 0 entry because that is used as a pointer to the first event.*/ /* Find a free event slot */ - for( new_event = 1; new_event<MAX_EVENTS && + for( new_event = 1; new_event<MAX_EVENTS && this->events[new_event].event->event_type > 0; new_event++ ) ; - + if (new_event < MAX_EVENTS) { /* Find position in event queue to be added. */ this_event=0; @@ -274,7 +274,7 @@ static int32_t video_overlay_add_event(video_overlay_manager_t *this_gen, void this->events[last_event].next_event=new_event; this->events[new_event].next_event=this_event; - + /* memcpy everything except the actual image */ if ( this->events[new_event].event == NULL ) { xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_overlay: error: event slot is NULL!\n"); @@ -287,7 +287,7 @@ static int32_t video_overlay_add_event(video_overlay_manager_t *this_gen, void if ( this->events[new_event].event->object.overlay ) { xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_overlay: add_event: event->object.overlay was not freed!\n"); } - + if( event->object.overlay ) { int i; for(i = 0; i < OVL_PALETTE_SIZE; i++) { @@ -298,7 +298,7 @@ static int32_t video_overlay_add_event(video_overlay_manager_t *this_gen, void } this->events[new_event].event->object.overlay = calloc(1, sizeof(vo_overlay_t)); - xine_fast_memcpy(this->events[new_event].event->object.overlay, + xine_fast_memcpy(this->events[new_event].event->object.overlay, event->object.overlay, sizeof(vo_overlay_t)); /* We took the callers rle and data, therefore it will be our job to free it */ @@ -311,9 +311,9 @@ static int32_t video_overlay_add_event(video_overlay_manager_t *this_gen, void xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_overlay:No spare subtitle event slots\n"); new_event = -1; } - + pthread_mutex_unlock (&this->events_mutex); - + return new_event; } @@ -335,7 +335,7 @@ static void video_overlay_print_overlay( vo_overlay_t *ovl ) { printf ("video_overlay: \thili_trans [%d %d %d %d]\n", ovl->hili_trans[0], ovl->hili_trans[1], ovl->hili_trans[2], ovl->hili_trans[3]); return; -} +} #endif /* @@ -347,9 +347,9 @@ static int video_overlay_event( video_overlay_t *this, int64_t vpts ) { int32_t handle; uint32_t this_event; int processed = 0; - + pthread_mutex_lock (&this->events_mutex); - + this_event=this->events[0].next_event; while ( this_event && (vpts > this->events[this_event].event->vpts || vpts == 0) ) { @@ -375,21 +375,21 @@ static int video_overlay_event( video_overlay_t *this, int64_t vpts ) { */ remove_showing_handle(this,handle); internal_video_overlay_free_handle(this, handle); - + this->objects[handle].handle = handle; if( this->objects[handle].overlay ) { xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_overlay: error: object->overlay was not freed!\n"); } - this->objects[handle].overlay = + this->objects[handle].overlay = this->events[this_event].event->object.overlay; - this->objects[handle].pts = + this->objects[handle].pts = this->events[this_event].event->object.pts; this->events[this_event].event->object.overlay = NULL; - + add_showing_handle( this, handle ); } break; - + case OVERLAY_EVENT_HIDE: #ifdef LOG_DEBUG printf ("video_overlay: HIDE SPU NOW\n"); @@ -399,17 +399,17 @@ static int video_overlay_event( video_overlay_t *this, int64_t vpts ) { if( this->events[this_event].event->object.overlay->rle != NULL ) free( this->events[this_event].event->object.overlay->rle ); free(this->events[this_event].event->object.overlay); - this->events[this_event].event->object.overlay = NULL; + this->events[this_event].event->object.overlay = NULL; } remove_showing_handle( this, handle ); break; - + case OVERLAY_EVENT_FREE_HANDLE: #ifdef LOG_DEBUG printf ("video_overlay: FREE SPU NOW\n"); #endif /* free any overlay associated with this event */ - if( this->events[this_event].event->object.overlay != NULL) { + if( this->events[this_event].event->object.overlay != NULL) { if( this->events[this_event].event->object.overlay->rle != NULL ) free( this->events[this_event].event->object.overlay->rle ); free(this->events[this_event].event->object.overlay); @@ -423,7 +423,7 @@ static int video_overlay_event( video_overlay_t *this, int64_t vpts ) { internal_video_overlay_free_handle( this, handle ); break; - + case OVERLAY_EVENT_MENU_BUTTON: /* mixes palette and copy clip coords */ #ifdef LOG_DEBUG @@ -433,10 +433,10 @@ static int video_overlay_event( video_overlay_t *this, int64_t vpts ) { /* This code drops buttons, where the button PTS derived from the NAV * packet on DVDs does not match the SPU PTS. Practical experience shows, * that this is not necessary and causes problems with some DVDs */ - if ( (this->events[this_event].event->object.pts != + if ( (this->events[this_event].event->object.pts != this->objects[handle].pts) ) { - xprintf (this->xine, XINE_VERBOSITY_DEBUG, - "video_overlay:MENU BUTTON DROPPED menu pts=%lld spu pts=%lld\n", + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "video_overlay:MENU BUTTON DROPPED menu pts=%lld spu pts=%lld\n", this->events[this_event].event->object.pts, this->objects[handle].pts); break; @@ -446,7 +446,7 @@ static int video_overlay_event( video_overlay_t *this, int64_t vpts ) { (this->objects[handle].overlay) ) { vo_overlay_t *overlay = this->objects[handle].overlay; vo_overlay_t *event_overlay = this->events[this_event].event->object.overlay; - + #ifdef LOG_DEBUG printf ("video_overlay:overlay present\n"); #endif @@ -477,84 +477,84 @@ static int video_overlay_event( video_overlay_t *this, int64_t vpts ) { free( this->events[this_event].event->object.overlay->rle ); this->events[this_event].event->object.overlay->rle = NULL; } - + if (this->events[this_event].event->object.overlay != NULL) { free (this->events[this_event].event->object.overlay); this->events[this_event].event->object.overlay = NULL; } break; - + default: xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_overlay: unhandled event type\n"); break; } - - this->events[0].next_event = this->events[this_event].next_event; + + this->events[0].next_event = this->events[this_event].next_event; this->events[this_event].next_event = 0; this->events[this_event].event->event_type = 0; - + this_event=this->events[0].next_event; } - + pthread_mutex_unlock (&this->events_mutex); return processed; } - -/* This is called from video_out.c + +/* This is called from video_out.c * must call output->overlay_blend for each active overlay. */ -static void video_overlay_multiple_overlay_blend (video_overlay_manager_t *this_gen, int64_t vpts, +static void video_overlay_multiple_overlay_blend (video_overlay_manager_t *this_gen, int64_t vpts, vo_driver_t *output, vo_frame_t *vo_img, int enabled) { video_overlay_t *this = (video_overlay_t *) this_gen; int i; int32_t handle; - /* Look at next events, if current video vpts > first event on queue, process the event - * else just continue + /* Look at next events, if current video vpts > first event on queue, process the event + * else just continue */ video_overlay_event( this, vpts ); - - /* Scan through 5 entries and display any present. + + /* Scan through 5 entries and display any present. */ pthread_mutex_lock( &this->showing_mutex ); if( output->overlay_begin ) output->overlay_begin(output, vo_img, this->showing_changed); - + for( i = 0; enabled && output->overlay_blend && i < MAX_SHOWING; i++ ) { - handle=this->showing[i].handle; + handle=this->showing[i].handle; if (handle >= 0 ) { output->overlay_blend(output, vo_img, this->objects[handle].overlay); } } - + if( output->overlay_end ) output->overlay_end(output, vo_img); - + this->showing_changed = 0; - + pthread_mutex_unlock( &this->showing_mutex ); } -/* this should be called on stream end or stop to make sure every +/* this should be called on stream end or stop to make sure every hide event is processed. */ static void video_overlay_flush_events(video_overlay_manager_t *this_gen ) { video_overlay_t *this = (video_overlay_t *) this_gen; - + video_overlay_event( this, 0 ); } -/* this is called from video_out.c on still frames to check +/* this is called from video_out.c on still frames to check if a redraw is needed. */ static int video_overlay_redraw_needed(video_overlay_manager_t *this_gen, int64_t vpts ) { video_overlay_t *this = (video_overlay_t *) this_gen; - + video_overlay_event( this, vpts ); return this->showing_changed; } @@ -575,7 +575,7 @@ static void video_overlay_dispose(video_overlay_manager_t *this_gen) { free (this->events[i].event); } } - + for (i=0; i < MAX_OBJECTS; i++) internal_video_overlay_free_handle(this, i); diff --git a/src/xine-engine/video_overlay.h b/src/xine-engine/video_overlay.h index 01f3a2a3a..f2deb8a2b 100644 --- a/src/xine-engine/video_overlay.h +++ b/src/xine-engine/video_overlay.h @@ -2,17 +2,17 @@ * Copyright (C) 2000-2003 the xine project * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -50,7 +50,7 @@ #define OVL_PALETTE_SIZE 256 typedef struct vo_buttons_s { - int32_t type; /* 0:Button not valid, + int32_t type; /* 0:Button not valid, 1:Button Valid, no auto_action, 2:Button Valid, auto_action. */ @@ -61,10 +61,10 @@ typedef struct vo_buttons_s { int32_t hili_bottom; int32_t hili_left; int32_t hili_right; - int32_t up; - int32_t down; - int32_t left; - int32_t right; + int32_t up; + int32_t down; + int32_t left; + int32_t right; uint32_t select_color[OVL_PALETTE_SIZE]; uint8_t select_trans[OVL_PALETTE_SIZE]; xine_event_t select_event; @@ -74,7 +74,7 @@ typedef struct vo_buttons_s { int32_t hili_rgb_clut; /* true if clut was converted to rgb*/ /* FIXME: Probably not needed ^^^ */ } vo_buttons_t; - + typedef struct video_overlay_object_s { int32_t handle; /* Used to match Show and Hide events. */ uint32_t object_type; /* 0=Subtitle, 1=Menu */ diff --git a/src/xine-engine/vo_scale.c b/src/xine-engine/vo_scale.c index 8d84c32da..e2b7ac9e4 100644 --- a/src/xine-engine/vo_scale.c +++ b/src/xine-engine/vo_scale.c @@ -7,7 +7,7 @@ * 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. - * + * * xine 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 @@ -53,14 +53,14 @@ void _x_vo_scale_compute_ideal_size (vo_scale_t *this) { this->video_pixel_aspect = this->gui_pixel_aspect; } else { - - /* + + /* * aspect ratio */ - + image_ratio = (double) (this->delivered_width - (this->crop_left + this->crop_right)) / (double) (this->delivered_height - (this->crop_top + this->crop_bottom)); - + switch (this->user_ratio) { case XINE_VO_ASPECT_AUTO: desired_ratio = this->delivered_ratio; @@ -80,7 +80,7 @@ void _x_vo_scale_compute_ideal_size (vo_scale_t *this) { } this->video_pixel_aspect = desired_ratio / image_ratio; - + _x_assert(this->gui_pixel_aspect != 0.0); if (fabs (this->video_pixel_aspect / this->gui_pixel_aspect - 1.0) @@ -89,7 +89,7 @@ void _x_vo_scale_compute_ideal_size (vo_scale_t *this) { } #if 0 - + /* onefield_xv divide by 2 the number of lines */ if (this->deinterlace_enabled && (this->deinterlace_method == DEINTERLACE_ONEFIELDXV) @@ -107,17 +107,17 @@ void _x_vo_scale_compute_ideal_size (vo_scale_t *this) { */ void _x_vo_scale_compute_output_size (vo_scale_t *this) { - + int cropped_width, cropped_height; double x_factor, y_factor, aspect; - + cropped_width = this->delivered_width - (this->crop_left + this->crop_right); - cropped_height = this->delivered_height - (this->crop_top + this->crop_bottom); + cropped_height = this->delivered_height - (this->crop_top + this->crop_bottom); aspect = this->video_pixel_aspect / this->gui_pixel_aspect; x_factor = (double) this->gui_width / (double) (cropped_width * aspect); y_factor = (double) (this->gui_height * aspect) / (double) cropped_height; - + if (this->scaling_disabled) { this->output_width = cropped_width; @@ -128,8 +128,8 @@ void _x_vo_scale_compute_output_size (vo_scale_t *this) { } else { if ( this->support_zoom ) { - - /* zoom behaviour: + + /* zoom behaviour: * - window size never changes due zooming * - output image shall be increased whenever there are * black borders to use. @@ -138,7 +138,7 @@ void _x_vo_scale_compute_output_size (vo_scale_t *this) { if (((double)this->gui_width - (double)cropped_width * y_factor) < ((double)this->gui_height - (double)cropped_height * x_factor)) { this->output_width = this->gui_width; this->displayed_width = (double)cropped_width / this->zoom_factor_x + 0.5; - + this->output_height = (double)cropped_height * x_factor + 0.5; if( this->output_height * this->zoom_factor_y <= this->gui_height ) { this->displayed_height = cropped_height; @@ -151,7 +151,7 @@ void _x_vo_scale_compute_output_size (vo_scale_t *this) { } else { this->output_height = this->gui_height; this->displayed_height = (double)cropped_height / this->zoom_factor_y + 0.5; - + this->output_width = (double)cropped_width * y_factor + 0.5; if( this->output_width * this->zoom_factor_x <= this->gui_width ) { this->displayed_width = cropped_width; @@ -162,7 +162,7 @@ void _x_vo_scale_compute_output_size (vo_scale_t *this) { this->output_width = this->gui_width; } } - + } else { if (((double)this->gui_width - (double)cropped_width * y_factor) < ((double)this->gui_height - (double)cropped_height * x_factor)) { this->output_width = (double) this->gui_width; @@ -174,27 +174,27 @@ void _x_vo_scale_compute_output_size (vo_scale_t *this) { this->displayed_width = cropped_width; this->displayed_height = cropped_height; } - } - + } + /* make sure displayed values are sane, that is, we are not trying to display * something outside the delivered image. may happen when zoom < 100%. */ if( this->displayed_width > this->delivered_width ) { - this->output_width = (double) this->output_width * + this->output_width = (double) this->output_width * this->delivered_width / this->displayed_width + 0.5; this->displayed_width = this->delivered_width; } if( this->displayed_height > this->delivered_height ) { - this->output_height = (double) this->output_height * + this->output_height = (double) this->output_height * this->delivered_height / this->displayed_height + 0.5; this->displayed_height = this->delivered_height; } - + this->output_xoffset = (this->gui_width - this->output_width) * this->output_horizontal_position + this->gui_x; this->output_yoffset = (this->gui_height - this->output_height) * this->output_vertical_position + this->gui_y; - + this->displayed_xoffset = ((cropped_width - this->displayed_width) / 2) + this->crop_left; this->displayed_yoffset = ((cropped_height - this->displayed_height) / 2) + this->crop_top; @@ -219,8 +219,8 @@ void _x_vo_scale_compute_output_size (vo_scale_t *this) { /* no top/bottom borders */ this->border[0].w = this->border[0].h = 0; this->border[1].w = this->border[1].h = 0; - } - + } + if (this->output_width < this->gui_width) { /* left */ this->border[2].x = 0; @@ -252,10 +252,10 @@ int _x_vo_scale_redraw_needed (vo_scale_t *this) { _x_assert(this->frame_output_cb); if ( ! this->frame_output_cb ) return 0; - + this->frame_output_cb (this->user_data, - this->delivered_width - (this->crop_left + this->crop_right), - this->delivered_height - (this->crop_top + this->crop_bottom), + this->delivered_width - (this->crop_left + this->crop_right), + this->delivered_height - (this->crop_top + this->crop_bottom), this->video_pixel_aspect, &gui_x, &gui_y, &gui_width, &gui_height, &gui_pixel_aspect, &gui_win_x, &gui_win_y ); @@ -277,7 +277,7 @@ int _x_vo_scale_redraw_needed (vo_scale_t *this) { } else ret = this->force_redraw; - + this->force_redraw = 0; return ret; } @@ -306,7 +306,7 @@ void _x_vo_scale_translate_gui2video(vo_scale_t *this, * translate output area coordianates into the delivered area * coordiantes. */ - + x = x * this->displayed_width / this->output_width + this->displayed_xoffset; y = y * this->displayed_height / this->output_height + this->displayed_yoffset; } @@ -343,21 +343,21 @@ char *_x_vo_scale_aspect_ratio_name(int a) { */ static void vo_scale_horizontal_pos_changed(void *data, xine_cfg_entry_t *entry) { vo_scale_t *this = (vo_scale_t *)data; - + this->output_horizontal_position = entry->num_value / 100.0; this->force_redraw = 1; } static void vo_scale_vertical_pos_changed(void *data, xine_cfg_entry_t *entry) { vo_scale_t *this = (vo_scale_t *)data; - + this->output_vertical_position = entry->num_value / 100.0; this->force_redraw = 1; } static void vo_scale_disable_scaling_changed(void *data, xine_cfg_entry_t *entry) { vo_scale_t *this = (vo_scale_t *)data; - + if (this->scaling_disabled < 2) { this->scaling_disabled = entry->num_value; this->force_redraw = 1; @@ -365,13 +365,13 @@ static void vo_scale_disable_scaling_changed(void *data, xine_cfg_entry_t *entry } -/* +/* * initialize rescaling struct */ - + void _x_vo_scale_init(vo_scale_t *this, int support_zoom, int scaling_disabled, config_values_t *config ) { - + memset( this, 0, sizeof(vo_scale_t) ); this->support_zoom = support_zoom; this->force_redraw = 1; @@ -380,13 +380,13 @@ void _x_vo_scale_init(vo_scale_t *this, int support_zoom, int scaling_disabled, this->gui_pixel_aspect = 1.0; this->user_ratio = XINE_VO_ASPECT_AUTO; this->delivered_ratio = 0.0; - + this->crop_left = 0; this->crop_right = 0; this->crop_top = 0; this->crop_bottom = 0; - - this->output_horizontal_position = + + this->output_horizontal_position = config->register_range(config, "video.output.horizontal_position", 50, 0, 100, _("horizontal image position in the output window"), _("If the video window's horizontal size is bigger than the actual image " diff --git a/src/xine-engine/vo_scale.h b/src/xine-engine/vo_scale.h index eb2607024..fe2594eeb 100644 --- a/src/xine-engine/vo_scale.h +++ b/src/xine-engine/vo_scale.h @@ -7,7 +7,7 @@ * 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. - * + * * xine 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 @@ -44,22 +44,22 @@ struct vo_scale_s { /* true if driver supports frame zooming */ int support_zoom; - + /* forces direct mapping between frame pixels and screen pixels */ int scaling_disabled; - + /* size / aspect ratio calculations */ - /* + /* * "delivered" size: * frame dimension / aspect as delivered by the decoder * used (among other things) to detect frame size changes * units: frame pixels */ - int delivered_width; - int delivered_height; + int delivered_width; + int delivered_height; double delivered_ratio; - + /* * required cropping: * units: frame pixels @@ -69,7 +69,7 @@ struct vo_scale_s { int crop_top; int crop_bottom; - /* + /* * displayed part of delivered images, * taking zoom into account * units: frame pixels @@ -93,7 +93,7 @@ struct vo_scale_s { int gui_x, gui_y; int gui_width, gui_height; int gui_win_x, gui_win_y; - + /* * video + display pixel aspect * One pixel of height 1 has this width @@ -113,11 +113,11 @@ struct vo_scale_s { int output_height; int output_xoffset; int output_yoffset; - + /* */ int force_redraw; - + /* gui callbacks */ @@ -125,13 +125,13 @@ struct vo_scale_s { void (*frame_output_cb) (void *user_data, int video_width, int video_height, double video_pixel_aspect, - int *dest_x, int *dest_y, + int *dest_x, int *dest_y, int *dest_width, int *dest_height, double *dest_pixel_aspect, int *win_x, int *win_y); - + void (*dest_size_cb) (void *user_data, - int video_width, int video_height, + int video_width, int video_height, double video_pixel_aspect, int *dest_width, int *dest_height, double *dest_pixel_aspect); @@ -145,10 +145,10 @@ struct vo_scale_s { */ double output_horizontal_position; double output_vertical_position; - + }; -typedef struct vo_scale_s vo_scale_t; +typedef struct vo_scale_s vo_scale_t; /* @@ -175,7 +175,7 @@ int _x_vo_scale_redraw_needed (vo_scale_t *self) XINE_PROTECTED; /* * */ - + void _x_vo_scale_translate_gui2video(vo_scale_t *self, int x, int y, int *vid_x, int *vid_y) XINE_PROTECTED; @@ -186,11 +186,11 @@ void _x_vo_scale_translate_gui2video(vo_scale_t *self, char *_x_vo_scale_aspect_ratio_name(int a) XINE_PROTECTED; -/* +/* * initialize rescaling struct */ - -void _x_vo_scale_init(vo_scale_t *self, int support_zoom, + +void _x_vo_scale_init(vo_scale_t *self, int support_zoom, int scaling_disabled, config_values_t *config ) XINE_PROTECTED; #ifdef __cplusplus diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index aebbffb39..9f63d793c 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2006 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -93,7 +93,7 @@ void _x_handle_stream_end (xine_stream_t *stream, int non_user) { * if they have called xine_stop explicitly, so only send * it if stream playback finished because of stream end reached */ - + xine_event_t event; event.data_length = 0; @@ -151,7 +151,7 @@ static int acquire_allowed_to_block(xine_ticket_t *this) { /* List too small. Realloc to larger size */ new_size = this->holder_thread_count * 2; lprintf("Reallocing from %d to %d entries\n", this->holder_thread_count, new_size); - + this->holder_threads = realloc(this->holder_threads, sizeof(*this->holder_threads) * new_size); memset(this->holder_threads + this->holder_thread_count, 0, this->holder_thread_count); @@ -160,15 +160,15 @@ static int acquire_allowed_to_block(xine_ticket_t *this) { this->holder_threads[this->holder_thread_count].holder = own_id; this->holder_thread_count = new_size; - return 1; + return 1; } - + static int ticket_acquire_internal(xine_ticket_t *this, int irrevocable, int nonblocking) { int must_wait = 0; pthread_mutex_lock(&this->lock); int allowed_to_block = acquire_allowed_to_block(this); - + if (this->ticket_revoked && !this->irrevocable_tickets) must_wait = !nonblocking; else if (this->atomic_revoke && !pthread_equal(this->atomic_revoker_thread, pthread_self())) @@ -182,12 +182,12 @@ static int ticket_acquire_internal(xine_ticket_t *this, int irrevocable, int non pthread_cond_wait(&this->issued, &this->lock); } - + this->tickets_granted++; if (irrevocable) this->irrevocable_tickets++; - - pthread_mutex_unlock(&this->lock); + + pthread_mutex_unlock(&this->lock); return 1; } @@ -202,7 +202,7 @@ static void ticket_acquire(xine_ticket_t *this, int irrevocable) { static int release_allowed_to_block(xine_ticket_t *this) { pthread_t own_id = pthread_self(); unsigned entry; - + for(entry = 0; entry < this->holder_thread_count; ++entry) { if(pthread_equal(this->holder_threads[entry].holder, own_id)) { this->holder_threads[entry].count--; @@ -218,18 +218,18 @@ static void ticket_release_internal(xine_ticket_t *this, int irrevocable, int no pthread_mutex_lock(&this->lock); int allowed_to_block = release_allowed_to_block(this); - + this->tickets_granted--; if (irrevocable) this->irrevocable_tickets--; - + if (this->ticket_revoked && !this->tickets_granted) pthread_cond_broadcast(&this->revoked); if (allowed_to_block) { if (this->ticket_revoked && !this->irrevocable_tickets && !nonblocking) pthread_cond_wait(&this->issued, &this->lock); } - + pthread_mutex_unlock(&this->lock); } @@ -244,17 +244,17 @@ static void ticket_release(xine_ticket_t *this, int irrevocable) { static void ticket_renew(xine_ticket_t *this, int irrevocable) { pthread_mutex_lock(&this->lock); - + this->tickets_granted--; - + _x_assert(this->ticket_revoked); if (!this->tickets_granted) pthread_cond_broadcast(&this->revoked); if (!this->irrevocable_tickets || !irrevocable) pthread_cond_wait(&this->issued, &this->lock); - + this->tickets_granted++; - + pthread_mutex_unlock(&this->lock); } @@ -263,12 +263,12 @@ static void ticket_issue(xine_ticket_t *this, int atomic) { if (!atomic) pthread_mutex_lock(&this->revoke_lock); pthread_mutex_lock(&this->lock); - + this->pending_revocations--; if (!this->pending_revocations) pthread_cond_broadcast(&this->issued); this->atomic_revoke = 0; - + pthread_mutex_unlock(&this->lock); pthread_mutex_unlock(&this->revoke_lock); } @@ -277,7 +277,7 @@ static void ticket_revoke(xine_ticket_t *this, int atomic) { pthread_mutex_lock(&this->revoke_lock); pthread_mutex_lock(&this->lock); - + this->pending_revocations++; this->ticket_revoked = 1; if (this->tickets_granted) @@ -288,7 +288,7 @@ static void ticket_revoke(xine_ticket_t *this, int atomic) { this->atomic_revoke = 1; this->atomic_revoker_thread = pthread_self(); } - + pthread_mutex_unlock(&this->lock); if (!atomic) pthread_mutex_unlock(&this->revoke_lock); @@ -300,15 +300,15 @@ static void ticket_dispose(xine_ticket_t *this) { pthread_mutex_destroy(&this->revoke_lock); pthread_cond_destroy(&this->issued); pthread_cond_destroy(&this->revoked); - + free(this); } static xine_ticket_t *XINE_MALLOC ticket_init(void) { xine_ticket_t *port_ticket; - + port_ticket = calloc(1, sizeof(xine_ticket_t)); - + port_ticket->acquire_nonblocking = ticket_acquire_nonblocking; port_ticket->acquire = ticket_acquire; port_ticket->release_nonblocking = ticket_release_nonblocking; @@ -319,12 +319,12 @@ static xine_ticket_t *XINE_MALLOC ticket_init(void) { port_ticket->dispose = ticket_dispose; port_ticket->holder_thread_count = XINE_MAX_TICKET_HOLDER_THREADS; port_ticket->holder_threads = calloc(XINE_MAX_TICKET_HOLDER_THREADS,sizeof(*port_ticket->holder_threads)); - + pthread_mutex_init(&port_ticket->lock, NULL); pthread_mutex_init(&port_ticket->revoke_lock, NULL); pthread_cond_init(&port_ticket->issued, NULL); pthread_cond_init(&port_ticket->revoked, NULL); - + return port_ticket; } @@ -335,25 +335,25 @@ static void set_speed_internal (xine_stream_t *stream, int speed) { if (old_speed != XINE_SPEED_PAUSE && speed == XINE_SPEED_PAUSE) /* get all decoder and post threads in a state where they agree to be blocked */ xine->port_ticket->revoke(xine->port_ticket, 0); - + if (old_speed == XINE_SPEED_PAUSE && speed != XINE_SPEED_PAUSE) /* all decoder and post threads may continue now */ xine->port_ticket->issue(xine->port_ticket, 0); - + if (old_speed != XINE_SPEED_PAUSE && speed == XINE_SPEED_PAUSE) /* set master clock so audio_out loop can pause in a safe place */ stream->xine->clock->set_fine_speed (stream->xine->clock, speed); - + /* see coment on audio_out loop about audio_paused */ if( stream->audio_out ) { xine->port_ticket->acquire(xine->port_ticket, 1); - + /* inform audio_out that speed has changed - he knows what to do */ stream->audio_out->set_property (stream->audio_out, AO_PROP_CLOCK_SPEED, speed); - + xine->port_ticket->release(xine->port_ticket, 1); } - + if (old_speed == XINE_SPEED_PAUSE || speed != XINE_SPEED_PAUSE) /* master clock is set after resuming the audio device (audio_out loop may continue) */ stream->xine->clock->set_fine_speed (stream->xine->clock, speed); @@ -406,18 +406,18 @@ void xine_stop (xine_stream_t *stream) { stream->video_out->set_property(stream->video_out, VO_PROP_DISCARD_FRAMES, 1); stop_internal (stream); - + if (stream->slave && (stream->slave_affection & XINE_MASTER_SLAVE_STOP)) xine_stop(stream->slave); if (stream->video_out) - stream->video_out->set_property(stream->video_out, VO_PROP_DISCARD_FRAMES, 0); + stream->video_out->set_property(stream->video_out, VO_PROP_DISCARD_FRAMES, 0); if (stream->audio_out) stream->audio_out->set_property(stream->audio_out, AO_PROP_DISCARD_BUFFERS, 0); - + stream->xine->port_ticket->release(stream->xine->port_ticket, 1); stream->ignore_speed_change = 0; - + pthread_cleanup_pop (0); pthread_mutex_unlock (&stream->frontend_lock); } @@ -444,25 +444,25 @@ static void close_internal (xine_stream_t *stream) { pthread_mutex_unlock(&stream->speed_change_lock); stream->xine->port_ticket->acquire(stream->xine->port_ticket, 1); - + if (stream->audio_out) stream->audio_out->set_property(stream->audio_out, AO_PROP_DISCARD_BUFFERS, 1); if (stream->video_out) stream->video_out->set_property(stream->video_out, VO_PROP_DISCARD_FRAMES, 1); } - + stop_internal( stream ); - + if( !gapless_switch ) { if (stream->video_out) - stream->video_out->set_property(stream->video_out, VO_PROP_DISCARD_FRAMES, 0); + stream->video_out->set_property(stream->video_out, VO_PROP_DISCARD_FRAMES, 0); if (stream->audio_out) stream->audio_out->set_property(stream->audio_out, AO_PROP_DISCARD_BUFFERS, 0); - + stream->xine->port_ticket->release(stream->xine->port_ticket, 1); stream->ignore_speed_change = 0; } - + if (stream->demux_plugin) { _x_free_demux_plugin(stream, stream->demux_plugin); stream->demux_plugin = NULL; @@ -524,14 +524,14 @@ static int stream_rewire_audio(xine_post_out_t *output, void *data) return 0; stream->xine->port_ticket->revoke(stream->xine->port_ticket, 1); - + if (stream->audio_out->status(stream->audio_out, stream, &bits, &rate, &mode)) { /* register our stream at the new output port */ (new_port->open) (new_port, stream, bits, rate, mode); stream->audio_out->close(stream->audio_out, stream); } stream->audio_out = new_port; - + stream->xine->port_ticket->issue(stream->xine->port_ticket, 1); return 1; @@ -543,19 +543,19 @@ static int stream_rewire_video(xine_post_out_t *output, void *data) xine_video_port_t *new_port = (xine_video_port_t *)data; int64_t img_duration; int width, height; - + if (!data) return 0; stream->xine->port_ticket->revoke(stream->xine->port_ticket, 1); - + if (stream->video_out->status(stream->video_out, stream, &width, &height, &img_duration)) { /* register our stream at the new output port */ (new_port->open) (new_port, stream); stream->video_out->close(stream->video_out, stream); } stream->video_out = new_port; - + stream->xine->port_ticket->issue(stream->xine->port_ticket, 1); return 1; @@ -611,24 +611,24 @@ xine_stream_t *xine_stream_new (xine_t *this, stream->video_driver = vo->driver; else stream->video_driver = NULL; - + stream->video_channel = 0; stream->video_decoder_plugin = NULL; stream->video_decoder_streamtype = -1; - stream->header_count_audio = 0; - stream->header_count_video = 0; - stream->finished_count_audio = 0; + stream->header_count_audio = 0; + stream->header_count_video = 0; + stream->finished_count_audio = 0; stream->finished_count_video = 0; stream->err = 0; stream->broadcaster = NULL; - + /* * initial master/slave */ stream->master = stream; stream->slave = NULL; stream->slave_is_subtitle = 0; - + /* * init mutexes and conditions */ @@ -663,7 +663,7 @@ xine_stream_t *xine_stream_new (xine_t *this, _x_meta_info_reset(stream, i); _x_meta_info_public_reset(stream, i); } - + /* * event queues */ @@ -734,12 +734,12 @@ xine_stream_t *xine_stream_new (xine_t *this, stream->video_source.type = XINE_POST_DATA_VIDEO; stream->video_source.data = stream; stream->video_source.rewire = stream_rewire_video; - + stream->audio_source.name = "audio source"; stream->audio_source.type = XINE_POST_DATA_AUDIO; stream->audio_source.data = stream; stream->audio_source.rewire = stream_rewire_audio; - + return stream; } @@ -749,7 +749,7 @@ void _x_mrl_unescape(char *mrl) { for (i = 0; i < len; i++) { if ((mrl[i]=='%') && (i<(len-2))) { unsigned int c; - + if (sscanf(&mrl[i + 1], "%02x", &c) == 1) { mrl[i]= (char)c; memmove(mrl + i + 1, mrl + i + 3, len - i - 3); @@ -809,7 +809,7 @@ static int open_internal (xine_stream_t *stream, const char *mrl) { const char *stream_setup = NULL; const char *mrl_proto = NULL; int no_cache = 0; - + if (!mrl) { xprintf (stream->xine, XINE_VERBOSITY_LOG, _("xine: error while parsing mrl\n")); stream->err = XINE_ERROR_MALFORMED_MRL; @@ -841,23 +841,23 @@ static int open_internal (xine_stream_t *stream, const char *mrl) { if (!mrl_proto[0] || mrl_proto[0] != ':' || mrl_proto[1] != '/') mrl_proto = NULL; } - + /* for raw filenames we must try every '#' checking if it is part of the filename */ if( !mrl_proto && stream_setup) { struct stat stat_buf; int res; - + while( stream_setup ) { char *raw_filename = strndup (mrl, stream_setup - mrl); - + res = stat(raw_filename, &stat_buf); free(raw_filename); - if( !res ) + if( !res ) break; stream_setup = strchr(stream_setup + 1, '#'); } } - + { char *input_source = strndup (mrl, stream_setup ? stream_setup - mrl : strlen (mrl)); @@ -866,7 +866,7 @@ static int open_internal (xine_stream_t *stream, const char *mrl) { */ stream->input_plugin = _x_find_input_plugin (stream, input_source); free(input_source); - + if ( stream->input_plugin ) { int res; @@ -874,7 +874,7 @@ static int open_internal (xine_stream_t *stream, const char *mrl) { stream->input_plugin->input_class->get_description(stream->input_plugin->input_class)); if (stream->input_plugin->input_class->eject_media) stream->eject_class = stream->input_plugin->input_class; - _x_meta_info_set_utf8(stream, XINE_META_INFO_INPUT_PLUGIN, + _x_meta_info_set_utf8(stream, XINE_META_INFO_INPUT_PLUGIN, (stream->input_plugin->input_class->get_identifier (stream->input_plugin->input_class))); res = (stream->input_plugin->open) (stream->input_plugin); @@ -893,7 +893,7 @@ static int open_internal (xine_stream_t *stream, const char *mrl) { } } } - + if (!stream->input_plugin) { xine_log (stream->xine, XINE_LOG_MSG, _("xine: cannot find input plugin for MRL [%s]\n"),mrl); stream->err = XINE_ERROR_NO_INPUT_PLUGIN; @@ -961,7 +961,7 @@ static int open_internal (xine_stream_t *stream, const char *mrl) { xine_log(stream->xine, XINE_LOG_MSG, _("xine: join rip input plugin\n")); input_saver = _x_rip_plugin_get_instance (stream, filename); free(filename); - + if( input_saver ) { stream->input_plugin = input_saver; } else { @@ -1139,7 +1139,7 @@ static int open_internal (xine_stream_t *stream, const char *mrl) { if( xine_open( stream->slave, subtitle_mrl ) ) { xprintf (stream->xine, XINE_VERBOSITY_LOG, _("subtitle mrl opened '%s'\n"), subtitle_mrl); stream->slave->master = stream; - stream->slave_is_subtitle = 1; + stream->slave_is_subtitle = 1; } else { xprintf(stream->xine, XINE_VERBOSITY_LOG, _("xine: error opening subtitle mrl\n")); xine_dispose( stream->slave ); @@ -1338,9 +1338,9 @@ static int play_internal (xine_stream_t *stream, int start_pos, int start_time) /* set normal speed */ if (_x_get_speed(stream) != XINE_SPEED_NORMAL) set_speed_internal (stream, XINE_FINE_SPEED_NORMAL); - + stream->xine->port_ticket->acquire(stream->xine->port_ticket, 1); - + /* only flush/discard output ports on master streams */ if( stream->master == stream && !stream->gapless_switch) { /* discard audio/video buffers to get engine going and take the lock faster */ @@ -1349,26 +1349,26 @@ static int play_internal (xine_stream_t *stream, int start_pos, int start_time) if (stream->video_out) stream->video_out->set_property(stream->video_out, VO_PROP_DISCARD_FRAMES, 1); } - + pthread_mutex_lock( &stream->demux_lock ); /* demux_lock taken. now demuxer is suspended */ stream->demux_action_pending = 0; pthread_cond_signal(&stream->demux_resume); - /* set normal speed again (now that demuxer/input pair is suspended) + /* set normal speed again (now that demuxer/input pair is suspended) * some input plugin may have changed speed by itself, we must ensure * the engine is not paused. */ if (_x_get_speed(stream) != XINE_SPEED_NORMAL) set_speed_internal (stream, XINE_FINE_SPEED_NORMAL); - + /* * start/seek demux */ /* seek to new position (no data is sent to decoders yet) */ demux_status = stream->demux_plugin->seek (stream->demux_plugin, - start_pos, start_time, + start_pos, start_time, stream->demux_thread_running); /* only flush/discard output ports on master streams */ @@ -1378,9 +1378,9 @@ static int play_internal (xine_stream_t *stream, int start_pos, int start_time) if (stream->video_out) stream->video_out->set_property(stream->video_out, VO_PROP_DISCARD_FRAMES, 0); } - + stream->xine->port_ticket->release(stream->xine->port_ticket, 1); - + /* before resuming the demuxer, set first_frame_flag */ pthread_mutex_lock (&stream->first_frame_lock); stream->first_frame_flag = 2; @@ -1392,7 +1392,7 @@ static int play_internal (xine_stream_t *stream, int start_pos, int start_time) pthread_mutex_unlock( &stream->current_extra_info_lock ); demux_thread_running = stream->demux_thread_running; - + /* now resume demuxer thread if it is running already */ pthread_mutex_unlock( &stream->demux_lock ); @@ -1415,7 +1415,7 @@ static int play_internal (xine_stream_t *stream, int start_pos, int start_time) * see video_out.c */ wait_first_frame (stream); - + xprintf (stream->xine, XINE_VERBOSITY_DEBUG, "play_internal ...done\n"); return 1; @@ -1429,26 +1429,26 @@ int xine_play (xine_stream_t *stream, int start_pos, int start_time) { pthread_cleanup_push (mutex_cleanup, (void *) &stream->frontend_lock); stream->delay_finish_event = 0; - + ret = play_internal (stream, start_pos, start_time); if( stream->slave && (stream->slave_affection & XINE_MASTER_SLAVE_PLAY) ) xine_play (stream->slave, start_pos, start_time); - + stream->gapless_switch = 0; pthread_cleanup_pop (0); pthread_mutex_unlock (&stream->frontend_lock); - + return ret; } int xine_eject (xine_stream_t *stream) { - + int status; - if (!stream->eject_class) + if (!stream->eject_class) return 0; - + pthread_mutex_lock (&stream->frontend_lock); pthread_cleanup_push (mutex_cleanup, (void *) &stream->frontend_lock); @@ -1463,7 +1463,7 @@ int xine_eject (xine_stream_t *stream) { pthread_cleanup_pop (0); pthread_mutex_unlock (&stream->frontend_lock); - + return status; } @@ -1495,7 +1495,7 @@ static void xine_dispose_internal (xine_stream_t *stream) { pthread_mutex_unlock(&stream->xine->streams_lock); _x_refcounter_dispose(stream->refcounter); - + free (stream->current_extra_info); free (stream->video_decoder_extra_info); free (stream->audio_decoder_extra_info); @@ -1513,7 +1513,7 @@ void xine_dispose (xine_stream_t *stream) { xine_close(stream); if( stream->master != stream ) { - stream->master->slave = NULL; + stream->master->slave = NULL; } if( stream->slave && stream->slave->master == stream ) { stream->slave->master = NULL; @@ -1521,7 +1521,7 @@ void xine_dispose (xine_stream_t *stream) { if(stream->broadcaster) _x_close_broadcaster(stream->broadcaster); - + xprintf (stream->xine, XINE_VERBOSITY_DEBUG, "shutdown audio\n"); _x_audio_decoder_shutdown (stream); @@ -1553,13 +1553,13 @@ void xine_exit (xine_t *this) { if(this->clock) this->clock->exit (this->clock); - + if(this->config) this->config->dispose(this->config); if(this->port_ticket) this->port_ticket->dispose(this->port_ticket); - + #if defined(WIN32) WSACleanup(); #endif @@ -1617,7 +1617,7 @@ xine_t *xine_new (void) { #endif /* WIN32 */ this->verbosity = XINE_VERBOSITY_NONE; - + return this; } @@ -1671,10 +1671,10 @@ static void config_save_cb (void *this_gen, xine_cfg_entry_t *entry) { strcmp(entry->str_value, homedir_trail_slash) == 0)) { xine_stream_t *stream; xine_list_iterator_t ite; - + xine_log(this, XINE_LOG_MSG, _("xine: The specified save_dir \"%s\" might be a security risk.\n"), entry->str_value); - + pthread_mutex_lock(&this->streams_lock); if ( (ite = xine_list_front(this->streams)) ) { stream = xine_list_get_value(this->streams, ite); @@ -1682,7 +1682,7 @@ static void config_save_cb (void *this_gen, xine_cfg_entry_t *entry) { } pthread_mutex_unlock(&this->streams_lock); } - + free(homedir_trail_slash); this->save_path = entry->str_value; } @@ -1696,7 +1696,7 @@ void xine_init (xine_t *this) { */ pthread_mutex_init (&this->streams_lock, NULL); pthread_mutex_init (&this->log_lock, NULL); - + /* initialize color conversion tables and functions */ init_yuv_conversion(); @@ -1736,7 +1736,7 @@ void xine_init (xine_t *this) { * save directory */ this->save_path = this->config->register_filename ( - this->config, + this->config, "media.capture.save_dir", "", XINE_CONFIG_STRING_IS_DIRECTORY_NAME, _("directory for saving streams"), _("When using the stream save feature, files will be written only into this directory.\n" @@ -1744,7 +1744,7 @@ void xine_init (xine_t *this) { "can be used to fill files in it with arbitrary content. So you should be careful that " "the directory you specify is robust against any content in any file."), XINE_CONFIG_SECURITY, config_save_cb, this); - + /* * implicit configuration changes */ @@ -1784,7 +1784,7 @@ void xine_init (xine_t *this) { this->clock = _x_metronom_clock_init(this); this->clock->start_clock (this->clock, 0); - + /* * tickets */ @@ -1797,7 +1797,7 @@ void _x_select_spu_channel (xine_stream_t *stream, int channel) { stream->spu_channel_user = (channel >= -2 ? channel : -2); stream->xine->port_ticket->acquire(stream->xine->port_ticket, 0); - + switch (stream->spu_channel_user) { case -2: stream->spu_channel = -1; @@ -1817,7 +1817,7 @@ void _x_select_spu_channel (xine_stream_t *stream, int channel) { lprintf("set to %d\n",stream->spu_channel); stream->xine->port_ticket->release(stream->xine->port_ticket, 0); - + pthread_mutex_unlock (&stream->frontend_lock); } @@ -1877,10 +1877,10 @@ void _x_set_fine_speed (xine_stream_t *stream, int speed) { { if (speed <= XINE_SPEED_PAUSE) speed = XINE_SPEED_PAUSE; - + xprintf (stream->xine, XINE_VERBOSITY_DEBUG, "set_speed %d\n", speed); set_speed_internal (stream, speed); - + if (stream->slave && (stream->slave_affection & XINE_MASTER_SLAVE_SPEED)) set_speed_internal (stream->slave, speed); } @@ -1892,7 +1892,7 @@ int _x_get_fine_speed (xine_stream_t *stream) { } void _x_set_speed (xine_stream_t *stream, int speed) { - + if (speed > XINE_SPEED_FAST_4) speed = XINE_SPEED_FAST_4; @@ -1901,13 +1901,13 @@ void _x_set_speed (xine_stream_t *stream, int speed) { int _x_get_speed (xine_stream_t *stream) { int speed = _x_get_fine_speed (stream); - + /* - * ensure compatibility with old API, only valid XINE_SPEED_xxx + * ensure compatibility with old API, only valid XINE_SPEED_xxx * constants are allowed. XINE_SPEED_NORMAL may only be returned * if speed is exactly XINE_FINE_SPEED_NORMAL. */ - + if( speed <= XINE_SPEED_PAUSE ) return XINE_SPEED_PAUSE; if( speed <= XINE_SPEED_SLOW_4 * XINE_FINE_SPEED_NORMAL / XINE_SPEED_NORMAL ) @@ -1973,7 +1973,7 @@ static int _x_get_current_frame_data (xine_stream_t *stream, stream->xine->port_ticket->acquire(stream->xine->port_ticket, 0); frame = stream->video_out->get_last_frame (stream->video_out); stream->xine->port_ticket->release(stream->xine->port_ticket, 0); - + if (!frame) { data->img_size = 0; return 0; @@ -1997,7 +1997,7 @@ static int _x_get_current_frame_data (xine_stream_t *stream, data->ratio_code = XINE_VO_ASPECT_ANAMORPHIC; else if (RATIO_LIKE(data->ratio_code, 21100)) data->ratio_code = XINE_VO_ASPECT_DVB; - + data->format = frame->format; data->interlaced = frame->progressive_frame ? 0 : (2 - frame->top_field_first); @@ -2017,7 +2017,7 @@ static int _x_get_current_frame_data (xine_stream_t *stream, default: if (data->img || (flags & XINE_FRAME_DATA_ALLOCATE_IMG)) { - xprintf (stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (stream->xine, XINE_VERBOSITY_DEBUG, "xine: error, snapshot function not implemented for format 0x%x\n", frame->format); _x_abort (); } @@ -2040,7 +2040,7 @@ static int _x_get_current_frame_data (xine_stream_t *stream, /* return used buffer size */ data->img_size = required_size; } - + if (data->img) { switch (frame->format) { @@ -2070,7 +2070,7 @@ static int _x_get_current_frame_data (xine_stream_t *stream, break; default: - xprintf (stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (stream->xine, XINE_VERBOSITY_DEBUG, "xine: error, snapshot function not implemented for format 0x%x\n", frame->format); _x_abort (); } @@ -2247,7 +2247,7 @@ static inline void check_log_alloc (xine_t *this, int buf) void xine_log (xine_t *this, int buf, const char *format, ...) { va_list argp; char buffer[SCRATCH_LINE_LEN_MAX]; - + check_log_alloc (this, buf); va_start (argp, format); @@ -2265,7 +2265,7 @@ void xine_log (xine_t *this, int buf, const char *format, ...) { this->log_cb (this->log_cb_user_data, buf); } -void xine_vlog(xine_t *this, int buf, const char *format, +void xine_vlog(xine_t *this, int buf, const char *format, va_list args) { check_log_alloc (this, buf); @@ -2318,13 +2318,13 @@ int _x_query_buffer_usage(xine_stream_t *stream, int *num_video_buffers, int *nu if (num_video_buffers) *num_video_buffers = (stream->video_fifo ? stream->video_fifo->size(stream->video_fifo) : 0); - + if (num_audio_buffers) *num_audio_buffers = (stream->audio_fifo ? stream->audio_fifo->size(stream->audio_fifo) : 0); - + if ((num_video_frames && stream->video_out) || (num_audio_frames && stream->audio_out)) { - + ticket_acquired = stream->xine->port_ticket->acquire_nonblocking(stream->xine->port_ticket, 1); } diff --git a/src/xine-engine/xine_interface.c b/src/xine-engine/xine_interface.c index 0438aedfa..e39c19817 100644 --- a/src/xine-engine/xine_interface.c +++ b/src/xine-engine/xine_interface.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -46,7 +46,7 @@ #include "demuxers/demux.h" #include "post.h" -/* +/* * version information / checking */ @@ -65,12 +65,12 @@ void xine_get_version (int *major, int *minor, int *sub) { } int xine_check_version(int major, int minor, int sub) { - - if((XINE_MAJOR > major) || - ((XINE_MAJOR == major) && (XINE_MINOR > minor)) || + + if((XINE_MAJOR > major) || + ((XINE_MAJOR == major) && (XINE_MINOR > minor)) || ((XINE_MAJOR == major) && (XINE_MINOR == minor) && (XINE_SUB >= sub))) return 1; - + return 0; } @@ -86,7 +86,7 @@ const char* xine_config_register_string (xine_t *self, int exp_level, xine_config_cb_t changed_cb, void *cb_data) { - + return self->config->register_string (self->config, key, def_value, @@ -107,7 +107,7 @@ const char* xine_config_register_filename (xine_t *self, int exp_level, xine_config_cb_t changed_cb, void *cb_data) { - + return self->config->register_filename (self->config, key, def_value, req_type, description, help, exp_level, @@ -128,7 +128,7 @@ int xine_config_register_range (xine_t *self, description, help, exp_level, changed_cb, cb_data); } - + int xine_config_register_enum (xine_t *self, const char *key, @@ -144,7 +144,7 @@ int xine_config_register_enum (xine_t *self, description, help, exp_level, changed_cb, cb_data); } - + int xine_config_register_num (xine_t *self, const char *key, @@ -155,7 +155,7 @@ int xine_config_register_num (xine_t *self, xine_config_cb_t changed_cb, void *cb_data) { return self->config->register_num (self->config, - key, def_value, + key, def_value, description, help, exp_level, changed_cb, cb_data); } @@ -170,11 +170,11 @@ int xine_config_register_bool (xine_t *self, xine_config_cb_t changed_cb, void *cb_data) { return self->config->register_bool (self->config, - key, def_value, + key, def_value, description, help, exp_level, changed_cb, cb_data); } - + /* * helper function: @@ -210,7 +210,7 @@ static int config_get_current_entry (xine_t *this, xine_cfg_entry_t *entry) { } /* - * get first config item + * get first config item */ int xine_config_get_first_entry (xine_t *this, xine_cfg_entry_t *entry) { int result; @@ -227,12 +227,12 @@ int xine_config_get_first_entry (xine_t *this, xine_cfg_entry_t *entry) { return result; } - + /* * get next config item (iterate through the items) * this will return NULL when called after returning the last item - */ + */ int xine_config_get_next_entry (xine_t *this, xine_cfg_entry_t *entry) { int result; config_values_t *config = this->config; @@ -243,7 +243,7 @@ int xine_config_get_next_entry (xine_t *this, xine_cfg_entry_t *entry) { pthread_mutex_unlock(&config->config_lock); return (xine_config_get_first_entry(this, entry)); } - + /* do not hand out unclaimed entries */ do { config->cur = config->cur->next; @@ -252,11 +252,11 @@ int xine_config_get_next_entry (xine_t *this, xine_cfg_entry_t *entry) { pthread_mutex_unlock(&config->config_lock); return result; -} - +} + /* - * search for a config entry by key + * search for a config entry by key */ int xine_config_lookup_entry (xine_t *this, const char *key, @@ -274,7 +274,7 @@ int xine_config_lookup_entry (xine_t *this, const char *key, return result; } - + /* * update a config entry (which was returned from lookup_entry() ) @@ -294,12 +294,12 @@ void xine_config_update_entry (xine_t *this, const xine_cfg_entry_t *entry) { break; default: - xprintf (this, XINE_VERBOSITY_DEBUG, + xprintf (this, XINE_VERBOSITY_DEBUG, "xine_interface: error, unknown config entry type %d\n", entry->type); _x_abort(); } } - + void xine_config_reset (xine_t *this) { @@ -326,7 +326,7 @@ void xine_config_reset (xine_t *this) { int xine_gui_send_vo_data (xine_stream_t *stream, int type, void *data) { - return stream->video_driver->gui_data_exchange (stream->video_driver, + return stream->video_driver->gui_data_exchange (stream->video_driver, type, data); } #endif @@ -334,7 +334,7 @@ int xine_gui_send_vo_data (xine_stream_t *stream, int xine_port_send_gui_data (xine_video_port_t *vo, int type, void *data) { - return vo->driver->gui_data_exchange (vo->driver, + return vo->driver->gui_data_exchange (vo->driver, type, data); } @@ -369,7 +369,7 @@ void xine_set_param (xine_stream_t *stream, int param, int value) { _x_set_speed (stream, value); pthread_mutex_unlock (&stream->frontend_lock); break; - + case XINE_PARAM_FINE_SPEED: pthread_mutex_lock (&stream->frontend_lock); _x_set_fine_speed (stream, value); @@ -379,7 +379,7 @@ void xine_set_param (xine_stream_t *stream, int param, int value) { case XINE_PARAM_AV_OFFSET: stream->metronom->set_option (stream->metronom, METRONOM_AV_OFFSET, value); break; - + case XINE_PARAM_SPU_OFFSET: stream->metronom->set_option (stream->metronom, METRONOM_SPU_OFFSET, value); break; @@ -417,14 +417,14 @@ void xine_set_param (xine_stream_t *stream, int param, int value) { stream->audio_out->set_property (stream->audio_out, AO_PROP_MUTE_VOL, value); stream->xine->port_ticket->release(stream->xine->port_ticket, 0); break; - + case XINE_PARAM_AUDIO_COMPR_LEVEL: stream->xine->port_ticket->acquire(stream->xine->port_ticket, 0); if (stream->audio_out) stream->audio_out->set_property (stream->audio_out, AO_PROP_COMPRESSOR, value); stream->xine->port_ticket->release(stream->xine->port_ticket, 0); break; - + case XINE_PARAM_AUDIO_AMP_LEVEL: stream->xine->port_ticket->acquire(stream->xine->port_ticket, 0); if (stream->audio_out) { @@ -464,8 +464,8 @@ void xine_set_param (xine_stream_t *stream, int param, int value) { case XINE_PARAM_EQ_16000HZ: stream->xine->port_ticket->acquire(stream->xine->port_ticket, 0); if (stream->audio_out) - stream->audio_out->set_property (stream->audio_out, - param - XINE_PARAM_EQ_30HZ + AO_PROP_EQ_30HZ, + stream->audio_out->set_property (stream->audio_out, + param - XINE_PARAM_EQ_30HZ + AO_PROP_EQ_30HZ, value); stream->xine->port_ticket->release(stream->xine->port_ticket, 0); break; @@ -495,15 +495,15 @@ void xine_set_param (xine_stream_t *stream, int param, int value) { case XINE_PARAM_IGNORE_VIDEO: _x_stream_info_set(stream, XINE_STREAM_INFO_IGNORE_VIDEO, value); break; - + case XINE_PARAM_IGNORE_AUDIO: _x_stream_info_set(stream, XINE_STREAM_INFO_IGNORE_AUDIO, value); break; - + case XINE_PARAM_IGNORE_SPU: _x_stream_info_set(stream, XINE_STREAM_INFO_IGNORE_SPU, value); break; - + case XINE_PARAM_METRONOM_PREBUFFER: stream->metronom->set_option(stream->metronom, METRONOM_PREBUFFER, value); break; @@ -516,26 +516,26 @@ void xine_set_param (xine_stream_t *stream, int param, int value) { stream->broadcaster = NULL; } break; - + case XINE_PARAM_EARLY_FINISHED_EVENT: stream->early_finish_event = !!value; break; - + case XINE_PARAM_DELAY_FINISHED_EVENT: stream->delay_finish_event = value; break; - + case XINE_PARAM_GAPLESS_SWITCH: stream->gapless_switch = !!value; if( stream->gapless_switch && !stream->early_finish_event ) { xprintf (stream->xine, XINE_VERBOSITY_DEBUG, "frontend possibly buggy: gapless_switch without early_finish_event\n"); } break; - + default: xprintf (stream->xine, XINE_VERBOSITY_DEBUG, "xine_interface: unknown or deprecated stream param %d set\n", param); - } + } } int xine_get_param (xine_stream_t *stream, int param) { @@ -545,7 +545,7 @@ int xine_get_param (xine_stream_t *stream, int param) { case XINE_PARAM_SPEED: ret = _x_get_speed(stream); break; - + case XINE_PARAM_FINE_SPEED: ret = _x_get_fine_speed(stream); break; @@ -553,7 +553,7 @@ int xine_get_param (xine_stream_t *stream, int param) { case XINE_PARAM_AV_OFFSET: ret = stream->metronom->get_option (stream->metronom, METRONOM_AV_OFFSET); break; - + case XINE_PARAM_SPU_OFFSET: ret = stream->metronom->get_option (stream->metronom, METRONOM_SPU_OFFSET); break; @@ -576,7 +576,7 @@ int xine_get_param (xine_stream_t *stream, int param) { ret = -1; else ret = stream->audio_out->get_property (stream->audio_out, AO_PROP_MIXER_VOL); - stream->xine->port_ticket->release(stream->xine->port_ticket, 0); + stream->xine->port_ticket->release(stream->xine->port_ticket, 0); break; case XINE_PARAM_AUDIO_MUTE: @@ -585,7 +585,7 @@ int xine_get_param (xine_stream_t *stream, int param) { ret = -1; else ret = stream->audio_out->get_property (stream->audio_out, AO_PROP_MUTE_VOL); - stream->xine->port_ticket->release(stream->xine->port_ticket, 0); + stream->xine->port_ticket->release(stream->xine->port_ticket, 0); break; case XINE_PARAM_AUDIO_COMPR_LEVEL: @@ -594,7 +594,7 @@ int xine_get_param (xine_stream_t *stream, int param) { ret = -1; else ret = stream->audio_out->get_property (stream->audio_out, AO_PROP_COMPRESSOR); - stream->xine->port_ticket->release(stream->xine->port_ticket, 0); + stream->xine->port_ticket->release(stream->xine->port_ticket, 0); break; case XINE_PARAM_AUDIO_AMP_LEVEL: @@ -603,7 +603,7 @@ int xine_get_param (xine_stream_t *stream, int param) { ret = -1; else ret = stream->audio_out->get_property (stream->audio_out, AO_PROP_AMP); - stream->xine->port_ticket->release(stream->xine->port_ticket, 0); + stream->xine->port_ticket->release(stream->xine->port_ticket, 0); break; case XINE_PARAM_AUDIO_AMP_MUTE: @@ -612,7 +612,7 @@ int xine_get_param (xine_stream_t *stream, int param) { ret = -1; else ret = stream->audio_out->get_property (stream->audio_out, AO_PROP_AMP_MUTE); - stream->xine->port_ticket->release(stream->xine->port_ticket, 0); + stream->xine->port_ticket->release(stream->xine->port_ticket, 0); break; case XINE_PARAM_EQ_30HZ: @@ -629,9 +629,9 @@ int xine_get_param (xine_stream_t *stream, int param) { if (!stream->audio_out) ret = -1; else - ret= stream->audio_out->get_property (stream->audio_out, + ret= stream->audio_out->get_property (stream->audio_out, param - XINE_PARAM_EQ_30HZ + AO_PROP_EQ_30HZ); - stream->xine->port_ticket->release(stream->xine->port_ticket, 0); + stream->xine->port_ticket->release(stream->xine->port_ticket, 0); break; case XINE_PARAM_VERBOSITY: @@ -655,17 +655,17 @@ int xine_get_param (xine_stream_t *stream, int param) { case XINE_PARAM_VO_CROP_BOTTOM: stream->xine->port_ticket->acquire(stream->xine->port_ticket, 0); ret = stream->video_out->get_property(stream->video_out, param); - stream->xine->port_ticket->release(stream->xine->port_ticket, 0); + stream->xine->port_ticket->release(stream->xine->port_ticket, 0); break; - + case XINE_PARAM_IGNORE_VIDEO: ret = _x_stream_info_get_public(stream, XINE_STREAM_INFO_IGNORE_VIDEO); break; - + case XINE_PARAM_IGNORE_AUDIO: ret = _x_stream_info_get_public(stream, XINE_STREAM_INFO_IGNORE_AUDIO); break; - + case XINE_PARAM_IGNORE_SPU: ret = _x_stream_info_get_public(stream, XINE_STREAM_INFO_IGNORE_SPU); break; @@ -673,22 +673,22 @@ int xine_get_param (xine_stream_t *stream, int param) { case XINE_PARAM_METRONOM_PREBUFFER: ret = stream->metronom->get_option(stream->metronom, METRONOM_PREBUFFER); break; - + case XINE_PARAM_BROADCASTER_PORT: if( stream->broadcaster ) ret = _x_get_broadcaster_port(stream->broadcaster); else ret = 0; break; - + case XINE_PARAM_EARLY_FINISHED_EVENT: ret = stream->early_finish_event; break; - + case XINE_PARAM_DELAY_FINISHED_EVENT: ret = stream->delay_finish_event; break; - + case XINE_PARAM_GAPLESS_SWITCH: ret = stream->gapless_switch; break; @@ -758,7 +758,7 @@ uint32_t xine_get_stream_info (xine_stream_t *stream, int info) { case XINE_STREAM_INFO_MAX_SPU_CHANNEL: return stream->spu_track_map_entries; - + default: xprintf (stream->xine, XINE_VERBOSITY_DEBUG, "xine_interface: unknown or deprecated stream info %d requested\n", info); @@ -779,11 +779,11 @@ xine_osd_t *xine_osd_new(xine_stream_t *stream, int x, int y, int width, int hei uint32_t xine_osd_get_capabilities(xine_osd_t *this) { return this->osd.renderer->get_capabilities(&this->osd); -} +} void xine_osd_draw_point(xine_osd_t *this, int x, int y, int color) { this->osd.renderer->point(&this->osd, x, y, color); -} +} void xine_osd_draw_line(xine_osd_t *this, int x1, int y1, int x2, int y2, int color) { this->osd.renderer->line(&this->osd, x1, y1, x2, y2, color); @@ -871,7 +871,7 @@ const char *const *xine_post_list_outputs(xine_post_t *this_gen) { xine_post_in_t *xine_post_input(xine_post_t *this_gen, const char *name) { post_plugin_t *this = (post_plugin_t *)this_gen; xine_list_iterator_t ite; - + ite = xine_list_front(this->input); while (ite) { xine_post_in_t *input = xine_list_get_value(this->input, ite); @@ -885,7 +885,7 @@ xine_post_in_t *xine_post_input(xine_post_t *this_gen, const char *name) { xine_post_out_t *xine_post_output(xine_post_t *this_gen, const char *name) { post_plugin_t *this = (post_plugin_t *)this_gen; xine_list_iterator_t ite; - + ite = xine_list_front(this->output); while (ite) { xine_post_out_t *output = xine_list_get_value(this->output, ite); @@ -936,7 +936,7 @@ int xine_post_wire_audio_port(xine_post_out_t *source, xine_audio_port_t *ao) { } xine_post_out_t * xine_get_video_source(xine_stream_t *stream) { - return &stream->video_source; + return &stream->video_source; } xine_post_out_t * xine_get_audio_source(xine_stream_t *stream) { @@ -993,14 +993,14 @@ int _x_message(xine_stream_t *stream, int type, ...) { va_end(ap); args[n] = NULL; - + size += sizeof(xine_ui_message_data_t) + 1; data = calloc(1, size ); strcpy(data->compatibility.str, "Upgrade your frontend to see the error messages"); data->type = type; data->num_parameters = n; - + if( explanation ) { strcpy(data->messages, explanation); data->explanation = data->messages - (char *)data; @@ -1011,10 +1011,10 @@ int _x_message(xine_stream_t *stream, int type, ...) { } data->parameters = params - (char *)data; - + n = 0; *params = '\0'; - + while(args[n]) { strcpy(params, args[n]); params += strlen(args[n]) + 1; diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h index 945157fc2..7566c83e0 100644 --- a/src/xine-engine/xine_internal.h +++ b/src/xine-engine/xine_internal.h @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2005 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -96,11 +96,11 @@ typedef struct xine_ticket_s xine_ticket_t; */ struct xine_s { - + config_values_t *config; plugin_catalog_t *plugin_catalog; - + int demux_strategy; char *save_path; @@ -111,7 +111,7 @@ struct xine_s { xine_list_t *streams; pthread_mutex_t streams_lock; - + metronom_clock_t *clock; #ifdef XINE_ENGINE_INTERNAL @@ -134,34 +134,34 @@ struct xine_ticket_s { * the ticket before any operation that might block * * you must never write to this member directly - */ + */ int ticket_revoked; - + /* apply for a ticket; between acquire and relese of an irrevocable * ticket (be sure to pair them properly!), it is guaranteed that you * will never be blocked by ticket revocation */ void (*acquire)(xine_ticket_t *self, int irrevocable); - + /* give a ticket back */ void (*release)(xine_ticket_t *self, int irrevocable); - + /* renew a ticket, when it has been revoked, see ticket_revoked above; * irrevocable must be set to one, if your thread might have acquired * irrevocable tickets you don't know of; set it to zero only when * you know that this is impossible */ void (*renew)(xine_ticket_t *self, int irrevocable); - + #ifdef XINE_ENGINE_INTERNAL /* allow handing out new tickets */ void (*issue)(xine_ticket_t *self, int atomic); - + /* revoke all tickets and deny new ones; * a pair of atomic revoke and issue cannot be interrupted by another * revocation or by other threads acquiring tickets */ void (*revoke)(xine_ticket_t *self, int atomic); - + /* behaves like acquire() but doesn't block the calling thread; when - * the thread would have been blocked, 0 is returned otherwise 1 + * the thread would have been blocked, 0 is returned otherwise 1 * this function acquires a ticket even if ticket revocation is active */ int (*acquire_nonblocking)(xine_ticket_t *self, int irrevocable); @@ -170,7 +170,7 @@ struct xine_ticket_s { void (*release_nonblocking)(xine_ticket_t *self, int irrevocable); void (*dispose)(xine_ticket_t *self); - + pthread_mutex_t lock; pthread_mutex_t revoke_lock; pthread_cond_t issued; @@ -209,28 +209,28 @@ struct xine_event_queue_s { */ struct xine_stream_s { - + /* reference to xine context */ xine_t *xine; - /* metronom instance used by current stream */ + /* metronom instance used by current stream */ metronom_t *metronom; - + /* demuxers use input_plugin to read data */ input_plugin_t *input_plugin; - + /* current content detection method, see METHOD_BY_xxx */ int content_detection_method; /* used by video decoders */ xine_video_port_t *video_out; - + /* demuxers send data to video decoders using this fifo */ fifo_buffer_t *video_fifo; - + /* used by audio decoders */ xine_audio_port_t *audio_out; - + /* demuxers send data to audio decoders using this fifo */ fifo_buffer_t *audio_fifo; @@ -243,10 +243,10 @@ struct xine_stream_s { /* input_dvd uses this one. is it possible to add helper functions instead? */ spu_decoder_t *spu_decoder_plugin; - + /* dxr3 use this one, should be possible to fix to use the port instead */ vo_driver_t *video_driver; - + /* these definitely should be made private! */ int audio_channel_auto; int spu_decoder_streamtype; @@ -254,10 +254,10 @@ struct xine_stream_s { int spu_channel_auto; int spu_channel_letterbox; int spu_channel; - + #ifdef XINE_ENGINE_INTERNAL /* these are private variables, plugins must not access them */ - + int status; /* lock controlling speed change access */ @@ -274,7 +274,7 @@ struct xine_stream_s { int video_decoder_streamtype; extra_info_t *video_decoder_extra_info; int video_channel; - + pthread_t audio_thread; int audio_thread_created; audio_decoder_t *audio_decoder_plugin; @@ -321,15 +321,15 @@ struct xine_stream_s { /* wait for headers sent / stream decoding finished */ pthread_mutex_t counter_lock; pthread_cond_t counter_changed; - int header_count_audio; - int header_count_video; - int finished_count_audio; - int finished_count_video; + int header_count_audio; + int header_count_video; + int finished_count_audio; + int finished_count_video; /* event mechanism */ xine_list_t *event_queues; pthread_mutex_t event_queues_lock; - + /* demux thread stuff */ pthread_t demux_thread; int demux_thread_created; @@ -345,14 +345,14 @@ struct xine_stream_s { xine_post_out_t video_source; xine_post_out_t audio_source; - + int slave_is_subtitle; /* ... and will be automaticaly disposed */ int slave_affection; /* what operations need to be propagated down to the slave? */ - + int err; - + broadcaster_t *broadcaster; - + refcounter_t *refcounter; int emergency_brake; /* something went really wrong and this stream must be @@ -412,11 +412,11 @@ void _x_extra_info_reset( extra_info_t *extra_info ) XINE_PROTECTED; void _x_extra_info_merge( extra_info_t *dst, extra_info_t *src ) XINE_PROTECTED; void _x_get_current_info (xine_stream_t *stream, extra_info_t *extra_info, int size) XINE_PROTECTED; - - + + /* demuxer helper functions from demux.c */ -/* +/* * Flush audio and video buffers. It is called from demuxers on * seek/stop, and may be useful when user input changes a stream and * xine-lib has cached buffers that have yet to be played. @@ -446,9 +446,9 @@ void _x_demux_send_data(fifo_buffer_t *fifo, uint8_t *data, int size, int input_normpos, int input_time, int total_time, uint32_t frame_number) XINE_PROTECTED; -int _x_demux_read_send_data(fifo_buffer_t *fifo, input_plugin_t *input, - int size, int64_t pts, uint32_t type, - uint32_t decoder_flags, off_t input_normpos, +int _x_demux_read_send_data(fifo_buffer_t *fifo, input_plugin_t *input, + int size, int64_t pts, uint32_t type, + uint32_t decoder_flags, off_t input_normpos, int input_time, int total_time, uint32_t frame_number) XINE_PROTECTED; @@ -461,7 +461,7 @@ void _x_demux_send_mrl_reference (xine_stream_t *stream, int alternative, */ void _x_mrl_unescape(char *mrl) XINE_PROTECTED; -/* +/* * plugin_loader functions * */ diff --git a/src/xine-engine/xine_plugin.h b/src/xine-engine/xine_plugin.h index 74e7523e9..3aa236ceb 100644 --- a/src/xine-engine/xine_plugin.h +++ b/src/xine-engine/xine_plugin.h @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -33,7 +33,7 @@ #define PLUGIN_VIDEO_OUT 7 #define PLUGIN_POST 8 -#define PLUGIN_TYPE_MAX PLUGIN_POST +#define PLUGIN_TYPE_MAX PLUGIN_POST /* this flag may be or'ed with type in order to force preloading the plugin. * very useful to register config items on xine initialization. diff --git a/src/xine-engine/xineintl.h b/src/xine-engine/xineintl.h index 113a033fa..bb9c006ef 100644 --- a/src/xine-engine/xineintl.h +++ b/src/xine-engine/xineintl.h @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2005 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA diff --git a/src/xine-utils/array.c b/src/xine-utils/array.c index f6989fbb6..5cb3100ad 100644 --- a/src/xine-utils/array.c +++ b/src/xine-utils/array.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2006 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA diff --git a/src/xine-utils/array.h b/src/xine-utils/array.h index 44f3c7632..cd0780e04 100644 --- a/src/xine-utils/array.h +++ b/src/xine-utils/array.h @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2006 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA diff --git a/src/xine-utils/attributes.h b/src/xine-utils/attributes.h index d7a0e2f1e..2326dab18 100644 --- a/src/xine-utils/attributes.h +++ b/src/xine-utils/attributes.h @@ -47,7 +47,7 @@ # define SUPPORT_ATTRIBUTE_UNUSED 1 # define SUPPORT_ATTRIBUTE_CONST 1 # endif - + # if __GNUC__ >= 4 # define SUPPORT_ATTRIBUTE_VISIBILITY_DEFAULT 1 # if __ELF__ diff --git a/src/xine-utils/color.c b/src/xine-utils/color.c index f5ebf6c00..bea4cd952 100644 --- a/src/xine-utils/color.c +++ b/src/xine-utils/color.c @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * Color Conversion Utility Functions - * + * * Overview: xine's video output modules only accept YUV images from * video decoder modules. A video decoder can either send a planar (YV12) * image or a packed (YUY2) image to a video output module. However, many @@ -140,16 +140,16 @@ void (*yuv411_to_yv12) const unsigned char *v_src, int v_src_pitch, unsigned char *v_dest, int v_dest_pitch, int width, int height); void (*yv12_to_yuy2) - (const unsigned char *y_src, int y_src_pitch, - const unsigned char *u_src, int u_src_pitch, - const unsigned char *v_src, int v_src_pitch, + (const unsigned char *y_src, int y_src_pitch, + const unsigned char *u_src, int u_src_pitch, + const unsigned char *v_src, int v_src_pitch, unsigned char *yuy2_map, int yuy2_pitch, int width, int height, int progressive); void (*yuy2_to_yv12) (const unsigned char *yuy2_map, int yuy2_pitch, - unsigned char *y_dst, int y_dst_pitch, - unsigned char *u_dst, int u_dst_pitch, - unsigned char *v_dst, int v_dst_pitch, + unsigned char *y_dst, int y_dst_pitch, + unsigned char *u_dst, int u_dst_pitch, + unsigned char *v_dst, int v_dst_pitch, int width, int height); /* @@ -183,7 +183,7 @@ void free_yuv_planes(yuv_planes_t *yuv_planes) { free(yuv_planes->v); } -/* +/* * yuv444_to_yuy2_c * * This is the simple, portable C version of the yuv444_to_yuy2() function. @@ -200,7 +200,7 @@ void free_yuv_planes(yuv_planes_t *yuv_planes) { * * YUY2 map: Y0 U0 Y1 V1 Y2 U2 Y3 V3 */ -static void yuv444_to_yuy2_c(const yuv_planes_t *yuv_planes, unsigned char *yuy2_map, +static void yuv444_to_yuy2_c(const yuv_planes_t *yuv_planes, unsigned char *yuy2_map, int pitch) { unsigned int row_ptr, pixel_ptr; @@ -235,12 +235,12 @@ static void yuv444_to_yuy2_c(const yuv_planes_t *yuv_planes, unsigned char *yuy2 } } -/* +/* * yuv444_to_yuy2_mmx * * This is the proper, filtering version of the yuv444_to_yuy2() function * optimized with basic Intel MMX instructions. - * + * * yuv_planes contains the 3 non-subsampled planes that represent Y, U, * and V samples for every pixel in the image. The goal is to convert the * 3 planes to a single packed YUY2 byte stream. Dealing with the Y @@ -345,7 +345,7 @@ static void yuv444_to_yuy2_mmx(const yuv_planes_t *yuv_planes, unsigned char *yu block_loops--; } - /* set up some MMX registers: + /* set up some MMX registers: * mm0 = 0, mm7 = color filter */ pxor_r2r(mm0, mm0); movq_m2r(*filter, mm7); @@ -525,8 +525,8 @@ static void vscale_chroma_line (unsigned char *dst, int pitch, } } -static void upsample_c_plane_c(const unsigned char *src, int src_width, - int src_height, unsigned char *dest, +static void upsample_c_plane_c(const unsigned char *src, int src_width, + int src_height, unsigned char *dest, unsigned int src_pitch, unsigned int dest_pitch) { unsigned char *cr1; @@ -585,11 +585,11 @@ static void yuv9_to_yv12_c } /* U plane */ - upsample_c_plane_c(u_src, width / 4, height / 4, u_dest, + upsample_c_plane_c(u_src, width / 4, height / 4, u_dest, u_src_pitch, u_dest_pitch); /* V plane */ - upsample_c_plane_c(v_src, width / 4, height / 4, v_dest, + upsample_c_plane_c(v_src, width / 4, height / 4, v_dest, v_src_pitch, v_dest_pitch); } @@ -628,7 +628,7 @@ static void yuv411_to_yv12_c c_src_pixel++) { /* downsample by averaging the samples from 2 rows */ - c_sample = + c_sample = (u_src[c_src_pixel] + u_src[c_src_pixel + u_src_pitch] + 1) / 2; /* upsample by outputting the sample twice on the YV12 row */ u_dest[c_dest_pixel++] = c_sample; @@ -647,7 +647,7 @@ static void yuv411_to_yv12_c c_src_pixel++) { /* downsample by averaging the samples from 2 rows */ - c_sample = + c_sample = (v_src[c_src_pixel] + v_src[c_src_pixel + v_src_pitch] + 1 ) / 2; /* upsample by outputting the sample twice on the YV12 row */ v_dest[c_dest_pixel++] = c_sample; @@ -670,9 +670,9 @@ static void yuv411_to_yv12_c * changed to support interlaced frames and use simple mean interpolation [MF] *****************************************************************************/ static void yv12_to_yuy2_c - (const unsigned char *y_src, int y_src_pitch, - const unsigned char *u_src, int u_src_pitch, - const unsigned char *v_src, int v_src_pitch, + (const unsigned char *y_src, int y_src_pitch, + const unsigned char *u_src, int u_src_pitch, + const unsigned char *v_src, int v_src_pitch, unsigned char *yuy2_map, int yuy2_pitch, int width, int height, int progressive) { @@ -697,15 +697,15 @@ static void yv12_to_yuy2_c { p_line1 = p_line2; p_line2 += yuy2_pitch; - + p_y1 = p_y2; p_y2 += y_src_pitch; - + for( i_x = width / 2 ; i_x-- ; ) { C_YUV420_YUYV( ); } - + p_y2 += i_source_margin; p_u += i_source_u_margin; p_v += i_source_v_margin; @@ -727,15 +727,15 @@ static void yv12_to_yuy2_c { p_line1 = p_line2; p_line2 += 2 * yuy2_pitch; - + p_y1 = p_y2; p_y2 += 2 * y_src_pitch; - + for( i_x = width / 2 ; i_x-- ; ) { C_YUV420_YUYV( ); } - + p_y2 += i_source_margin + y_src_pitch; p_u += i_source_u_margin + u_src_pitch; p_v += i_source_v_margin + v_src_pitch; @@ -748,27 +748,27 @@ static void yv12_to_yuy2_c } p_line2 += i_dest_margin + yuy2_pitch; } - + p_line2 = yuy2_map + yuy2_pitch; p_y2 = y_src + y_src_pitch; p_u = u_src + u_src_pitch; p_v = v_src + v_src_pitch; p_u2 = u_src + 3*u_src_pitch; p_v2 = v_src + 3*v_src_pitch; - + for( i_y = height / 4 ; i_y-- ; ) { p_line1 = p_line2; p_line2 += 2 * yuy2_pitch; - + p_y1 = p_y2; p_y2 += 2 * y_src_pitch; - + for( i_x = width / 2 ; i_x-- ; ) { C_YUV420_YUYV( ); } - + p_y2 += i_source_margin + y_src_pitch; p_u += i_source_u_margin + u_src_pitch; p_v += i_source_v_margin + v_src_pitch; @@ -825,9 +825,9 @@ do { #endif static void yv12_to_yuy2_mmxext - (const unsigned char *y_src, int y_src_pitch, - const unsigned char *u_src, int u_src_pitch, - const unsigned char *v_src, int v_src_pitch, + (const unsigned char *y_src, int y_src_pitch, + const unsigned char *u_src, int u_src_pitch, + const unsigned char *v_src, int v_src_pitch, unsigned char *yuy2_map, int yuy2_pitch, int width, int height, int progressive ) { #if defined(ARCH_X86) || defined(ARCH_X86_64) @@ -851,10 +851,10 @@ static void yv12_to_yuy2_mmxext { p_line1 = p_line2; p_line2 += yuy2_pitch; - + p_y1 = p_y2; p_y2 += y_src_pitch; - + for( i_x = width / 8 ; i_x-- ; ) { MMXEXT_YUV420_YUYV( ); @@ -863,7 +863,7 @@ static void yv12_to_yuy2_mmxext { C_YUV420_YUYV( ); } - + p_y2 += i_source_margin; p_u += i_source_u_margin; p_v += i_source_v_margin; @@ -885,10 +885,10 @@ static void yv12_to_yuy2_mmxext { p_line1 = p_line2; p_line2 += 2 * yuy2_pitch; - + p_y1 = p_y2; p_y2 += 2 * y_src_pitch; - + for( i_x = width / 8 ; i_x-- ; ) { MMXEXT_YUV420_YUYV( ); @@ -897,7 +897,7 @@ static void yv12_to_yuy2_mmxext { C_YUV420_YUYV( ); } - + p_y2 += i_source_margin + y_src_pitch; p_u += i_source_u_margin + u_src_pitch; p_v += i_source_v_margin + v_src_pitch; @@ -910,22 +910,22 @@ static void yv12_to_yuy2_mmxext } p_line2 += i_dest_margin + yuy2_pitch; } - + p_line2 = yuy2_map + yuy2_pitch; p_y2 = y_src + y_src_pitch; p_u = u_src + u_src_pitch; p_v = v_src + v_src_pitch; p_u2 = u_src + 3*u_src_pitch; p_v2 = v_src + 3*v_src_pitch; - + for( i_y = height / 4 ; i_y-- ; ) { p_line1 = p_line2; p_line2 += 2 * yuy2_pitch; - + p_y1 = p_y2; p_y2 += 2 * y_src_pitch; - + for( i_x = width / 8 ; i_x-- ; ) { MMXEXT_YUV420_YUYV( ); @@ -934,7 +934,7 @@ static void yv12_to_yuy2_mmxext { C_YUV420_YUYV( ); } - + p_y2 += i_source_margin + y_src_pitch; p_u += i_source_u_margin + u_src_pitch; p_v += i_source_v_margin + v_src_pitch; @@ -964,9 +964,9 @@ static void yv12_to_yuy2_mmxext static void yuy2_to_yv12_c (const unsigned char *yuy2_map, int yuy2_pitch, - unsigned char *y_dst, int y_dst_pitch, - unsigned char *u_dst, int u_dst_pitch, - unsigned char *v_dst, int v_dst_pitch, + unsigned char *y_dst, int y_dst_pitch, + unsigned char *u_dst, int u_dst_pitch, + unsigned char *v_dst, int v_dst_pitch, int width, int height) { const uint8_t *p_line1, *p_line2 = yuy2_map; @@ -986,10 +986,10 @@ static void yuy2_to_yv12_c { p_line1 = p_line2; p_line2 += yuy2_pitch; - + p_y1 = p_y2; p_y2 += y_dst_pitch; - + for( i_x = width / 8 ; i_x-- ; ) { C_YUYV_YUV420( ); @@ -997,7 +997,7 @@ static void yuy2_to_yv12_c C_YUYV_YUV420( ); C_YUYV_YUV420( ); } - + p_y2 += i_dest_margin; p_u += i_dest_u_margin; p_v += i_dest_v_margin; @@ -1057,9 +1057,9 @@ do { static void yuy2_to_yv12_mmxext (const unsigned char *yuy2_map, int yuy2_pitch, - unsigned char *y_dst, int y_dst_pitch, - unsigned char *u_dst, int u_dst_pitch, - unsigned char *v_dst, int v_dst_pitch, + unsigned char *y_dst, int y_dst_pitch, + unsigned char *u_dst, int u_dst_pitch, + unsigned char *v_dst, int v_dst_pitch, int width, int height) { #if defined(ARCH_X86) || defined(ARCH_X86_64) const uint8_t *p_line1, *p_line2 = yuy2_map; @@ -1083,15 +1083,15 @@ static void yuy2_to_yv12_mmxext { p_line1 = p_line2; p_line2 += yuy2_pitch; - + p_y1 = p_y2; p_y2 += y_dst_pitch; - + for( i_x = width / 8 ; i_x-- ; ) { MMXEXT_YUYV_YUV420( ); } - + p_y2 += i_dest_margin; p_u += i_dest_u_margin; p_v += i_dest_v_margin; diff --git a/src/xine-utils/compat.h b/src/xine-utils/compat.h index d4b95aeb3..0392b45fd 100644 --- a/src/xine-utils/compat.h +++ b/src/xine-utils/compat.h @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2001 the xine project - * + * * This file is part of xine, a unix video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA diff --git a/src/xine-utils/copy.c b/src/xine-utils/copy.c index ed42b3a88..277cb64af 100644 --- a/src/xine-utils/copy.c +++ b/src/xine-utils/copy.c @@ -17,10 +17,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * - * $Id: + * $Id: * */ - + #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -32,9 +32,9 @@ void yv12_to_yv12 const unsigned char *u_src, int u_src_pitch, unsigned char *u_dst, int u_dst_pitch, const unsigned char *v_src, int v_src_pitch, unsigned char *v_dst, int v_dst_pitch, int width, int height) { - + int y, half_width = width / 2; - + /* Y Plane */ if(y_src_pitch == y_dst_pitch) xine_fast_memcpy(y_dst, y_src, y_src_pitch*height); @@ -45,7 +45,7 @@ void yv12_to_yv12 y_dst += y_dst_pitch; } } - + /* U/V Planes */ if((u_src_pitch == u_dst_pitch) && (v_src_pitch == v_dst_pitch)) { xine_fast_memcpy(u_dst, u_src, u_src_pitch*height/2); @@ -54,12 +54,12 @@ void yv12_to_yv12 for(y = 0; y < (height / 2); y++) { xine_fast_memcpy(u_dst, u_src, half_width); xine_fast_memcpy(v_dst, v_src, half_width); - + u_src += u_src_pitch; v_src += v_src_pitch; - + u_dst += u_dst_pitch; - v_dst += v_dst_pitch; + v_dst += v_dst_pitch; } } } @@ -68,9 +68,9 @@ void yuy2_to_yuy2 (const unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch, int width, int height) { - + int y, double_width = width * 2; - + if(src_pitch == dst_pitch) xine_fast_memcpy(dst, src, src_pitch*height); else { diff --git a/src/xine-utils/cpu_accel.c b/src/xine-utils/cpu_accel.c index d6c4bd9a8..1e12986fb 100644 --- a/src/xine-utils/cpu_accel.c +++ b/src/xine-utils/cpu_accel.c @@ -285,10 +285,10 @@ static uint32_t arch_accel (void) } canjump = 1; - + /* pdist %f0, %f0, %f0 */ __asm__ __volatile__(".word\t0x81b007c0"); - + canjump = 0; flags |= MM_ACCEL_SPARC_VIS; @@ -296,15 +296,15 @@ static uint32_t arch_accel (void) signal(SIGILL, SIG_DFL); return flags; } - + canjump = 1; - + /* edge8n %g0, %g0, %g0 */ __asm__ __volatile__(".word\t0x81b00020"); - + canjump = 0; flags |= MM_ACCEL_SPARC_VIS2; - + signal(SIGILL, SIG_DFL); return flags; } diff --git a/src/xine-utils/list.c b/src/xine-utils/list.c index eb654a3e3..48ef0bff6 100644 --- a/src/xine-utils/list.c +++ b/src/xine-utils/list.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2006 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA diff --git a/src/xine-utils/list.h b/src/xine-utils/list.h index f05ed2b0e..4910f9982 100644 --- a/src/xine-utils/list.h +++ b/src/xine-utils/list.h @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2006 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA diff --git a/src/xine-utils/mangle.h b/src/xine-utils/mangle.h index 746317fa5..4ca7db7a5 100644 --- a/src/xine-utils/mangle.h +++ b/src/xine-utils/mangle.h @@ -8,12 +8,12 @@ * 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA diff --git a/src/xine-utils/memcpy.c b/src/xine-utils/memcpy.c index 1b3e38fd1..a19e700c5 100644 --- a/src/xine-utils/memcpy.c +++ b/src/xine-utils/memcpy.c @@ -471,7 +471,7 @@ void xine_probe_fast_memcpy(xine_t *xine) #endif NULL }; - + config_flags = xine_mm_accel(); best = xine->config->register_enum (xine->config, "engine.performance.memcpy_method", 0, diff --git a/src/xine-utils/monitor.c b/src/xine-utils/monitor.c index 77280ffc6..3fe83b3f7 100644 --- a/src/xine-utils/monitor.c +++ b/src/xine-utils/monitor.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2008 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA diff --git a/src/xine-utils/pool.c b/src/xine-utils/pool.c index 1b7fd63f3..8b7f6d9f3 100644 --- a/src/xine-utils/pool.c +++ b/src/xine-utils/pool.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2006 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -39,7 +39,7 @@ struct xine_pool_chunk_s { struct xine_pool_s { size_t object_size; - + /* callbacks */ void (*create_object)(void *object); void (*prepare_object)(void *object); diff --git a/src/xine-utils/pool.h b/src/xine-utils/pool.h index 2667b7fdc..37f60220c 100644 --- a/src/xine-utils/pool.h +++ b/src/xine-utils/pool.h @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2006 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA diff --git a/src/xine-utils/ring_buffer.c b/src/xine-utils/ring_buffer.c index 031fda4fc..da3e2450c 100644 --- a/src/xine-utils/ring_buffer.c +++ b/src/xine-utils/ring_buffer.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2006 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA diff --git a/src/xine-utils/ring_buffer.h b/src/xine-utils/ring_buffer.h index 5f104dc77..7678aa903 100644 --- a/src/xine-utils/ring_buffer.h +++ b/src/xine-utils/ring_buffer.h @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2006 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA diff --git a/src/xine-utils/sorted_array.c b/src/xine-utils/sorted_array.c index 363325f0b..4bb618d4c 100644 --- a/src/xine-utils/sorted_array.c +++ b/src/xine-utils/sorted_array.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2006 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA diff --git a/src/xine-utils/sorted_array.h b/src/xine-utils/sorted_array.h index c6fdd1c25..0d229199a 100644 --- a/src/xine-utils/sorted_array.h +++ b/src/xine-utils/sorted_array.h @@ -1,25 +1,25 @@ -/* +/* * Copyright (C) 2000-2006 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * Sorted array which grows automatically when you add elements. * A binary search is used to find the position of a new element. - * + * * Example: * Let's create de comparison method for integers: * diff --git a/src/xine-utils/utils.c b/src/xine-utils/utils.c index c3281f369..2f62c95a8 100644 --- a/src/xine-utils/utils.c +++ b/src/xine-utils/utils.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2005 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -274,12 +274,12 @@ void *xine_xmalloc(size_t size) { void *xine_xmalloc_aligned(size_t alignment, size_t size, void **base) { char *ptr; - + *base = ptr = calloc(1, size+alignment); - + while ((size_t) ptr % alignment) ptr++; - + return ptr; } @@ -532,13 +532,13 @@ static const lang_locale_t *_get_first_lang_locale(const char *lcal) { lang_len = mod++ - lcal; else lang_len = strlen(lcal); - + while(llocale->language) { if(!strncmp(lcal, llocale->language, lang_len)) { if ((!mod && !llocale->modifier) || (mod && llocale->modifier && !strcmp(mod, llocale->modifier))) return llocale; } - + llocale++; } } @@ -548,7 +548,7 @@ static const lang_locale_t *_get_first_lang_locale(const char *lcal) { static char *_get_lang(void) { char *lang; - + if(!(lang = getenv("LC_ALL"))) if(!(lang = getenv("LC_MESSAGES"))) lang = getenv("LANG"); @@ -562,7 +562,7 @@ static char *_get_lang(void) { */ char *xine_get_system_encoding(void) { char *codeset = NULL; - + #ifdef HAVE_NL_LANGINFO setlocale(LC_CTYPE, ""); codeset = nl_langinfo(CODESET); @@ -646,15 +646,15 @@ int xine_monotonic_clock(struct timeval *tv, struct timezone *tz) #if _POSIX_TIMERS > 0 && defined(_POSIX_MONOTONIC_CLOCK) && defined(HAVE_POSIX_TIMERS) static int initialized = 0; static int use_clock_monotonic = 0; - + struct timespec tp; - - if( !initialized ) { + + if( !initialized ) { struct timespec res; int ret; - + ret = clock_getres(CLOCK_MONOTONIC, &res); - + if( ret != 0 ) { lprintf("get resolution of monotonic clock failed\n"); } else { @@ -673,8 +673,8 @@ int xine_monotonic_clock(struct timeval *tv, struct timezone *tz) } } initialized = 1; - } - + } + if(use_clock_monotonic && !clock_gettime(CLOCK_MONOTONIC, &tp)) { tv->tv_sec = tp.tv_sec; tv->tv_usec = tp.tv_nsec / 1000; @@ -684,7 +684,7 @@ int xine_monotonic_clock(struct timeval *tv, struct timezone *tz) } #else - + return gettimeofday(tv, tz); #endif diff --git a/src/xine-utils/xine_buffer.c b/src/xine-utils/xine_buffer.c index 44d0acbab..b1cfcf76b 100644 --- a/src/xine-utils/xine_buffer.c +++ b/src/xine-utils/xine_buffer.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -74,9 +74,9 @@ typedef struct { uint32_t size; uint32_t chunk_size; - + uint8_t magic; - + } xine_buffer_header_t; #define XINE_BUFFER_HEADER_SIZE 9 @@ -120,7 +120,7 @@ typedef struct { * reallocation on slow growing buffers. */ void *xine_buffer_init(int chunk_size) { - + uint8_t *data=calloc(1, chunk_size+XINE_BUFFER_HEADER_SIZE); xine_buffer_header_t *header=(xine_buffer_header_t*)data; @@ -157,7 +157,7 @@ void *_xine_buffer_free(void *buf) { void *xine_buffer_dup(const void *buf) { uint8_t *new; - + #ifdef CHECKS if (!buf) { lprintf("warning: got NULL pointer\n"); @@ -168,7 +168,7 @@ void *xine_buffer_dup(const void *buf) { new = malloc(GET_HEADER(buf)->size+XINE_BUFFER_HEADER_SIZE); - xine_fast_memcpy(new, ((uint8_t*)buf)-XINE_BUFFER_HEADER_SIZE, + xine_fast_memcpy(new, ((uint8_t*)buf)-XINE_BUFFER_HEADER_SIZE, GET_HEADER(buf)->size+XINE_BUFFER_HEADER_SIZE); return new+XINE_BUFFER_HEADER_SIZE; @@ -180,7 +180,7 @@ void *xine_buffer_dup(const void *buf) { #define xine_buffer_copyin(buf,i,data,len) \ buf=_xine_buffer_copyin(buf,i,data,len) void *_xine_buffer_copyin(void *buf, int index, const void *data, int len) { - + #ifdef CHECKS if (!buf || !data) { lprintf("warning: got NULL pointer\n"); @@ -237,7 +237,7 @@ void *_xine_buffer_set(void *buf, int index, uint8_t b, int len) { #endif GROW_TO(buf, index+len); - + memset(((uint8_t*)buf)+index, b, len); return buf; @@ -326,6 +326,6 @@ void *_xine_buffer_ensure_size(void *buf, int size) { #endif GROW_TO(buf, size); - + return buf; } diff --git a/src/xine-utils/xine_buffer.h b/src/xine-utils/xine_buffer.h index 84511bd1b..f88a21aef 100644 --- a/src/xine-utils/xine_buffer.h +++ b/src/xine-utils/xine_buffer.h @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA diff --git a/src/xine-utils/xine_check.c b/src/xine-utils/xine_check.c index b8465f3f8..ad94b0382 100644 --- a/src/xine-utils/xine_check.c +++ b/src/xine-utils/xine_check.c @@ -114,7 +114,7 @@ static xine_health_check_t* _x_health_check_kernel (xine_health_check_t* hc) { hc->status = XINE_HEALTH_CHECK_OK; } else { - set_hc_result (hc, XINE_HEALTH_CHECK_FAIL, + set_hc_result (hc, XINE_HEALTH_CHECK_FAIL, "FAILED - Could not get kernel information."); } return hc; @@ -129,7 +129,7 @@ static xine_health_check_t* _x_health_check_mtrr (xine_health_check_t* hc) { fd = fopen("/proc/mtrr", "r"); if (!fd) { - set_hc_result (hc, XINE_HEALTH_CHECK_FAIL, + set_hc_result (hc, XINE_HEALTH_CHECK_FAIL, "FAILED: mtrr is not enabled."); } else { hc->status = XINE_HEALTH_CHECK_OK; @@ -143,7 +143,7 @@ static xine_health_check_t* _x_health_check_mtrr (xine_health_check_t* hc) { hc->title = "Check for MTRR support"; hc->explanation = "Don't worry about this one"; - set_hc_result (hc, XINE_HEALTH_CHECK_OK, + set_hc_result (hc, XINE_HEALTH_CHECK_OK, "mtrr does not apply on this hw platform."); return hc; } @@ -162,12 +162,12 @@ static xine_health_check_t* _x_health_check_cdrom (xine_health_check_t* hc) { set_hc_result (hc, XINE_HEALTH_CHECK_FAIL, "FAILED - could not access cdrom: %s\n", hc->cdrom_dev); return hc; } - + if ((cdrom_st.st_mode & S_IFMT) != S_IFBLK) { set_hc_result (hc, XINE_HEALTH_CHECK_FAIL, "FAILED - %s is not a block device.\n", hc->cdrom_dev); return hc; } - + if ( (fd = open(hc->cdrom_dev, O_RDWR)) < 0) { switch (errno) { case EACCES: @@ -180,7 +180,7 @@ static xine_health_check_t* _x_health_check_cdrom (xine_health_check_t* hc) { } } else close(fd); - + hc->status = XINE_HEALTH_CHECK_OK; return hc; } @@ -279,7 +279,7 @@ static xine_health_check_t* _x_health_check_x (xine_health_check_t* hc) { char* env_display = getenv("DISPLAY"); hc->title = "Check for X11 environment"; - hc->explanation = "Make sure you're running X11, if this is an ssh connection,\n" + hc->explanation = "Make sure you're running X11, if this is an ssh connection,\n" "make sure you have X11 forwarding enabled (ssh -X ...)"; if (strlen (env_display) == 0) { @@ -341,7 +341,7 @@ static xine_health_check_t* _x_health_check_xv (xine_health_check_t* hc) { dlclose(x11_handle); return hc; } - + dlerror(); /* clear error code */ xv_handle = dlopen(LIBXV_SO, RTLD_LAZY); if(!xv_handle) { @@ -362,7 +362,7 @@ static xine_health_check_t* _x_health_check_xv (xine_health_check_t* hc) { dlclose(xv_handle); return hc; } - + /* Get reference to XvQueryAdaptors */ xvqueryadaptors = dlsym(xv_handle,"XvQueryAdaptors"); if((err = dlerror()) != NULL) { @@ -372,7 +372,7 @@ static xine_health_check_t* _x_health_check_xv (xine_health_check_t* hc) { dlclose(xv_handle); return hc; } - + /* Get reference to XvListImageFormats */ xvlistimageformats = dlsym(xv_handle,"XvListImageFormats"); if((err = dlerror()) != NULL) { @@ -382,7 +382,7 @@ static xine_health_check_t* _x_health_check_xv (xine_health_check_t* hc) { dlclose(xv_handle); return hc; } - + if(!(dpy = (*xopendisplay)(disname))) { if (!disname) { @@ -445,7 +445,7 @@ static xine_health_check_t* _x_health_check_xv (xine_health_check_t* hc) { dlclose(x11_handle); dlclose(xv_handle); - + return hc; #else hc->title = "Check for MIT Xv extension"; @@ -501,7 +501,7 @@ xine_health_check_t* xine_health_check (xine_health_check_t* hc, int check_num) hc->title = "xine health check not supported on this platform"; hc->explanation = "contact the xine-devel mailing list if you'd like to\n" "contribute code for your platform."; - set_hc_result(hc, XINE_HEALTH_CHECK_NO_SUCH_CHECK, + set_hc_result(hc, XINE_HEALTH_CHECK_NO_SUCH_CHECK, "xine health check not supported on the OS.\n"); return hc; } diff --git a/src/xine-utils/xine_mmx.h b/src/xine-utils/xine_mmx.h index 440d1efcc..26e712409 100644 --- a/src/xine-utils/xine_mmx.h +++ b/src/xine-utils/xine_mmx.h @@ -173,7 +173,7 @@ typedef union { #define punpckhwd_m2r(var,reg) mmx_m2r (punpckhwd, var, reg) #define punpckhwd_r2r(regs,regd) mmx_r2r (punpckhwd, regs, regd) -#define punpcklbw_m2r(var,reg) mmx_m2r (punpcklbw, var, reg) +#define punpcklbw_m2r(var,reg) mmx_m2r (punpcklbw, var, reg) #define punpcklbw_r2r(regs,regd) mmx_r2r (punpcklbw, regs, regd) #define punpckldq_m2r(var,reg) mmx_m2r (punpckldq, var, reg) #define punpckldq_r2r(regs,regd) mmx_r2r (punpckldq, regs, regd) diff --git a/src/xine-utils/xine_mutex.c b/src/xine-utils/xine_mutex.c index c94f32be0..e53de574b 100644 --- a/src/xine-utils/xine_mutex.c +++ b/src/xine-utils/xine_mutex.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine 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. - * + * * xine 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -40,7 +40,7 @@ int xine_mutex_init (xine_mutex_t *mutex, const pthread_mutexattr_t *mutexattr, return pthread_mutex_init (&mutex->mutex, mutexattr); } - + int xine_mutex_lock (xine_mutex_t *mutex, const char *who) { #ifndef DBG_MUTEX @@ -50,13 +50,13 @@ int xine_mutex_lock (xine_mutex_t *mutex, const char *who) { #else if (pthread_mutex_trylock (&mutex->mutex)) { - printf ("xine_mutex: BLOCK when %s tried to lock mutex %s because it is locked by %s. continue trying...)\n", + printf ("xine_mutex: BLOCK when %s tried to lock mutex %s because it is locked by %s. continue trying...)\n", who, mutex->id, mutex->locked_by); pthread_mutex_lock (&mutex->mutex); } - printf ("xine_mutex: %s has now locked mutex %s\n", + printf ("xine_mutex: %s has now locked mutex %s\n", who, mutex->id); mutex->locked_by = who; diff --git a/src/xine-utils/xineutils.h b/src/xine-utils/xineutils.h index 581932cee..0fd0bbf0e 100644 --- a/src/xine-utils/xineutils.h +++ b/src/xine-utils/xineutils.h @@ -61,7 +61,7 @@ extern "C" { #include <stdio.h> #include <string.h> -/* +/* * Mark exported data symbols for link engine library clients with older * Win32 compilers */ diff --git a/src/xine-utils/xmllexer.c b/src/xine-utils/xmllexer.c index 696c18011..fb504f430 100644 --- a/src/xine-utils/xmllexer.c +++ b/src/xine-utils/xmllexer.c @@ -471,7 +471,7 @@ int lexer_get_token_d_r(struct lexer * lexer, char ** _tok, int * _tok_size, int } } } - lprintf ("loop done tok_pos = %d, tok_size=%d, lexbuf_pos=%d, lexbuf_size=%d\n", + lprintf ("loop done tok_pos = %d, tok_size=%d, lexbuf_pos=%d, lexbuf_size=%d\n", tok_pos, tok_size, lexer->lexbuf_pos, lexer->lexbuf_size); /* pb */ diff --git a/src/xine-utils/xmlparser.c b/src/xine-utils/xmlparser.c index 2e93da4e9..add985512 100644 --- a/src/xine-utils/xmlparser.c +++ b/src/xine-utils/xmlparser.c @@ -312,7 +312,7 @@ static int _xml_parser_get_node (xml_parser_t *xml_parser, char ** token_buffer, current_subtree = subtree; } else { current_subtree->next = subtree; - current_subtree = subtree; + current_subtree = subtree; } state = STATE_IDLE; break; @@ -553,7 +553,7 @@ const char *xml_parser_get_property (const xml_node_t *node, const char *name) { return NULL; } -int xml_parser_get_property_int (const xml_node_t *node, const char *name, +int xml_parser_get_property_int (const xml_node_t *node, const char *name, int def_value) { const char *v; @@ -570,7 +570,7 @@ int xml_parser_get_property_int (const xml_node_t *node, const char *name, return ret; } -int xml_parser_get_property_bool (const xml_node_t *node, const char *name, +int xml_parser_get_property_bool (const xml_node_t *node, const char *name, int def_value) { const char *v; diff --git a/src/xine-utils/xmlparser.h b/src/xine-utils/xmlparser.h index fe94e4b76..832925bd0 100644 --- a/src/xine-utils/xmlparser.h +++ b/src/xine-utils/xmlparser.h @@ -71,9 +71,9 @@ int xml_parser_build_tree_r(xml_parser_t *xml_parser, xml_node_t **root_node) XI void xml_parser_free_tree(xml_node_t *root_node) XINE_PROTECTED; const char *xml_parser_get_property (const xml_node_t *node, const char *name) XINE_PROTECTED; -int xml_parser_get_property_int (const xml_node_t *node, const char *name, +int xml_parser_get_property_int (const xml_node_t *node, const char *name, int def_value) XINE_PROTECTED; -int xml_parser_get_property_bool (const xml_node_t *node, const char *name, +int xml_parser_get_property_bool (const xml_node_t *node, const char *name, int def_value) XINE_PROTECTED; /* for output: diff --git a/win32/config.h b/win32/config.h index f62c641ec..62555cf4e 100644 --- a/win32/config.h +++ b/win32/config.h @@ -423,7 +423,7 @@ static char * exec_path_append_subdir( char * string ) if (tmpchar) *tmpchar = 0; } - // find the last occurance of a back + // find the last occurance of a back // slash or fore slash back_slash = strrchr( tmp_win32_path, '\\' ); fore_slash = strrchr( tmp_win32_path, '/' ); -- cgit v1.2.3