Ticket #429: mythfm.diff
File mythfm.diff, 19.2 KB (added by , 19 years ago) |
---|
-
configure
21 21 fftw_lib="no" 22 22 sdl="no" 23 23 aac="no" 24 radio="no" 24 25 transcode="no" 25 26 vcdsupport="no" 26 27 exif="no" … … 80 81 ;; 81 82 --disable-aac) aac="no" 82 83 ;; 84 --enable-radio) radio="yes" 85 ;; 86 --disable-radio) radio="no" 87 ;; 83 88 --enable-transcode) transcode="yes" 84 89 ;; 85 90 --disable-transcode) transcode="no" … … 109 114 opengl="yes"; 110 115 fftw_lib="yes"; 111 116 aac="yes"; 117 radio="yes"; 112 118 vcdsupport="yes"; 113 119 transcode="yes"; 114 120 exif="yes"; … … 126 132 sdl="no"; 127 133 opengl="no"; 128 134 fftw_lib="no"; 129 aac="no"; 135 aac="no"; 136 radio="no"; 130 137 vcdsupport="no"; 131 138 transcode="no"; 132 139 exif="no"; … … 166 173 --enable-fftw enable fftw visualizers [default=no] 167 174 --enable-sdl use SDL for the synaesthesia output [default=no] 168 175 --enable-aac enable AAC/MP4 audio file decompression [default=no] 169 176 --enable-radio enable V4L Radio decoder [default=no] 177 170 178 MythNews related options: 171 179 --enable-mythnews build the mythnews plugin [default=yes] 172 180 … … 453 461 fi 454 462 fi 455 463 464 if test "$radio" = "yes" ; then 465 echo " V4L Radio support will be included in MythMusic" 466 echo "#define RADIO_SUPPORT 1" >> ./mythmusic/mythmusic/config.h 467 echo "HEADERS += radiodecoder.h metaioradiocomment.h v4lradio.h stationsimporter.h" >> ./mythmusic/mythmusic/config.pro 468 echo "SOURCES += radiodecoder.cpp metaioradiocomment.cpp v4lradio.cpp stationsimporter.cpp" >> ./mythmusic/mythmusic/config.pro 469 fi 470 if test "$radio" = "no" ; then 471 echo " V4L Radio support will not be included in MythMusic" 472 fi 473 456 474 ########################################################### 457 475 # # 458 476 # MythPhone related configuration options # -
mythmusic/mythmusic/playbackbox.cpp
50 50 curMeta = NULL; 51 51 curSmartPlaylistCategory = ""; 52 52 curSmartPlaylistName = ""; 53 54 #ifdef RADIO_SUPPORT 55 // read radio decoder settings, even radio decoder not activate??? 56 radio_lock_device = gContext->GetNumSetting("RadioLockDevice", 0); 57 radio_max_freq = gContext->GetNumSetting("RadioFMaxOverride", 108000); 58 radio_min_freq = gContext->GetNumSetting("RadioFMinOverride", 87500); 59 radio_freq_step = gContext->GetNumSetting("RadioScanStep", 50); 60 #endif 53 61 54 62 // Set our pointers the playlists and the metadata containers 55 63 … … 936 944 937 945 void PlaybackBoxMusic::pause(void) 938 946 { 947 #ifdef RADIO_SUPPORT 948 // sometimes radio decoder can't stop from pause state 949 // sets pause key act as mute key :( 950 if (decoder && decoder->factory()->extension() == ".fmd") 951 { 952 if (output) 953 output->ToggleMute(); 954 return; 955 } 956 #endif 957 939 958 if (output) 940 959 { 941 960 isplaying = !isplaying; … … 1018 1037 info_text->SetText(""); 1019 1038 1020 1039 isplaying = false; 1040 1041 #ifdef RADIO_SUPPORT 1042 // restore rating image 1043 if (showrating && curMeta) 1044 { 1045 if (ratings_image) 1046 ratings_image->setRepeat(curMeta->Rating()); 1047 } 1048 else 1049 { 1050 if (ratings_image) 1051 ratings_image->setRepeat(0); 1052 } 1053 #endif 1021 1054 } 1022 1055 1023 1056 void PlaybackBoxMusic::stopAll() … … 1087 1120 1088 1121 void PlaybackBoxMusic::seekforward() 1089 1122 { 1123 #ifdef RADIO_SUPPORT 1124 if (decoder && decoder->factory()->extension() == ".fmd") 1125 { 1126 // seek only available if radio device in lock mode 1127 if (artist_text && radio_lock_device) 1128 { 1129 QString sfreq = (artist_text->GetText().left(6)).stripWhiteSpace(); 1130 int ifreq = (int) (sfreq.toFloat() * 1000.0); 1131 1132 ifreq = ifreq + radio_freq_step; 1133 if (ifreq > radio_max_freq) ifreq = radio_max_freq; 1134 1135 seek(ifreq); 1136 } 1137 return; 1138 } 1139 #endif 1090 1140 int nextTime = currentTime + 5; 1091 1141 if (nextTime > maxTime) 1092 1142 nextTime = maxTime; … … 1095 1145 1096 1146 void PlaybackBoxMusic::seekback() 1097 1147 { 1148 #ifdef RADIO_SUPPORT 1149 if (decoder && decoder->factory()->extension() == ".fmd") 1150 { 1151 // seek only available if radio device in lock mode 1152 if (artist_text && radio_lock_device) 1153 { 1154 QString sfreq = (artist_text->GetText().left(6)).stripWhiteSpace(); 1155 int ifreq = (int) (sfreq.toFloat() * 1000.0); 1156 1157 ifreq = ifreq - radio_freq_step; 1158 if (ifreq < radio_min_freq) ifreq = radio_min_freq; 1159 1160 seek(ifreq); 1161 } 1162 return; 1163 } 1164 #endif 1098 1165 int nextTime = currentTime - 5; 1099 1166 if (nextTime < 0) 1100 1167 nextTime = 0; … … 1106 1173 if (output) 1107 1174 { 1108 1175 output->Reset(); 1176 #ifdef RADIO_SUPPORT 1177 if (decoder && decoder->factory()->extension() == ".fmd" && decoder->running()) 1178 { 1179 if (artist_text) 1180 artist_text->SetText(QString().setNum((float) pos / 1000.0, 'f', 2) + " " + tr("MHz")); 1181 } 1182 else 1183 #endif 1109 1184 output->SetTimecode(pos*1000); 1110 1185 1111 1186 if (decoder && decoder->running()) … … 1419 1494 } 1420 1495 } 1421 1496 1497 #ifdef RADIO_SUPPORT 1498 // signal viewer only available if radio device in lock mode 1499 if (radio_lock_device && decoder && decoder->factory()->extension() == ".fmd") 1500 { 1501 if (ratings_image) 1502 { 1503 decoder->mutex()->lock(); 1504 ratings_image->setRepeat((int) (decoder->radioSignalQuality() * 10.0)); 1505 decoder->mutex()->unlock(); 1506 } 1507 } 1508 #endif 1509 1422 1510 break; 1423 1511 } 1424 1512 case OutputEvent::Error: -
mythmusic/mythmusic/decoder.h
81 81 82 82 virtual Metadata *getMetadata() = 0; 83 83 virtual void commitMetadata(Metadata *mdata) = 0; 84 85 #ifdef RADIO_SUPPORT 86 virtual float radioSignalQuality() const { return 0; } 87 #endif 84 88 85 89 static void SetLocationFormatUseTags(void); 86 90 … … 177 181 }; 178 182 #endif 179 183 184 #ifdef RADIO_SUPPORT 185 class RadioDecoderFactory : public DecoderFactory 186 { 187 public: 188 bool supports(const QString &) const; 189 const QString &extension() const; 190 const QString &description() const; 191 Decoder *create(const QString &, QIODevice *, AudioOutput *, bool); 192 }; 180 193 #endif 194 195 #endif -
mythmusic/mythmusic/globalsettings.cpp
1 1 #include "mythtv/mythcontext.h" 2 2 #include "config.h" 3 3 #include <unistd.h> 4 4 5 5 #include "globalsettings.h" … … 12 12 #include <qprocess.h> 13 13 #include <qapplication.h> 14 14 15 #ifdef RADIO_SUPPORT 16 #include "stationsimporter.h" 17 #endif 18 15 19 // General Settings 16 20 17 21 static HostLineEdit *SetMusicDirectory() … … 297 301 return gc; 298 302 }; 299 303 304 305 #ifdef RADIO_SUPPORT 306 static HostComboBox *RadioDevice() 307 { 308 HostComboBox *gc = new HostComboBox("RadioDevice", true); 309 gc->setLabel(QObject::tr("Radio device")); 310 QDir dev("/dev", "radio*", QDir::Name, QDir::System); 311 gc->fillSelectionsFromDir(dev); 312 313 dev.setNameFilter("radio*"); 314 dev.setPath("/dev/v4l"); 315 gc->fillSelectionsFromDir(dev); 316 //gc->setHelpText(QObject::tr("Radio device used for playback.")); 317 return gc; 318 }; 319 320 static HostSpinBox *RadioFMinOverride() 321 { 322 HostSpinBox *gc = new HostSpinBox("RadioFMinOverride", 65000, 108000, 500); 323 gc->setLabel(QObject::tr("Minimum frequency [kHz]")); 324 gc->setValue(87500); 325 gc->setHelpText(QObject::tr("Override radio device minimum frequency to this value.")); 326 return gc; 327 }; 328 329 static HostSpinBox *RadioFMaxOverride() 330 { 331 HostSpinBox *gc = new HostSpinBox("RadioFMaxOverride", 65000, 108000, 500); 332 gc->setLabel(QObject::tr("Maximum frequency [kHz]")); 333 gc->setValue(108000); 334 gc->setHelpText(QObject::tr("Override radio device maximum frequency to this value.")); 335 return gc; 336 }; 337 338 static HostSpinBox *RadioScanStep() 339 { 340 HostSpinBox *gc = new HostSpinBox("RadioScanStep", 5, 500, 5); 341 gc->setLabel(QObject::tr("Frequency step (kHz)")); 342 gc->setValue(50); 343 gc->setHelpText(QObject::tr("Sets radio frequency to this value multiplication.")); 344 return gc; 345 }; 346 347 static HostSpinBox *RadioSignalMinQuality() 348 { 349 HostSpinBox *gc = new HostSpinBox("RadioSignalMinQuality", 10, 100, 1); 350 gc->setLabel(QObject::tr("Minimum signal quality [%]")); 351 gc->setValue(60); 352 gc->setHelpText(QObject::tr("Minimum signal for frequency good quality.")); 353 return gc; 354 }; 355 356 static HostLineEdit *RadioDirectory() 357 { 358 HostLineEdit *gc = new HostLineEdit("RadioLocation"); 359 gc->setLabel(QObject::tr("Directory to hold radio file")); 360 gc->setValue("/mnt/store/music/radio"); 361 gc->setHelpText(QObject::tr("This directory must exist, and the user " 362 "running MythMusic needs to have write permission " 363 "to the directory. Sets under MythMusic directory.")); 364 return gc; 365 }; 366 367 static TransButtonSetting *ButtonImport() 368 { 369 TransButtonSetting *gc = new TransButtonSetting(); 370 gc->setLabel(QObject::tr("Import MythFM Station Database")); 371 gc->setHelpText(QObject::tr("Import all MythFM station database and save it to .fmd file.")); 372 return gc; 373 } 374 375 static TransButtonSetting *ButtonScan() 376 { 377 TransButtonSetting *gc = new TransButtonSetting(); 378 gc->setLabel(QObject::tr("Scan Radio Stations")); 379 gc->setHelpText(QObject::tr("Scan all radio stations and save it to .fmd file.")); 380 return gc; 381 } 382 383 static HostCheckBox *RadioUseOldV4L2Calls() 384 { 385 HostCheckBox *gc = new HostCheckBox("RadioUseOldV4L2Calls"); 386 gc->setLabel(QObject::tr("Use old V4L2 calls")); 387 gc->setValue(true); 388 gc->setHelpText(QObject::tr("Sets this value to figure out old version V4L2 calls. " 389 "MythMusic will try the other version of the call in case this set " 390 "did not work.")); 391 return gc; 392 }; 393 394 static HostCheckBox *RadioIVTVPassthrough() 395 { 396 HostCheckBox *gc = new HostCheckBox("RadioIVTVPassthrough"); 397 gc->setLabel(QObject::tr("Activate ivtv passthrough mode")); 398 gc->setValue(false); 399 gc->setHelpText(QObject::tr("Sets this value to enable ivtv passthrough mode in " 400 "case ivtv driver activate. (experimental)")); 401 return gc; 402 }; 403 404 static HostCheckBox *RadioLockDevice() 405 { 406 HostCheckBox *gc = new HostCheckBox("RadioLockDevice"); 407 gc->setLabel(QObject::tr("Lock radio device while playing")); 408 gc->setValue(false); 409 gc->setHelpText(QObject::tr("Note that activate this setting can be " 410 "disturb your tv recording schedule. Be carefull. " 411 "Frequency seeker and signal viewer only available " 412 "in lock mode.")); 413 return gc; 414 }; 415 416 static HostComboBox *RadioAudioDevice() 417 { 418 HostComboBox *gc = new HostComboBox("RadioAudioDevice", true); 419 gc->setLabel(QObject::tr("Radio audio device")); 420 QDir dev("/dev", "dsp*", QDir::Name, QDir::System); 421 gc->fillSelectionsFromDir(dev); 422 dev.setNameFilter("video*"); 423 gc->fillSelectionsFromDir(dev); 424 425 dev.setNameFilter("dsp*"); 426 dev.setPath("/dev/sound"); 427 gc->fillSelectionsFromDir(dev); 428 gc->setHelpText(QObject::tr("Audio device used as audio input for audio playback.")); 429 return gc; 430 }; 431 432 static HostComboBox *RadioAudioRate() 433 { 434 HostComboBox *gc = new HostComboBox("RadioAudioRate", true); 435 gc->setLabel(QObject::tr("Audio sampling rate")); 436 gc->addSelection("32000"); // prepare for bttv audio 437 gc->addSelection("44100"); // prepare for audio pass-through 438 gc->addSelection("48000"); // prepare for ivtv audio 439 gc->setHelpText(QObject::tr("Sets the audio sampling rate for your DSP. " 440 "Ensure that you choose a sampling rate appropriate " 441 "for your device. btaudio may only allow 32000, " 442 "ivtv may only allow 48000.")); 443 return gc; 444 }; 445 446 static HostSlider *RadioVolume() 447 { 448 HostSlider *gc = new HostSlider("RadioVolume", 0, 100, 5); 449 gc->setLabel(QObject::tr("Radio device volume")); 450 gc->setValue(100); 451 gc->setHelpText(QObject::tr("Volume position for radio device.")); 452 return gc; 453 }; 454 455 static HostSlider *RadioTreble() 456 { 457 HostSlider *gc = new HostSlider("RadioTreble", 0, 100, 5); 458 gc->setLabel(QObject::tr("Radio device treble")); 459 gc->setValue(50); 460 gc->setHelpText(QObject::tr("Treble position for radio device.")); 461 return gc; 462 }; 463 464 static HostSlider *RadioBass() 465 { 466 HostSlider *gc = new HostSlider("RadioBass", 0, 100, 5); 467 gc->setLabel(QObject::tr("Radio device bass")); 468 gc->setValue(50); 469 gc->setHelpText(QObject::tr("Bass position for radio device.")); 470 return gc; 471 }; 472 473 static HostSlider *RadioBalance() 474 { 475 HostSlider *gc = new HostSlider("RadioBalance", -100, 100, 5); 476 gc->setLabel(QObject::tr("Radio device balance")); 477 gc->setValue(0); 478 gc->setHelpText(QObject::tr("Balance position for radio device.")); 479 return gc; 480 }; 481 482 static HostCheckBox *RadioAudioAsFile() 483 { 484 HostCheckBox *gc = new HostCheckBox("RadioAudioAsFile"); 485 gc->setLabel(QObject::tr("Open audio device as file")); 486 gc->setValue(false); 487 gc->setHelpText(QObject::tr("Open audio device as raw PCM stream file. " 488 "Activate this setting to enable ivtv radio audio support.")); 489 return gc; 490 }; 491 #endif 492 300 493 //Player Settings 301 494 302 495 static HostComboBox *PlayMode() … … 510 703 general2->addChild(CDWriteSpeed()); 511 704 general2->addChild(CDBlankType()); 512 705 addChild(general2); 706 707 #ifdef RADIO_SUPPORT 708 VerticalConfigurationGroup* general3 = new VerticalConfigurationGroup(false); 709 general3->setLabel(QObject::tr("Radio Settings")); 710 general3->addChild(RadioDevice()); 711 general3->addChild(RadioLockDevice()); 712 general3->addChild(RadioFMinOverride()); 713 general3->addChild(RadioFMaxOverride()); 714 general3->addChild(RadioScanStep()); 715 general3->addChild(RadioSignalMinQuality()); 716 general3->addChild(RadioDirectory()); 717 718 HorizontalConfigurationGroup* buttonImporter = 719 new HorizontalConfigurationGroup(false, false); 720 721 StationsImporter* importer = new StationsImporter(); 722 723 TransButtonSetting* buttonImport = ButtonImport(); 724 buttonImporter->addChild(buttonImport); 725 QObject::connect(buttonImport, SIGNAL(pressed()), importer, SLOT(importStations())); 726 727 TransButtonSetting* buttonScan = ButtonScan(); 728 buttonImporter->addChild(buttonScan); 729 QObject::connect(buttonScan, SIGNAL(pressed()), importer, SLOT(scanStations())); 730 731 general3->addChild(buttonImporter); 732 733 addChild(general3); 734 735 VerticalConfigurationGroup* general4 = new VerticalConfigurationGroup(false); 736 general4->setLabel(QObject::tr("Radio Settings (part 2)")); 737 general4->addChild(RadioAudioDevice()); 738 general4->addChild(RadioAudioAsFile()); 739 general4->addChild(RadioAudioRate()); 740 general4->addChild(RadioVolume()); 741 general4->addChild(RadioTreble()); 742 general4->addChild(RadioBass()); 743 general4->addChild(RadioBalance()); 744 745 general4->addChild(RadioUseOldV4L2Calls()); 746 general4->addChild(RadioIVTVPassthrough()); 747 748 addChild(general4); 749 #endif 513 750 } 514 751 515 752 MusicPlayerSettings::MusicPlayerSettings() -
mythmusic/mythmusic/decoder.cpp
121 121 #ifdef AAC_SUPPORT 122 122 Decoder::registerFactory(new aacDecoderFactory); 123 123 #endif 124 #ifdef RADIO_SUPPORT 125 Decoder::registerFactory(new RadioDecoderFactory); 126 #endif 124 127 } 125 128 } 126 129 -
mythmusic/mythmusic/editmetadata.cpp
5 5 #include "decoder.h" 6 6 #include "genres.c" 7 7 8 #include "config.h" 9 10 #include <math.h> 11 12 #ifdef RADIO_SUPPORT 13 int intFrequency(int freq) 14 { 15 int step = gContext->GetNumSetting("RadioScanStep", 50); 16 int minf = gContext->GetNumSetting("RadioFMinOverride", 87500); 17 int maxf = gContext->GetNumSetting("RadioFMaxOverride", 108000); 18 19 if (freq < minf || freq > maxf) freq = 87500; 20 21 // rounding frequency to step 22 freq = (int)(rint(freq / step) * step); 23 24 return freq; 25 } 26 27 QString strFrequency(int freq) 28 { 29 float ffreq = (float) intFrequency(freq) / 1000.0; 30 31 QString s = QString().setNum(ffreq, 'f', 2) + " " + QObject::tr("MHz"); 32 33 return s; 34 } 35 #endif 36 8 37 EditMetadataDialog::EditMetadataDialog(Metadata *source_metadata, 9 38 MythMainWindow *parent, 10 39 QString window_name, … … 487 516 void EditMetadataDialog::saveToDatabase() 488 517 { 489 518 cancelPopup(); 519 520 #ifdef RADIO_SUPPORT 521 Decoder *decoder = Decoder::create(m_metadata->Filename(), NULL, NULL, true); 522 if (decoder) 523 { 524 if (decoder->factory()->extension() == ".fmd") 525 { 526 int i = m_metadata->Track(); 490 527 528 m_metadata->setArtist(strFrequency(i)); 529 m_metadata->setAlbum(tr("Radio Stations")); 530 m_metadata->setTrack(intFrequency(i)); 531 } 532 delete decoder; 533 } 534 #endif 535 491 536 m_metadata->updateDatabase(QString::null); 492 537 *m_sourceMetadata = m_metadata; 493 538 done(1); … … 509 554 Decoder *decoder = Decoder::create(m_metadata->Filename(), NULL, NULL, true); 510 555 if (decoder) 511 556 { 557 #ifdef RADIO_SUPPORT 558 if (decoder->factory()->extension() == ".fmd") 559 { 560 int i = m_metadata->Track(); 561 562 m_metadata->setArtist(strFrequency(i)); 563 m_metadata->setAlbum(tr("Radio Stations")); 564 m_metadata->setTrack(intFrequency(i)); 565 } 566 #endif 512 567 decoder->commitMetadata(m_metadata); 513 568 delete decoder; 514 569 } -
mythmusic/mythmusic/playbackbox.h
9 9 #include <mythtv/dialogbox.h> 10 10 #include <mythtv/audiooutput.h> 11 11 12 #include "config.h" 13 12 14 #include "mainvisual.h" 13 15 #include "metadata.h" 14 16 #include "playlist.h" … … 153 155 bool show_whole_tree; 154 156 bool keyboard_accelerators; 155 157 bool volume_control; 158 159 #ifdef RADIO_SUPPORT 160 bool radio_lock_device; 161 int radio_max_freq; 162 int radio_min_freq; 163 int radio_freq_step; 164 #endif 156 165 157 166 MythPopupBox *playlist_popup; 158 167