| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 The WebM 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 static void write_ivf_frame_header(FILE *outfile, | 112 static void write_ivf_frame_header(FILE *outfile, |
| 113 const vpx_codec_cx_pkt_t *pkt) | 113 const vpx_codec_cx_pkt_t *pkt) |
| 114 { | 114 { |
| 115 char header[12]; | 115 char header[12]; |
| 116 vpx_codec_pts_t pts; | 116 vpx_codec_pts_t pts; |
| 117 | 117 |
| 118 if(pkt->kind != VPX_CODEC_CX_FRAME_PKT) | 118 if(pkt->kind != VPX_CODEC_CX_FRAME_PKT) |
| 119 return; | 119 return; |
| 120 | 120 |
| 121 pts = pkt->data.frame.pts; | 121 pts = pkt->data.frame.pts; |
| 122 mem_put_le32(header, pkt->data.frame.sz); | 122 mem_put_le32(header, (unsigned int)pkt->data.frame.sz); |
| 123 mem_put_le32(header+4, pts&0xFFFFFFFF); | 123 mem_put_le32(header+4, pts&0xFFFFFFFF); |
| 124 mem_put_le32(header+8, pts >> 32); | 124 mem_put_le32(header+8, pts >> 32); |
| 125 | 125 |
| 126 (void) fwrite(header, 1, 12, outfile); | 126 (void) fwrite(header, 1, 12, outfile); |
| 127 } | 127 } |
| 128 | 128 |
| 129 int main(int argc, char **argv) { | 129 int main(int argc, char **argv) { |
| 130 FILE *infile, *outfile; | 130 FILE *infile, *outfile; |
| 131 vpx_codec_ctx_t codec; | 131 vpx_codec_ctx_t codec; |
| 132 vpx_codec_enc_cfg_t cfg; | 132 vpx_codec_enc_cfg_t cfg; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 vpx_img_free(&raw); | 216 vpx_img_free(&raw); |
| 217 if(vpx_codec_destroy(&codec)) | 217 if(vpx_codec_destroy(&codec)) |
| 218 die_codec(&codec, "Failed to destroy codec"); | 218 die_codec(&codec, "Failed to destroy codec"); |
| 219 | 219 |
| 220 /* Try to rewrite the file header with the actual frame count */ | 220 /* Try to rewrite the file header with the actual frame count */ |
| 221 if(!fseek(outfile, 0, SEEK_SET)) | 221 if(!fseek(outfile, 0, SEEK_SET)) |
| 222 write_ivf_file_header(outfile, &cfg, frame_cnt-1); | 222 write_ivf_file_header(outfile, &cfg, frame_cnt-1); |
| 223 fclose(outfile); | 223 fclose(outfile); |
| 224 return EXIT_SUCCESS; | 224 return EXIT_SUCCESS; |
| 225 } | 225 } |
| OLD | NEW |