*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
ret = video_input_init(&input_ctx, input_format_string, input_path, input_options);
if (ret < 0) {
ret = video_input_init(&input_ctx, input_format_string, input_path, input_options);
if (ret < 0) {
if (picture_raw == NULL) {
fprintf(stderr, "cannot allocate the raw picture frame!\n");
ret = -ENOMEM;
if (picture_raw == NULL) {
fprintf(stderr, "cannot allocate the raw picture frame!\n");
ret = -ENOMEM;
if (picture_scaled == NULL) {
fprintf(stderr, "cannot allocate the scaled picture!\n");
ret = -ENOMEM;
if (picture_scaled == NULL) {
fprintf(stderr, "cannot allocate the scaled picture!\n");
ret = -ENOMEM;
/* that is more or less a "continue", but there is
* still the packet to free */
goto end_while;
/* that is more or less a "continue", but there is
* still the packet to free */
goto end_while;
- ret = avcodec_decode_video2(input_ctx.codec_ctx, picture_raw, &got_picture, &packet);
+ ret = avcodec_decode_video2(input_ctx.codec_ctx, picture_raw, &got_picture, &in_packet);
- /* TODO: switch to avcodec_encode_video2() eventually */
- out_picture_size = avcodec_encode_video(output_ctx.codec_ctx,
- out_buf,
- out_buf_size,
- picture_scaled);
- if (out_picture_size < 0) {
+ av_init_packet(&out_packet);
+ out_packet.data = NULL;
+ out_packet.size = 0;
+ got_packet = 0;
+ ret = avcodec_encode_video2(output_ctx.codec_ctx,
+ &out_packet,
+ picture_scaled,
+ &got_packet);
+ if (ret < 0 || !got_packet) {
else
snprintf(filename, NAME_MAX, "out.raw");
file = fopen(filename, "wb");
else
snprintf(filename, NAME_MAX, "out.raw");
file = fopen(filename, "wb");
- fwrite(out_buf, 1, out_picture_size, file);
+ fwrite(out_picture, 1, out_picture_size, file);
- ret = am7xxx_send_image(dev,
- image_format,
- (output_ctx.codec_ctx)->width,
- (output_ctx.codec_ctx)->height,
- out_buf,
- out_picture_size);
+ ret = am7xxx_send_image_async(dev,
+ image_format,
+ (output_ctx.codec_ctx)->width,
+ (output_ctx.codec_ctx)->height,
+ out_picture,
+ out_picture_size);
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");
AM7XXX_POWER_OFF, AM7XXX_POWER_TURBO);
printf("\t\t\t\tWARNING: Level 2 and greater require the master AND\n");
printf("\t\t\t\t the slave connector to be plugged in.\n");
AM7XXX_POWER_OFF, AM7XXX_POWER_TURBO);
printf("\t\t\t\tWARNING: Level 2 and greater require the master AND\n");
printf("\t\t\t\t the slave connector to be plugged in.\n");
- printf("\t-z <zoom mode>\t\tthe display zoom mode, between %d (original) and %d (test)\n",
- AM7XXX_ZOOM_ORIGINAL, AM7XXX_ZOOM_TEST);
+ printf("\t-z <zoom mode>\t\tthe display zoom mode, between %d (original) and %d (tele)\n",
+ AM7XXX_ZOOM_ORIGINAL, AM7XXX_ZOOM_TELE);
printf("\t-h \t\t\tthis help message\n");
printf("\n\nEXAMPLES OF USE:\n");
printf("\t%s -f x11grab -i :0.0 -o video_size=800x480\n", name);
printf("\t-h \t\t\tthis help message\n");
printf("\n\nEXAMPLES OF USE:\n");
printf("\t%s -f x11grab -i :0.0 -o video_size=800x480\n", name);
unsigned int upscale = 0;
unsigned int quality = 95;
int log_level = AM7XXX_LOG_INFO;
unsigned int upscale = 0;
unsigned int quality = 95;
int log_level = AM7XXX_LOG_INFO;
* draw_mouse=1,framerate=100,video_size=800x480
*/
subopts = subopts_saved = strdup(optarg);
* draw_mouse=1,framerate=100,video_size=800x480
*/
subopts = subopts_saved = strdup(optarg);
- while((subopt = strtok_r(subopts, ",", &subopts))) {
+ while ((subopt = strtok_r(subopts, ",", &subopts))) {
char *subopt_name = strtok_r(subopt, "=", &subopt);
char *subopt_value = strtok_r(NULL, "", &subopt);
if (subopt_value == NULL) {
char *subopt_name = strtok_r(subopt, "=", &subopt);
char *subopt_value = strtok_r(NULL, "", &subopt);
if (subopt_value == NULL) {
fprintf(stdout, "Zoom: %d\n", zoom);
break;
default:
fprintf(stderr, "Invalid zoom mode value, must be between %d and %d\n",
fprintf(stdout, "Zoom: %d\n", zoom);
break;
default:
fprintf(stderr, "Invalid zoom mode value, must be between %d and %d\n",