Bug#632133: avbin: FTBFS with Libav 0.7
Hi, Stefano Rivera stefa...@debian.org (26/09/2011): Hi Stefano (2011.09.25_22:33:46_+0200) Anyway, here are my incomplete and totally untested additions Had some more time to look at it. Final version, as uploaded to Ubuntu, attached. any reasons not to upload it to unstable as-is? Should I? (Assuming the patch still applies for libav 0.8) SR -- Stefano Rivera http://tumbleweed.org.za/ H: +27 21 465 6908 C: +27 72 419 8559 UCT: x3127 diff --git a/debian/changelog b/debian/changelog index af5f478..288e3b2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +avbin (7-1.1ubuntu2) oneiric; urgency=low + + * Further libav 0.7 deprecated API removal (LP: #859189) + + -- Stefano Rivera stefa...@ubuntu.com Mon, 26 Sep 2011 16:24:22 +0200 + avbin (7-1.1ubuntu1) oneiric; urgency=low * Remove usage of deprecated APIs to work with Libav 0.7 diff --git a/src/avbin.c b/src/avbin.c index 1e26831..cbe76e4 100644 --- a/src/avbin.c +++ b/src/avbin.c @@ -33,7 +33,6 @@ struct _AVbinFile { AVFormatContext *context; -AVDictionary *format_options; AVPacket *packet; }; @@ -124,7 +123,8 @@ AVbinResult avbin_set_log_callback(AVbinLogCallback callback) AVbinFile *avbin_open_filename(const char *filename) { AVbinFile *file = malloc(sizeof *file); -if (av_open_input(file-context, filename, NULL, file-format_options) != 0) +file-context = avformat_alloc_context(); +if (avformat_open_input(file-context, filename, NULL, NULL) 0) goto error; if (av_find_stream_info(file-context) 0) @@ -179,29 +179,37 @@ AVbinResult avbin_file_info(AVbinFile *file, AVbinFileInfo *info) info-start_time = file-context-start_time; info-duration = file-context-duration; -result = av_dict_get(file-format_options, title, NULL, 0); -strncpy(info-title, result-value, sizeof(info-title)); +result = av_dict_get(file-context-metadata, title, NULL, 0); +if (result) +strncpy(info-title, result-value, sizeof(info-title)); -result = av_dict_get(file-format_options, artist, NULL, 0); -strncpy(info-author, result-value, sizeof(info-author)); +result = av_dict_get(file-context-metadata, artist, NULL, 0); +if (result) +strncpy(info-author, result-value, sizeof(info-author)); -result = av_dict_get(file-format_options, copyright, NULL, 0); -strncpy(info-copyright, result-value, sizeof(info-copyright)); +result = av_dict_get(file-context-metadata, copyright, NULL, 0); +if (result) +strncpy(info-copyright, result-value, sizeof(info-copyright)); -result = av_dict_get(file-format_options, comment, NULL, 0); -strncpy(info-comment, result-value, sizeof(info-comment)); +result = av_dict_get(file-context-metadata, comment, NULL, 0); +if (result) +strncpy(info-comment, result-value, sizeof(info-comment)); -result = av_dict_get(file-format_options, album, NULL, 0); -strncpy(info-album, result-value, sizeof(info-album)); +result = av_dict_get(file-context-metadata, album, NULL, 0); +if (result) +strncpy(info-album, result-value, sizeof(info-album)); -result = av_dict_get(file-format_options, year, NULL, 0); -info-year = strtol(result-value, NULL, 10); +result = av_dict_get(file-context-metadata, year, NULL, 0); +if (result) +info-year = strtol(result-value, NULL, 10); -result = av_dict_get(file-format_options, track, NULL, 0); -info-track = strtol(result-value, NULL, 10); +result = av_dict_get(file-context-metadata, track, NULL, 0); +if (result) +info-track = strtol(result-value, NULL, 10); -result = av_dict_get(file-format_options, genre, NULL, 0); -strncpy(info-genre, result-value, sizeof(info-genre)); +result = av_dict_get(file-context-metadata, genre, NULL, 0); +if (result) +strncpy(info-genre, result-value, sizeof(info-genre)); return AVBIN_RESULT_OK; } @@ -321,9 +329,13 @@ int avbin_decode_audio(AVbinStream *stream, if (stream-type != AVMEDIA_TYPE_AUDIO) return AVBIN_RESULT_ERROR; -used = avcodec_decode_audio2(stream-codec_context, +AVPacket avpkt; +av_init_packet(avpkt); +avpkt.data = data_in; +avpkt.size = size_in; +used = avcodec_decode_audio3(stream-codec_context, (int16_t *) data_out, size_out, - data_in, size_in); + avpkt); if (used 0) return AVBIN_RESULT_ERROR; @@ -344,9 +356,15 @@ int avbin_decode_video(AVbinStream *stream, if (stream-type != AVMEDIA_TYPE_VIDEO) return AVBIN_RESULT_ERROR; -used = avcodec_decode_video(stream-codec_context, -stream-frame, got_picture, -data_in, size_in); +
Bug#632133: avbin: FTBFS with Libav 0.7
Hi Stefano (2011.09.25_22:33:46_+0200) Anyway, here are my incomplete and totally untested additions Had some more time to look at it. Final version, as uploaded to Ubuntu, attached. SR -- Stefano Rivera http://tumbleweed.org.za/ H: +27 21 465 6908 C: +27 72 419 8559 UCT: x3127 diff --git a/debian/changelog b/debian/changelog index af5f478..288e3b2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +avbin (7-1.1ubuntu2) oneiric; urgency=low + + * Further libav 0.7 deprecated API removal (LP: #859189) + + -- Stefano Rivera stefa...@ubuntu.com Mon, 26 Sep 2011 16:24:22 +0200 + avbin (7-1.1ubuntu1) oneiric; urgency=low * Remove usage of deprecated APIs to work with Libav 0.7 diff --git a/src/avbin.c b/src/avbin.c index 1e26831..cbe76e4 100644 --- a/src/avbin.c +++ b/src/avbin.c @@ -33,7 +33,6 @@ struct _AVbinFile { AVFormatContext *context; -AVDictionary *format_options; AVPacket *packet; }; @@ -124,7 +123,8 @@ AVbinResult avbin_set_log_callback(AVbinLogCallback callback) AVbinFile *avbin_open_filename(const char *filename) { AVbinFile *file = malloc(sizeof *file); -if (av_open_input(file-context, filename, NULL, file-format_options) != 0) +file-context = avformat_alloc_context(); +if (avformat_open_input(file-context, filename, NULL, NULL) 0) goto error; if (av_find_stream_info(file-context) 0) @@ -179,29 +179,37 @@ AVbinResult avbin_file_info(AVbinFile *file, AVbinFileInfo *info) info-start_time = file-context-start_time; info-duration = file-context-duration; -result = av_dict_get(file-format_options, title, NULL, 0); -strncpy(info-title, result-value, sizeof(info-title)); +result = av_dict_get(file-context-metadata, title, NULL, 0); +if (result) +strncpy(info-title, result-value, sizeof(info-title)); -result = av_dict_get(file-format_options, artist, NULL, 0); -strncpy(info-author, result-value, sizeof(info-author)); +result = av_dict_get(file-context-metadata, artist, NULL, 0); +if (result) +strncpy(info-author, result-value, sizeof(info-author)); -result = av_dict_get(file-format_options, copyright, NULL, 0); -strncpy(info-copyright, result-value, sizeof(info-copyright)); +result = av_dict_get(file-context-metadata, copyright, NULL, 0); +if (result) +strncpy(info-copyright, result-value, sizeof(info-copyright)); -result = av_dict_get(file-format_options, comment, NULL, 0); -strncpy(info-comment, result-value, sizeof(info-comment)); +result = av_dict_get(file-context-metadata, comment, NULL, 0); +if (result) +strncpy(info-comment, result-value, sizeof(info-comment)); -result = av_dict_get(file-format_options, album, NULL, 0); -strncpy(info-album, result-value, sizeof(info-album)); +result = av_dict_get(file-context-metadata, album, NULL, 0); +if (result) +strncpy(info-album, result-value, sizeof(info-album)); -result = av_dict_get(file-format_options, year, NULL, 0); -info-year = strtol(result-value, NULL, 10); +result = av_dict_get(file-context-metadata, year, NULL, 0); +if (result) +info-year = strtol(result-value, NULL, 10); -result = av_dict_get(file-format_options, track, NULL, 0); -info-track = strtol(result-value, NULL, 10); +result = av_dict_get(file-context-metadata, track, NULL, 0); +if (result) +info-track = strtol(result-value, NULL, 10); -result = av_dict_get(file-format_options, genre, NULL, 0); -strncpy(info-genre, result-value, sizeof(info-genre)); +result = av_dict_get(file-context-metadata, genre, NULL, 0); +if (result) +strncpy(info-genre, result-value, sizeof(info-genre)); return AVBIN_RESULT_OK; } @@ -321,9 +329,13 @@ int avbin_decode_audio(AVbinStream *stream, if (stream-type != AVMEDIA_TYPE_AUDIO) return AVBIN_RESULT_ERROR; -used = avcodec_decode_audio2(stream-codec_context, +AVPacket avpkt; +av_init_packet(avpkt); +avpkt.data = data_in; +avpkt.size = size_in; +used = avcodec_decode_audio3(stream-codec_context, (int16_t *) data_out, size_out, - data_in, size_in); + avpkt); if (used 0) return AVBIN_RESULT_ERROR; @@ -344,9 +356,15 @@ int avbin_decode_video(AVbinStream *stream, if (stream-type != AVMEDIA_TYPE_VIDEO) return AVBIN_RESULT_ERROR; -used = avcodec_decode_video(stream-codec_context, -stream-frame, got_picture, -data_in, size_in); +AVPacket avpkt; +av_init_packet(avpkt); +avpkt.data = data_in; +avpkt.size = size_in; +// HACK for CorePNG to decode as normal PNG by default +avpkt.flags = AV_PKT_FLAG_KEY; +used = avcodec_decode_video2(stream-codec_context, +
Bug#632133: avbin: FTBFS with Libav 0.7
Hi Reinhard (2011.06.29_21:12:49_+0200) * Remove usage of deprecated APIs to work with Libav 0.7 This patch looks incomplete, it uses functions that aren't in libav 0.7. I made the following changes, to attempt to fix it, but it still segfaults if I try to use it. The following av_dict_gets return NULL: +result = av_dict_get(file-format_options, title, NULL, 0); +strncpy(info-title, result-value, sizeof(info-title)); Anyway, here are my incomplete and totally untested additions: diff -u avbin-7/src/avbin.c avbin-7/src/avbin.c --- avbin-7/src/avbin.c +++ avbin-7/src/avbin.c @@ -124,7 +124,7 @@ AVbinFile *avbin_open_filename(const char *filename) { AVbinFile *file = malloc(sizeof *file); -if (av_open_input(file-context, filename, NULL, file-format_options) != 0) +if (avformat_open_input(file-context, filename, NULL, file-format_options) 0) goto error; if (av_find_stream_info(file-context) 0) @@ -321,9 +321,13 @@ if (stream-type != AVMEDIA_TYPE_AUDIO) return AVBIN_RESULT_ERROR; -used = avcodec_decode_audio2(stream-codec_context, +AVPacket avpkt; +av_init_packet(avpkt); +avpkt.data = data_in; +avpkt.size = size_in; +used = avcodec_decode_audio3(stream-codec_context, (int16_t *) data_out, size_out, - data_in, size_in); + avpkt); if (used 0) return AVBIN_RESULT_ERROR; @@ -344,9 +348,15 @@ if (stream-type != AVMEDIA_TYPE_VIDEO) return AVBIN_RESULT_ERROR; -used = avcodec_decode_video(stream-codec_context, -stream-frame, got_picture, -data_in, size_in); +AVPacket avpkt; +av_init_packet(avpkt); +avpkt.data = data_in; +avpkt.size = size_in; +// HACK for CorePNG to decode as normal PNG by default +avpkt.flags = AV_PKT_FLAG_KEY; +used = avcodec_decode_video2(stream-codec_context, + stream-frame, got_picture, + avpkt); if (!got_picture) return AVBIN_RESULT_ERROR; SR -- Stefano Rivera http://tumbleweed.org.za/ H: +27 21 465 6908 C: +27 72 419 8559 UCT: x3127 -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#632133: avbin: FTBFS with Libav 0.7
Package: avbin Version: 7-1.1 Severity: important Tags: patch User: ubuntu-de...@lists.ubuntu.com Usertags: origin-ubuntu oneiric ubuntu-patch *** /tmp/tmpRLR17V In Ubuntu, the attached patch was applied to achieve the following: * Remove usage of deprecated APIs to work with Libav 0.7 Libav 0.7 is currently in experimental, but will be soon uploaded to unstable. -- System Information: Debian Release: squeeze/sid APT prefers natty-updates APT policy: (500, 'natty-updates'), (500, 'natty-security'), (500, 'natty-proposed'), (500, 'natty') Architecture: amd64 (x86_64) Kernel: Linux 2.6.38-10-generic (SMP w/4 CPU cores) Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash diff -u avbin-7/debian/changelog avbin-7/debian/changelog diff -u avbin-7/src/avbin.c avbin-7/src/avbin.c --- avbin-7/src/avbin.c +++ avbin-7/src/avbin.c @@ -29,9 +29,11 @@ #include avcodec.h #include avutil.h #include swscale.h +#include libavutil/dict.h struct _AVbinFile { AVFormatContext *context; +AVDictionary *format_options; AVPacket *packet; }; @@ -122,7 +124,7 @@ AVbinFile *avbin_open_filename(const char *filename) { AVbinFile *file = malloc(sizeof *file); -if (av_open_input_file(file-context, filename, NULL, 0, NULL) != 0) +if (av_open_input(file-context, filename, NULL, file-format_options) != 0) goto error; if (av_find_stream_info(file-context) 0) @@ -168,20 +170,38 @@ AVbinResult avbin_file_info(AVbinFile *file, AVbinFileInfo *info) { +AVDictionaryEntry *result; + if (info-structure_size sizeof *info) return AVBIN_RESULT_ERROR; info-n_streams = file-context-nb_streams; info-start_time = file-context-start_time; info-duration = file-context-duration; -memcpy(info-title, file-context-title, sizeof(info-title)); -memcpy(info-author, file-context-author, sizeof(info-author)); -memcpy(info-copyright, file-context-copyright, sizeof(info-copyright)); -memcpy(info-comment, file-context-comment, sizeof(info-comment)); -memcpy(info-album, file-context-album, sizeof(info-album)); -info-year = file-context-year; -info-track = file-context-track; -memcpy(info-genre, file-context-genre, sizeof(info-genre)); + +result = av_dict_get(file-format_options, title, NULL, 0); +strncpy(info-title, result-value, sizeof(info-title)); + +result = av_dict_get(file-format_options, artist, NULL, 0); +strncpy(info-author, result-value, sizeof(info-author)); + +result = av_dict_get(file-format_options, copyright, NULL, 0); +strncpy(info-copyright, result-value, sizeof(info-copyright)); + +result = av_dict_get(file-format_options, comment, NULL, 0); +strncpy(info-comment, result-value, sizeof(info-comment)); + +result = av_dict_get(file-format_options, album, NULL, 0); +strncpy(info-album, result-value, sizeof(info-album)); + +result = av_dict_get(file-format_options, year, NULL, 0); +info-year = strtol(result-value, NULL, 10); + +result = av_dict_get(file-format_options, track, NULL, 0); +info-track = strtol(result-value, NULL, 10); + +result = av_dict_get(file-format_options, genre, NULL, 0); +strncpy(info-genre, result-value, sizeof(info-genre)); return AVBIN_RESULT_OK; } @@ -197,14 +217,14 @@ switch (context-codec_type) { -case CODEC_TYPE_VIDEO: +case AVMEDIA_TYPE_VIDEO: info-type = AVBIN_STREAM_TYPE_VIDEO; info-video.width = context-width; info-video.height = context-height; info-video.sample_aspect_num = context-sample_aspect_ratio.num; info-video.sample_aspect_den = context-sample_aspect_ratio.den; break; -case CODEC_TYPE_AUDIO: +case AVMEDIA_TYPE_AUDIO: info-type = AVBIN_STREAM_TYPE_AUDIO; info-audio.sample_rate = context-sample_rate; info-audio.channels = context-channels; @@ -256,7 +276,7 @@ stream-format_context = file-context; stream-codec_context = codec_context; stream-type = codec_context-codec_type; -if (stream-type == CODEC_TYPE_VIDEO) +if (stream-type == AVMEDIA_TYPE_VIDEO) stream-frame = avcodec_alloc_frame(); else stream-frame = NULL; @@ -298,7 +318,7 @@ uint8_t *data_out, int *size_out) { int used; -if (stream-type != CODEC_TYPE_AUDIO) +if (stream-type != AVMEDIA_TYPE_AUDIO) return AVBIN_RESULT_ERROR; used = avcodec_decode_audio2(stream-codec_context, @@ -321,7 +341,7 @@ int height = stream-codec_context-height; int used; -if (stream-type != CODEC_TYPE_VIDEO) +if (stream-type != AVMEDIA_TYPE_VIDEO) return AVBIN_RESULT_ERROR; used = avcodec_decode_video(stream-codec_context,