/*
 * xine_frontend.h:
 *
 * See the README file for copyright information and how to reach the author.
 *
 */

#ifndef _XINE_FRONTEND_H
#define _XINE_FRONTEND_H

#ifdef __cplusplus
extern "C" {
#endif

#include "xine_input_vdr.h"

#define FE_VERSION_STR  "0.9.9"
#define FE_VERSION      0x99 /*(((0)<<16) | ((9)<<8) | ((9)))*/

typedef void (*fe_keypress_f)(char *keymap, char *name);

typedef struct frontend_config_s frontend_config_t;

typedef struct frontend_s frontend_t;

#if 0
struct frontend_config_s {
  /* Display */
  int width; 
  int height;
  int fullscreen;
  int modeswitch; 
  char *modeline;
  int aspect;
                          
  char *video_port;
                          
  int scale_video;
  int field_order;

  fe_keypress_f keypresshandler;

  /* Xine engine */
  char *audio_driver;
  char *audio_port;
  char *video_driver;
  int pes_buffers;
  int priority;
};
#endif

struct frontend_s {
  /* Display */
  int (*fe_display_open)(frontend_t*, int winwidth, int winheight, 
			 int fullscreen,
			 int modeswitch, char *modeline, int aspect,
			 fe_keypress_f keypresshandler, char *video_port,
			 int scale_video, int field_order);
  int  (*fe_display_config)(frontend_t *, int width, int height, 
			    int fullscreen,
                            int modeswitch, char *modeline, 
			    int aspect, int scale_video, int field_order);
  void (*fe_display_close)(frontend_t*);

  /* Xine engine */
  int  (*xine_init)(frontend_t*, char *audio_driver, char *audio_port, 
		    char *video_driver, int pes_buffers, 
		    int priority, char *static_post);
  int  (*xine_open)(frontend_t*, char *mrl);
  int  (*xine_play)(frontend_t*);
  int  (*xine_stop)(frontend_t*);
  void (*xine_close)(frontend_t*);
  void (*xine_exit)(frontend_t*);

  /* Post plugins */
#if 0
  int  (*post_open)(frontend_t*, char *name, char *args);
  int  (*post_close)(frontend_t*, char *name, int level);
#endif

  /* Execution control */
  int  (*fe_run)(frontend_t*);
  void (*fe_interrupt)(frontend_t*);
  void (*fe_free)(frontend_t*);

  /* Data transfer */
  int  (*xine_is_finished)(frontend_t*);
  int  (*xine_osd_command)(frontend_t*, osd_command_t *cmd);
  /*int  (*xine_queue_poll)(frontend_t*, int timeout_ms);*/
  /*int  (*xine_queue_flush)(frontend_t*, int timeout_ms);*/
  int  (*xine_control)(frontend_t*, char *cmd);
  int  (*xine_queue_pes_packet)(frontend_t*, char *data, int len);
  /*int64_t (*xine_get_current_scr)(frontend_t*f);*/

  char *(*grab)(frontend_t*, int *size, int jpeg, int quality,
		int width, int height);
#if 0
  frontend_config_t config;
#endif
};

typedef frontend_t *(*fe_creator_f)(void);

#ifdef __cplusplus
} /* extern "C" { */
#endif

#endif /* _XINE_FRONTEND_H */

