OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 return -10; | 28 return -10; |
29 } | 29 } |
30 | 30 |
31 FILE* in_fid = fopen(in_path.c_str() , "rb"); | 31 FILE* in_fid = fopen(in_path.c_str() , "rb"); |
32 if (!in_fid) { | 32 if (!in_fid) { |
33 fprintf(stderr, "Could not read input file: %s.\n", in_path.c_str()); | 33 fprintf(stderr, "Could not read input file: %s.\n", in_path.c_str()); |
34 return -11; | 34 return -11; |
35 } | 35 } |
36 | 36 |
37 // Frame size of I420. | 37 // Frame size of I420. |
38 size_t frame_length = CalcBufferSize(kI420, width, height); | 38 size_t frame_length = CalcBufferSize(VideoType::kI420, width, height); |
39 | 39 |
40 std::unique_ptr<uint8_t[]> temp_buffer(new uint8_t[frame_length]); | 40 std::unique_ptr<uint8_t[]> temp_buffer(new uint8_t[frame_length]); |
41 | 41 |
42 FILE* out_fid = fopen(out_path.c_str(), "wb"); | 42 FILE* out_fid = fopen(out_path.c_str(), "wb"); |
43 | 43 |
44 if (!out_fid) { | 44 if (!out_fid) { |
45 fprintf(stderr, "Could not open output file: %s.\n", out_path.c_str()); | 45 fprintf(stderr, "Could not open output file: %s.\n", out_path.c_str()); |
46 fclose(in_fid); | 46 fclose(in_fid); |
47 return -12; | 47 return -12; |
48 } | 48 } |
(...skipping 29 matching lines...) Expand all Loading... |
78 if (num_bytes_read > 0 && num_bytes_read < frame_length) { | 78 if (num_bytes_read > 0 && num_bytes_read < frame_length) { |
79 printf("Frame to small! Last frame truncated.\n"); | 79 printf("Frame to small! Last frame truncated.\n"); |
80 } | 80 } |
81 fclose(in_fid); | 81 fclose(in_fid); |
82 fclose(out_fid); | 82 fclose(out_fid); |
83 | 83 |
84 printf("Done editing!\n"); | 84 printf("Done editing!\n"); |
85 return 0; | 85 return 0; |
86 } | 86 } |
87 } // namespace webrtc | 87 } // namespace webrtc |
OLD | NEW |