All pastes #1321185 Raw Edit

Unnamed

public diff v1 · immutable
#1321185 ·published 2009-01-28 23:08 UTC
rendered paste body
=== modified file 'cd.cpp'--- cd.cpp	2009-01-18 21:12:28 +0000+++ cd.cpp	2009-01-28 22:35:28 +0000@@ -71,6 +71,7 @@ {   int speed = 4;   int ret;+  fprintf(stderr, "CD speed set to %dx\n", speed);    assert(cdrom != -1); === modified file 'plugins/feature/audio/players/xine/xine.cpp'--- plugins/feature/audio/players/xine/xine.cpp	2009-01-18 16:29:42 +0000+++ plugins/feature/audio/players/xine/xine.cpp	2009-01-28 22:42:22 +0000@@ -35,6 +35,8 @@   S_Global::get_instance()->register_reconfigure(boost::bind(&AudioPlayer::reconfigure, this));   xine_config_load(xine, configfile.c_str());   xine_init(xine);+  cd_manager = S_Cd::get_instance();+  cd_device = cd_manager->get_device();   make_new_stream();   /* start run thread */   pthread_create(&thread_loop, NULL, (void *(*)(void *))(pre_run), this);@@ -71,7 +73,6 @@   std::string ao_driver = "auto";   GlobalOptions * go =  S_GlobalOptions::get_instance();   global_audio_device gad = go->get_audio_device_audio();-     if (gad.dev_output != ""){     ao_driver = gad.dev_output;   }@@ -83,17 +84,18 @@   ao_port = xine_open_audio_driver(xine, ao_driver.c_str(), NULL);    if (ao_port == NULL){-    +     DialogWaitPrint pdialog(4000);     pdialog.add_line(dgettext("mms-audio-xine", "Audio device unavailable: ") + ao_driver);     pdialog.print();     return false;   } -  /* Xine uses its own config file for a lot of stuff, including path to cdda device-  make it use our cdda device path */- -  xine_cfg_entry_t config;+  /* Xine uses its own config file for a lot of stuff */+   xine_cfg_entry_t config;++  /* for some reason this doesn't work for someone+   if (!xine_config_lookup_entry(xine, "input.cdda_device", &config)) {     fprintf(stderr, "Xine: Can't set cdda device\n");   }@@ -101,7 +103,7 @@     std::string str = S_Cd::get_instance()->get_device();     config.str_value =  const_cast<char*>(str.c_str());     xine_config_update_entry(xine, &config);-  }+  } */    /* Disable CDDB, we have our own CDDB library  */   if (xine_config_lookup_entry(xine, "media.audio_cd.use_cddb", &config)){@@ -114,7 +116,6 @@   if (stream == NULL){     xine_close_audio_driver(xine, ao_port);     ao_port = NULL;-         return false;   } @@ -210,7 +211,13 @@ #endif #endif       /* fprintf(stderr, "file.path %s\n", file.path.c_str()); */-      if(!xine_open(stream, file.path.c_str()))+      std::string _str = file.path;+      if (file.type == "media-track"){+        std::string _path = "cdda:/" + cd_device +"/";+        _str = regex_tools::regex_replace(_str, _path.c_str(), "^cdda:/", false, false);+        fprintf(stderr, "%s\n", _str.c_str());+      }+      if(!xine_open(stream, _str.c_str()))         break;       int len = 0;       off_t play_at = 0;@@ -230,7 +237,6 @@         gather_info_internal();         audio_state->set_playing(true);         buffering_state = 0;-	       }        else{@@ -424,7 +430,7 @@   }   default:     {-    ; /* nothing */+      break; /* nothing */     }   } }@@ -509,6 +515,7 @@   if (quitting)     return;   pthread_mutex_lock(&stream_mutex);+  cd_device = cd_manager->get_device(); /* Update CD device, which migh have changed */   /* fprintf(stderr, "Will play '%s'\n", f.path.c_str()); */   file = f;   xine_request = _XINE_REQUEST_PLAY;@@ -520,9 +527,9 @@   if (quitting)     return;   pthread_mutex_lock(&stream_mutex);+  cd_device = cd_manager->get_device(); /* Update CD device, which migh have changed */   if (!cur_nr.path.empty())     file = cur_nr;-   xine_request = _XINE_REQUEST_PLAY;   pthread_cond_broadcast(&stream_switch);   pthread_mutex_unlock(&stream_mutex);@@ -578,7 +585,6 @@ void Xine::collect_info(const std::string &f){   if (quitting)     return;-     pthread_mutex_lock(&stream_mutex);   if (!playing || file.path != f){     /* Exceptionally we don't let the loop handle this */@@ -723,9 +729,7 @@     return;   while (playing)     mmsUsleep(100000);-   setpos(cur_time);- };  bool Xine::loaded(){return true;};@@ -734,11 +738,6 @@  int Xine::getpos(){return cur_time;}; -std::string Xine::cd_track_path(int track_nr)-{-  std::ostringstream tmp;--  tmp << "cdda:/" << track_nr;--  return tmp.str();+std::string Xine::cd_track_path(int track_nr){+  return string_format::str_printf("cdda:/%d", track_nr); }=== modified file 'plugins/feature/audio/players/xine/xine.hpp'--- plugins/feature/audio/players/xine/xine.hpp	2009-01-01 18:29:54 +0000+++ plugins/feature/audio/players/xine/xine.hpp	2009-01-28 11:42:34 +0000@@ -59,6 +59,8 @@   volatile bool running;   bool initted;   bool retry_track;+  std::string cd_device;+  Cd * cd_manager;  typedef enum{   _XINE_REQUEST_NONE,