From: Miguel F. <mig...@us...> - 2005-07-16 19:06:11
|
Update of /cvsroot/xine/xine-ui/src/fb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17839/src/fb Modified Files: main.c main.h options.c post.c post.h Log Message: Reinhard Nissl's xine-ui/fbxine audio post plugin support Index: main.c =================================================================== RCS file: /cvsroot/xine/xine-ui/src/fb/main.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- main.c 15 Dec 2004 21:10:43 -0000 1.18 +++ main.c 16 Jul 2005 19:05:30 -0000 1.19 @@ -44,10 +44,14 @@ tty_fd: -1, video_port_id: "fb", - post_elements: NULL, - post_elements_num: 0, - post_enable: 1, + post_video_elements: NULL, + post_video_elements_num: 0, + post_video_enable: 1, + post_audio_elements: NULL, + post_audio_elements_num: 0, + post_audio_enable: 1, + deinterlace_plugin: NULL, deinterlace_elements: NULL, deinterlace_elements_num: 0, @@ -72,6 +76,7 @@ XINE_CONFIG_FILE); } xine_config_load(fbxine.xine, fbxine.configfile); + xine_engine_set_param(fbxine.xine, XINE_ENGINE_PARAM_VERBOSITY, fbxine.verbosity); } static int check_version(void) @@ -245,14 +250,14 @@ { if(!check_version()) return 0; - if(!init_xine()) - return 0; switch(parse_options(argc, argv)) { case 0: case -1: return 0; } + if(!init_xine()) + return 0; if (stdctl) fbxine_init_stdctl(); @@ -275,13 +280,15 @@ char **plugin = pplugins; while(*plugin) { - pplugin_parse_and_store_post((const char *) *plugin); + vpplugin_parse_and_store_post((const char *) *plugin); + applugin_parse_and_store_post((const char *) *plugin); printf("1\n"); plugin++; } - pplugin_rewire_posts(); + vpplugin_rewire_posts(); + applugin_rewire_posts(); } post_deinterlace_init(NULL); Index: main.h =================================================================== RCS file: /cvsroot/xine/xine-ui/src/fb/main.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- main.h 14 Dec 2003 13:05:28 -0000 1.8 +++ main.h 16 Jul 2005 19:05:30 -0000 1.9 @@ -75,13 +75,18 @@ int screen_height; int debug; + int verbosity; int ignore_next; - post_element_t **post_elements; - int post_elements_num; - int post_enable; + post_element_t **post_video_elements; + int post_video_elements_num; + int post_video_enable; + post_element_t **post_audio_elements; + int post_audio_elements_num; + int post_audio_enable; + char *deinterlace_plugin; post_element_t **deinterlace_elements; int deinterlace_elements_num; Index: options.c =================================================================== RCS file: /cvsroot/xine/xine-ui/src/fb/options.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- options.c 26 Apr 2004 21:31:43 -0000 1.6 +++ options.c 16 Jul 2005 19:05:30 -0000 1.7 @@ -35,6 +35,7 @@ #include "options.h" #define OPTION_STDCTL 5000 +#define OPTION_VERBOSE 1005 #define OPTION_POST 1008 int stdctl; @@ -78,6 +79,7 @@ printf("Usage: fbxine [options] <MRL> ...\n" "\n" " -v, --version Display version.\n" + " --verbose [=level] Set verbosity level. Default is 1.\n" " -V, --video-driver <drv> Select video driver:\n"); driver_id = xine_list_video_output_plugins(fbxine.xine); @@ -139,8 +141,9 @@ { "version", no_argument, 0, 'v' }, { "no-lirc", no_argument, 0, 'L' }, { "stdctl", optional_argument, 0, OPTION_STDCTL }, - {"post", required_argument, 0, OPTION_POST }, - {"deinterlace", no_argument, 0, 'D' }, + { "post", required_argument, 0, OPTION_POST }, + { "deinterlace", no_argument, 0, 'D' }, + { "verbose", optional_argument, 0, OPTION_VERBOSE }, { 0, no_argument, 0, 0 } }; const char *short_options = "?hda:qA:V:R::vD"; @@ -209,6 +212,13 @@ pplugins[pplugins_num] = NULL; break; + case OPTION_VERBOSE: + if(!optarg) + fbxine.verbosity = 1; + else + fbxine.verbosity = strtol(optarg, &optarg, 10); + break; + case 'h': case '?': print_usage(); Index: post.c =================================================================== RCS file: /cvsroot/xine/xine-ui/src/fb/post.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- post.c 19 Jun 2004 18:29:54 -0000 1.7 +++ post.c 16 Jul 2005 19:05:30 -0000 1.8 @@ -89,7 +89,7 @@ /* -post <name>:option1=value1,option2=value2... */ -static post_element_t **pplugin_parse_and_load(const char *pchain, int *post_elements_num) { +static post_element_t **pplugin_parse_and_load(int plugin_type, const char *pchain, int *post_elements_num) { post_element_t **post_elements = NULL; char *post_chain; @@ -118,7 +118,14 @@ args = p; post = xine_post_init(fbxine.xine, plugin, 0, &fbxine.audio_port, &fbxine.video_port); - + + if (post && plugin_type) { + if (post->type != plugin_type) { + xine_post_dispose(fbxine.xine, post); + post = NULL; + } + } + if(post) { post_object_t pobj; @@ -250,34 +257,46 @@ } -void pplugin_parse_and_store_post(const char *post_chain) { +static void pplugin_parse_and_store_post(int plugin_type, const char *post_chain) { + post_element_t ***_post_elements = (plugin_type == XINE_POST_TYPE_VIDEO_FILTER) ? &fbxine.post_video_elements : &fbxine.post_audio_elements; + int *_post_elements_num = (plugin_type == XINE_POST_TYPE_VIDEO_FILTER) ? &fbxine.post_video_elements_num : &fbxine.post_audio_elements_num; post_element_t **posts = NULL; int num; - if((posts = pplugin_parse_and_load(post_chain, &num))) { - if(fbxine.post_elements_num) { + if((posts = pplugin_parse_and_load(plugin_type, post_chain, &num))) { + if(*_post_elements_num) { int i; - int ptot = fbxine.post_elements_num + num; + int ptot = *_post_elements_num + num; - fbxine.post_elements = (post_element_t **) realloc(fbxine.post_elements, + *_post_elements = (post_element_t **) realloc(*_post_elements, sizeof(post_element_t *) * (ptot + 1)); - for(i = fbxine.post_elements_num; i < ptot; i++) - fbxine.post_elements[i] = posts[i - fbxine.post_elements_num]; + for(i = *_post_elements_num; i < ptot; i++) + (*_post_elements)[i] = posts[i - *_post_elements_num]; - fbxine.post_elements[i] = NULL; - fbxine.post_elements_num += num; + (*_post_elements)[i] = NULL; + (*_post_elements_num) += num; } else { - fbxine.post_elements = posts; - fbxine.post_elements_num = num;; + *_post_elements = posts; + *_post_elements_num = num; } } } -static void _pplugin_unwire(void) { +void vpplugin_parse_and_store_post(const char *post_chain) { + pplugin_parse_and_store_post(XINE_POST_TYPE_VIDEO_FILTER, post_chain); +} + + +void applugin_parse_and_store_post(const char *post_chain) { + pplugin_parse_and_store_post(XINE_POST_TYPE_AUDIO_FILTER, post_chain); +} + + +static void _vpplugin_unwire(void) { xine_post_out_t *vo_source; vo_source = xine_get_video_source(fbxine.stream); @@ -286,7 +305,16 @@ } -static void _pplugin_rewire_from_post_elements(post_element_t **post_elements, int post_elements_num) { +static void _applugin_unwire(void) { + xine_post_out_t *ao_source; + + ao_source = xine_get_audio_source(fbxine.stream); + + (void) xine_post_wire_audio_port(ao_source, fbxine.audio_port); +} + + +static void _vpplugin_rewire_from_post_elements(post_element_t **post_elements, int post_elements_num) { if(post_elements_num) { xine_post_out_t *vo_source; @@ -300,9 +328,14 @@ xine_post_wire_video_port((xine_post_out_t *) vo_out, fbxine.video_port); } else { - const xine_post_in_t *vo_in = xine_post_input(post_elements[i + 1]->post, "video"); + const xine_post_in_t *vo_in; int err; + /* look for standard input names */ + vo_in = xine_post_input(post_elements[i + 1]->post, "video"); + if( !vo_in ) + vo_in = xine_post_input(post_elements[i + 1]->post, "video in"); + err = xine_post_wire((xine_post_out_t *) vo_out, (xine_post_in_t *) vo_in); } } @@ -313,13 +346,45 @@ } +static void _applugin_rewire_from_post_elements(post_element_t **post_elements, int post_elements_num) { + + if(post_elements_num) { + xine_post_out_t *ao_source; + int i = 0; + + for(i = (post_elements_num - 1); i >= 0; i--) { + + const char *const *outs = xine_post_list_outputs(post_elements[i]->post); + const xine_post_out_t *ao_out = xine_post_output(post_elements[i]->post, (char *) *outs); + if(i == (post_elements_num - 1)) { + xine_post_wire_audio_port((xine_post_out_t *) ao_out, fbxine.audio_port); + } + else { + const xine_post_in_t *ao_in; + int err; + + /* look for standard input names */ + ao_in = xine_post_input(post_elements[i + 1]->post, "audio"); + if( !ao_in ) + ao_in = xine_post_input(post_elements[i + 1]->post, "audio in"); + + err = xine_post_wire((xine_post_out_t *) ao_out, (xine_post_in_t *) ao_in); + } + } + + ao_source = xine_get_audio_source(fbxine.stream); + xine_post_wire_audio_port(ao_source, post_elements[0]->post->audio_input[0]); + } +} + + static post_element_t **_pplugin_join_deinterlace_and_post_elements(int *post_elements_num) { post_element_t **post_elements; - int i, j; + int i = 0, j = 0; *post_elements_num = 0; - if( fbxine.post_enable ) - *post_elements_num += fbxine.post_elements_num; + if( fbxine.post_video_enable ) + *post_elements_num += fbxine.post_video_elements_num; if( fbxine.deinterlace_enable ) *post_elements_num += fbxine.deinterlace_elements_num; @@ -330,17 +395,45 @@ xine_xmalloc(sizeof(post_element_t *) * (*post_elements_num)); for( i = 0; fbxine.deinterlace_enable && i < fbxine.deinterlace_elements_num; i++ ) { - post_elements[i] = fbxine.deinterlace_elements[i]; + post_elements[i+j] = fbxine.deinterlace_elements[i]; } - for( j = 0; fbxine.post_enable && j < fbxine.post_elements_num; j++ ) { - post_elements[i+j] = fbxine.post_elements[j]; + for( j = 0; fbxine.post_video_enable && j < fbxine.post_video_elements_num; j++ ) { + post_elements[i+j] = fbxine.post_video_elements[j]; } return post_elements; } -static void _pplugin_rewire(void) { +static post_element_t **_pplugin_join_visualization_and_post_elements(int *post_elements_num) { + post_element_t **post_elements; + int i = 0, j = 0; + + *post_elements_num = 0; + if( fbxine.post_audio_enable ) + *post_elements_num += fbxine.post_audio_elements_num; +/* + if( fbxine.visual_anim_enable ) + *post_elements_num++; +*/ + if( *post_elements_num == 0 ) + return NULL; + + post_elements = (post_element_t **) + xine_xmalloc(sizeof(post_element_t *) * (*post_elements_num)); + + for( j = 0; fbxine.post_audio_enable && j < fbxine.post_audio_elements_num; j++ ) { + post_elements[i+j] = fbxine.post_audio_elements[j]; + } +/* + for( i = 0; fbxine.visual_anim_enable && i < 1; i++ ) { + post_elements[i+j] = fbxine.visual_anim_element; + } +*/ + return post_elements; +} + +static void _vpplugin_rewire(void) { static post_element_t **post_elements; int post_elements_num; @@ -348,7 +441,21 @@ post_elements = _pplugin_join_deinterlace_and_post_elements(&post_elements_num); if( post_elements ) { - _pplugin_rewire_from_post_elements(post_elements, post_elements_num); + _vpplugin_rewire_from_post_elements(post_elements, post_elements_num); + + free(post_elements); + } +} + +static void _applugin_rewire(void) { + + static post_element_t **post_elements; + int post_elements_num; + + post_elements = _pplugin_join_visualization_and_post_elements(&post_elements_num); + + if( post_elements ) { + _applugin_rewire_from_post_elements(post_elements, post_elements_num); free(post_elements); } @@ -395,7 +502,7 @@ fbxine.deinterlace_plugin = DEFAULT_DEINTERLACER; - if((posts = pplugin_parse_and_load((deinterlace_post && strlen(deinterlace_post)) ? + if((posts = pplugin_parse_and_load(0, (deinterlace_post && strlen(deinterlace_post)) ? deinterlace_post : fbxine.deinterlace_plugin, &num))) { fbxine.deinterlace_elements = posts; fbxine.deinterlace_elements_num = num; @@ -411,15 +518,21 @@ fbxine.deinterlace_enable); } else { - _pplugin_unwire(); - _pplugin_rewire(); + _vpplugin_unwire(); + _vpplugin_rewire(); } } -void pplugin_rewire_posts(void) { +void vpplugin_rewire_posts(void) { + + _vpplugin_unwire(); + _vpplugin_rewire(); +} + +void applugin_rewire_posts(void) { - _pplugin_unwire(); - _pplugin_rewire(); + _applugin_unwire(); + _applugin_rewire(); } /* end of post.c */ Index: post.h =================================================================== RCS file: /cvsroot/xine/xine-ui/src/fb/post.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- post.h 1 Dec 2003 17:23:27 -0000 1.2 +++ post.h 16 Jul 2005 19:05:30 -0000 1.3 @@ -22,8 +22,10 @@ #ifndef POST_HH #define POST_HH -void pplugin_rewire_posts(void); -void pplugin_parse_and_store_post(const char *post); +void vpplugin_rewire_posts(void); +void applugin_rewire_posts(void); +void vpplugin_parse_and_store_post(const char *post); +void applugin_parse_and_store_post(const char *post); void post_deinterlace(void); void post_deinterlace_init(const char *deinterlace_post); |