ref: 0768fc0badbc4319d9494404afa2d69c703522c0
parent: 376c5386a4b9a14d6fc66865e601057aac3e3fb7
parent: 373b0f9ae36a85d09b350d981b761314b2bd8d42
author: Dmitry Kovalev <[email protected]>
date: Wed Jan 29 17:07:17 EST 2014
Merge "Changing ivf_write_frame_header() function signature."
--- a/ivfenc.c
+++ b/ivfenc.c
@@ -10,7 +10,6 @@
#include "./ivfenc.h"
-#include "./tools_common.h"
#include "vpx/vpx_encoder.h"
#include "vpx_ports/mem_ops.h"
@@ -24,33 +23,31 @@
header[1] = 'K';
header[2] = 'I';
header[3] = 'F';
- mem_put_le16(header + 4, 0); /* version */
- mem_put_le16(header + 6, 32); /* headersize */
- mem_put_le32(header + 8, fourcc); /* four CC */
- mem_put_le16(header + 12, cfg->g_w); /* width */
- mem_put_le16(header + 14, cfg->g_h); /* height */
- mem_put_le32(header + 16, cfg->g_timebase.den); /* rate */
- mem_put_le32(header + 20, cfg->g_timebase.num); /* scale */
- mem_put_le32(header + 24, frame_cnt); /* length */
- mem_put_le32(header + 28, 0); /* unused */
+ mem_put_le16(header + 4, 0); // version
+ mem_put_le16(header + 6, 32); // header size
+ mem_put_le32(header + 8, fourcc); // fourcc
+ mem_put_le16(header + 12, cfg->g_w); // width
+ mem_put_le16(header + 14, cfg->g_h); // height
+ mem_put_le32(header + 16, cfg->g_timebase.den); // rate
+ mem_put_le32(header + 20, cfg->g_timebase.num); // scale
+ mem_put_le32(header + 24, frame_cnt); // length
+ mem_put_le32(header + 28, 0); // unused
- (void) fwrite(header, 1, 32, outfile);
+ fwrite(header, 1, 32, outfile);
}
-void ivf_write_frame_header(FILE *outfile, const struct vpx_codec_cx_pkt *pkt) {
+void ivf_write_frame_header(FILE *outfile, int64_t pts, size_t frame_size) {
char header[12];
- vpx_codec_pts_t pts;
- pts = pkt->data.frame.pts;
- mem_put_le32(header, (int)pkt->data.frame.sz);
- mem_put_le32(header + 4, pts & 0xFFFFFFFF);
- mem_put_le32(header + 8, pts >> 32);
-
- (void) fwrite(header, 1, 12, outfile);
+ mem_put_le32(header, (int)frame_size);
+ mem_put_le32(header + 4, (int)(pts & 0xFFFFFFFF));
+ mem_put_le32(header + 8, (int)(pts >> 32));
+ fwrite(header, 1, 12, outfile);
}
-void ivf_write_frame_size(FILE *outfile, size_t size) {
+void ivf_write_frame_size(FILE *outfile, size_t frame_size) {
char header[4];
- mem_put_le32(header, (int)size);
- (void) fwrite(header, 1, 4, outfile);
+
+ mem_put_le32(header, (int)frame_size);
+ fwrite(header, 1, 4, outfile);
}
--- a/ivfenc.h
+++ b/ivfenc.h
@@ -23,8 +23,10 @@
const struct vpx_codec_enc_cfg *cfg,
uint32_t fourcc,
int frame_cnt);
-void ivf_write_frame_header(FILE *outfile, const struct vpx_codec_cx_pkt *pkt);
-void ivf_write_frame_size(FILE *outfile, size_t size);
+
+void ivf_write_frame_header(FILE *outfile, int64_t pts, size_t frame_size);
+
+void ivf_write_frame_size(FILE *outfile, size_t frame_size);
#ifdef __cplusplus
} /* extern "C" */
--- a/vp9_spatial_scalable_encoder.c
+++ b/vp9_spatial_scalable_encoder.c
@@ -193,8 +193,6 @@
vpx_codec_err_t res;
int pts = 0; /* PTS starts at 0 */
int frame_duration = 1; /* 1 timebase tick per frame */
- vpx_codec_cx_pkt_t packet = {0};
- packet.kind = VPX_CODEC_CX_FRAME_PKT;
memset(&svc_ctx, 0, sizeof(svc_ctx));
svc_ctx.log_print = 1;
@@ -234,9 +232,7 @@
die_codec(&codec, "Failed to encode frame");
}
if (vpx_svc_get_frame_size(&svc_ctx) > 0) {
- packet.data.frame.pts = pts;
- packet.data.frame.sz = vpx_svc_get_frame_size(&svc_ctx);
- ivf_write_frame_header(outfile, &packet);
+ ivf_write_frame_header(outfile, pts, vpx_svc_get_frame_size(&svc_ctx));
(void)fwrite(vpx_svc_get_buffer(&svc_ctx), 1,
vpx_svc_get_frame_size(&svc_ctx), outfile);
}
--- a/vpxenc.c
+++ b/vpxenc.c
@@ -1323,7 +1323,7 @@
ivf_header_pos = ftello(stream->file);
fsize = pkt->data.frame.sz;
- ivf_write_frame_header(stream->file, pkt);
+ ivf_write_frame_header(stream->file, pkt->data.frame.pts, fsize);
} else {
fsize += pkt->data.frame.sz;