Date: Sunday, July 23, 2017 @ 09:00:46 Author: arojas Revision: 301182
Port away from removed ffmpeg API (FS#54907) Modified: transcode/trunk/PKGBUILD transcode/trunk/transcode-1.1.7-ffmpeg29.patch --------------------------------+ PKGBUILD | 6 +-- transcode-1.1.7-ffmpeg29.patch | 66 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 3 deletions(-) Modified: PKGBUILD =================================================================== --- PKGBUILD 2017-07-22 23:20:40 UTC (rev 301181) +++ PKGBUILD 2017-07-23 09:00:46 UTC (rev 301182) @@ -6,7 +6,7 @@ pkgname=transcode _sripver=0.3-4 pkgver=1.1.7 -pkgrel=22 +pkgrel=23 pkgdesc="A video/DVD ripper and encoder for the terminal/console" arch=('i686' 'x86_64') url="http://www.transcoding.org/" @@ -26,7 +26,7 @@ transcode-1.1.7-preset-force.patch transcode-1.1.7-ffmpeg2.patch transcode-1.1.7-ffmpeg-2.4.patch - transcode-1.1.7-ffmpeg29.patch + transcode-1.1.7-ffmpeg29.patch # rpmfusion transcode-ffmpeg3.patch) sha1sums=('e35df68b960eb56ef0a59a4cdbed1491be56aee6' 'd93ff3578dd5f722c8f4ef16bc0903eec5781a0d' @@ -40,7 +40,7 @@ '034853427bc784a80b333d2e2f4bab44f0b86ce0' '764de67996e2c4947346c7a91586cc4ca826a8e2' 'b590dfc30cdc4bc2a6825de247928b46a8928a9a' - '0e8769c1e8ec9f0ed87266c404ba13560db3578d' + 'f034f9871a0e96d5aa682b69451961f3dd9c7309' '6aefa6a13fa70f8cc92ed03dd5383a4adcd4a6d0') prepare() { Modified: transcode-1.1.7-ffmpeg29.patch =================================================================== --- transcode-1.1.7-ffmpeg29.patch 2017-07-22 23:20:40 UTC (rev 301181) +++ transcode-1.1.7-ffmpeg29.patch 2017-07-23 09:00:46 UTC (rev 301182) @@ -350,3 +350,69 @@ src_fmt = IMG_YUV444P; YUV_INIT_PLANES(src_planes, frame, src_fmt, lavc_dec_context->width, lavc_dec_context->height); +Index: transcode-1.1.7/export/aud_aux.c +=================================================================== +--- transcode-1.1.7.orig/export/aud_aux.c ++++ transcode-1.1.7/export/aud_aux.c +@@ -846,6 +846,9 @@ static int tc_audio_encode_ffmpeg(char * + #ifdef HAVE_FFMPEG + int in_size, out_size; + char *in_buf; ++ int got_packet; ++ AVPacket avpkt = { 0 }; ++ AVFrame *frame = av_frame_alloc(); + + //-- input buffer and amount of bytes -- + in_size = aud_size; +@@ -866,10 +869,14 @@ static int tc_audio_encode_ffmpeg(char * + + ac_memcpy(&mpa_buf[mpa_buf_ptr], in_buf, bytes_needed); + ++ frame->nb_samples = mpa_ctx.frame_size; ++ avcodec_fill_audio_frame(frame, mpa_ctx.channels, mpa_ctx.sample_fmt, (const uint8_t *)mpa_buf, mpa_bytes_pf, 1); ++ avpkt.data = output; ++ avpkt.size = OUTPUT_SIZE; + TC_LOCK_LIBAVCODEC; +- out_size = avcodec_encode_audio(&mpa_ctx, (unsigned char *)output, +- OUTPUT_SIZE, (short *)mpa_buf); ++ out_size = avcodec_encode_audio2(&mpa_ctx, &avpkt, frame, &got_packet); + TC_UNLOCK_LIBAVCODEC; ++ out_size = avpkt.size; + tc_audio_write(output, out_size, avifile); + + in_size -= bytes_needed; +@@ -884,6 +891,7 @@ static int tc_audio_encode_ffmpeg(char * + + ac_memcpy(&mpa_buf[mpa_buf_ptr], aud_buffer, bytes_avail); + mpa_buf_ptr += bytes_avail; ++ av_frame_free(&frame); + return (0); + } + } //bytes availabe from last call? +@@ -893,10 +901,15 @@ static int tc_audio_encode_ffmpeg(char * + //---------------------------------------------------- + + while (in_size >= mpa_bytes_pf) { ++ av_frame_unref(frame); ++ frame->nb_samples = mpa_ctx.frame_size; ++ avcodec_fill_audio_frame(frame, mpa_ctx.channels, mpa_ctx.sample_fmt, (const uint8_t *)in_buf, mpa_bytes_pf, 1); ++ avpkt.data = output; ++ avpkt.size = OUTPUT_SIZE; + TC_LOCK_LIBAVCODEC; +- out_size = avcodec_encode_audio(&mpa_ctx, (unsigned char *)output, +- OUTPUT_SIZE, (short *)in_buf); ++ out_size = avcodec_encode_audio2(&mpa_ctx, &avpkt, frame, &got_packet); + TC_UNLOCK_LIBAVCODEC; ++ out_size = avpkt.size; + + tc_audio_write(output, out_size, avifile); + +@@ -904,6 +917,8 @@ static int tc_audio_encode_ffmpeg(char * + in_buf += mpa_bytes_pf; + } + ++ av_frame_free(&frame); ++ + //-- hold rest of bytes in mpa-buffer -- + //-------------------------------------- + if (in_size > 0) {