Package: amide Followup-For: Bug #739211 Please find my proposed patch attached to this email.
Reinhard -- System Information: Debian Release: 7.4 APT prefers stable APT policy: (500, 'stable') Architecture: amd64 (x86_64) Kernel: Linux 3.11.0-17-generic (SMP w/2 CPU cores) Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash
Description: Fix compilation against libav 10 Author: Reinhard Tartler <[email protected]> Bug-Debian: http://bugs.debian.org/739211 --- amide-1.0.4.orig/src/mpeg_encode.c +++ amide-1.0.4/src/mpeg_encode.c @@ -142,6 +142,7 @@ static void convert_rgb_pixbuf_to_yuv(yu #ifdef AMIDE_FFMPEG_SUPPORT #include <libavcodec/avcodec.h> +#include <libavutil/frame.h> typedef struct { @@ -234,11 +235,11 @@ gpointer mpeg_encode_setup(gchar * outpu switch(type) { case ENCODE_MPEG4: - codec_type = CODEC_ID_MPEG4; + codec_type = AV_CODEC_ID_MPEG4; break; case ENCODE_MPEG1: default: - codec_type=CODEC_ID_MPEG1VIDEO; + codec_type=AV_CODEC_ID_MPEG1VIDEO; break; } @@ -268,7 +269,7 @@ gpointer mpeg_encode_setup(gchar * outpu return NULL; } - encode->picture= avcodec_alloc_frame(); + encode->picture= av_frame_alloc(); if (!encode->picture) { g_warning("couldn't allocate memory for encode->picture"); encode_free(encode); @@ -360,14 +361,37 @@ gpointer mpeg_encode_setup(gchar * outpu gboolean mpeg_encode_frame(gpointer data, GdkPixbuf * pixbuf) { encode_t * encode = data; gint out_size; + AVPacket pkt; + int ret, got_packet = 0; convert_rgb_pixbuf_to_yuv(encode->yuv, pixbuf); - /* encode the image */ - out_size = avcodec_encode_video(encode->context, encode->output_buffer, encode->output_buffer_size, encode->picture); - fwrite(encode->output_buffer, 1, out_size, encode->output_file); + av_init_packet(&pkt); + pkt.data = encode->output_buffer; + pkt.size = encode->output_buffer_size; - return TRUE; + /* encode the image */ + ret = avcodec_encode_video2(encode->context, &pkt, encode->picture, &got_packet); + if (!ret && got_packet && encode->context->coded_frame) { + encode->context->coded_frame->pts = pkt.pts; + encode->context->coded_frame->key_frame = !!(pkt.flags & AV_PKT_FLAG_KEY); + } + + /* free any side data since we cannot return it */ + if (pkt.side_data_elems > 0) { + int i; + for (i = 0; i < pkt.side_data_elems; i++) + av_free(pkt.side_data[i].data); + av_freep(&pkt.side_data); + pkt.side_data_elems = 0; + } + + if (!ret) { + fwrite(encode->output_buffer, 1, pkt.size, encode->output_file); + return TRUE; + } else { + return FALSE; + } }; /* close everything up */

