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 [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]