summaryrefslogtreecommitdiff
blob: f0b223e1401c63e511c554fb3c64764d06c65c5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
Index: hwdecode-demos-0.9.5/src/ffmpeg.c
===================================================================
--- hwdecode-demos-0.9.5.orig/src/ffmpeg.c
+++ hwdecode-demos-0.9.5/src/ffmpeg.c
@@ -53,7 +53,6 @@ static int ffmpeg_init(void)
         return -1;
     }
 
-    avcodec_init();
     avcodec_register_all();
 
     ffmpeg_context = ffmpeg;
@@ -148,7 +147,6 @@ static int get_buffer(struct AVCodecCont
     void *surface = (void *)(uintptr_t)vaapi->surface_id;
 
     pic->type           = FF_BUFFER_TYPE_USER;
-    pic->age            = 1;
     pic->data[0]        = surface;
     pic->data[1]        = NULL;
     pic->data[2]        = NULL;
Index: hwdecode-demos-0.9.5/src/ffmpeg_video.c
===================================================================
--- hwdecode-demos-0.9.5.orig/src/ffmpeg_video.c
+++ hwdecode-demos-0.9.5/src/ffmpeg_video.c
@@ -23,6 +23,7 @@
 
 #ifdef HAVE_LIBAVFORMAT_AVFORMAT_H
 # include <libavformat/avformat.h>
+# include <libavformat/avio.h>
 #endif
 #ifdef HAVE_FFMPEG_AVFORMAT_H
 # include <ffmpeg/avformat.h>
@@ -59,7 +60,7 @@
 int decode(void)
 {
     AVProbeData pd;
-    ByteIOContext ioctx;
+    AVIOContext *ioctx;
     AVInputFormat *format = NULL;
     AVFormatContext *ic = NULL;
     AVCodec *codec;
@@ -84,15 +85,20 @@ int decode(void)
         goto end;
     format->flags |= AVFMT_NOFILE;
 
-    if (init_put_byte(&ioctx, (uint8_t *)video_data, video_data_size, 0, NULL, NULL, NULL, NULL) < 0)
+    ioctx = avio_alloc_context((uint8_t *)video_data, video_data_size, 0, NULL, NULL, NULL, NULL);
+    if (!ioctx)
         goto end;
 
-    if (av_open_input_stream(&ic, &ioctx, "", format, NULL) < 0)
+    ic = avformat_alloc_context();
+    if(!ic)
+        goto end;
+    ic->pb = ioctx;
+    if (avformat_open_input(&ic, "", format, NULL) < 0)
         goto end;
 
     if (av_find_stream_info(ic) < 0)
         goto end;
-    dump_format(ic, 0, "", 0);
+    av_dump_format(ic, 0, "", 0);
 
     video_stream = NULL;
     for (i = 0; i < ic->nb_streams; i++) {
@@ -135,6 +141,6 @@ end:
     if (avctx)
         avcodec_close(avctx);
     if (ic)
-        av_close_input_stream(ic);
+        avformat_close_input(&ic);
     return error;
 }