From: Michal Sojka Date: Sat, 8 May 2010 19:50:27 +0000 (+0200) Subject: url_fseek works X-Git-Tag: jsa-paper-casestudy-v2~62 X-Git-Url: https://rtime.felk.cvut.cz/gitweb/frescor/demo.git/commitdiff_plain/3752e38d1294351f77a49977af3ddd47406cde05 url_fseek works --- diff --git a/build-no-frsh/cmd.gdb b/build-no-frsh/cmd.gdb index eae5529..fb236f1 100644 --- a/build-no-frsh/cmd.gdb +++ b/build-no-frsh/cmd.gdb @@ -1,9 +1,10 @@ file /home/wsh/frescor/demo/build-no-frsh/_compiled/bin/recorder -b url_fopen -b url_fdopen -b file_open -b av_interleaved_write_frame -# b file_write -# b av_interleaved_write_frame -run -s 640x480 -r 15 -f video4linux2 -i /dev/video0 -#run -s 320x240 -f video4linux2 -i /dev/video0 +#b url_fopen +#b url_fdopen +#b file_open +#b av_interleaved_write_frame +#b file_write +b file_read +#run -s 640x480 -r 15 -f video4linux2 -i /dev/video0 +run -i snapshot%02d.png -y stream.mp4 + diff --git a/build/Makefile.omk b/build/Makefile.omk index 2f932d5..9e9dd19 100644 --- a/build/Makefile.omk +++ b/build/Makefile.omk @@ -1 +1,9 @@ SUBDIRS=$(sort $(ALL_OMK_SUBDIRS) ffmpeg) + +test: + ./_compiled/bin/recorder -i snapshot%02d.png -y test_normal.mp4 + ./_compiled/bin/recorder -i snapshot%02d.png -y -direct test_direct.mp4 + hexdump -C test_normal.mp4 > test_normal.hex + hexdump -C test_direct.mp4 > test_direct.hex + kdiff3 test_normal.hex test_direct.hex + diff --git a/src/ffmpeg b/src/ffmpeg index 77b0842..a4582fb 160000 --- a/src/ffmpeg +++ b/src/ffmpeg @@ -1 +1 @@ -Subproject commit 77b0842e4959363e840f573192cccd6e4ac40cb9 +Subproject commit a4582fb42456fe83734835ecc73d5a9b2ec2aba3 diff --git a/src/recorder/ffmpeg.c b/src/recorder/ffmpeg.c index f625257..7776379 100644 --- a/src/recorder/ffmpeg.c +++ b/src/recorder/ffmpeg.c @@ -179,6 +179,7 @@ static int64_t start_time = 0; static int64_t rec_timestamp = 0; static int64_t input_ts_offset = 0; static int file_overwrite = 0; +static int o_direct = 0; static int metadata_count; static AVMetadataTag *metadata; static int do_benchmark = 0; @@ -3505,7 +3506,7 @@ static void opt_output_file(const char *filename) } /* open the file */ - if (url_fopen(&oc->pb, filename, URL_WRONLY|URL_DIRECT) < 0) { + if (url_fopen(&oc->pb, filename, o_direct ? URL_RDWR|URL_DIRECT : URL_WRONLY) < 0) { fprintf(stderr, "Could not open '%s'\n", filename); av_exit(1); } @@ -3896,6 +3897,7 @@ static const OptionDef options[] = { { "f", HAS_ARG, {(void*)opt_format}, "force format", "fmt" }, { "i", HAS_ARG, {(void*)opt_input_file}, "input file name", "filename" }, { "y", OPT_BOOL, {(void*)&file_overwrite}, "overwrite output files" }, + { "direct", OPT_BOOL, {(void*)&o_direct}, "write to output file using direct I/O (O_DIRECT)" }, { "map", HAS_ARG | OPT_EXPERT, {(void*)opt_map}, "set input stream mapping", "file:stream[:syncfile:syncstream]" }, { "map_meta_data", HAS_ARG | OPT_EXPERT, {(void*)opt_map_meta_data}, "set meta data information of outfile from infile", "outfile:infile" }, { "t", OPT_FUNC2 | HAS_ARG, {(void*)opt_recording_time}, "record or transcode \"duration\" seconds of audio/video", "duration" },