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) {
/* 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");
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) {
default:
fprintf(stderr, "Invalid zoom mode value, must be between %d and %d\n",
AM7XXX_ZOOM_ORIGINAL, AM7XXX_ZOOM_TEST);
default:
fprintf(stderr, "Invalid zoom mode value, must be between %d and %d\n",
AM7XXX_ZOOM_ORIGINAL, AM7XXX_ZOOM_TEST);