summaryrefslogtreecommitdiff
blob: d72aa04533ddd35bacdfb8e887573764be14d646 (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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
Index: squeezeslave-1.1_p381/src/slimaudio/slimaudio_decoder.c
===================================================================
--- squeezeslave-1.1_p381.orig/src/slimaudio/slimaudio_decoder.c
+++ squeezeslave-1.1_p381/src/slimaudio/slimaudio_decoder.c
@@ -69,7 +69,6 @@ void av_lib_setup (void)
 		av_register_all();
 		DEBUGF("decoder_thread: av_register_all\n");
 
-		avcodec_init();
 		avcodec_register_all();
 		DEBUGF("decoder_thread: avcodec_register_all\n");
 
Index: squeezeslave-1.1_p381/src/slimaudio/slimaudio_decoder_aac.c
===================================================================
--- squeezeslave-1.1_p381.orig/src/slimaudio/slimaudio_decoder_aac.c
+++ squeezeslave-1.1_p381/src/slimaudio/slimaudio_decoder_aac.c
@@ -47,6 +47,11 @@
 
 #define AUDIO_INBUF_SIZE (AUDIO_CHUNK_SIZE*2)
 
+#ifndef AVCODEC_MAX_AUDIO_FRAME_SIZE
+#define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio
+#endif
+
+
 int slimaudio_decoder_aac_init(slimaudio_t *audio)
 {
 	av_lib_setup();
@@ -164,7 +169,7 @@ int slimaudio_decoder_aac_process(slimau
 	}
 	else
 	{
-		AVIOCtx->is_streamed = 1;
+		AVIOCtx->seekable = 0;
 	}
 
 	AVInputFormat* pAVInputFormat = av_find_input_format(streamformat);
@@ -199,7 +204,7 @@ int slimaudio_decoder_aac_process(slimau
 	}
 	else
 	{
-		iRC = av_find_stream_info(pFormatCtx);
+		iRC = avformat_find_stream_info(pFormatCtx, NULL);
 		if ( iRC < 0 )
 		{
 			DEBUGF("aac: find stream info failed:%d\n", iRC);
@@ -236,7 +241,7 @@ int slimaudio_decoder_aac_process(slimau
 	} 
 	
 	/* Open codec */
-	iRC = avcodec_open(pCodecCtx, pCodec);
+	iRC = avcodec_open2(pCodecCtx, pCodec, NULL);
 	if ( iRC < 0)
 	{
 		DEBUGF("aac: could not open codec:%d\n", iRC);
@@ -274,7 +279,7 @@ int slimaudio_decoder_aac_process(slimau
 				eos=true;
 			}
 
-			if ( url_ferror(pFormatCtx->pb) )
+			if ( pFormatCtx->pb && pFormatCtx->pb->error )
 			{
 				DEBUGF("aac: url_ferror\n");
 #if 0
@@ -312,7 +317,7 @@ int slimaudio_decoder_aac_process(slimau
 
 	/* Close the stream */
 	DEBUGF ("aac: av_close_input_stream\n");
-	av_close_input_stream(pFormatCtx);
+	avformat_close_input(&pFormatCtx);
 
 	return 0;
 }
Index: squeezeslave-1.1_p381/src/slimaudio/slimaudio_decoder_wma.c
===================================================================
--- squeezeslave-1.1_p381.orig/src/slimaudio/slimaudio_decoder_wma.c
+++ squeezeslave-1.1_p381/src/slimaudio/slimaudio_decoder_wma.c
@@ -47,6 +47,10 @@
 
 #define AUDIO_INBUF_SIZE (AUDIO_CHUNK_SIZE*2)
 
+#ifndef AVCODEC_MAX_AUDIO_FRAME_SIZE
+#define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio
+#endif
+
 int slimaudio_decoder_wma_init(slimaudio_t *audio)
 {
 	av_lib_setup();
@@ -159,7 +163,7 @@ int slimaudio_decoder_wma_process(slimau
 	}
 	else
 	{
-		AVIOCtx->is_streamed = 1;
+		AVIOCtx->seekable = 1;
 	}
 
 	AVInputFormat* pAVInputFormat = av_find_input_format(streamformat);
@@ -194,7 +198,7 @@ int slimaudio_decoder_wma_process(slimau
 	}
 	else
 	{
-		iRC = av_find_stream_info(pFormatCtx);
+		iRC = avformat_find_stream_info(pFormatCtx,NULL);
 		if ( iRC < 0 )
 		{
 			DEBUGF("wma: find stream info failed:%d\n", iRC);
@@ -231,7 +235,7 @@ int slimaudio_decoder_wma_process(slimau
 	} 
 	
 	/* Open codec */
-	iRC = avcodec_open(pCodecCtx, pCodec);
+	iRC = avcodec_open2(pCodecCtx, pCodec, NULL);
 	if ( iRC < 0)
 	{
 		DEBUGF("wma: could not open codec:%d\n", iRC);
@@ -270,7 +274,7 @@ int slimaudio_decoder_wma_process(slimau
 				eos=true;
 			}
 
-			if ( url_ferror(pFormatCtx->pb) )
+			if ( pFormatCtx->pb && pFormatCtx->pb->error )
 			{
 				DEBUGF("wma: url_ferror\n");
 #if 0
@@ -308,7 +312,7 @@ int slimaudio_decoder_wma_process(slimau
 
 	/* Close the stream */
 	DEBUGF ("wma: av_close_input_stream\n");
-	av_close_input_stream(pFormatCtx);
+	avformat_close_input(&pFormatCtx);
 
 	return 0;
 }