| 1 | /* |
| 2 | * scan_packet_headers.c |
| 3 | * |
| 4 | * Copyright (C) Peter Schlaile - January 2001 |
| 5 | * |
| 6 | * This file is part of libdv, a free DV (IEC 61834/SMPTE 314M) |
| 7 | * codec. |
| 8 | * |
| 9 | * libdv is free software; you can redistribute it and/or modify it |
| 10 | * under the terms of the GNU Lesser Public License as published by |
| 11 | * the Free Software Foundation; either version 2.1, or (at your |
| 12 | * option) any later version. |
| 13 | * |
| 14 | * libdv is distributed in the hope that it will be useful, but |
| 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 | * Lesser Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU Lesser Public License |
| 20 | * along with libdv; see the file COPYING. If not, write to |
| 21 | * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
| 22 | * |
| 23 | * The libdv homepage is http://libdv.sourceforge.net/. |
| 24 | */ |
| 25 | |
| 26 | #include "libdv/dv_types.h"cxx . . $ `<file>/libdv/dv_types.h`/ |
| 27 | |
| 28 | #include <stdio.h> |
| 29 | #include <stdlib.h> |
| 30 | #include <unistd.h> |
| 31 | #include <assert.h> |
| 32 | #include <sys/types.h> |
| 33 | #include <sys/stat.h> |
| 34 | #include <fcntl.h> |
| 35 | |
| 36 | int maincxx . . $ main(d8e43b79a186046c).(int argc, const char** argv) |
| 37 | { |
| 38 | int in_ren; |
| 39 | int in_cap; |
| 40 | unsigned char buf_ren[80]; |
| 41 | unsigned char buf_cap[80]; |
| 42 | int dif_block_count = 0; |
| 43 | int vid_count = 0; |
| 44 | |
| 45 | if (argc != 3) { |
| 46 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "Usage: steal_header in_rendered in_captured " |
| 47 | "> out.dv\n"); |
| 48 | return -1; |
| 49 | } |
| 50 | |
| 51 | in_ren = opencxx . . $ open(e156e3aa1e5c4ad1).(argv[1], O_RDONLYcxx . . $ `<external>/14578502075116107718/fcntl-linux.h:43:9`!); |
| 52 | in_cap = opencxx . . $ open(e156e3aa1e5c4ad1).(argv[2], O_RDONLYcxx . . $ `<external>/14578502075116107718/fcntl-linux.h:43:9`!); |
| 53 | |
| 54 | assertcxx . . $ `<external>/4398592474888995393/assert.h:169:12`!(in_ren != -1 && in_cap != -1); |
| 55 | |
| 56 | while (readcxx . . $ read(7e34d0a36f355389).(in_ren, buf_ren, 80) == 80 && |
| 57 | readcxx . . $ read(7e34d0a36f355389).(in_cap, buf_cap, 80) == 80) { |
| 58 | if (dif_block_count < 6) { |
| 59 | writecxx . . $ write(41184a59d38b4f65).(STDOUT_FILENOcxx . . $ `<external>/12628407106812493757/unistd.h:211:9`!, buf_cap, 80); |
| 60 | } else { |
| 61 | if (!vid_count) { |
| 62 | writecxx . . $ write(41184a59d38b4f65).(STDOUT_FILENOcxx . . $ `<external>/12628407106812493757/unistd.h:211:9`!, buf_ren, 80); |
| 63 | } else { |
| 64 | buf_ren[0] = buf_cap[0]; |
| 65 | buf_ren[1] = buf_cap[1]; |
| 66 | buf_ren[2] = buf_cap[2]; |
| 67 | writecxx . . $ write(41184a59d38b4f65).(STDOUT_FILENOcxx . . $ `<external>/12628407106812493757/unistd.h:211:9`!, buf_ren, 80); |
| 68 | } |
| 69 | vid_count++; |
| 70 | vid_count %= 16; |
| 71 | } |
| 72 | |
| 73 | dif_block_count++; |
| 74 | dif_block_count %= 150; |
| 75 | } |
| 76 | return 0; |
| 77 | } |