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, 

Reply via email to