dst->d_h, mode);
}
#endif
-void show_help(FILE *fout, int shorthelp) {
+static void show_help(FILE *fout, int shorthelp) {
int i;
fprintf(fout, "Usage: %s <options> filename\n\n", exec_name);
return 1;
}
-static int read_frame(struct VpxDecInputContext *input, uint8_t **buf,
- size_t *bytes_in_buffer, size_t *buffer_size) {
+static int dec_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:
#if !CONFIG_WEBM_IO
fprintf(stderr, "vpxdec was built without WebM container support.\n");
#endif
+ free(argv);
return EXIT_FAILURE;
}
if (arg_skip) fprintf(stderr, "Skipping first %d frames.\n", arg_skip);
while (arg_skip) {
- if (read_frame(&input, &buf, &bytes_in_buffer, &buffer_size)) break;
+ if (dec_read_frame(&input, &buf, &bytes_in_buffer, &buffer_size)) break;
arg_skip--;
}
ext_fb_list.num_external_frame_buffers = num_external_frame_buffers;
ext_fb_list.ext_fb = (struct ExternalFrameBuffer *)calloc(
num_external_frame_buffers, sizeof(*ext_fb_list.ext_fb));
+ if (!ext_fb_list.ext_fb) {
+ fprintf(stderr, "Failed to allocate ExternalFrameBuffer\n");
+ goto fail;
+ }
if (vpx_codec_set_frame_buffer_functions(&decoder, get_vp9_frame_buffer,
release_vp9_frame_buffer,
&ext_fb_list)) {
frame_avail = 0;
if (!stop_after || frame_in < stop_after) {
- if (!read_frame(&input, &buf, &bytes_in_buffer, &buffer_size)) {
+ if (!dec_read_frame(&input, &buf, &bytes_in_buffer, &buffer_size)) {
frame_avail = 1;
frame_in++;
}
scaled_img =
vpx_img_alloc(NULL, img->fmt, render_width, render_height, 16);
+ if (!scaled_img) {
+ fprintf(stderr, "Failed to allocate scaled image (%d x %d)\n",
+ render_width, render_height);
+ goto fail;
+ }
scaled_img->bit_depth = img->bit_depth;
}
if (!img_shifted) {
img_shifted =
vpx_img_alloc(NULL, shifted_fmt, img->d_w, img->d_h, 16);
+ if (!img_shifted) {
+ fprintf(stderr, "Failed to allocate image\n");
+ goto fail;
+ }
img_shifted->bit_depth = output_bit_depth;
}
if (output_bit_depth > img->bit_depth) {