mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-06-01 16:42:34 +02:00
2016-06-15 Fred Gleason <fredg@paravelsystems.com>
* Added '--bitrate=', '--channels=', '--format=', '--quality=' and '--samplerate=' to rdexport(1) in 'utils/rdexport/rdexport.cpp' and 'utils/rdexport/rdexport.h'.
This commit is contained in:
parent
faaa5b4cdb
commit
aa610a739c
@ -15236,3 +15236,7 @@
|
||||
2016-06-14 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Merged fixes for NULL SQL date-time values from Wayne Merricks
|
||||
[GitHub pull request #000133].
|
||||
2016-06-15 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Added '--bitrate=', '--channels=', '--format=', '--quality='
|
||||
and '--samplerate=' to rdexport(1) in 'utils/rdexport/rdexport.cpp'
|
||||
and 'utils/rdexport/rdexport.h'.
|
||||
|
@ -58,8 +58,25 @@
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--bitrate=</option><replaceable>rate</replaceable>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Specify the bitrate to use, in <replaceable>rate</replaceable>
|
||||
bits per second. Default value is the bitrate of the original
|
||||
audio, or 256000 bits/sec for PCM originals.
|
||||
</para>
|
||||
<para>
|
||||
This setting is meaningful only when used with the
|
||||
<userinput>MP2</userinput> or <userinput>MP3</userinput> formats.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--carts=</option><replaceable>start-cart</replaceable>:<replaceable>end-cart</replaceable>
|
||||
</term>
|
||||
@ -73,6 +90,19 @@
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--channels=</option><replaceable>chans</replaceable>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Specify the number of channels to use. Valid values are
|
||||
<userinput>1</userinput> or <userinput>2</userinput>. Default
|
||||
value is the channel count of the original audio.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--continue-after-error</option>
|
||||
@ -106,6 +136,65 @@
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--format=</option><replaceable>format</replaceable>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Specify the file and audio encoding format to be used. The
|
||||
following values for <replaceable>format</replaceable> are
|
||||
recognized:
|
||||
</para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><userinput>FLAC</userinput></term>
|
||||
<listitem>
|
||||
<para>Free Lossless Audio Codec (.flac)</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><userinput>MP2</userinput></term>
|
||||
<listitem>
|
||||
<para>MPEG-1 Layer 2 (.mp2)</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><userinput>MP3</userinput></term>
|
||||
<listitem>
|
||||
<para>MPEG-1 Layer 3 (.mp3)</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><userinput>PCM16</userinput></term>
|
||||
<listitem>
|
||||
<para>PCM16 audio in a WAV file format (.wav)</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><userinput>PCM24</userinput></term>
|
||||
<listitem>
|
||||
<para>PCM24 audio in a WAV file format (.wav)</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><userinput>VORBIS</userinput></term>
|
||||
<listitem>
|
||||
<para>OggVorbis (.ogg)</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
<para>
|
||||
Default value is to use whatever format was used in the audio store.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--group=</option><replaceable>group-name</replaceable>
|
||||
@ -260,6 +349,37 @@
|
||||
<para>
|
||||
Default value is <userinput>%n_%j</userinput>.
|
||||
</para>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--quality=</option><replaceable>qual</replaceable>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Specify the quality level to use, in the range
|
||||
<userinput>-1</userinput> through <userinput>10</userinput>,
|
||||
inclusive. Default value is <userinput>3</userinput>.
|
||||
</para>
|
||||
<para>
|
||||
This setting is meaningful only when used with the
|
||||
<userinput>VORBIS</userinput> format.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--samplerate=</option><replaceable>rate</replaceable>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Specify the sample rate to use, in <replaceable>rate</replaceable>
|
||||
samples per second. Default value is the sample rate of the original
|
||||
audio.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
|
@ -44,6 +44,10 @@ MainObject::MainObject(QObject *parent)
|
||||
export_escape_string="_";
|
||||
export_continue_after_error=false;
|
||||
export_allow_clobber=false;
|
||||
export_samplerate=0;
|
||||
export_bitrate=0;
|
||||
export_channels=0;
|
||||
export_quality=3;
|
||||
|
||||
//
|
||||
// Read Command Options
|
||||
@ -59,6 +63,15 @@ MainObject::MainObject(QObject *parent)
|
||||
export_allow_clobber=true;
|
||||
cmd->setProcessed(i,true);
|
||||
}
|
||||
if(cmd->key(i)=="--bitrate") {
|
||||
bool ok=false;
|
||||
export_bitrate=cmd->value(i).toUInt(&ok);
|
||||
if(!ok) {
|
||||
fprintf(stderr,"rdexport: invalid bitrate\n");
|
||||
exit(256);
|
||||
}
|
||||
cmd->setProcessed(i,true);
|
||||
}
|
||||
if(cmd->key(i)=="--carts") {
|
||||
bool ok=false;
|
||||
bool valid=false;
|
||||
@ -80,6 +93,15 @@ MainObject::MainObject(QObject *parent)
|
||||
}
|
||||
cmd->setProcessed(i,true);
|
||||
}
|
||||
if(cmd->key(i)=="--channels") {
|
||||
bool ok=false;
|
||||
export_channels=cmd->value(i).toUInt(&ok);
|
||||
if((export_channels<1)||(export_channels>2)||(!ok)) {
|
||||
fprintf(stderr,"rdexport: invalid --channels argument\n");
|
||||
exit(256);
|
||||
}
|
||||
cmd->setProcessed(i,true);
|
||||
}
|
||||
if(cmd->key(i)=="--continue-after-error") {
|
||||
export_continue_after_error=true;
|
||||
cmd->setProcessed(i,true);
|
||||
@ -92,6 +114,40 @@ MainObject::MainObject(QObject *parent)
|
||||
export_escape_string=cmd->value(i);
|
||||
cmd->setProcessed(i,true);
|
||||
}
|
||||
if(cmd->key(i)=="--format") {
|
||||
export_format=cmd->value(i);
|
||||
bool ok=false;
|
||||
if(export_format.lower()=="flac") {
|
||||
export_set_format=RDSettings::Flac;
|
||||
ok=true;
|
||||
}
|
||||
if(export_format.lower()=="mp2") {
|
||||
export_set_format=RDSettings::MpegL2;
|
||||
ok=true;
|
||||
}
|
||||
if(export_format.lower()=="mp3") {
|
||||
export_set_format=RDSettings::MpegL3;
|
||||
ok=true;
|
||||
}
|
||||
if(export_format.lower()=="pcm16") {
|
||||
export_set_format=RDSettings::Pcm16;
|
||||
ok=true;
|
||||
}
|
||||
if(export_format.lower()=="pcm24") {
|
||||
export_set_format=RDSettings::Pcm24;
|
||||
ok=true;
|
||||
}
|
||||
if(export_format.lower()=="vorbis") {
|
||||
export_set_format=RDSettings::OggVorbis;
|
||||
ok=true;
|
||||
}
|
||||
if(!ok) {
|
||||
fprintf(stderr,"rdexport: unknown format \"%s\"\n",
|
||||
(const char *)export_format);
|
||||
exit(256);
|
||||
}
|
||||
cmd->setProcessed(i,true);
|
||||
}
|
||||
if(cmd->key(i)=="--group") {
|
||||
export_groups.push_back(cmd->value(i));
|
||||
cmd->setProcessed(i,true);
|
||||
@ -100,6 +156,24 @@ MainObject::MainObject(QObject *parent)
|
||||
export_metadata_pattern=cmd->value(i);
|
||||
cmd->setProcessed(i,true);
|
||||
}
|
||||
if(cmd->key(i)=="--quality") {
|
||||
bool ok=false;
|
||||
export_quality=cmd->value(i).toInt(&ok);
|
||||
if((export_quality<-1)||(export_quality>10)||(!ok)) {
|
||||
fprintf(stderr,"rdexport: invalid --quality value\n");
|
||||
exit(256);
|
||||
}
|
||||
cmd->setProcessed(i,true);
|
||||
}
|
||||
if(cmd->key(i)=="--samplerate") {
|
||||
bool ok=false;
|
||||
export_samplerate=cmd->value(i).toUInt(&ok);
|
||||
if(!ok) {
|
||||
fprintf(stderr,"rdexport: invalid samplerate\n");
|
||||
exit(256);
|
||||
}
|
||||
cmd->setProcessed(i,true);
|
||||
}
|
||||
if(cmd->key(i)=="--verbose") {
|
||||
export_verbose=true;
|
||||
cmd->setProcessed(i,true);
|
||||
@ -283,32 +357,57 @@ void MainObject::ExportCut(RDCart *cart,RDCut *cut)
|
||||
}
|
||||
}
|
||||
RDSettings settings;
|
||||
switch(info->format()) {
|
||||
case RDWaveFile::Pcm16:
|
||||
settings.setFormat(RDSettings::Pcm16);
|
||||
break;
|
||||
if(export_format.isEmpty()) {
|
||||
switch(info->format()) {
|
||||
case RDWaveFile::Pcm16:
|
||||
settings.setFormat(RDSettings::Pcm16);
|
||||
break;
|
||||
|
||||
case RDWaveFile::Pcm24:
|
||||
settings.setFormat(RDSettings::Pcm24);
|
||||
break;
|
||||
case RDWaveFile::Pcm24:
|
||||
settings.setFormat(RDSettings::Pcm24);
|
||||
break;
|
||||
|
||||
case RDWaveFile::MpegL2:
|
||||
settings.setFormat(RDSettings::MpegL2);
|
||||
break;
|
||||
case RDWaveFile::MpegL2:
|
||||
settings.setFormat(RDSettings::MpegL2);
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr,"rdexport: unsupported source audio format\n");
|
||||
if(export_continue_after_error) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
exit(256);
|
||||
default:
|
||||
fprintf(stderr,"rdexport: unsupported source audio format\n");
|
||||
if(export_continue_after_error) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
exit(256);
|
||||
}
|
||||
}
|
||||
}
|
||||
settings.setChannels(info->channels());
|
||||
settings.setSampleRate(info->sampleRate());
|
||||
settings.setBitRate(info->bitRate());
|
||||
|
||||
else {
|
||||
settings.setFormat(export_set_format);
|
||||
}
|
||||
if(export_channels==0) {
|
||||
settings.setChannels(info->channels());
|
||||
}
|
||||
else {
|
||||
settings.setChannels(export_channels);
|
||||
}
|
||||
if(export_samplerate==0) {
|
||||
settings.setSampleRate(info->sampleRate());
|
||||
}
|
||||
else {
|
||||
settings.setSampleRate(export_samplerate);
|
||||
}
|
||||
if(export_bitrate==0) {
|
||||
if(info->bitRate()==0) {
|
||||
settings.setBitRate(256000);
|
||||
}
|
||||
else {
|
||||
settings.setBitRate(info->bitRate());
|
||||
}
|
||||
}
|
||||
else {
|
||||
settings.setBitRate(export_bitrate);
|
||||
}
|
||||
settings.setQuality(export_quality);
|
||||
Verbose(QString("exporting cart/cut ")+
|
||||
QString().sprintf("%06u/%03d",RDCut::cartNumber(cut->cutName()),
|
||||
RDCut::cutNumber(cut->cutName()))+" ["+cart->title()+"]");
|
||||
|
@ -56,6 +56,12 @@ class MainObject : public QObject
|
||||
std::vector<QString> export_groups;
|
||||
QString export_metadata_pattern;
|
||||
QString export_output_to;
|
||||
QString export_format;
|
||||
RDSettings::Format export_set_format;
|
||||
unsigned export_samplerate;
|
||||
unsigned export_bitrate;
|
||||
unsigned export_channels;
|
||||
int export_quality;
|
||||
RDConfig *export_config;
|
||||
RDRipc *export_ripc;
|
||||
RDStation *export_station;
|
||||
|
Loading…
x
Reference in New Issue
Block a user