diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/Makefile.am | 47 | ||||
-rw-r--r-- | include/audio_out.h | 97 | ||||
-rw-r--r-- | include/video_out.h | 327 | ||||
-rw-r--r-- | include/xine.h.tmpl.in | 171 |
4 files changed, 642 insertions, 0 deletions
diff --git a/include/Makefile.am b/include/Makefile.am new file mode 100644 index 000000000..bdf7dcca3 --- /dev/null +++ b/include/Makefile.am @@ -0,0 +1,47 @@ +## +## Process this file with automake to produce Makefile.in +## + +EXTRA_DIST = xine.h.tmpl.in + +include_HEADERS = audio_out.h video_out.h xine.h + + +xine.h: xine.h.tmpl + @echo "creating xine.h"; \ + rm -f xine.h && \ + echo '/* !! DO NO EDIT THIS FILE, it is automatically generated */' \ + > xine.h && \ + cat xine.h.tmpl >> xine.h + + +debug: + +install-includeHEADERS: $(include_HEADERS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(includedir)/xine + @list='$(include_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \ + echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/xine/$$p"; \ + $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/xine/$$p; \ + done + + +## +## Remove them +## +uninstall-includeHEADERS: + @$(NORMAL_UNINSTALL) + list='$(include_HEADERS)'; for p in $$list; do \ + rm -f $(DESTDIR)$(includedir)/xine/$$p; \ + done + + +mostlyclean-generic: + -rm -f *~ \#* .*~ .\#* + + +maintainer-clean-generic: + -@echo "This command is intended for maintainers to use;" + -@echo "it deletes files that may require special tools to rebuild." + -rm -f Makefile.in xine.h diff --git a/include/audio_out.h b/include/audio_out.h new file mode 100644 index 000000000..3e0118325 --- /dev/null +++ b/include/audio_out.h @@ -0,0 +1,97 @@ +/* + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + * $Id: audio_out.h,v 1.1 2001/04/18 22:36:42 f1rmb Exp $ + */ +#ifndef HAVE_AUDIO_OUT_H +#define HAVE_AUDIO_OUT_H + +#include <inttypes.h> + +/* + * audio output modes Used as Bitfield in AC3 decoder + */ + +#define AO_MODE_AC3 1 +#define AO_MODE_MONO 2 /* 1 sample == 2 bytes */ +#define AO_MODE_STEREO 4 /* 1 sample == 4 bytes */ +#define AO_MODE_4CHANNEL 8 /* 1 sample == 8 bytes */ +#define AO_MODE_5CHANNEL 16 /* 1 sample == 10 bytes */ + +typedef struct ao_functions_s +{ + + /* + * find out if desired output mode is supported by + * this driver + */ + + int (*is_mode_supported) (int mode); + + /* + * init device - buffer will be flushed(!) + * return value: <=0 : failure, 1 : ok + */ + + int (*open)(uint32_t bits, uint32_t rate, int mode); + + /* + * write audio data to output buffer - may block + * audio driver must sync sample playback with metronom + */ + + void (*write_audio_data)(int16_t* audio_data, uint32_t num_samples, + uint32_t pts); + + /* + * close the audio driver + */ + + void (*close)(void); + +} ao_functions_t; + +/* + * available drivers: + */ + +#define AO_DRIVER_UNSET -1 +#define AO_DRIVER_NULL 0 +#define AO_DRIVER_OSS 1 +#if defined(HAVE_ALSA) +# define AO_DRIVER_ALSA 2 +# if defined(HAVE_ESD) +# define AO_DRIVER_ESD 3 +# endif +#else /* no ALSA */ +# if defined(HAVE_ESD) +# define AO_DRIVER_ESD 2 +# endif +#endif + +/* + * find right device driver, init it + */ + +ao_functions_t *ao_init(char *driver_name) ; + +char *ao_get_available_drivers (); + +#endif + diff --git a/include/video_out.h b/include/video_out.h new file mode 100644 index 000000000..3a4ba0b72 --- /dev/null +++ b/include/video_out.h @@ -0,0 +1,327 @@ +/* + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + * $Id: video_out.h,v 1.1 2001/04/18 22:36:44 f1rmb Exp $ + * + * + * xine version of video_out.h + * + */ + +#ifndef HAVE_VIDEO_OUT_H + +#define HAVE_VIDEO_OUT_H + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <inttypes.h> +#include <pthread.h> +#include <X11/Xlib.h> + +#if defined(XINE_COMPILE) +#include "configfile.h" +#include "metronom.h" +#else +#include "xine/configfile.h" +#include "xine/metronom.h" +#endif + +typedef struct vo_frame_s vo_frame_t; +typedef struct vo_driver_s vo_driver_t ; +typedef struct vo_instance_s vo_instance_t; +typedef struct img_buf_fifo_s img_buf_fifo_t; + +/* public part, video drivers may add private fields */ +struct vo_frame_s { + struct vo_frame_s *next; + + uint32_t PTS; + int bFrameBad; /* e.g. frame skipped or based on skipped frame */ + uint8_t *base[3]; + int nType; /* I, B or P frame */ + + int bDisplayLock, bDecoderLock, bDriverLock; + pthread_mutex_t mutex; /* so the various locks will be serialized */ + + int nID; /* debugging purposes only */ + + vo_instance_t *instance; + + /* + * member functions + */ + + /* this frame is no longer used by decoder */ + void (*free) (vo_frame_t *vo_img); + + /* tell video driver to copy/convert a slice of this frame */ + void (*copy) (vo_frame_t *vo_img, uint8_t **src); + + /* 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, + returns number of frames to skip if decoder is late */ + int (*draw) (vo_frame_t *vo_img); + + /* this frame is no longer used by the video driver */ + void (*displayed) (vo_frame_t *vo_img); + + /* free memory/resources for this frame */ + void (*dispose) (vo_frame_t *vo_img); +}; + + +struct vo_instance_s { + + uint32_t (*get_capabilities) (vo_instance_t *this); /* for constants see below */ + + /* open display driver for video output */ + void (*open) (vo_instance_t *this); + + /* + * get_frame - allocate an image buffer from display driver + * + * params : width == width of video to display. + * height == height of video to display. + * ratio == aspect ration information + * format == FOURCC descriptor of image format + * duration == frame duration in 1/90000 sec + */ + vo_frame_t* (*get_frame) (vo_instance_t *this, uint32_t width, + uint32_t height, int ratio_code, + int format, uint32_t duration); + + /* video driver is no longer used by decoder => close */ + void (*close) (vo_instance_t *this); + + /* called on xine exit */ + void (*exit) (vo_instance_t *this); + + /* get/set driver properties, flags see below */ + int (*get_property) (vo_instance_t *this, int nProperty); + + /* set a property - returns value on succ, ~value otherwise*/ + int (*set_property) (vo_instance_t *this, + int nProperty, int value); + void (*get_property_min_max) (vo_instance_t *this, + int nProperty, int *min, int *max); + + /* + * handle events for video window (e.g. expose) + * parameter will typically be something like a pointer + * to an XEvent structure for X11 drivers, but + * may be something different for, say, fb drivers + */ + void (*handle_event) (vo_instance_t *this, void *event) ; + + /* + * get whatever is usefull to contact the window/video output + * (mostly usefull for the gui if it wants to access + * the video output window) + */ + void* (*get_window) (vo_instance_t *this); + + /* private stuff */ + + vo_driver_t *driver; + metronom_t *metronom; + + img_buf_fifo_t *free_img_buf_queue; + img_buf_fifo_t *display_img_buf_queue; + + int video_loop_running; + pthread_t video_thread; + + uint32_t pts_per_half_frame; + uint32_t pts_per_frame; + + int num_frames_delivered; + int num_frames_skipped; + int num_frames_discarded; + +} ; + +/* constants for the get/set property functions */ + +#define VO_PROP_WINDOW_VISIBLE 0 +#define VO_PROP_CURSOR_VISIBLE 1 +#define VO_PROP_FULLSCREEN 2 +#define VO_PROP_INTERLACED 3 +#define VO_PROP_ASPECT_RATIO 4 +#define VO_PROP_HUE 5 +#define VO_PROP_SATURATION 6 +#define VO_PROP_CONTRAST 7 +#define VO_PROP_BRIGHTNESS 8 +#define VO_PROP_COLORKEY 9 +#define VO_NUM_PROPERTIES 10 + +/* image formats that can be supported by display drivers: */ + +#define IMGFMT_YV12 0x32315659 +#define IMGFMT_YUY2 (('2'<<24)|('Y'<<16)|('U'<<8)|'Y') +#define IMGFMT_RGB (('R'<<24)|('G'<<16)|('B'<<8)) + +/* possible ratios for the VO_PROP_ASPECT_RATIO call */ + +#define ASPECT_AUTO 0 +#define ASPECT_ANAMORPHIC 1 /* 16:9 */ +#define ASPECT_FULL 2 /* 4:3 */ +#define ASPECT_DVB 3 /* 1:2 */ + +/* video driver capabilities */ + +/* driver copies image (i.e. converts it to + rgb buffers in the private fields of image buffer) */ +#define VO_CAP_COPIES_IMAGE 0x00000001 + +#define VO_CAP_RGB 0x00000002 /* driver can handle 24bit rgb pictures */ +#define VO_CAP_YV12 0x00000004 /* driver can handle YUV 4:2:0 pictures */ +#define VO_CAP_YUY2 0x00000008 /* driver can handle YUY2 pictures */ + +#define VO_CAP_HUE 0x00000010 /* driver can set HUE value */ +#define VO_CAP_SATURATION 0x00000020 /* driver can set SATURATION value */ +#define VO_CAP_BRIGHTNESS 0x00000040 /* driver can set BRIGHTNESS value */ +#define VO_CAP_CONTRAST 0x00000080 /* driver can set CONTRAST value */ +#define VO_CAP_COLORKEY 0x00000100 /* driver can set COLORKEY value */ + +/* + * vo_driver_s contains the function every display driver + * has to implement. The vo_new_instance function (see below) + * should then be used to construct a vo_instance using this + * driver. Some of the function pointers will be copied + * directly into vo_instance_s, others will be called + * from generic vo functions. + */ + + +struct vo_driver_s { + + uint32_t (*get_capabilities) (vo_driver_t *this); /* for constants see below */ + + /* + * allocate an vo_frame_t struct, + * the driver must supply the copy, field and dispose functions + */ + vo_frame_t* (*alloc_frame) (vo_driver_t *this); + + + /* + * check if the given image fullfills the format specified + * (re-)allocate memory if necessary + */ + void (*update_frame_format) (vo_driver_t *this, vo_frame_t *img, + uint32_t width, uint32_t height, + int ratio_code, int format); + + /* display a given frame */ + void (*display_frame) (vo_driver_t *this, vo_frame_t *vo_img); + + int (*get_property) (vo_driver_t *this, int property); + int (*set_property) (vo_driver_t *this, + int property, int value); + void (*get_property_min_max) (vo_driver_t *this, + int property, int *min, int *max); + + void (*handle_event) (vo_driver_t *this, void *event) ; + void* (*get_window) (vo_driver_t *this); + + /* set logo visibility */ + void (*set_logo_mode) (vo_driver_t *this, int show_logo); + + void (*exit) (vo_driver_t *this); +}; + + +/* + * build a video_out_instance from + * a given video driver + */ + +vo_instance_t *vo_new_instance (vo_driver_t *driver, metronom_t *metronom) ; + +/* + * init a video driver. The driver is selected either + * by auto-detection or (if given) by the driver_name + */ + +vo_instance_t *vo_init (char *driver_name); + +/* returns a list of available drivers */ + +char *vo_get_available_drivers (); + +/* + * driver-specific stuff starts here + */ + + +vo_driver_t *init_video_out_xv (Display *display, config_values_t *config) ; + +/* FIXME + vo_driver_t *init_video_out_mga () ; + vo_driver_t *init_video_out_xshm () ; + vo_functions_t *init_video_out_x11 () ; + FIXME +*/ + + +#warning "FIXME" +#ifndef VIDEOOUT_COMPILE +static inline int vo_setup (vo_instance_t * instance, int width, int height) +{ + // return instance->setup (instance, width, height); + return 1; +} + +static inline void vo_close (vo_instance_t * instance) +{ + if (instance->close) + instance->close (instance); +} + +#define VO_TOP_FIELD 1 +#define VO_BOTTOM_FIELD 2 +#define VO_BOTH_FIELDS (VO_TOP_FIELD | VO_BOTTOM_FIELD) +#define VO_PREDICTION_FLAG 4 + +static inline vo_frame_t * vo_get_frame (vo_instance_t * instance, int flags) +{ + //return instance->get_frame (instance, flags); + return instance->get_frame (instance, 0, 0, 0, 0, 0); +} + +static inline void vo_field (vo_frame_t * frame, int flags) +{ + if (frame->field) + frame->field (frame, flags); +} + +static inline void vo_draw (vo_frame_t * frame) +{ + frame->draw (frame); +} +#endif +#warning "FIXME" +#endif + + + diff --git a/include/xine.h.tmpl.in b/include/xine.h.tmpl.in new file mode 100644 index 000000000..9f468cdd2 --- /dev/null +++ b/include/xine.h.tmpl.in @@ -0,0 +1,171 @@ +/* + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + * $Id: xine.h.tmpl.in,v 1.1 2001/04/18 22:36:42 f1rmb Exp $ + * + */ + +#ifndef HAVE_XINE_H +#define HAVE_XINE_H + +#if !defined(XINE_COMPILE) + +#include <inttypes.h> +#include "input_plugin.h" +#include "audio_out.h" +#include "video_out.h" +#include "configfile.h" +#include "demux.h" + +#define XINE_MAJOR_VERSION @XINE_MAJOR@ +#define XINE_MINOR_VERSION @XINE_MINOR@ +#define XINE_SUB_VERSION @XINE_SUB@ + + +typedef void xine_t; + +#endif + + +/* nStatus : current xine status */ +typedef void (*gui_status_callback_func_t)(int nStatus); + +/* + * player status constants: + */ + +#define XINE_STOP 0 +#define XINE_PLAY 1 +#define XINE_PAUSE 2 +#define XINE_QUIT 3 + +#if !defined(XINE_COMPILE) +/* + * init xine - call once at startup + * + */ + +xine_t *xine_init (vo_instance_t *vo, + ao_functions_t *ao, + gui_status_callback_func_t gui_status_callback, + config_values_t *config, int demux_strategy, uint32_t debug_lvl) ; + +/* + * open a stream and play it + * + * name : mrl to open + * pos : start position 0..65535 + * + */ +void xine_play (xine_t *this, char *MRL, int pos); + + +/* + * toggle pause mode + */ +void xine_pause (xine_t *this); + + +/* + * stop playing + */ +void xine_stop (xine_t *this); + +/* + * tell current input plugin to eject media. + */ +int xine_eject(xine_t *this); + +/* + * return current status (XINE_PLAY/XINE_STOP...) + */ +int xine_get_status (xine_t *this); + +/* + * get current position in stream + * returns position (range : 0 - 65535) + */ +int xine_get_current_position (xine_t *this); + +/* + * return the current audio channel + */ +int xine_get_audio_channel (xine_t *this); + +/* + * set desired audio channel + */ +void xine_select_audio_channel (xine_t *this, int channel); + +/* + * return the current SPU channel + */ +int xine_get_spu_channel (xine_t *this); + +/* + * set desired SPU channel + */ +void xine_select_spu_channel (xine_t *this, int channel); + +/* + * exit xine + */ +void xine_exit (xine_t *this); + +/* + * browsing support + */ + +/* + * some input plugins are browseable + * returns a list of ids of these plugins + */ +char **xine_get_browsable_input_plugin_ids (xine_t *this) ; + +/* + * browse function + * asks input plugin named <plugin_id> to return + * a list of available MRLs in domain/directory <start_mrl> + * + * start_mrl may be NULL indicating the toplevel domain/dir + * returns start_mrl if start_mrl is a valid MRL, not a directory + * returns NULL if start_mrl is an invalid MRL, not even a directory + */ + +char **xine_get_browse_mrls (xine_t *this, char *plugin_id, + char *start_mrl); + +/* + * autoplay support + */ + +/* + * some input plugins can generate autoplay lists + * returns a list of ids of these plugins + */ +char **xine_get_autoplay_input_plugin_ids (xine_t *this) ; + +/* + * get autoplay MRL list for input plugin named <plugin_id> + */ +char **xine_get_autoplay_mrls (xine_t *this, char *plugin_id); + +#endif + +#endif |