2017-08-28 Fred Gleason <fredg@paravelsystems.com>

* Added '--first-line=' and '--last-line=' switches to rdrender(1).
This commit is contained in:
Fred Gleason
2017-08-28 14:06:31 -04:00
parent fa57222fc7
commit c7aba101b2
5 changed files with 100 additions and 48 deletions

View File

@@ -15970,3 +15970,5 @@
* Added verbose messages for non-audio events to rdrender(1).
2017-08-28 Fred Gleason <fredg@paravelsystems.com>
* Added a rdrender(1) man page.
2017-08-28 Fred Gleason <fredg@paravelsystems.com>
* Added '--first-line=' and '--last-line=' switches to rdrender(1).

View File

@@ -31,8 +31,6 @@
<cmdsynopsis>
<command>rdrender</command>
<arg choice='opt'><replaceable>OPTIONS</replaceable></arg>
<arg choice='opt'><userinput>--channels=</userinput><replaceable>chans</replaceable></arg>
<arg choice='opt'><userinput>--start-time=</userinput><replaceable>HH:MM:SS</replaceable></arg>
<sbr/>
</cmdsynopsis>
</refsynopsisdiv>
@@ -57,6 +55,30 @@
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--first-line=</option><replaceable>lineno</replaceable>
</term>
<listitem>
<para>
Use line number <replaceable>lineno</replaceable> as the first
event in the rendered log.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--last-line=</option><replaceable>lineno</replaceable>
</term>
<listitem>
<para>
Use line number <replaceable>lineno</replaceable> as the last
event in the rendered log.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--start-time=</option><replaceable>HH:MM:SS</replaceable>

View File

@@ -76,57 +76,60 @@ int MainObject::MainLoop()
// Iterate through it
//
for(unsigned i=0;i<lls.size();i++) {
if(lls.at(i)->transType()==RDLogLine::Stop) {
Verbose(current_time,i,"STOP ",lls.at(i)->summary());
warnings+=
QString().sprintf("log render halted at line %d due to STOP\n",i);
break;
}
if(lls.at(i)->open(current_time)) {
Verbose(current_time,i,RDLogLine::transText(lls.at(i)->transType()),
QString().sprintf(" cart %06u [",lls.at(i)->cartNumber())+
lls.at(i)->title()+"]");
sf_count_t frames=0;
if((lls.at(i+1)->transType()==RDLogLine::Segue)&&
(lls.at(i)->cut()->segueStartPoint()>=0)) {
frames=FramesFromMsec(lls.at(i)->cut()->segueStartPoint()-
lls.at(i)->cut()->startPoint());
current_time=current_time.addMSecs(lls.at(i)->cut()->segueStartPoint()-
lls.at(i)->cut()->startPoint());
if(((render_first_line==-1)||(render_first_line<=(int)i))&&
((render_last_line==-1)||(render_last_line>=(int)i))) {
if(lls.at(i)->transType()==RDLogLine::Stop) {
Verbose(current_time,i,"STOP ",lls.at(i)->summary());
warnings+=
QString().sprintf("log render halted at line %d due to STOP\n",i);
break;
}
else {
frames=FramesFromMsec(lls.at(i)->cut()->endPoint()-
lls.at(i)->cut()->startPoint());
current_time=current_time.addMSecs(lls.at(i)->cut()->endPoint()-
lls.at(i)->cut()->startPoint());
}
pcm=new float[frames*render_channels];
memset(pcm,0,frames*render_channels);
for(unsigned j=0;j<i;j++) {
Sum(pcm,lls.at(j),frames);
}
Sum(pcm,lls.at(i),frames);
sf_writef_float(sf_out,pcm,frames);
delete pcm;
pcm=NULL;
lls.at(i)->setRamp(lls.at(i+1)->transType());
}
else {
if(i<(lls.size()-1)) {
if(lls.at(i)->type()==RDLogLine::Cart) {
Verbose(current_time,i,"FAIL",lls.at(i)->summary()+
" (NO AUDIO AVAILABLE)");
warnings+=
lls.at(i)->summary()+QString().
sprintf("at line %d failed to play (NO AUDIO AVAILABLE)\n",i);
if(lls.at(i)->open(current_time)) {
Verbose(current_time,i,RDLogLine::transText(lls.at(i)->transType()),
QString().sprintf(" cart %06u [",lls.at(i)->cartNumber())+
lls.at(i)->title()+"]");
sf_count_t frames=0;
if((lls.at(i+1)->transType()==RDLogLine::Segue)&&
(lls.at(i)->cut()->segueStartPoint()>=0)) {
frames=FramesFromMsec(lls.at(i)->cut()->segueStartPoint()-
lls.at(i)->cut()->startPoint());
current_time=current_time.addMSecs(lls.at(i)->cut()->segueStartPoint()-
lls.at(i)->cut()->startPoint());
}
else {
Verbose(current_time,i,"SKIP",lls.at(i)->summary());
frames=FramesFromMsec(lls.at(i)->cut()->endPoint()-
lls.at(i)->cut()->startPoint());
current_time=current_time.addMSecs(lls.at(i)->cut()->endPoint()-
lls.at(i)->cut()->startPoint());
}
pcm=new float[frames*render_channels];
memset(pcm,0,frames*render_channels);
for(unsigned j=0;j<i;j++) {
Sum(pcm,lls.at(j),frames);
}
Sum(pcm,lls.at(i),frames);
sf_writef_float(sf_out,pcm,frames);
delete pcm;
pcm=NULL;
lls.at(i)->setRamp(lls.at(i+1)->transType());
}
else {
Verbose(current_time,lls.size()-1,"STOP","--- end of log ---");
if(i<(lls.size()-1)) {
if(lls.at(i)->type()==RDLogLine::Cart) {
Verbose(current_time,i,"FAIL",lls.at(i)->summary()+
" (NO AUDIO AVAILABLE)");
warnings+=
lls.at(i)->summary()+QString().
sprintf("at line %d failed to play (NO AUDIO AVAILABLE)\n",i);
}
else {
Verbose(current_time,i,"SKIP",lls.at(i)->summary());
}
}
else {
Verbose(current_time,lls.size()-1,"STOP","--- end of log ---");
}
}
}
}

View File

@@ -2,7 +2,7 @@
//
// Render a Rivendell log.
//
// (C) Copyright 2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2017 Fred Gleason <fredg@paravelsystems.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
@@ -42,6 +42,8 @@ MainObject::MainObject(QObject *parent)
{
render_verbose=false;
render_channels=RDRENDER_DEFAULT_CHANNELS;
render_first_line=-1;
render_last_line=-1;
//
// Read Command Options
@@ -72,6 +74,22 @@ MainObject::MainObject(QObject *parent)
}
cmd->setProcessed(i,true);
}
if(cmd->key(i)=="--first-line") {
render_first_line=cmd->value(i).toInt(&ok);
if((!ok)|(render_first_line<0)) {
fprintf(stderr,"rdrender: invalid --first-line argument\n");
exit(1);
}
cmd->setProcessed(i,true);
}
if(cmd->key(i)=="--last-line") {
render_last_line=cmd->value(i).toInt(&ok);
if((!ok)||(render_last_line<0)) {
fprintf(stderr,"rdrender: invalid --last-line argument\n");
exit(1);
}
cmd->setProcessed(i,true);
}
if(cmd->key(i)=="--start-time") {
render_start_time=QTime::fromString(cmd->value(i));
if(!render_start_time.isValid()) {
@@ -85,6 +103,11 @@ MainObject::MainObject(QObject *parent)
exit(256);
}
}
if((render_last_line>=0)&&(render_first_line>=0)&&
(render_last_line<render_first_line)) {
fprintf(stderr,"--last-line must be greater than --first-line\n");
exit(1);
}
render_logname=cmd->key(cmd->keys()-2);
render_output_filename=cmd->key(cmd->keys()-1);
if(render_start_time.isNull()) {

View File

@@ -64,6 +64,8 @@ class MainObject : public QObject
QString render_output_filename;
unsigned render_channels;
QTime render_start_time;
int render_first_line;
int render_last_line;
RDRipc *render_ripc;
RDStation *render_station;
RDSystem *render_system;