Skip to content

Commit ea7ecb8

Browse files
authored
Add start option
- new start option -FstartR -FstartG -FstartB for seeking to a given frame
1 parent 6bf310c commit ea7ecb8

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

src/fl2k_file.c

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@ void usage(void)
132132
"\t[-ireR IRE level for input R (-50.0 to +50.0)\n"
133133
"\t[-ireG IRE level for input G (-50.0 to +50.0)\n"
134134
"\t[-ireB IRE level for input B (-50.0 to +50.0)\n"
135+
"\t[-FstartR seek to frame for input R\n"
136+
"\t[-FstartG seek to frame for input G\n"
137+
"\t[-FstartB seek to frame for input B\n"
135138
"\t[-readMode (default = 0) option : 0 = multit-threading (RGB) / 1 = hybrid (R --> GB) / 2 = hybrid (RG --> B) / 3 = sequential (R -> G -> B)\n"
136139
);
137140
exit(1);
@@ -591,6 +594,9 @@ int main(int argc, char **argv)
591594
uint32_t buf_num = 0;
592595
int dev_index = 0;
593596
void *status;
597+
off64_t start_r = 0;
598+
off64_t start_g = 0;
599+
off64_t start_b = 0;
594600

595601
//file adress
596602
char *filename_r = NULL;
@@ -612,6 +618,9 @@ int main(int argc, char **argv)
612618
{"ireR", 1, 0, 11},
613619
{"ireG", 1, 0, 12},
614620
{"ireB", 1, 0, 13},
621+
{"FstartR", 1, 0, 14},
622+
{"FstartG", 1, 0, 15},
623+
{"FstartB", 1, 0, 16},
615624
{0, 0, 0, 0}
616625
};
617626

@@ -691,6 +700,15 @@ int main(int argc, char **argv)
691700
case 13:
692701
ire_b = atof(optarg);
693702
break;
703+
case 14:
704+
start_r = atoi(optarg);
705+
break;
706+
case 15:
707+
start_g = atoi(optarg);
708+
break;
709+
case 16:
710+
start_b = atoi(optarg);
711+
break;
694712
default:
695713
usage();
696714
break;
@@ -727,6 +745,19 @@ int main(int argc, char **argv)
727745
usage();
728746
}
729747

748+
if(samp_rate == 17734475 || samp_rate == 17735845)//PAL set first frame
749+
{
750+
start_r = start_r * ((709375 + (1135 * tbcR)) * (1 + r16));
751+
start_g = start_g * ((709375 + (1135 * tbcB)) * (1 + g16));
752+
start_b = start_b * ((709375 + (1135 * tbcG)) * (1 + b16));
753+
}
754+
else if(samp_rate == 14318181 || samp_rate == 14318170)//NTSC set first frame
755+
{
756+
start_r = start_r * ((477750 + (910 * tbcR)) * (1 + r16));
757+
start_g = start_g * ((477750 + (910 * tbcG)) * (1 + g16));
758+
start_b = start_b * ((477750 + (910 * tbcB)) * (1 + b16));
759+
}
760+
730761
//RED
731762
if(red == 1)
732763
{
@@ -741,6 +772,10 @@ if(red == 1)
741772
fprintf(stderr, "(RED) : Failed to open %s\n", filename_r);
742773
return -ENOENT;
743774
}
775+
else
776+
{
777+
fseeko64(file_r,start_r,0);
778+
}
744779
}
745780

746781
txbuf_r = malloc(FL2K_BUF_LEN);
@@ -764,6 +799,10 @@ if(green == 1)
764799
fprintf(stderr, "(GREEN) : Failed to open %s\n", filename_g);
765800
return -ENOENT;
766801
}
802+
else
803+
{
804+
fseeko64(file_g,start_g,0);
805+
}
767806
}
768807

769808
txbuf_g = malloc(FL2K_BUF_LEN);
@@ -786,6 +825,10 @@ if(blue == 1)
786825
fprintf(stderr, "(BLUE) : Failed to open %s\n", filename_b);
787826
return -ENOENT;
788827
}
828+
else
829+
{
830+
fseeko64(file_b,start_b,0);
831+
}
789832
}
790833

791834
txbuf_b = malloc(FL2K_BUF_LEN);

0 commit comments

Comments
 (0)