summaryrefslogtreecommitdiff
blob: 0b335e282cfd726bfdba082cacb1089c713cef81 (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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
diff -urb mediastreamer-2.8.2.old/src/h264dec.c mediastreamer-2.8.2/src/h264dec.c
--- mediastreamer-2.8.2.old/src/h264dec.c	2013-06-22 19:13:24.649838347 +0200
+++ mediastreamer-2.8.2/src/h264dec.c	2013-06-22 19:20:52.044822431 +0200
@@ -55,10 +55,10 @@
 	int error;
 	codec=avcodec_find_decoder(CODEC_ID_H264);
 	if (codec==NULL) ms_fatal("Could not find H264 decoder in ffmpeg.");
-	avcodec_get_context_defaults(&d->av_context);
-	error=avcodec_open(&d->av_context,codec);
+	avcodec_get_context_defaults3(&d->av_context, NULL);
+	error=avcodec_open2(&d->av_context,codec, NULL);
 	if (error!=0){
-		ms_fatal("avcodec_open() failed.");
+		ms_fatal("avcodec_open2() failed.");
 	}
 }
 
diff -urb mediastreamer-2.8.2.old/src/jpegwriter.c mediastreamer-2.8.2/src/jpegwriter.c
--- mediastreamer-2.8.2.old/src/jpegwriter.c	2013-06-22 19:13:24.649838347 +0200
+++ mediastreamer-2.8.2/src/jpegwriter.c	2013-06-22 19:17:57.087828655 +0200
@@ -90,7 +90,7 @@
 			mblk_t *jpegm;
 			struct SwsContext *sws_ctx;
 			
-			AVCodecContext *avctx=avcodec_alloc_context();
+			AVCodecContext *avctx=avcodec_alloc_context3(NULL);
 			
 			avctx->width=yuvbuf.w;
 			avctx->height=yuvbuf.h;
@@ -98,9 +98,9 @@
 			avctx->time_base.den =1;
 			avctx->pix_fmt=PIX_FMT_YUVJ420P;
 
-			error=avcodec_open(avctx,s->codec);
+			error=avcodec_open2(avctx,s->codec,NULL);
 			if (error!=0) {
-				ms_error("avcodec_open() failed: %i",error);
+				ms_error("avcodec_open2() failed: %i",error);
 				cleanup(s,NULL);
 				av_free(avctx);
 				return;
diff -urb mediastreamer-2.8.2.old/src/nowebcam.c mediastreamer-2.8.2/src/nowebcam.c
--- mediastreamer-2.8.2.old/src/nowebcam.c	2013-06-22 19:13:24.652838347 +0200
+++ mediastreamer-2.8.2/src/nowebcam.c	2013-06-22 19:20:43.198822745 +0200
@@ -68,9 +68,9 @@
 		return NULL;
 	}
 
-	avcodec_get_context_defaults(&av_context);
-	if (avcodec_open(&av_context,codec)<0){
-		ms_error("jpeg2yuv: avcodec_open failed");
+	avcodec_get_context_defaults3(&av_context, NULL);
+	if (avcodec_open2(&av_context,codec,NULL)<0){
+		ms_error("jpeg2yuv: avcodec_open2 failed");
 		return NULL;
 	}
 	av_init_packet(&pkt);
diff -urb mediastreamer-2.8.2.old/src/videodec.c mediastreamer-2.8.2/src/videodec.c
--- mediastreamer-2.8.2.old/src/videodec.c	2013-06-22 19:13:24.654838347 +0200
+++ mediastreamer-2.8.2/src/videodec.c	2013-06-22 19:28:58.436805127 +0200
@@ -52,7 +52,7 @@
 	DecState *s=(DecState *)ms_new0(DecState,1);
 	ms_ffmpeg_check_init();
 	
-	avcodec_get_context_defaults(&s->av_context);
+	avcodec_get_context_defaults3(&s->av_context, NULL);
 	s->av_codec=NULL;
 	s->codec=cid;
 	s->input=NULL;
@@ -133,8 +133,8 @@
 	if (s->av_context.codec==NULL){
 		/* we must know picture size before initializing snow decoder*/
 		if (s->codec!=CODEC_ID_SNOW){
-			error=avcodec_open(&s->av_context, s->av_codec);
-			if (error!=0) ms_error("avcodec_open() failed: %i",error);
+			error=avcodec_open2(&s->av_context, s->av_codec,NULL);
+			if (error!=0) ms_error("avcodec_open2() failed: %i",error);
 			if (s->codec==CODEC_ID_MPEG4 && s->dci_size>0){
 				s->av_context.extradata=s->dci;
 				s->av_context.extradata_size=s->dci_size;
@@ -223,8 +223,8 @@
 			int error;
 			s->av_context.width=h>>16;
 			s->av_context.height=h&0xffff;
-			error=avcodec_open(&s->av_context, s->av_codec);
-			if (error!=0) ms_error("avcodec_open() failed for snow: %i",error);
+			error=avcodec_open2(&s->av_context, s->av_codec, NULL);
+			if (error!=0) ms_error("avcodec_open2() failed for snow: %i",error);
 			else {
 				s->snow_initialized=TRUE;
 				ms_message("Snow decoder initialized,size=%ix%i",
diff -urb mediastreamer-2.8.2.old/src/videoenc.c mediastreamer-2.8.2/src/videoenc.c
--- mediastreamer-2.8.2.old/src/videoenc.c	2013-06-22 19:13:24.654838347 +0200
+++ mediastreamer-2.8.2/src/videoenc.c	2013-06-22 19:20:19.732823580 +0200
@@ -236,7 +236,7 @@
 	AVCodecContext *c=&s->av_context;
 	const int max_br_vbv=128000;
 
-	avcodec_get_context_defaults(c);
+	avcodec_get_context_defaults3(c, NULL);
 	if (s->codec==CODEC_ID_MJPEG)
 	{
 		ms_message("Codec bitrate set to %i",c->bit_rate);
@@ -342,9 +342,9 @@
 		ms_error("could not find encoder for codec id %i",s->codec);
 		return;
 	}
-	error=avcodec_open(&s->av_context, s->av_codec);
+	error=avcodec_open2(&s->av_context, s->av_codec, NULL);
 	if (error!=0) {
-		ms_error("avcodec_open() failed: %i",error);
+		ms_error("avcodec_open2() failed: %i",error);
 		return;
 	}
 	video_starter_init(&s->starter);