* in particular they won't be 0, this is needed because they are used
* as divisor somewhere in the encoding process */
output_codec_ctx->qmin = output_codec_ctx->qmax = ((100 - (quality - 1)) * FF_QUALITY_SCALE) / 100;
* in particular they won't be 0, this is needed because they are used
* as divisor somewhere in the encoding process */
output_codec_ctx->qmin = output_codec_ctx->qmax = ((100 - (quality - 1)) * FF_QUALITY_SCALE) / 100;
- output_codec_ctx->mb_lmin = output_codec_ctx->lmin = output_codec_ctx->qmin * FF_QP2LAMBDA;
- output_codec_ctx->mb_lmax = output_codec_ctx->lmax = output_codec_ctx->qmax * FF_QP2LAMBDA;
+ output_codec_ctx->mb_lmin = output_codec_ctx->qmin * FF_QP2LAMBDA;
+ output_codec_ctx->mb_lmax = output_codec_ctx->qmax * FF_QP2LAMBDA;
output_codec_ctx->flags |= CODEC_FLAG_QSCALE;
output_codec_ctx->global_quality = output_codec_ctx->qmin * FF_QP2LAMBDA;
output_codec_ctx->flags |= CODEC_FLAG_QSCALE;
output_codec_ctx->global_quality = output_codec_ctx->qmin * FF_QP2LAMBDA;
picture_scaled->height = (output_ctx.codec_ctx)->height;
/* calculate the bytes needed for the output image and create buffer for the output image */
picture_scaled->height = (output_ctx.codec_ctx)->height;
/* calculate the bytes needed for the output image and create buffer for the output image */
- out_buf_size = avpicture_get_size((output_ctx.codec_ctx)->pix_fmt,
- (output_ctx.codec_ctx)->width,
- (output_ctx.codec_ctx)->height);
+ out_buf_size = av_image_get_buffer_size((output_ctx.codec_ctx)->pix_fmt,
+ (output_ctx.codec_ctx)->width,
+ (output_ctx.codec_ctx)->height,
+ 1);
out_buf = av_malloc(out_buf_size * sizeof(uint8_t));
if (out_buf == NULL) {
fprintf(stderr, "cannot allocate output data buffer!\n");
out_buf = av_malloc(out_buf_size * sizeof(uint8_t));
if (out_buf == NULL) {
fprintf(stderr, "cannot allocate output data buffer!\n");
- avpicture_fill((AVPicture *)picture_scaled,
- out_buf,
- (output_ctx.codec_ctx)->pix_fmt,
- (output_ctx.codec_ctx)->width,
- (output_ctx.codec_ctx)->height);
+ av_image_fill_arrays(picture_scaled->data,
+ picture_scaled->linesize,
+ out_buf,
+ (output_ctx.codec_ctx)->pix_fmt,
+ (output_ctx.codec_ctx)->width,
+ (output_ctx.codec_ctx)->height,
+ 1);
sw_scale_ctx = sws_getCachedContext(NULL,
(input_ctx.codec_ctx)->width,
sw_scale_ctx = sws_getCachedContext(NULL,
(input_ctx.codec_ctx)->width,
- char filename[NAME_MAX];
- FILE *file;
- if (!output_ctx.raw_output)
- snprintf(filename, NAME_MAX, "out_q%03d.jpg", quality);
- else
- snprintf(filename, NAME_MAX, "out.raw");
- file = fopen(filename, "wb");
- fwrite(out_picture, 1, out_picture_size, file);
- fclose(file);
+ if (dump_frame) {
+ char filename[NAME_MAX];
+ FILE *file;
+ if (!output_ctx.raw_output)
+ snprintf(filename, NAME_MAX, "out_q%03d.jpg", quality);
+ else
+ snprintf(filename, NAME_MAX, "out.raw");
+ file = fopen(filename, "wb");
+ fwrite(out_picture, 1, out_picture_size, file);
+ fclose(file);
+ }
+#else
+ (void) dump_frame;
- fprintf(stderr, "%s: fallback implementation\n", __func__);
+ fprintf(stderr, "%s: fallback implementation, assuming a vga screen\n", __func__);
printf("usage: %s [OPTIONS]\n\n", name);
printf("OPTIONS:\n");
printf("\t-d <index>\t\tthe device index (default is 0)\n");
printf("usage: %s [OPTIONS]\n\n", name);
printf("OPTIONS:\n");
printf("\t-d <index>\t\tthe device index (default is 0)\n");
printf("\t-f <input format>\tthe input device format\n");
printf("\t-i <input path>\t\tthe input path\n");
printf("\t-o <options>\t\ta comma separated list of input format options\n");
printf("\t-f <input format>\tthe input device format\n");
printf("\t-i <input path>\t\tthe input path\n");
printf("\t-o <options>\t\ta comma separated list of input format options\n");