[Getdata-commits] SF.net SVN: getdata:[922] trunk/defile
Scientific Database Format
Brought to you by:
ketiltrout
|
From: <ket...@us...> - 2014-09-30 02:32:55
|
Revision: 922
http://sourceforge.net/p/getdata/code/922
Author: ketiltrout
Date: 2014-09-30 02:32:45 +0000 (Tue, 30 Sep 2014)
Log Message:
-----------
Output frameoffset.
Modified Paths:
--------------
trunk/defile/bin/defile.c
trunk/defile/doc/defile.1.in
trunk/defile/lib/internal.h
trunk/defile/lib/libdefile.c
Modified: trunk/defile/bin/defile.c
===================================================================
--- trunk/defile/bin/defile.c 2014-07-30 20:00:59 UTC (rev 921)
+++ trunk/defile/bin/defile.c 2014-09-30 02:32:45 UTC (rev 922)
@@ -943,7 +943,7 @@
DF_WOPT_VERBOSE, DF_WOPT_REMOTE, DF_WOPT_LOCAL, DF_WOPT_RSH, DF_WOPT_LISTEN,
DF_WOPT_NOLISTEN, DF_WOPT_RCMD, DF_WOPT_RDEBUG, DF_WOPT_NORDEBUG,
DF_WOPT_SRVRATE, DF_WOPT_DAEMON, DF_WOPT_CURFILE, DF_WOPT_SYMLINK,
- DF_WOPT_NOSYMLINK, DF_WOPT_NOCURFILE, DF_WOPT_CLOBBERONE
+ DF_WOPT_NOSYMLINK, DF_WOPT_NOCURFILE, DF_WOPT_CLOBBERONE, DF_WOPT_FOFFS
};
static int DF_OutputOpt(struct df_defile *df, struct df_rc_config *config,
@@ -1049,10 +1049,19 @@
~(DF_MODE_RDEBUG_I | DF_MODE_RDEBUG_O | DF_MODE_RDEBUG_T);
break;
+ case DF_WOPT_FOFFS: /* --output-offset */
+ /* a sign means relative adjustment */
+ if (config->argument[0] != '-' && config->argument[0] != '+')
+ df->output_adjust_set = 1;
+ else
+ df->output_adjust_set = 0;
+ df->output_adjust = strtoll(config->argument, NULL, 0);
+ break;
+
SETMODE(APPEND, DF_MODE_APPEND);
CLRMODE(NOAPPEND, DF_MODE_APPEND);
@@ -2537,6 +2546,10 @@
{ DF_WOPT_OUTPUT, DF_OPT_EXPAND | DF_OPT_ARG_RQ, 'o', "output", "Output",
"PATH", "write data to a dirfile called PATH"
},
+ { DF_WOPT_FOFFS, DF_OPT_ARG_RQ, 'O', "offset-adjust", "OffsetAdjust",
+ "ADJUST", "adjust the frame offset of the output dirfile by ADJUST "
+ "(default: +0)"
+ },
{ DF_WOPT_QUIET, DF_OPT_NO_ARG, 'q', "quiet", "Quiet", NULL,
"be less verbose"
},
Modified: trunk/defile/doc/defile.1.in
===================================================================
--- trunk/defile/doc/defile.1.in 2014-07-30 20:00:59 UTC (rev 921)
+++ trunk/defile/doc/defile.1.in 2014-09-30 02:32:45 UTC (rev 922)
@@ -295,6 +295,78 @@
Don't create a curfile. This is the default behaviour. (Directive:
.BR NoCurFile )
+.SS Frame Selection Options
+The following options affect the starting frame number for input and output.
+.TP
+.BR \-s ", " \-\-skip=\fINUM
+Skip the first
+.I NUM
+frames of the input; equivalently: request the input start with the frame
+numbered
+.IR NUM .
+Even when this option is specified, defile may start on a later frame, if the
+first frame available in the input is greater than
+.IR NUM .
+Only the last
+.B \-\-skip
+specified is honoured. The default skip is zero (i.e. start with the first
+frame).
+
+Using
+.B \-\-append
+(q.v.) to append to a pre-existing output dirfile has the effect of specifying
+an implicit
+.B \-\-skip
+with
+.I NUM
+equal to the number of frames currently in the output dirfile. A
+.B \-\-skip
+which specifies a smaller number is ignored, but this option can be used to
+advance the starting frame number further (leaving a hole in the outpu
+dirfile). (Directive:
+.BR Skip )
+
+.TP
+.BR \-O ", " \-\-offset-adjust=\fIADJUST
+When not in
+.I Append Mode\fR,
+defile will, by default, set the frame offset of the output dirfile to the
+frame number of the first converted frame (which may have been adjusted with the
+.B \-\-skip
+option). This option permits modification of the output dirfile's frame offset.
+If the
+.I ADJUST
+parameter is starts with a plus (+) or minus (\-) sign, the value is taken as a
+relative adjustment to this default frame offset. If the relative offset would
+result in a negative frame offset, the output frame offset is set to zero. If
+.I ADJUST
+is a number with neither sign, the frame offset is set to that value. So:
+.RS
+.IP
+.nh
+.ad l
+\-\-offset\-adjust=100
+.hy
+.ad n
+.RE
+.IP
+sets the output dirfile's frame offset to 100, regardless of the actual starting
+frame, while:
+.RS
+.IP
+.nh
+.ad l
+\-\-offset\-adjust=+100
+.hy
+.ad n
+.RE
+.IP
+adds 100 to the default frame offset. The default is, effectively, "+0" (i.e.,
+no adjustment). In
+.I Append Mode\fR,
+this option is ignored. (Directive:
+.BR OutputAdjust )
+
.SS Running Mode Options
The following options affect the modes in which defile runs.
.TP
Modified: trunk/defile/lib/internal.h
===================================================================
--- trunk/defile/lib/internal.h 2014-07-30 20:00:59 UTC (rev 921)
+++ trunk/defile/lib/internal.h 2014-09-30 02:32:45 UTC (rev 922)
@@ -296,6 +296,8 @@
struct df_config config;
long long offset;
long long input_offset;
+ long long output_adjust;
+ int output_adjust_set;
unsigned long buflen;
unsigned int mode_flags;
Modified: trunk/defile/lib/libdefile.c
===================================================================
--- trunk/defile/lib/libdefile.c 2014-07-30 20:00:59 UTC (rev 921)
+++ trunk/defile/lib/libdefile.c 2014-09-30 02:32:45 UTC (rev 922)
@@ -1228,11 +1228,21 @@
pthread_mutex_lock(&df_config_mx);
offset = (df->input_offset > df->offset) ? df->input_offset : df->offset;
pthread_mutex_unlock(&df_config_mx);
+
+ /* output frameoffset */
+ if (!append) {
+ long long output_offset = offset;
+ if (df->output_adjust_set)
+ output_offset = df->output_adjust;
+ else if (output_offset < -df->output_adjust) /* underflow */
+ output_offset = 0;
+ else
+ output_offset += df->output_adjust;
+ if (output_offset)
+ gd_alter_frameoffset64(df->D, output_offset, GD_ALL_FRAGMENTS, 0);
+ }
+
if (offset > 0) {
- /* frameoffset */
- if (!append)
- gd_alter_frameoffset(df->D, offset, GD_ALL_FRAGMENTS, 0);
-
/* seek to the start frame */
for (i = 0; i < df->nraw; ++i)
if (gd_seek64(df->D, df->raw[i].name, offset, 0,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|