|
@@ -20,7 +20,25 @@
|
20
|
20
|
return -1;
|
21
|
21
|
if (enc->codec_type != AVMEDIA_TYPE_AUDIO) {
|
22
|
22
|
lsx_fail("ffmpeg CODEC %x is not an audio CODEC", enc->codec_type);
|
23
|
|
-@@ -267,7 +271,11 @@ static int stopread(sox_format_t * ft)
|
|
23
|
+@@ -178,7 +182,7 @@ static int startread(sox_format_t * ft)
|
|
24
|
+ }
|
|
25
|
+
|
|
26
|
+ /* Get CODEC parameters */
|
|
27
|
+- if ((ret = av_find_stream_info(ffmpeg->ctxt)) < 0) {
|
|
28
|
++ if ((ret = avformat_find_stream_info(ffmpeg->ctxt, NULL)) < 0) {
|
|
29
|
+ lsx_fail("ffmpeg could not find CODEC parameters for %s", ft->filename);
|
|
30
|
+ return SOX_EOF;
|
|
31
|
+ }
|
|
32
|
+@@ -256,7 +260,7 @@ static int stopread(sox_format_t * ft)
|
|
33
|
+ if (ffmpeg->audio_stream >= 0)
|
|
34
|
+ stream_component_close(ffmpeg, ffmpeg->audio_stream);
|
|
35
|
+ if (ffmpeg->ctxt) {
|
|
36
|
+- av_close_input_file(ffmpeg->ctxt);
|
|
37
|
++ avformat_close_input(&ffmpeg->ctxt);
|
|
38
|
+ ffmpeg->ctxt = NULL; /* safety */
|
|
39
|
+ }
|
|
40
|
+
|
|
41
|
+@@ -267,16 +271,21 @@ static int stopread(sox_format_t * ft)
|
24
|
42
|
/*
|
25
|
43
|
* add an audio output stream
|
26
|
44
|
*/
|
|
@@ -32,7 +50,18 @@
|
32
|
50
|
{
|
33
|
51
|
AVCodecContext *c;
|
34
|
52
|
AVStream *st;
|
35
|
|
-@@ -306,7 +314,7 @@ static int open_audio(priv_t * ffmpeg, A
|
|
53
|
+
|
|
54
|
+- st = av_new_stream(oc, 1);
|
|
55
|
++ st = avformat_new_stream(oc, NULL);
|
|
56
|
+ if (!st) {
|
|
57
|
+ lsx_fail("ffmpeg could not alloc stream");
|
|
58
|
+ return NULL;
|
|
59
|
+ }
|
|
60
|
++ st->id = 1;
|
|
61
|
+
|
|
62
|
+ c = st->codec;
|
|
63
|
+ c->codec_id = codec_id;
|
|
64
|
+@@ -306,7 +315,7 @@ static int open_audio(priv_t * ffmpeg, A
|
36
|
65
|
}
|
37
|
66
|
|
38
|
67
|
/* open it */
|