Ticket #1625: transcode-filters.diff
File transcode-filters.diff, 7.6 KB (added by , 18 years ago) |
---|
-
libs/libmythtv/recordingprofile.h
38 38 class ImageSize; 39 39 class TranscodeResize; 40 40 class TranscodeLossless; 41 class TranscodeFilters; 41 42 42 43 class RecordingProfile: public ConfigurationWizard 43 44 { … … 102 103 private slots: 103 104 void ResizeTranscode(bool resize); 104 105 void SetLosslessTranscode(bool lossless); 106 void FiltersChanged(const QString &val); 105 107 106 108 private: 107 109 ID *id; … … 109 111 ImageSize *imageSize; 110 112 TranscodeResize *tr_resize; 111 113 TranscodeLossless *tr_lossless; 114 TranscodeFilters *tr_filters; 112 115 VideoCompressionSettings *videoSettings; 113 116 AudioCompressionSettings *audioSettings; 114 117 QString profileName; -
libs/libmythtv/recordingprofile.cpp
676 676 }; 677 677 }; 678 678 679 class TranscodeFilters: public CodecParam, public LineEditSetting { 680 public: 681 TranscodeFilters(const RecordingProfile& parent): 682 CodecParam(parent, "transcodefilters"), 683 LineEditSetting() { 684 setLabel(QObject::tr("Custom Filters")); 685 setHelpText(QObject::tr("Filters used when transcoding using " 686 "this profile. Format:\n" 687 "[[<filter>=<options>,]...]" 688 )); 689 }; 690 }; 691 679 692 class ImageSize: public VerticalConfigurationGroup { 680 693 public: 681 694 class Width: public SpinBoxSetting, public CodecParam { … … 755 768 : id(new ID()), name(new Name(*this)), 756 769 imageSize(NULL), videoSettings(NULL), 757 770 audioSettings(NULL), profileName(profName), 758 isEncoder(true) 771 isEncoder(true) 759 772 { 760 773 // This must be first because it is needed to load/save the other settings 761 774 addChild(id); … … 769 782 profile->setLabel(labelName); 770 783 profile->addChild(name); 771 784 785 tr_filters = NULL; 772 786 tr_lossless = NULL; 773 787 tr_resize = NULL; 774 788 … … 776 790 { 777 791 if (profName.left(11) == "Transcoders") 778 792 { 793 tr_filters = new TranscodeFilters(*this); 779 794 tr_lossless = new TranscodeLossless(*this); 780 795 tr_resize = new TranscodeResize(*this); 796 profile->addChild(tr_filters); 781 797 profile->addChild(tr_lossless); 782 798 profile->addChild(tr_resize); 783 799 } … … 786 802 } 787 803 else 788 804 { 805 tr_filters = new TranscodeFilters(*this); 789 806 tr_lossless = new TranscodeLossless(*this); 790 807 tr_resize = new TranscodeResize(*this); 808 profile->addChild(tr_filters); 791 809 profile->addChild(tr_lossless); 792 810 profile->addChild(tr_resize); 793 811 profile->addChild(new AutoTranscode(*this)); … … 799 817 void RecordingProfile::ResizeTranscode(bool resize) 800 818 { 801 819 MythWizard *wizard = (MythWizard *)dialog; 820 if (!wizard) 821 return; 802 822 //page '1' is the Image Size page 803 823 QWidget *size_page = wizard->page(1); 804 824 wizard->setAppropriate(size_page, resize); … … 807 827 void RecordingProfile::SetLosslessTranscode(bool lossless) 808 828 { 809 829 MythWizard *wizard = (MythWizard *)dialog; 830 if (!wizard) 831 return; 810 832 811 833 bool show_size = (lossless) ? false : tr_resize->boolValue(); 812 834 wizard->setAppropriate(wizard->page(1), show_size); … … 816 838 wizard->setNextEnabled(wizard->page(0), ! lossless); 817 839 wizard->setFinishEnabled(wizard->page(0), lossless); 818 840 841 if (tr_filters) 842 tr_filters->setEnabled(!lossless); 819 843 } 820 844 821 845 void RecordingProfile::loadByID(int profileId) … … 846 870 847 871 audioSettings = new AudioCompressionSettings(*this, profileName); 848 872 addChild(audioSettings); 849 873 850 874 if (profileName && profileName.left(11) == "Transcoders") 851 875 { 852 876 connect(tr_resize, SIGNAL(valueChanged (bool)), 853 877 this, SLOT( ResizeTranscode(bool))); 854 878 connect(tr_lossless, SIGNAL(valueChanged (bool)), 855 this, SLOT( SetLosslessTranscode(bool))); 879 this, SLOT( SetLosslessTranscode(bool))); 880 connect(tr_filters, SIGNAL(valueChanged(const QString &)), 881 this, SLOT(FiltersChanged(const QString &))); 856 882 } 857 883 } 858 884 … … 860 886 load(); 861 887 } 862 888 889 void RecordingProfile::FiltersChanged(const QString &val) 890 { 891 if (!tr_filters || !tr_lossless) 892 return; 893 894 // If there are filters, we can not do lossless transcoding 895 if (val.stripWhiteSpace().length() > 0) { 896 tr_lossless->setValue(false); 897 tr_lossless->setEnabled(false); 898 } else { 899 tr_lossless->setEnabled(true); 900 } 901 } 902 863 903 bool RecordingProfile::loadByType(QString name, QString cardtype) 864 904 { 865 905 QString hostname = gContext->GetHostName(); … … 937 977 int RecordingProfile::exec() 938 978 { 939 979 MythDialog* dialog = dialogWidget(gContext->GetMainWindow()); 980 940 981 dialog->Show(); 941 982 if (tr_lossless) 942 983 SetLosslessTranscode(tr_lossless->boolValue()); 943 984 if (tr_resize) 985 ResizeTranscode(tr_resize->boolValue()); 986 // Filters should be set last because it might disable lossless 987 if (tr_filters) 988 FiltersChanged(tr_filters->getValue()); 989 944 990 int ret = dialog->exec(); 945 991 946 992 delete dialog; -
libs/libmyth/settings.h
214 214 215 215 class ConfigurationDialog: virtual public Configurable { 216 216 public: 217 ConfigurationDialog() : 218 Configurable(), dialog(NULL) {}; 219 217 220 // Make a modal dialog containing configWidget 218 221 virtual MythDialog* dialogWidget(MythMainWindow *parent, 219 222 const char* widgetName = 0); -
programs/mythtranscode/transcode.cpp
378 378 QString encodingType = nvp->GetEncodingType(); 379 379 bool copyvideo = false, copyaudio = false; 380 380 381 QString vidsetting = NULL, audsetting = NULL ;381 QString vidsetting = NULL, audsetting = NULL, vidfilters = NULL; 382 382 383 383 int video_width = nvp->GetVideoWidth(); 384 384 int video_height = nvp->GetVideoHeight(); … … 397 397 } 398 398 vidsetting = profile.byName("videocodec")->getValue(); 399 399 audsetting = profile.byName("audiocodec")->getValue(); 400 vidfilters = profile.byName("transcodefilters")->getValue(); 400 401 401 402 if (encodingType == "MPEG-2" && 402 403 profile.byName("transcodelossless")->getValue().toInt()) … … 413 414 } 414 415 else if (profile.byName("transcoderesize")->getValue().toInt()) 415 416 { 417 nvp->SetVideoFilters(vidfilters); 416 418 newWidth = profile.byName("width")->getValue().toInt(); 417 419 newHeight = profile.byName("height")->getValue().toInt(); 418 420 … … 443 445 .arg(video_width).arg(video_height) 444 446 .arg(newWidth).arg(newHeight)); 445 447 } 448 else // lossy and no resize 449 nvp->SetVideoFilters(vidfilters); 446 450 447 451 // this is ripped from tv_rec SetupRecording. It'd be nice to merge 448 452 nvr->SetOption("inpixfmt", FMT_YV12);