]> git.pld-linux.org Git - packages/sox.git/blob - sox-ffmpeg.patch
- release 2 (by relup.sh)
[packages/sox.git] / sox-ffmpeg.patch
1 --- sox-14.4.1/src/ffmpeg.c.orig        2013-08-28 21:02:16.835128774 +0200
2 +++ sox-14.4.1/src/ffmpeg.c     2013-08-28 21:17:33.048423663 +0200
3 @@ -98,7 +98,7 @@
4    ic->error_recognition = 1;
5  #endif
6  
7 -  if (!codec || avcodec_open(enc, codec) < 0)
8 +  if (!codec || avcodec_open2(enc, codec, NULL) < 0)
9      return -1;
10    if (enc->codec_type != AVMEDIA_TYPE_AUDIO) {
11      lsx_fail("ffmpeg CODEC %x is not an audio CODEC", enc->codec_type);
12 @@ -163,7 +163,7 @@
13    int ret;
14    int i;
15  
16 -  ffmpeg->audio_buf_raw = lsx_calloc(1, (size_t)AVCODEC_MAX_AUDIO_FRAME_SIZE + 32);
17 +  ffmpeg->audio_buf_raw = lsx_calloc(1, (size_t)192000 /* AVCODEC_MAX_AUDIO_FRAME_SIZE */ + 32);
18    ffmpeg->audio_buf_aligned = ALIGN16(ffmpeg->audio_buf_raw);
19  
20    /* Signal audio stream not found */
21 @@ -235,7 +235,7 @@
22        if ((ret = av_read_frame(ffmpeg->ctxt, pkt)) < 0 &&
23           (ret == AVERROR_EOF || ( ffmpeg->ctxt->pb && ffmpeg->ctxt->pb->error)))
24         break;
25 -      ffmpeg->audio_buf_size = audio_decode_frame(ffmpeg, ffmpeg->audio_buf_aligned, AVCODEC_MAX_AUDIO_FRAME_SIZE);
26 +      ffmpeg->audio_buf_size = audio_decode_frame(ffmpeg, ffmpeg->audio_buf_aligned, 192000 /* AVCODEC_MAX_AUDIO_FRAME_SIZE */ );
27        ffmpeg->audio_buf_index = 0;
28      }
29  
30 @@ -269,7 +269,7 @@
31  /*
32   * add an audio output stream
33   */
34 -static AVStream *add_audio_stream(sox_format_t * ft, AVFormatContext *oc, enum CodecID codec_id)
35 +static AVStream *add_audio_stream(sox_format_t * ft, AVFormatContext *oc, enum AVCodecID codec_id)
36  {
37    AVCodecContext *c;
38    AVStream *st;
39 @@ -308,18 +308,18 @@
40    }
41  
42    /* open it */
43 -  if (avcodec_open(c, codec) < 0) {
44 +  if (avcodec_open2(c, codec, NULL) < 0) {
45      lsx_fail("ffmpeg could not open CODEC");
46      return SOX_EOF;
47    }
48  
49 -  ffmpeg->audio_buf_raw = lsx_malloc((size_t)AVCODEC_MAX_AUDIO_FRAME_SIZE + 32);
50 +  ffmpeg->audio_buf_raw = lsx_malloc((size_t)192000 /* AVCODEC_MAX_AUDIO_FRAME_SIZE */ + 32);
51    ffmpeg->audio_buf_aligned = ALIGN16(ffmpeg->audio_buf_raw);
52  
53    /* ugly hack for PCM codecs (will be removed ASAP with new PCM
54       support to compute the input frame size in samples */
55    if (c->frame_size <= 1) {
56 -    ffmpeg->audio_input_frame_size = AVCODEC_MAX_AUDIO_FRAME_SIZE / c->channels;
57 +    ffmpeg->audio_input_frame_size = 192000 /* AVCODEC_MAX_AUDIO_FRAME_SIZE */ / c->channels;
58      switch(st->codec->codec_id) {
59      case CODEC_ID_PCM_S16LE:
60      case CODEC_ID_PCM_S16BE:
61 @@ -423,7 +423,7 @@
62        AVPacket pkt;
63  
64        av_init_packet(&pkt);
65 -      pkt.size = avcodec_encode_audio(c, ffmpeg->audio_buf_aligned, AVCODEC_MAX_AUDIO_FRAME_SIZE, ffmpeg->samples);
66 +      pkt.size = avcodec_encode_audio(c, ffmpeg->audio_buf_aligned, 192000 /* AVCODEC_MAX_AUDIO_FRAME_SIZE */, ffmpeg->samples);
67        pkt.pts = av_rescale_q(c->coded_frame->pts, c->time_base, ffmpeg->audio_st->time_base);
68        pkt.flags |= AV_PKT_FLAG_KEY;
69        pkt.stream_index = ffmpeg->audio_st->index;
This page took 0.067138 seconds and 3 git commands to generate.