Line 0
Link Here
|
|
|
1 |
For ffmpeg 3.x compatibility |
2 |
|
3 |
https://github.com/nordlicht/nordlicht/commit/5505a1898ab997a23b75553794eff6609447c43b.patch |
4 |
https://github.com/nordlicht/nordlicht/commit/6e534a0c273756b88eecea7f510b6aa8a62dd789.patch |
5 |
|
6 |
--- source.c.orig 2016-01-24 19:35:50 UTC |
7 |
+++ source.c |
8 |
@@ -6,9 +6,34 @@ |
9 |
#include <libavutil/avutil.h> |
10 |
#include <libswscale/swscale.h> |
11 |
|
12 |
+// Changes for ffmpeg 3.0 |
13 |
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57,24,0) |
14 |
+# include <libavutil/imgutils.h> |
15 |
+# define av_free_packet av_packet_unref |
16 |
+# define avpicture_get_size(fmt,w,h) av_image_get_buffer_size(fmt,w,h,1) |
17 |
+#endif |
18 |
+ |
19 |
+// PIX_FMT was renamed to AV_PIX_FMT on this version |
20 |
+#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(51,74,100) |
21 |
+# define AVPixelFormat PixelFormat |
22 |
+# define AV_PIX_FMT_RGB24 PIX_FMT_RGB24 |
23 |
+# define AV_PIX_FMT_YUVJ420P PIX_FMT_YUVJ420P |
24 |
+# define AV_PIX_FMT_YUVJ422P PIX_FMT_YUVJ422P |
25 |
+# define AV_PIX_FMT_YUVJ440P PIX_FMT_YUVJ440P |
26 |
+# define AV_PIX_FMT_YUVJ444P PIX_FMT_YUVJ444P |
27 |
+# define AV_PIX_FMT_YUV420P PIX_FMT_YUV420P |
28 |
+# define AV_PIX_FMT_YUV422P PIX_FMT_YUV422P |
29 |
+# define AV_PIX_FMT_YUV440P PIX_FMT_YUV440P |
30 |
+# define AV_PIX_FMT_YUV444P PIX_FMT_YUV444P |
31 |
+#endif |
32 |
+ |
33 |
#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(52, 8, 0) |
34 |
-#define av_frame_alloc avcodec_alloc_frame |
35 |
-#define av_frame_free av_freep |
36 |
+# define av_frame_alloc avcodec_alloc_frame |
37 |
+# if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(54,59,100) |
38 |
+# define av_frame_free av_freep |
39 |
+# else |
40 |
+# define av_frame_free avcodec_free_frame |
41 |
+# endif |
42 |
#endif |
43 |
|
44 |
#define HEURISTIC_NUMBER_OF_FRAMES 1800 // how many frames will the heuristic look at? |
45 |
@@ -244,13 +269,17 @@ source* source_init(const char *filename |
46 |
s->scaleframe = av_frame_alloc(); |
47 |
s->scaleframe->width = s->video->frame->width; |
48 |
s->scaleframe->height = s->video->frame->height; |
49 |
- s->scaleframe->format = PIX_FMT_RGB24; |
50 |
+ s->scaleframe->format = AV_PIX_FMT_RGB24; |
51 |
|
52 |
- s->buffer = (uint8_t *)av_malloc(sizeof(uint8_t)*avpicture_get_size(PIX_FMT_RGB24, s->scaleframe->width, s->scaleframe->height)); |
53 |
- avpicture_fill((AVPicture *)s->scaleframe, s->buffer, PIX_FMT_RGB24, s->video->frame->width, s->video->frame->height); |
54 |
+ s->buffer = (uint8_t *)av_malloc(sizeof(uint8_t)*avpicture_get_size(s->scaleframe->format, s->scaleframe->width, s->scaleframe->height)); |
55 |
+ #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57,24,0) |
56 |
+ av_image_fill_arrays(s->scaleframe->data, s->scaleframe->linesize, s->buffer, s->scaleframe->format, s->video->frame->width, s->video->frame->height, 1); |
57 |
+ #else |
58 |
+ avpicture_fill((AVPicture *)s->scaleframe, s->buffer, s->scaleframe->format, s->video->frame->width, s->video->frame->height); |
59 |
+ #endif |
60 |
|
61 |
s->sws_context = sws_getCachedContext(NULL, s->video->frame->width, s->video->frame->height, s->video->frame->format, |
62 |
- s->scaleframe->width, s->scaleframe->height, PIX_FMT_RGB24, SWS_AREA, NULL, NULL, NULL); |
63 |
+ s->scaleframe->width, s->scaleframe->height, s->scaleframe->format, SWS_AREA, NULL, NULL, NULL); |
64 |
} |
65 |
|
66 |
s->keyframes = NULL; |