> Plus the diff itself is mangled, probably by gmail. New patch attached and sent via mutt.
-- Regards, Brad DeMorrow
Index: audio/pianobar/Makefile =================================================================== RCS file: /cvs/ports/audio/pianobar/Makefile,v retrieving revision 1.88 diff -u -p -u -r1.88 Makefile --- audio/pianobar/Makefile 12 Jul 2019 20:43:39 -0000 1.88 +++ audio/pianobar/Makefile 16 Dec 2019 15:13:52 -0000 @@ -2,8 +2,8 @@ COMMENT = command-line client for Pandora Internet Radio -DISTNAME = pianobar-2017.08.30 -REVISION = 1 +DISTNAME = pianobar-2019.02.14 +REVISION = 0 EXTRACT_SUFX = .tar.bz2 CATEGORIES = audio @@ -11,7 +11,7 @@ HOMEPAGE = https://6xq.net/pianobar/ MASTER_SITES = ${HOMEPAGE} -SHARED_LIBS = piano 9.0 # 0.0.0 +SHARED_LIBS = piano 10.0 # 0.0.0 # MIT PERMIT_PACKAGE = Yes Index: audio/pianobar/distinfo =================================================================== RCS file: /cvs/ports/audio/pianobar/distinfo,v retrieving revision 1.35 diff -u -p -u -r1.35 distinfo --- audio/pianobar/distinfo 31 Aug 2017 09:12:36 -0000 1.35 +++ audio/pianobar/distinfo 16 Dec 2019 15:13:52 -0000 @@ -1,2 +1,2 @@ -SHA256 (pianobar-2017.08.30.tar.bz2) = 7BTbbPGn28HYGQtcoNJWAh6XBYe82usjkE1LynGgRnQ= -SIZE (pianobar-2017.08.30.tar.bz2) = 46664 +SHA256 (pianobar-2019.02.14.tar.bz2) = wL0DE7MUku0mbRky0xnP4qS+cCRoZJLEWLteTOsO4h8= +SIZE (pianobar-2019.02.14.tar.bz2) = 48396 Index: audio/pianobar/patches/patch-src_player_c =================================================================== RCS file: audio/pianobar/patches/patch-src_player_c diff -N audio/pianobar/patches/patch-src_player_c --- audio/pianobar/patches/patch-src_player_c 18 Feb 2019 10:05:39 -0000 1.23 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,242 +0,0 @@ -$OpenBSD: patch-src_player_c,v 1.23 2019/02/18 10:05:39 ajacoutot Exp $ - -- XXX Revert: - commit f3dff6792232d1e3f2deb8baf21dc1fa81581090 - Author: Lars-Dominik Braun <[email protected]> - Date: Fri Mar 24 10:02:27 2017 - - Replace deprecated avcodec_decode_audio4 - - Use new send_packet/receive_frame API. -- Remove deprecated header avfiltergraph.h - -Index: src/player.c ---- src/player.c.orig -+++ src/player.c -@@ -36,7 +36,6 @@ THE SOFTWARE. - #include <libavcodec/avcodec.h> - #include <libavutil/avutil.h> - #include <libavfilter/avfilter.h> --#include <libavfilter/avfiltergraph.h> - #include <libavfilter/buffersink.h> - #include <libavfilter/buffersrc.h> - #ifdef HAVE_LIBAVFILTER_AVCODEC_H -@@ -166,23 +165,16 @@ static bool openStream (player_t * const player) { - } - - player->st = player->fctx->streams[player->streamIdx]; -+ AVCodecContext * const cctx = player->st->codec; - player->st->discard = AVDISCARD_DEFAULT; - - /* decoder setup */ -- if ((player->cctx = avcodec_alloc_context3 (NULL)) == NULL) { -- softfail ("avcodec_alloc_context3"); -- } -- const AVCodecParameters * const cp = player->st->codecpar; -- if ((ret = avcodec_parameters_to_context (player->cctx, cp)) < 0) { -- softfail ("avcodec_parameters_to_context"); -- } -- -- AVCodec * const decoder = avcodec_find_decoder (cp->codec_id); -+ AVCodec * const decoder = avcodec_find_decoder (cctx->codec_id); - if (decoder == NULL) { - softfail ("find_decoder"); - } - -- if ((ret = avcodec_open2 (player->cctx, decoder, NULL)) < 0) { -+ if ((ret = avcodec_open2 (cctx, decoder, NULL)) < 0) { - softfail ("codec_open2"); - } - -@@ -203,7 +195,7 @@ static bool openFilter (player_t * const player) { - /* filter setup */ - char strbuf[256]; - int ret = 0; -- AVCodecParameters * const cp = player->st->codecpar; -+ AVCodecContext * const cctx = player->st->codec; - - if ((player->fgraph = avfilter_graph_alloc ()) == NULL) { - softfail ("graph_alloc"); -@@ -212,11 +204,17 @@ static bool openFilter (player_t * const player) { - /* abuffer */ - AVRational time_base = player->st->time_base; - -+ /* Workaround for a bug in libav-11, which reports an invalid channel -+ * layout mp3 files */ -+ if (cctx->channel_layout == 0) { -+ cctx->channel_layout = av_get_default_channel_layout (cctx->channels); -+ } -+ - snprintf (strbuf, sizeof (strbuf), - "time_base=%d/%d:sample_rate=%d:sample_fmt=%s:channel_layout=0x%"PRIx64, -- time_base.num, time_base.den, cp->sample_rate, -- av_get_sample_fmt_name (player->cctx->sample_fmt), -- cp->channel_layout); -+ time_base.num, time_base.den, cctx->sample_rate, -+ av_get_sample_fmt_name (cctx->sample_fmt), -+ cctx->channel_layout); - if ((ret = avfilter_graph_create_filter (&player->fabuf, - avfilter_get_by_name ("abuffer"), NULL, strbuf, NULL, - player->fgraph)) < 0) { -@@ -264,14 +262,14 @@ static bool openFilter (player_t * const player) { - /* setup libao - */ - static bool openDevice (player_t * const player) { -- const AVCodecParameters * const cp = player->st->codecpar; -+ AVCodecContext * const cctx = player->st->codec; - - ao_sample_format aoFmt; - memset (&aoFmt, 0, sizeof (aoFmt)); - aoFmt.bits = av_get_bytes_per_sample (avformat) * 8; - assert (aoFmt.bits > 0); -- aoFmt.channels = cp->channels; -- aoFmt.rate = cp->sample_rate; -+ aoFmt.channels = cctx->channels; -+ aoFmt.rate = cctx->sample_rate; - aoFmt.byte_format = AO_FMT_NATIVE; - - int driver = ao_default_driver_id (); -@@ -289,7 +287,6 @@ static int play (player_t * const player) { - assert (player != NULL); - - AVPacket pkt; -- AVCodecContext * const cctx = player->cctx; - av_init_packet (&pkt); - pkt.data = NULL; - pkt.size = 0; -@@ -300,28 +297,18 @@ static int play (player_t * const player) { - filteredFrame = av_frame_alloc (); - assert (filteredFrame != NULL); - -- enum { FILL, DRAIN, DONE } drainMode = FILL; -- int ret = 0; -- while (!player->doQuit && drainMode != DONE) { -- if (drainMode == FILL) { -- ret = av_read_frame (player->fctx, &pkt); -- if (ret == AVERROR_EOF) { -- /* enter drain mode */ -- drainMode = DRAIN; -- avcodec_send_packet (cctx, NULL); -- } else if (pkt.stream_index != player->streamIdx) { -- /* unused packet */ -- av_packet_unref (&pkt); -- continue; -- } else if (ret < 0) { -- /* error, abort */ -- break; -- } else { -- /* fill buffer */ -- avcodec_send_packet (cctx, &pkt); -- } -+ while (!player->doQuit) { -+ int ret = av_read_frame (player->fctx, &pkt); -+ if (ret < 0) { -+ av_free_packet (&pkt); -+ return ret; -+ } else if (pkt.stream_index != player->streamIdx) { -+ av_free_packet (&pkt); -+ continue; - } - -+ AVPacket pkt_orig = pkt; -+ - /* pausing */ - pthread_mutex_lock (&player->pauseMutex); - if (player->doPause) { -@@ -333,50 +320,54 @@ static int play (player_t * const player) { - } - pthread_mutex_unlock (&player->pauseMutex); - -- while (!player->doQuit) { -- ret = avcodec_receive_frame (cctx, frame); -- if (ret == AVERROR_EOF) { -- /* done draining */ -- drainMode = DONE; -+ while (pkt.size > 0 && !player->doQuit) { -+ int got_frame = 0; -+ -+ const int decoded = avcodec_decode_audio4 (player->st->codec, -+ frame, &got_frame, &pkt); -+ if (decoded < 0) { -+ /* skip this one */ - break; -- } else if (ret != 0) { -- /* no more output */ -- break; - } - -- /* XXX: suppresses warning from resample filter */ -- if (frame->pts == (int64_t) AV_NOPTS_VALUE) { -- frame->pts = 0; -- } -- ret = av_buffersrc_write_frame (player->fabuf, frame); -- assert (ret >= 0); -- -- while (true) { -- if (av_buffersink_get_frame (player->fbufsink, filteredFrame) < 0) { -- /* try again next frame */ -- break; -+ if (got_frame != 0) { -+ /* XXX: suppresses warning from resample filter */ -+ if (frame->pts == (int64_t) AV_NOPTS_VALUE) { -+ frame->pts = 0; - } -+ ret = av_buffersrc_write_frame (player->fabuf, frame); -+ assert (ret >= 0); - -- const int numChannels = av_get_channel_layout_nb_channels ( -- filteredFrame->channel_layout); -- const int bps = av_get_bytes_per_sample(filteredFrame->format); -- ao_play (player->aoDev, (char *) filteredFrame->data[0], -- filteredFrame->nb_samples * numChannels * bps); -+ while (true) { -+ if (av_buffersink_get_frame (player->fbufsink, filteredFrame) < 0) { -+ /* try again next frame */ -+ break; -+ } - -- av_frame_unref (filteredFrame); -+ const int numChannels = av_get_channel_layout_nb_channels ( -+ filteredFrame->channel_layout); -+ const int bps = av_get_bytes_per_sample(filteredFrame->format); -+ ao_play (player->aoDev, (char *) filteredFrame->data[0], -+ filteredFrame->nb_samples * numChannels * bps); -+ -+ av_frame_unref (filteredFrame); -+ } - } -- } - -+ pkt.data += decoded; -+ pkt.size -= decoded; -+ }; -+ -+ av_free_packet (&pkt_orig); -+ - player->songPlayed = av_q2d (player->st->time_base) * (double) pkt.pts; - player->lastTimestamp = pkt.pts; -- -- av_packet_unref (&pkt); - } - - av_frame_free (&filteredFrame); - av_frame_free (&frame); - -- return ret; -+ return 0; - } - - static void finish (player_t * const player) { -@@ -386,9 +377,9 @@ static void finish (player_t * const player) { - avfilter_graph_free (&player->fgraph); - player->fgraph = NULL; - } -- if (player->cctx != NULL) { -- avcodec_close (player->cctx); -- player->cctx = NULL; -+ if (player->st != NULL && player->st->codec != NULL) { -+ avcodec_close (player->st->codec); -+ player->st = NULL; - } - if (player->fctx != NULL) { - avformat_close_input (&player->fctx); Index: audio/pianobar/patches/patch-src_player_h =================================================================== RCS file: audio/pianobar/patches/patch-src_player_h diff -N audio/pianobar/patches/patch-src_player_h --- audio/pianobar/patches/patch-src_player_h 18 Feb 2019 10:05:39 -0000 1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,15 +0,0 @@ -$OpenBSD: patch-src_player_h,v 1.3 2019/02/18 10:05:39 ajacoutot Exp $ - -Remove deprecated header avfiltergraph.h - -Index: src/player.h ---- src/player.h.orig -+++ src/player.h -@@ -34,7 +34,6 @@ THE SOFTWARE. - #include <ao/ao.h> - #include <libavformat/avformat.h> - #include <libavfilter/avfilter.h> --#include <libavfilter/avfiltergraph.h> - #include <piano.h> - - #include "settings.h" Index: audio/pianobar/pkg/PLIST =================================================================== RCS file: /cvs/ports/audio/pianobar/pkg/PLIST,v retrieving revision 1.7 diff -u -p -u -r1.7 PLIST --- audio/pianobar/pkg/PLIST 10 Jan 2017 12:46:41 -0000 1.7 +++ audio/pianobar/pkg/PLIST 16 Dec 2019 15:13:52 -0000 @@ -1,7 +1,7 @@ -@comment $OpenBSD: PLIST,v 1.7 2017/01/10 12:46:41 sthen Exp $ +@comment $OpenBSD: PLIST,v$ @bin bin/pianobar include/piano.h -lib/libpiano.a +@static-lib lib/libpiano.a @lib lib/libpiano.so.${LIBpiano_VERSION} @man man/man1/pianobar.1 share/examples/pianobar/
