1 |
aballier 08/01/15 19:44:05 |
2 |
|
3 |
Added: cinelerra-cvs-20080115-swscaler.patch |
4 |
digest-cinelerra-cvs-20080115 |
5 |
Log: |
6 |
bump a new snapshot |
7 |
(Portage version: 2.1.4) |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 media-video/cinelerra-cvs/files/cinelerra-cvs-20080115-swscaler.patch |
11 |
|
12 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/media-video/cinelerra-cvs/files/cinelerra-cvs-20080115-swscaler.patch?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/media-video/cinelerra-cvs/files/cinelerra-cvs-20080115-swscaler.patch?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: cinelerra-cvs-20080115-swscaler.patch |
16 |
=================================================================== |
17 |
Index: cinelerra-cvs/cinelerra/ffmpeg.C |
18 |
=================================================================== |
19 |
--- cinelerra-cvs.orig/cinelerra/ffmpeg.C |
20 |
+++ cinelerra-cvs/cinelerra/ffmpeg.C |
21 |
@@ -140,6 +140,11 @@ int FFMPEG::convert_cmodel(VFrame *frame |
22 |
PixelFormat pix_fmt_out = |
23 |
color_model_to_pix_fmt(frame_out->get_color_model()); |
24 |
|
25 |
+#ifdef HAVE_SWSCALER |
26 |
+ // We need a context for swscale |
27 |
+ struct SwsContext *convert_ctx; |
28 |
+#endif |
29 |
+ |
30 |
// do conversion within libavcodec if possible |
31 |
if (pix_fmt_in != PIX_FMT_NB && pix_fmt_out != PIX_FMT_NB) { |
32 |
// set up a temporary pictures from frame_in and frame_out |
33 |
@@ -147,7 +152,9 @@ int FFMPEG::convert_cmodel(VFrame *frame |
34 |
init_picture_from_frame(&picture_in, frame_in); |
35 |
init_picture_from_frame(&picture_out, frame_out); |
36 |
|
37 |
- int result = img_convert(&picture_out, |
38 |
+ int result; |
39 |
+#ifndef HAVE_SWSCALER |
40 |
+ result = img_convert(&picture_out, |
41 |
pix_fmt_out, |
42 |
&picture_in, |
43 |
pix_fmt_in, |
44 |
@@ -156,6 +163,28 @@ int FFMPEG::convert_cmodel(VFrame *frame |
45 |
if (result) { |
46 |
printf("FFMPEG::convert_cmodel img_convert() failed\n"); |
47 |
} |
48 |
+#else |
49 |
+ convert_ctx = sws_getContext(frame_in->get_w(), frame_in->get_h(),pix_fmt_in, |
50 |
+ frame_out->get_w(),frame_out->get_h(),pix_fmt_out, |
51 |
+ SWS_BICUBIC, NULL, NULL, NULL); |
52 |
+ |
53 |
+ if(convert_ctx == NULL){ |
54 |
+ printf("FFMPEG::convert_cmodel : swscale context initialization failed\n"); |
55 |
+ return 1; |
56 |
+ } |
57 |
+ |
58 |
+ result = sws_scale(convert_ctx, |
59 |
+ picture_in.data, picture_in.linesize, |
60 |
+ 0, 0, |
61 |
+ picture_out.data, picture_out.linesize); |
62 |
+ |
63 |
+ |
64 |
+ sws_freeContext(convert_ctx); |
65 |
+ |
66 |
+ if(result){ |
67 |
+ printf("FFMPEG::convert_cmodel sws_scale() failed\n"); |
68 |
+ } |
69 |
+#endif |
70 |
return result; |
71 |
} |
72 |
|
73 |
@@ -203,13 +232,19 @@ int FFMPEG::convert_cmodel(AVPicture *pi |
74 |
|
75 |
// set up a temporary picture_out from frame_out |
76 |
AVPicture picture_out; |
77 |
+#ifdef HAVE_SWSCALER |
78 |
+ // We need a context for swscale |
79 |
+ struct SwsContext *convert_ctx; |
80 |
+#endif |
81 |
init_picture_from_frame(&picture_out, frame_out); |
82 |
int cmodel_out = frame_out->get_color_model(); |
83 |
PixelFormat pix_fmt_out = color_model_to_pix_fmt(cmodel_out); |
84 |
|
85 |
// do conversion within libavcodec if possible |
86 |
if (pix_fmt_out != PIX_FMT_NB) { |
87 |
- int result = img_convert(&picture_out, |
88 |
+ int result; |
89 |
+#ifndef HAVE_SWSCALER |
90 |
+ result = img_convert(&picture_out, |
91 |
pix_fmt_out, |
92 |
picture_in, |
93 |
pix_fmt_in, |
94 |
@@ -218,6 +253,28 @@ int FFMPEG::convert_cmodel(AVPicture *pi |
95 |
if (result) { |
96 |
printf("FFMPEG::convert_cmodel img_convert() failed\n"); |
97 |
} |
98 |
+#else |
99 |
+ convert_ctx = sws_getContext(width_in, height_in,pix_fmt_in, |
100 |
+ frame_out->get_w(),frame_out->get_h(),pix_fmt_out, |
101 |
+ SWS_BICUBIC, NULL, NULL, NULL); |
102 |
+ |
103 |
+ if(convert_ctx == NULL){ |
104 |
+ printf("FFMPEG::convert_cmodel : swscale context initialization failed\n"); |
105 |
+ return 1; |
106 |
+ } |
107 |
+ |
108 |
+ result = sws_scale(convert_ctx, |
109 |
+ picture_in->data, picture_in->linesize, |
110 |
+ 0, 0, |
111 |
+ picture_out.data, picture_out.linesize); |
112 |
+ |
113 |
+ |
114 |
+ sws_freeContext(convert_ctx); |
115 |
+ |
116 |
+ if(result){ |
117 |
+ printf("FFMPEG::convert_cmodel sws_scale() failed\n"); |
118 |
+ } |
119 |
+#endif |
120 |
return result; |
121 |
} |
122 |
|
123 |
Index: cinelerra-cvs/cinelerra/ffmpeg.h |
124 |
=================================================================== |
125 |
--- cinelerra-cvs.orig/cinelerra/ffmpeg.h |
126 |
+++ cinelerra-cvs/cinelerra/ffmpeg.h |
127 |
@@ -3,6 +3,9 @@ |
128 |
|
129 |
extern "C" { |
130 |
#include <avcodec.h> |
131 |
+#ifdef HAVE_SWSCALER |
132 |
+#include <swscale.h> |
133 |
+#endif |
134 |
}; |
135 |
|
136 |
#include "asset.h" |
137 |
Index: cinelerra-cvs/configure.in |
138 |
=================================================================== |
139 |
--- cinelerra-cvs.orig/configure.in |
140 |
+++ cinelerra-cvs/configure.in |
141 |
@@ -341,10 +341,33 @@ AC_SUBST(CPU_CFLAGS) |
142 |
############ external ffmpeg |
143 |
AC_ARG_WITH([external-ffmpeg], AC_HELP_STRING([--with-external-ffmpeg], [use external ffmpeg library])) |
144 |
|
145 |
+AH_TEMPLATE(HAVE_SWSCALER, [Define to 1 if swscaler is available in ffmpeg.]) |
146 |
+ |
147 |
if test "x$with_external_ffmpeg" = "xyes"; then |
148 |
- PKG_CHECK_MODULES([FFMPEG], [libavcodec libpostproc]) |
149 |
+ PKG_CHECK_MODULES([FFMPEG_TEMP], [libavcodec libpostproc]) |
150 |
FFMPEG_FOLDER="" |
151 |
FFMPEG_EXTERNALTEXT="External ffmpeg" |
152 |
+ |
153 |
+ dnl -------------------------------------------------------------- |
154 |
+ dnl check if libavcodec contains img_convert |
155 |
+ dnl that means that libswscale is compiled in |
156 |
+ |
157 |
+ AC_MSG_CHECKING(for ffmpeg swscale support) |
158 |
+ saved_LIBS="$LIBS" |
159 |
+ LIBS="$saved_LIBS $FFMPEG_TEMP_LIBS" |
160 |
+ AC_TRY_LINK([#include <ffmpeg/avcodec.h>], |
161 |
+ [img_convert(0, 0, 0,0,0,0)], |
162 |
+ enable_ffmpeg_swscale=no,enable_ffmpeg_swscale=yes) |
163 |
+ LIBS="$saved_LIBS" |
164 |
+ AC_MSG_RESULT($enable_ffmpeg_swscale) |
165 |
+ |
166 |
+ if test x"$enable_ffmpeg_swscale" == xyes; then |
167 |
+ AC_DEFINE(HAVE_SWSCALER) |
168 |
+ PKG_CHECK_MODULES([FFMPEG], [libavcodec libpostproc libswscale]) |
169 |
+ else |
170 |
+ PKG_CHECK_MODULES([FFMPEG], [libavcodec libpostproc]) |
171 |
+ fi |
172 |
+ |
173 |
else |
174 |
FFMPEG_FOLDER=ffmpeg |
175 |
FFMPEG_CFLAGS="-I\$(top_srcdir)/quicktime/ffmpeg/libavcodec" |
176 |
|
177 |
|
178 |
|
179 |
1.1 media-video/cinelerra-cvs/files/digest-cinelerra-cvs-20080115 |
180 |
|
181 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/media-video/cinelerra-cvs/files/digest-cinelerra-cvs-20080115?rev=1.1&view=markup |
182 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/media-video/cinelerra-cvs/files/digest-cinelerra-cvs-20080115?rev=1.1&content-type=text/plain |
183 |
|
184 |
Index: digest-cinelerra-cvs-20080115 |
185 |
=================================================================== |
186 |
MD5 8f99b362101d2828f76e00e36b48c233 cinelerra-cvs-20080115.tar.bz2 31231763 |
187 |
RMD160 41bc0a88e12f91aabca278ea05dde04d6632a3e0 cinelerra-cvs-20080115.tar.bz2 31231763 |
188 |
SHA256 3ada71b7632379e9aca2ff335a038f73e36965e97df23551f788cc307081957c cinelerra-cvs-20080115.tar.bz2 31231763 |
189 |
|
190 |
|
191 |
|
192 |
-- |
193 |
gentoo-commits@l.g.o mailing list |