comparison mplayer.c @ 12672:9709ce101949

New 'Mixer API' with ability to change volume through libaf (this part was written by Reimar Doffinger) and lesser global variables
author alex
date Sat, 26 Jun 2004 09:14:20 +0000
parents 733c9d9882d1
children 6d815f12e3e5
comparison
equal deleted inserted replaced
12671:c1fc3d58f66e 12672:9709ce101949
522 //extern void write_avi_header_1(FILE *f,int fcc,float fps,int width,int height); 522 //extern void write_avi_header_1(FILE *f,int fcc,float fps,int width,int height);
523 523
524 extern void mp_input_register_options(m_config_t* cfg); 524 extern void mp_input_register_options(m_config_t* cfg);
525 525
526 #include "mixer.h" 526 #include "mixer.h"
527 static mixer_t mixer;
528
527 #include "cfg-mplayer.h" 529 #include "cfg-mplayer.h"
528 530
529 void parse_cfgfiles( m_config_t* conf ) 531 void parse_cfgfiles( m_config_t* conf )
530 { 532 {
531 char *conffile; 533 char *conffile;
1900 // uninit_player(INITED_ACODEC|INITED_AO); // close codec & ao 1902 // uninit_player(INITED_ACODEC|INITED_AO); // close codec & ao
1901 // sh_audio=d_audio->sh=NULL; // -> nosound 1903 // sh_audio=d_audio->sh=NULL; // -> nosound
1902 } 1904 }
1903 #endif 1905 #endif
1904 } 1906 }
1907 mixer.audio_out = audio_out;
1908 mixer.afilter = sh_audio->afilter;
1909 mixer.volstep = 3;
1905 } 1910 }
1906 1911
1907 current_module="av_init"; 1912 current_module="av_init";
1908 1913
1909 if(sh_video) sh_video->timer=0; 1914 if(sh_video) sh_video->timer=0;
2486 printf( "\nEDL_SKIP: start [%f], stop [%f], length [%f]\n", next_edl_record->start_sec, next_edl_record->stop_sec, next_edl_record->length_sec ); 2491 printf( "\nEDL_SKIP: start [%f], stop [%f], length [%f]\n", next_edl_record->start_sec, next_edl_record->stop_sec, next_edl_record->length_sec );
2487 #endif 2492 #endif
2488 edl_decision = 1; 2493 edl_decision = 1;
2489 next_edl_record = next_edl_record->next; 2494 next_edl_record = next_edl_record->next;
2490 } else if( next_edl_record->action == EDL_MUTE ) { 2495 } else if( next_edl_record->action == EDL_MUTE ) {
2491 mixer_mute(); 2496 mixer_mute(&mixer);
2492 #ifdef DEBUG_EDL 2497 #ifdef DEBUG_EDL
2493 printf( "\nEDL_MUTE: [%f]\n", next_edl_record->start_sec ); 2498 printf( "\nEDL_MUTE: [%f]\n", next_edl_record->start_sec );
2494 #endif 2499 #endif
2495 edl_decision = 1; 2500 edl_decision = 1;
2496 next_edl_record = next_edl_record->next; 2501 next_edl_record = next_edl_record->next;
2655 // start change for absolute volume value 2660 // start change for absolute volume value
2656 int abs = (cmd->nargs > 1) ? cmd->args[1].v.i : 0; 2661 int abs = (cmd->nargs > 1) ? cmd->args[1].v.i : 0;
2657 2662
2658 if( abs ) 2663 if( abs )
2659 { 2664 {
2660 mixer_setvolume( (float)v, (float)v ); 2665 mixer_setvolume(&mixer, (float)v, (float)v );
2661 } else { 2666 } else {
2662 if(v > 0) 2667 if(v > 0)
2663 mixer_incvolume(); 2668 mixer_incvolume(&mixer);
2664 else 2669 else
2665 mixer_decvolume(); 2670 mixer_decvolume(&mixer);
2666 } 2671 }
2667 2672
2668 #ifdef USE_OSD 2673 #ifdef USE_OSD
2669 if(osd_level && sh_video){ 2674 if(osd_level && sh_video){
2675 float vol;
2670 osd_visible=sh_video->fps; // 1 sec 2676 osd_visible=sh_video->fps; // 1 sec
2671 vo_osd_progbar_type=OSD_VOLUME; 2677 vo_osd_progbar_type=OSD_VOLUME;
2672 vo_osd_progbar_value=(mixer_getbothvolume()*256.0)/100.0; 2678 mixer_getbothvolume(&mixer, &vol);
2679 vo_osd_progbar_value=(vol*256.0)/100.0;
2673 vo_osd_changed(OSDTYPE_PROGBAR); 2680 vo_osd_changed(OSDTYPE_PROGBAR);
2674 } 2681 }
2675 #endif 2682 #endif
2676 } break; 2683 } break;
2677 case MP_CMD_MUTE: 2684 case MP_CMD_MUTE:
2678 mixer_mute(); 2685 mixer_mute(&mixer);
2679 break; 2686 break;
2680 case MP_CMD_LOADFILE : { 2687 case MP_CMD_LOADFILE : {
2681 play_tree_t* e = play_tree_new(); 2688 play_tree_t* e = play_tree_new();
2682 play_tree_add_file(e,cmd->args[0].v.s); 2689 play_tree_add_file(e,cmd->args[0].v.s);
2683 2690