[Toxine-cvs] CVS: toxine/src common.h,1.21,1.22 main.c,1.22,1.23 xine_commands.c,1.31,1.32 xine_comm
Brought to you by:
f1rmb
From: Daniel Caujolle-B. <f1...@us...> - 2003-01-18 17:01:32
|
Update of /cvsroot/toxine/toxine/src In directory sc8-pr-cvs1:/tmp/cvs-serv14886 Modified Files: common.h main.c xine_commands.c xine_commands.h Log Message: @@first displayed frames Index: common.h =================================================================== RCS file: /cvsroot/toxine/toxine/src/common.h,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- common.h 17 Jan 2003 23:59:15 -0000 1.21 +++ common.h 18 Jan 2003 17:01:24 -0000 1.22 @@ -118,6 +118,14 @@ } \ } while(0) +#define return_if_no_stream(x) do { \ + if(((x)->xine == NULL) || !((x)->xine_state & XINE_STREAM)) { \ + perr("%s(): no stream created. Do it first.\n", \ + __tox_func__); \ + return; \ + } \ + } while(0) + #ifndef NAME_MAX #define _NAME_MAX 256 #else Index: main.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/main.c,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- main.c 17 Jan 2003 23:59:15 -0000 1.22 +++ main.c 18 Jan 2003 17:01:25 -0000 1.23 @@ -76,7 +76,7 @@ int major, minor, sub; printf("This is toxine - xine shell v%s\n" - "(c) 2002 by Daniel Caujolle-Bert <f1...@us...>.\n", VERSION); + "(c) 2002-2003 by Daniel Caujolle-Bert <f1...@us...>.\n", VERSION); printf("Built with xine library %d.%d.%d (%s)\n", XINE_MAJOR_VERSION, XINE_MINOR_VERSION, XINE_SUB_VERSION, XINE_VERSION); @@ -288,6 +288,7 @@ tox->xine_state |= XINE_NEW; toxine_config_load(tox); + tox->running = 1; tox->playlist.mmk = NULL; tox->playlist.thread_num = 0;; Index: xine_commands.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/xine_commands.c,v retrieving revision 1.31 retrieving revision 1.32 diff -u -r1.31 -r1.32 --- xine_commands.c 17 Jan 2003 23:39:57 -0000 1.31 +++ xine_commands.c 18 Jan 2003 17:01:26 -0000 1.32 @@ -480,6 +480,27 @@ pinfo("\n"); } +void _xine_stream_new(commands_t *command, toxine_t *tox, void *data) { + return_if_no_init(tox); + + if(tox->video.port == NULL) { + perr("Choose and initialise a video driver first\n"); + return; + } + if(tox->stream != NULL) { + perr("Stream is already created, use xine_dispose() in order to create a new one\n"); + return; + } + + pinfo("xine_stream_new()"); + tox->stream = xine_stream_new(tox->xine, tox->audio.port, tox->video.port); + pinfo("return 0x%x\n", (int) tox->stream); + if(tox->stream) + tox->xine_state |= XINE_STREAM; + else + perr("Wow, xine_stream_new() failed.\n"); +} + /* * */ @@ -495,20 +516,20 @@ if(!(tox->xine_state & XINE_NEW)) _xine_new(NULL, tox, NULL); - + + pinfo("xine_init()"); + xine_init(tox->xine); + pinfo("\n"); + tox->xine_state |= XINE_INIT; + if(!toxine_video_out_init(tox)) { perr("unable to initialize video out plugin.\n"); return; } - printf("toxine_video_out_init(): DONE\n"); if(!toxine_audio_out_init(tox)) perr("unable to initialize audio driver, audio output disabled.\n"); - - pinfo("xine_init(%s, %s):\n", (tox->audio.name)?tox->audio.name:"NULL", tox->video.name); - // xine_init(tox->xine, tox->audio.port, tox->video.port); - tox->xine_state |= XINE_INIT; - + tox->audio.mixer.enable = 0; tox->audio.mixer.caps = 0; /* @@ -528,12 +549,12 @@ tox->audio.mixer.mute = xine_get_param(tox->xine, XINE_PARAM_AUDIO_MUTE); */ pthread_mutex_init(&tox->event.mutex, NULL); - pinfo("xine_register_event_listener()\n"); #warning FIXME #if 0 + pinfo("xine_register_event_listener()\n"); xine_register_event_listener(tox->xine, toxine_event_listener, (void *) tox); -#endif pinfo(".\n"); +#endif } Index: xine_commands.h =================================================================== RCS file: /cvsroot/toxine/toxine/src/xine_commands.h,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- xine_commands.h 17 Jan 2003 23:39:57 -0000 1.19 +++ xine_commands.h 18 Jan 2003 17:01:27 -0000 1.20 @@ -24,6 +24,7 @@ void _xine_new(commands_t *, toxine_t *, void *); void _xine_init(commands_t *, toxine_t *, void *); void _xine_open(commands_t *, toxine_t *, void *); +void _xine_stream_new(commands_t *, toxine_t *, void *); void _xine_play(commands_t *, toxine_t *, void *); void _xine_trick_mode(commands_t *, toxine_t *, void *); void _xine_get_stream_info(commands_t *, toxine_t *, void *); @@ -60,6 +61,81 @@ void _xine_get_version_string(commands_t *, toxine_t *, void *); void _xine_check_version(commands_t *, toxine_t *, void *); +/* + + void _xine_stream_master_slave(...) + void xine_close(...) + void xine_dispose(...) + void xine_get_current_frame(...) + void xine_get_meta_info(...) + void xine_get_file_extensions(...) + void xine_get_mime_types(...) + void xine_gui_send_vo_data(...) + void xine_config_update_entry(...) + + //// POST + xine_post_init(...) + xine_list_post_plugins + xine_list_post_plugins_typed + xine_post_list_inputs + xine_post_list_outputs + xine_post_input + xine_post_output + xine_post_wire + xine_post_wire_video_port + xine_post_wire_audio_port + xine_get_video_source + xine_get_audio_source + xine_post_dispose + + ////post plugin types + XINE_POST_TYPE_VIDEO_FILTER 0x010000 + XINE_POST_TYPE_VIDEO_VISUALIZATION 0x010001 + XINE_POST_TYPE_AUDIO_FILTER 0x020000 + XINE_POST_TYPE_AUDIO_VISUALIZATION 0x020001 + + + ////post plugin data types + XINE_POST_DATA_VIDEO 0 + XINE_POST_DATA_AUDIO 1 + XINE_POST_DATA_INT 3 + XINE_POST_DATA_DOUBLE 4 + + + xine_config_register_string + xine_config_register_range (xine_t *self, + xine_config_register_enum (xine_t *self, + xine_config_register_num (xine_t *self, + xine_config_register_bool (xine_t *self, + + + xine_event_new_queue (xine_stream_t *stream); + xine_event_dispose_queue (xine_event_queue_t *queue); + + xine_event_get (xine_event_queue_t *queue); + xine_event_wait (xine_event_queue_t *queue); + xine_event_free (xine_event_t *event); + xine_event_create_listener_thread + + + ////////OSD + xine_osd_new (xine_stream_t *self, int x, int y, + xine_osd_draw_point (xine_osd_t *self, int x, int y, int color); + xine_osd_draw_line (xine_osd_t *self, int x1, int y1, + xine_osd_draw_rect (xine_osd_t *self, int x1, int y1, + xine_osd_draw_text (xine_osd_t *self, int x1, int y1, + xine_osd_get_text_size (xine_osd_t *self, const char *text, + xine_osd_set_font (xine_osd_t *self, const char *fontname, + xine_osd_set_position (xine_osd_t *self, int x, int y); + xine_osd_show (xine_osd_t *self, int64_t vpts); + xine_osd_hide (xine_osd_t *self, int64_t vpts); + xine_osd_clear (xine_osd_t *self); + xine_osd_free (xine_osd_t *self); + xine_osd_set_palette (xine_osd_t *self, + xine_osd_set_text_palette (xine_osd_t *self, + xine_osd_get_palette (xine_osd_t *self, uint32_t *color, + +*/ ///////////////////// /* void _xine_get_spu_channel(commands_t *, toxine_t *, void *); @@ -97,6 +173,10 @@ "Create a new xine instance.", \ "xine_new" \ }, \ + { "xine_stream_new", NO_ARGS, _xine_stream_new, \ + "Create a new stream object.", \ + "xine_stream_new" \ + }, \ { "xine_init", NO_ARGS, _xine_init, \ "Initialize xine engine.", \ "xine_init" \ @@ -470,112 +550,77 @@ #endif /* 0 */ + /* + xine_audio_port_t *xine_open_audio_driver (xine_t *self, const char *id, + void *data); + xine_video_port_t *xine_open_video_driver (xine_t *self, const char *id, + int visual, void *data); + + void xine_close_audio_driver (xine_t *self, xine_audio_port_t *driver); + void xine_close_video_driver (xine_t *self, xine_video_port_t *driver); + */ -/* -xine_ao_driver_p xine_open_audio_driver (xine_p self, const char *id, - void *data); -xine_vo_driver_p xine_open_video_driver (xine_p self, const char *id, - int visual, void *data); -int xine_get_current_frame (xine_p self, int *width, int *height, - int *ratio_code, int *format, - uint8_t *img); - -void xine_register_log_cb (xine_p self, xine_log_cb_t cb, void *user_data); -int xine_register_report_codec_cb(xine_p self, xine_report_codec_cb_t report_codec, void *user_data); - -int xine_gui_send_vo_data (xine_p self, int type, void *data); - -///// -TODO CONFIG - -const char *xine_config_register_string (xine_p self, - const char *key, - const char *def_value, - const char *description, - const char *help, - int exp_level, - xine_config_cb_t changed_cb, - void *cb_data); - -int xine_config_register_range (xine_p self, - const char *key, - int def_value, - int min, int max, - const char *description, - const char *help, - int exp_level, - xine_config_cb_t changed_cb, - void *cb_data); - -int xine_config_register_enum (xine_p self, - const char *key, - int def_value, - char **values, - const char *description, - const char *help, - int exp_level, - xine_config_cb_t changed_cb, - void *cb_data); - -int xine_config_register_num (xine_p self, - const char *key, - int def_value, - const char *description, - const char *help, - int exp_level, - xine_config_cb_t changed_cb, - void *cb_data); - -int xine_config_register_bool (xine_p self, - const char *key, - int def_value, - const char *description, - const char *help, - int exp_level, - xine_config_cb_t changed_cb, - void *cb_data); - -int xine_register_event_listener (xine_p self, - xine_event_listener_cb_t listener, - void *user_data); -int xine_remove_event_listener (xine_p self, - xine_event_listener_cb_t listener); - -////////////// - -////////////// -osd -xine_osd_p xine_osd_new (xine_p self, int x, int y, - int width, int height); -void xine_osd_draw_point (xine_osd_p self, int x, int y, int color); -void xine_osd_draw_line (xine_osd_p self, int x1, int y1, - int x2, int y2, int color); -void xine_osd_draw_rect (xine_osd_p self, int x1, int y1, - int x2, int y2, - int color, int filled ); -void xine_osd_draw_text (xine_osd_p self, int x1, int y1, - const char *text, int color_base); -void xine_osd_get_text_size (xine_osd_p self, const char *text, - int *width, int *height); -void xine_osd_set_font (xine_osd_p self, const char *fontname, - int size); -void xine_osd_set_position (xine_osd_p self, int x, int y); -void xine_osd_show (xine_osd_p self, int64_t vpts); -void xine_osd_hide (xine_osd_p self, int64_t vpts); -void xine_osd_clear (xine_osd_p self); - -void xine_osd_free (xine_osd_p self); -void xine_osd_set_palette (xine_osd_p self, - const uint32_t *const color, - const uint8_t *const trans ); -void xine_osd_set_text_palette (xine_osd_p self, - int palette_number, - int color_base ); -void xine_osd_get_palette (xine_osd_p self, const uint32_t *color, - const uint8_t *trans); -OSD -///////////// -*/ +#ifdef XINE_ENABLE_EXPERIMENTAL_FEATURES + +xine_video_port_t *xine_new_framegrab_video_port (xine_t *self); + +typedef struct { + + int64_t vpts; /* timestamp 1/90000 sec for a/v sync */ + int64_t duration; + int width, height; + int colorspace; /* XINE_IMGFMT_* */ + double aspect_ratio; + + int pos_stream; /* bytes from stream start */ + int pos_time; /* milliseconds */ + + uint8_t *data; + void *xine_frame; /* used internally by xine engine */ +} xine_video_frame_t; + +int xine_get_next_video_frame (xine_video_port_t *port, + xine_video_frame_t *frame); + +void xine_free_video_frame (xine_video_port_t *port, xine_video_frame_t *frame); + +xine_audio_port_t *xine_new_framegrab_audio_port (xine_t *self); + +typedef struct { + + int64_t vpts; /* timestamp 1/90000 sec for a/v sync */ + int num_samples; + int sample_rate; + int num_channels; + int bits_per_sample; /* per channel */ + + off_t pos_stream; /* bytes from stream start */ + int pos_time; /* milliseconds */ + + uint8_t *data; + void *xine_frame; /* used internally by xine engine */ +} xine_audio_frame_t; + +int xine_get_next_audio_frame (xine_audio_port_t *port, + xine_audio_frame_t *frame); + +void xine_free_audio_frame (xine_audio_port_t *port, xine_audio_frame_t *frame); + + /* + * maybe future aproach: + */ + +int xine_get_video_frame (xine_stream_t *stream, + int timestamp, /* msec */ + int *width, int *height, + int *ratio_code, + int *duration, /* msec */ + int *format, + uint8_t *img); + +/* TODO: xine_get_audio_frame */ + +#endif #endif |