slang: make install-static do install-pkgconfig
[buildroot-gz.git] / package / mediastreamer / 0001-misc-fixes.patch
blob84c99483d4fc1d87b4a42c402212ff8ba9ee692a
1 Fix linphone compile with newer ffmpeg versions, downloaded from
2 https://github.com/dankamongmen/mediastreamer2/commit/4f438eb8e132a3119284be771e0daad143597ebd
4 Fixes
5 http://autobuild.buildroot.net/results/b72/b72b1f6287986af3d686cc3c8b9c1b3fd9419d29/
7 Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
10 From 4f438eb8e132a3119284be771e0daad143597ebd Mon Sep 17 00:00:00 2001
11 From: nick black <nick.black@sprezzatech.com>
12 Date: Mon, 28 Jan 2013 23:54:17 -0500
13 Subject: [PATCH] adapt to new libav API
15 ---
16 src/utils/ffmpeg-priv.h | 1 +
17 src/videofilters/h264dec.c | 6 +++---
18 src/videofilters/jpegwriter.c | 6 +++---
19 src/videofilters/nowebcam.c | 6 +++---
20 src/videofilters/videodec.c | 8 ++++----
21 src/videofilters/videoenc.c | 6 +++---
22 6 files changed, 17 insertions(+), 16 deletions(-)
24 diff --git a/src/utils/ffmpeg-priv.h b/src/utils/ffmpeg-priv.h
25 index 0eab098..a405c05 100644
26 --- a/src/utils/ffmpeg-priv.h
27 +++ b/src/utils/ffmpeg-priv.h
28 @@ -35,6 +35,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 /* new layout */
30 # include <libavcodec/avcodec.h>
31 # include <libavutil/avutil.h>
32 +# include <libavutil/mem.h>
33 #else
34 /* old layout */
35 # include <ffmpeg/avcodec.h>
36 diff --git a/src/videofilters/h264dec.c b/src/videofilters/h264dec.c
37 index 5229b5e..7059634 100644
38 --- a/src/videofilters/h264dec.c
39 +++ b/src/videofilters/h264dec.c
40 @@ -58,10 +58,10 @@ static void dec_open(DecData *d){
41 int error;
42 codec=avcodec_find_decoder(CODEC_ID_H264);
43 if (codec==NULL) ms_fatal("Could not find H264 decoder in ffmpeg.");
44 - avcodec_get_context_defaults(&d->av_context);
45 - error=avcodec_open(&d->av_context,codec);
46 + avcodec_get_context_defaults3(&d->av_context, codec);
47 + error=avcodec_open2(&d->av_context,codec, NULL);
48 if (error!=0){
49 - ms_fatal("avcodec_open() failed.");
50 + ms_fatal("avcodec_open2() failed.");
54 diff --git a/src/videofilters/jpegwriter.c b/src/videofilters/jpegwriter.c
55 index cca79c5..daf3cdb 100644
56 --- a/src/videofilters/jpegwriter.c
57 +++ b/src/videofilters/jpegwriter.c
58 @@ -90,7 +90,7 @@ static void jpg_process(MSFilter *f){
59 mblk_t *jpegm;
60 struct SwsContext *sws_ctx;
62 - AVCodecContext *avctx=avcodec_alloc_context();
63 + AVCodecContext *avctx=avcodec_alloc_context3(NULL);
65 avctx->width=yuvbuf.w;
66 avctx->height=yuvbuf.h;
67 @@ -98,9 +98,9 @@ static void jpg_process(MSFilter *f){
68 avctx->time_base.den =1;
69 avctx->pix_fmt=PIX_FMT_YUVJ420P;
71 - error=avcodec_open(avctx,s->codec);
72 + error=avcodec_open2(avctx,s->codec,NULL);
73 if (error!=0) {
74 - ms_error("avcodec_open() failed: %i",error);
75 + ms_error("avcodec_open2() failed: %i",error);
76 cleanup(s,NULL);
77 av_free(avctx);
78 return;
79 diff --git a/src/videofilters/nowebcam.c b/src/videofilters/nowebcam.c
80 index f1c10de..b45f89f 100644
81 --- a/src/videofilters/nowebcam.c
82 +++ b/src/videofilters/nowebcam.c
83 @@ -68,9 +68,9 @@ static mblk_t *jpeg2yuv(uint8_t *jpgbuf, int bufsize, MSVideoSize *reqsize){
84 return NULL;
87 - avcodec_get_context_defaults(&av_context);
88 - if (avcodec_open(&av_context,codec)<0){
89 - ms_error("jpeg2yuv: avcodec_open failed");
90 + avcodec_get_context_defaults3(&av_context,NULL);
91 + if (avcodec_open2(&av_context,codec,NULL)<0){
92 + ms_error("jpeg2yuv: avcodec_open2 failed");
93 return NULL;
95 av_init_packet(&pkt);
96 diff --git a/src/videofilters/videodec.c b/src/videofilters/videodec.c
97 index 9807214..2f1b452 100644
98 --- a/src/videofilters/videodec.c
99 +++ b/src/videofilters/videodec.c
100 @@ -53,7 +53,7 @@ static void dec_init(MSFilter *f, enum CodecID cid){
101 DecState *s=(DecState *)ms_new0(DecState,1);
102 ms_ffmpeg_check_init();
104 - avcodec_get_context_defaults(&s->av_context);
105 + avcodec_get_context_defaults3(&s->av_context,NULL);
106 s->av_codec=NULL;
107 s->codec=cid;
108 s->input=NULL;
109 @@ -135,7 +135,7 @@ static void dec_preprocess(MSFilter *f){
110 if (s->av_context.codec==NULL){
111 /* we must know picture size before initializing snow decoder*/
112 if (s->codec!=CODEC_ID_SNOW){
113 - error=avcodec_open(&s->av_context, s->av_codec);
114 + error=avcodec_open2(&s->av_context, s->av_codec, NULL);
115 if (error!=0) ms_error("avcodec_open() failed: %i",error);
116 if (s->codec==CODEC_ID_MPEG4 && s->dci_size>0){
117 s->av_context.extradata=s->dci;
118 @@ -225,8 +225,8 @@ static mblk_t * parse_snow_header(DecState *s,mblk_t *inm){
119 int error;
120 s->av_context.width=h>>16;
121 s->av_context.height=h&0xffff;
122 - error=avcodec_open(&s->av_context, s->av_codec);
123 - if (error!=0) ms_error("avcodec_open() failed for snow: %i",error);
124 + error=avcodec_open2(&s->av_context, s->av_codec, NULL);
125 + if (error!=0) ms_error("avcodec_open2() failed for snow: %i",error);
126 else {
127 s->snow_initialized=TRUE;
128 ms_message("Snow decoder initialized,size=%ix%i",
129 diff --git a/src/videofilters/videoenc.c b/src/videofilters/videoenc.c
130 index da35592..4101772 100644
131 --- a/src/videofilters/videoenc.c
132 +++ b/src/videofilters/videoenc.c
133 @@ -242,7 +242,7 @@ static void prepare(EncState *s){
134 AVCodecContext *c=&s->av_context;
135 const int max_br_vbv=128000;
137 - avcodec_get_context_defaults(c);
138 + avcodec_get_context_defaults3(c,NULL);
139 if (s->codec==CODEC_ID_MJPEG)
141 ms_message("Codec bitrate set to %i",c->bit_rate);
142 @@ -348,9 +348,9 @@ static void enc_preprocess(MSFilter *f){
143 ms_error("could not find encoder for codec id %i",s->codec);
144 return;
146 - error=avcodec_open(&s->av_context, s->av_codec);
147 + error=avcodec_open2(&s->av_context, s->av_codec, NULL);
148 if (error!=0) {
149 - ms_error("avcodec_open() failed: %i",error);
150 + ms_error("avcodec_open2() failed: %i",error);
151 return;
153 video_starter_init(&s->starter);
155 2.0.3