Skip to content

Commit 1e67b56

Browse files
committed
bmdcapture: Support AVFormat options
1 parent 1837178 commit 1e67b56

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

bmdcapture.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,7 @@ int usage(int status)
671671
" 4: SDI\n"
672672
" 5: Optical SDI\n"
673673
" 6: S-Video\n"
674+
" -o <optionstring> AVFormat options\n"
674675
"Capture video and audio to a file. Raw video and audio can be sent to a pipe to avconv or vlc e.g.:\n"
675676
"\n"
676677
" bmdcapture -m 2 -A 1 -V 1 -F nut -f pipe:1\n\n\n"
@@ -705,6 +706,7 @@ int main(int argc, char *argv[])
705706
int exitStatus = 1;
706707
int aconnection = 0, vconnection = 0, camera = 0, i = 0;
707708
int ch;
709+
AVDictionary *opts = NULL;
708710
BMDPixelFormat pix = bmdFormat8BitYUV;
709711
HRESULT result;
710712
pthread_t th;
@@ -720,7 +722,7 @@ int main(int argc, char *argv[])
720722
}
721723

722724
// Parse command line options
723-
while ((ch = getopt(argc, argv, "?hvc:s:f:a:m:n:p:M:F:C:A:V:")) != -1) {
725+
while ((ch = getopt(argc, argv, "?hvc:s:f:a:m:n:p:M:F:C:A:V:o:")) != -1) {
724726
switch (ch) {
725727
case 'v':
726728
g_verbose = true;
@@ -797,6 +799,12 @@ int main(int argc, char *argv[])
797799
case 'S':
798800
serial_fd = open(optarg, O_RDWR | O_NONBLOCK);
799801
break;
802+
case 'o':
803+
if (av_dict_parse_string(&opts, optarg, "=", ":", 0) < 0) {
804+
fprintf(stderr, "Cannot parse option string %s\n",
805+
optarg);
806+
goto bail;
807+
}
800808
case '?':
801809
case 'h':
802810
usage(0);
@@ -965,7 +973,7 @@ int main(int argc, char *argv[])
965973
}
966974
}
967975

968-
avformat_write_header(oc, NULL);
976+
avformat_write_header(oc, &opts);
969977
avpacket_queue_init(&queue);
970978

971979
result = deckLinkInput->StartStreams();

0 commit comments

Comments
 (0)