#define VPX_CODEC_DISABLE_COMPAT 1
#include "./vpx_config.h"
#include "vpx/vpx_decoder.h"
+#include "vpx_ports/mem_ops.h"
#include "vpx_ports/vpx_timer.h"
#if CONFIG_VP8_DECODER || CONFIG_VP9_DECODER
#endif
static int vpx_image_scale(vpx_image_t *src, vpx_image_t *dst,
- FilterMode mode) {
+ FilterModeEnum mode) {
assert(src->fmt == VPX_IMG_FMT_I420);
assert(dst->fmt == VPX_IMG_FMT_I420);
return I420Scale(src->planes[VPX_PLANE_Y], src->stride[VPX_PLANE_Y],
static int read_frame(struct VpxDecInputContext *input, uint8_t **buf,
size_t *bytes_in_buffer, size_t *buffer_size) {
switch (input->vpx_input_ctx->file_type) {
+#if CONFIG_WEBM_IO
case FILE_TYPE_WEBM:
return webm_read_frame(input->webm_ctx,
buf, bytes_in_buffer, buffer_size);
+#endif
case FILE_TYPE_RAW:
return raw_read_frame(input->vpx_input_ctx->file,
buf, bytes_in_buffer, buffer_size);
return is_raw;
}
-void show_progress(int frame_in, int frame_out, unsigned long dx_time) {
- fprintf(stderr, "%d decoded frames/%d showed frames in %lu us (%.2f fps)\r",
+void show_progress(int frame_in, int frame_out, uint64_t dx_time) {
+ fprintf(stderr,
+ "%d decoded frames/%d showed frames in %"PRId64" us (%.2f fps)\r",
frame_in, frame_out, dx_time,
- (float)frame_out * 1000000.0 / (float)dx_time);
+ (double)frame_out * 1000000.0 / (double)dx_time);
}
struct ExternalFrameBuffer {
int ec_enabled = 0;
const VpxInterface *interface = NULL;
const VpxInterface *fourcc_interface = NULL;
- unsigned long dx_time = 0;
+ uint64_t dx_time = 0;
struct arg arg;
char **argv, **argi, **argj;
input.vpx_input_ctx->file = infile;
if (file_is_ivf(input.vpx_input_ctx))
input.vpx_input_ctx->file_type = FILE_TYPE_IVF;
+#if CONFIG_WEBM_IO
else if (file_is_webm(input.webm_ctx, input.vpx_input_ctx))
input.vpx_input_ctx->file_type = FILE_TYPE_WEBM;
+#endif
else if (file_is_raw(input.vpx_input_ctx))
input.vpx_input_ctx->file_type = FILE_TYPE_RAW;
else {
fprintf(stderr, "Unrecognized input file type.\n");
+#if !CONFIG_WEBM_IO
+ fprintf(stderr, "vpxdec was built without WebM container support.\n");
+#endif
return EXIT_FAILURE;
}
return EXIT_FAILURE;
}
+#if CONFIG_WEBM_IO
if (vpx_input_ctx.file_type == FILE_TYPE_WEBM) {
if (webm_guess_framerate(input.webm_ctx, input.vpx_input_ctx)) {
fprintf(stderr, "Failed to guess framerate -- error parsing "
return EXIT_FAILURE;
}
}
+#endif
}
fourcc_interface = get_vpx_decoder_by_fourcc(vpx_input_ctx.fourcc);
vpx_usec_timer_start(&timer);
- if (vpx_codec_decode(&decoder, buf, bytes_in_buffer, NULL, 0)) {
+ if (vpx_codec_decode(&decoder, buf, (unsigned int)bytes_in_buffer,
+ NULL, 0)) {
const char *detail = vpx_codec_error_detail(&decoder);
warn("Failed to decode frame %d: %s",
frame_in, vpx_codec_error(&decoder));
}
vpx_usec_timer_mark(&timer);
- dx_time += (unsigned int)vpx_usec_timer_elapsed(&timer);
+ dx_time += vpx_usec_timer_elapsed(&timer);
}
}
vpx_input_ctx.height,
&vpx_input_ctx.framerate, img->fmt);
if (do_md5) {
- MD5Update(&md5_ctx, (md5byte *)buf, len);
+ MD5Update(&md5_ctx, (md5byte *)buf, (unsigned int)len);
} else {
fputs(buf, outfile);
}
// Y4M frame header
len = y4m_write_frame_header(buf, sizeof(buf));
if (do_md5) {
- MD5Update(&md5_ctx, (md5byte *)buf, len);
+ MD5Update(&md5_ctx, (md5byte *)buf, (unsigned int)len);
} else {
fputs(buf, outfile);
}
}
}
+#if CONFIG_WEBM_IO
if (input.vpx_input_ctx->file_type == FILE_TYPE_WEBM)
webm_free(input.webm_ctx);
- else
+#endif
+
+ if (input.vpx_input_ctx->file_type != FILE_TYPE_WEBM)
free(buf);
if (scaled_img) vpx_img_free(scaled_img);