Skip to content

Commit 1b2d37e

Browse files
committed
Do not require extra argument for fast forward/rewind.
1 parent 832dbbc commit 1b2d37e

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

deckcontrol.cpp

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ static const DeckCommandMapping commandTable [] = {
4949
{ "toggleplaystop", TOGGLE_PLAY_STOP, 0 },
5050
{ "eject", EJECT, 0 },
5151
{ "gototimecode", GO_TO_TIMECODE, 1 },
52-
{ "fastforward", FAST_FORWARD, 1 },
53-
{ "rewind", REWIND, 1 },
52+
{ "fastforward", FAST_FORWARD, 0 },
53+
{ "rewind", REWIND, 0 },
5454
{ "stepforward", STEP_FORWARD, 0 },
5555
{ "stepback", STEP_BACK, 0 },
5656
{ "jog", JOG, 1 },
@@ -100,6 +100,7 @@ int main(int argc, char *argv[])
100100
{
101101
int err = 0;
102102
DeckCommand cmd = NO_COMMAND;
103+
const char *cmdarg;
103104
const DeckCommandMapping *tmpTable;
104105

105106
IDeckLinkIterator *deckLinkIterator = NULL;
@@ -126,6 +127,10 @@ int main(int argc, char *argv[])
126127
argc - 2 >= tmpTable->numParameters)
127128
{
128129
cmd = tmpTable->commandNum;
130+
if (argc > 2)
131+
cmdarg = argv[2];
132+
else
133+
cmdarg = "0";
129134
printf("Issued command '%s'\n", tmpTable->commandString);
130135
}
131136
tmpTable++;
@@ -214,15 +219,14 @@ int main(int argc, char *argv[])
214219
break;
215220
case GO_TO_TIMECODE:
216221
int tc[4];
217-
char *c;
218-
c = strtok(argv[2], ":");
222+
cmdarg = strtok(argv[2], ":");
219223
for (int i=0; i<4; i++)
220224
{
221-
if (!c) break;
222-
tc[i] = atoi(c);
225+
if (!cmdarg) break;
226+
tc[i] = atoi(cmdarg);
223227
if (tc[i] > 59 || tc[i] < 0)
224228
tc[i] = 0;
225-
c = strtok(NULL, ":");
229+
cmdarg = strtok(NULL, ":");
226230
}
227231
deckControl->GoToTimecode(MAKE_TC_BCD(tc[0] / 10, tc[0] % 10,
228232
tc[1] / 10, tc[1] % 10,
@@ -231,10 +235,10 @@ int main(int argc, char *argv[])
231235
&deckError);
232236
break;
233237
case FAST_FORWARD:
234-
deckControl->FastForward(atoi(argv[2]), &deckError);
238+
deckControl->FastForward(atoi(cmdarg), &deckError);
235239
break;
236240
case REWIND:
237-
deckControl->Rewind(atoi(argv[2]), &deckError);
241+
deckControl->Rewind(atoi(cmdarg), &deckError);
238242
break;
239243
case STEP_FORWARD:
240244
deckControl->StepForward(&deckError);

0 commit comments

Comments
 (0)