Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(301)

Side by Side Diff: source/libvpx/ivfenc.c

Issue 168343002: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: libvpx: Pull from upstream Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « source/libvpx/ivfenc.h ('k') | source/libvpx/libs.mk » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebM project authors. All Rights Reserved. 2 * Copyright (c) 2013 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
11 #include "./ivfenc.h" 11 #include "./ivfenc.h"
12 12
13 #include "./tools_common.h"
14 #include "vpx/vpx_encoder.h" 13 #include "vpx/vpx_encoder.h"
15 #include "vpx_ports/mem_ops.h" 14 #include "vpx_ports/mem_ops.h"
16 15
17 void ivf_write_file_header(FILE *outfile, 16 void ivf_write_file_header(FILE *outfile,
18 const struct vpx_codec_enc_cfg *cfg, 17 const struct vpx_codec_enc_cfg *cfg,
19 unsigned int fourcc, 18 unsigned int fourcc,
20 int frame_cnt) { 19 int frame_cnt) {
21 char header[32]; 20 char header[32];
22 21
23 header[0] = 'D'; 22 header[0] = 'D';
24 header[1] = 'K'; 23 header[1] = 'K';
25 header[2] = 'I'; 24 header[2] = 'I';
26 header[3] = 'F'; 25 header[3] = 'F';
27 mem_put_le16(header + 4, 0); /* version */ 26 mem_put_le16(header + 4, 0); // version
28 mem_put_le16(header + 6, 32); /* headersize */ 27 mem_put_le16(header + 6, 32); // header size
29 mem_put_le32(header + 8, fourcc); /* four CC */ 28 mem_put_le32(header + 8, fourcc); // fourcc
30 mem_put_le16(header + 12, cfg->g_w); /* width */ 29 mem_put_le16(header + 12, cfg->g_w); // width
31 mem_put_le16(header + 14, cfg->g_h); /* height */ 30 mem_put_le16(header + 14, cfg->g_h); // height
32 mem_put_le32(header + 16, cfg->g_timebase.den); /* rate */ 31 mem_put_le32(header + 16, cfg->g_timebase.den); // rate
33 mem_put_le32(header + 20, cfg->g_timebase.num); /* scale */ 32 mem_put_le32(header + 20, cfg->g_timebase.num); // scale
34 mem_put_le32(header + 24, frame_cnt); /* length */ 33 mem_put_le32(header + 24, frame_cnt); // length
35 mem_put_le32(header + 28, 0); /* unused */ 34 mem_put_le32(header + 28, 0); // unused
36 35
37 (void) fwrite(header, 1, 32, outfile); 36 fwrite(header, 1, 32, outfile);
38 } 37 }
39 38
40 void ivf_write_frame_header(FILE *outfile, const struct vpx_codec_cx_pkt *pkt) { 39 void ivf_write_frame_header(FILE *outfile, int64_t pts, size_t frame_size) {
41 char header[12]; 40 char header[12];
42 vpx_codec_pts_t pts;
43 41
44 pts = pkt->data.frame.pts; 42 mem_put_le32(header, (int)frame_size);
45 mem_put_le32(header, (int)pkt->data.frame.sz); 43 mem_put_le32(header + 4, (int)(pts & 0xFFFFFFFF));
46 mem_put_le32(header + 4, pts & 0xFFFFFFFF); 44 mem_put_le32(header + 8, (int)(pts >> 32));
47 mem_put_le32(header + 8, pts >> 32); 45 fwrite(header, 1, 12, outfile);
48
49 (void) fwrite(header, 1, 12, outfile);
50 } 46 }
51 47
52 void ivf_write_frame_size(FILE *outfile, size_t size) { 48 void ivf_write_frame_size(FILE *outfile, size_t frame_size) {
53 char header[4]; 49 char header[4];
54 mem_put_le32(header, (int)size); 50
55 (void) fwrite(header, 1, 4, outfile); 51 mem_put_le32(header, (int)frame_size);
52 fwrite(header, 1, 4, outfile);
56 } 53 }
OLDNEW
« no previous file with comments | « source/libvpx/ivfenc.h ('k') | source/libvpx/libs.mk » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698