ping !

Anyone using cmus ?

On Wed, 17 Apr 2019, Paco Esteban wrote:

> Here's a diff for cmus port 2.7.1 --> 2.8.0
> According to changelog:
> 
>   Major new features:
> 
>       multiple playlists support in playlist view
>           new :pl-* commands for playlist management
>       CoreAudio output plugin
>       BASS input plugin
>       D-Bus (MPRIS) support
> 
>   Notable changes:
> 
>       use of internal cue parser instead of libcue
>       24-bit playback support for
>           FLAC
>           JACK
>           sndio
>       plugin ABI versioning checks
>       new themes:
>           dracula
>           gruvbox
>           gruvbox-alt
>           jellybeans
>       new commands:
>           :left-view / :right-view
>           :player-pause-playback
>           :raise-vte
>           :rand
>           :version
>           :win-half-page-down / :win-half-page-up
>       new options:
>           color_win_cur_attr
>           input.*.priority
>           lib_add_filter
>           start_view
>           time_show_leading_zero
> 
> I basically removed some patches that seem to be now integrated
> upstream related to ffmpeg plugin and sndio. Configure patch has been
> also tweaked to apply cleanly. I've left the rest untouched.
> 
> Works fine for me on amd64.
> 
> 
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/audio/cmus/Makefile,v
> retrieving revision 1.20
> diff -u -p -r1.20 Makefile
> --- Makefile  16 Apr 2019 20:19:01 -0000      1.20
> +++ Makefile  17 Apr 2019 09:58:49 -0000
> @@ -3,11 +3,11 @@
>  COMMENT-main=                ncurses-based music player
>  COMMENT-ffmpeg=              ffmpeg input plugin for cmus (.aac, .mp4...)
>  
> -V=                   2.7.1
> +V=                   2.8.0
>  DISTNAME=            cmus-${V}
>  PKGNAME-main=                ${PKGNAME}
>  PKGNAME-ffmpeg=              cmus-ffmpeg-${V}
> -REVISION=            6
> +REVISION=            0
>  
>  GH_ACCOUNT=          cmus
>  GH_PROJECT=          cmus
> @@ -21,12 +21,11 @@ PERMIT_PACKAGE_CDROM=     Yes
>  
>  MULTI_PACKAGES=              -main -ffmpeg
>  
> -WANTLIB-main+=               c cdio cdio_cdda cue curses discid FLAC iconv m 
> mad
> +WANTLIB-main+=               c cdio cdio_cdda curses discid FLAC iconv m mad
>  WANTLIB-main+=               ogg opusfile pthread sndio vorbis vorbisfile 
> wavpack
>  
>  LIB_DEPENDS-main=    audio/flac \
>                       audio/libcdio \
> -                     audio/libcue \
>                       audio/libdiscid \
>                       audio/libmad \
>                       audio/libogg \
> Index: distinfo
> ===================================================================
> RCS file: /cvs/ports/audio/cmus/distinfo,v
> retrieving revision 1.4
> diff -u -p -r1.4 distinfo
> --- distinfo  17 Jan 2016 01:16:38 -0000      1.4
> +++ distinfo  17 Apr 2019 09:58:49 -0000
> @@ -1,2 +1,2 @@
> -SHA256 (cmus-2.7.1.tar.gz) = gXmnqEPSV921hfTGVZmES8DlFv6F6X9vh6fOreTrUWU=
> -SIZE (cmus-2.7.1.tar.gz) = 296818
> +SHA256 (cmus-2.8.0.tar.gz) = dWzixiQbIQTcGQl0iCJd5VmsGAKhdb4CM8+2+8AvO9I=
> +SIZE (cmus-2.8.0.tar.gz) = 317243
> Index: patches/patch-Makefile
> ===================================================================
> RCS file: /cvs/ports/audio/cmus/patches/patch-Makefile,v
> retrieving revision 1.2
> diff -u -p -r1.2 patch-Makefile
> --- patches/patch-Makefile    17 Jan 2016 01:16:38 -0000      1.2
> +++ patches/patch-Makefile    17 Apr 2019 09:58:49 -0000
> @@ -2,9 +2,10 @@ $OpenBSD: patch-Makefile,v 1.2 2016/01/1
>  
>  Fix install(1) usage.
>  
> ---- Makefile.orig    Mon Jul 13 12:00:56 2015
> -+++ Makefile Tue Jul 28 14:05:50 2015
> -@@ -262,17 +262,21 @@ plugins: $(ip-y) $(op-y)
> +Index: Makefile
> +--- Makefile.orig
> ++++ Makefile
> +@@ -272,17 +272,21 @@ plugins: $(ip-y) $(op-y)
>   man: $(man1) $(man7)
>   
>   install-main: main
> Index: patches/patch-configure
> ===================================================================
> RCS file: /cvs/ports/audio/cmus/patches/patch-configure,v
> retrieving revision 1.5
> diff -u -p -r1.5 patch-configure
> --- patches/patch-configure   6 Jun 2018 12:14:44 -0000       1.5
> +++ patches/patch-configure   17 Apr 2019 09:58:49 -0000
> @@ -11,16 +11,7 @@ final build.
>  Index: configure
>  --- configure.orig
>  +++ configure
> -@@ -378,7 +378,7 @@ check_aac()
> - check_ffmpeg()
> - {
> -     HAVE_FFMPEG_AVCODEC_H=y
> --    pkg_config FFMPEG "libavformat" || return $?
> -+    pkg_config FFMPEG "libavformat libavcodec" || return $?
> -     if check_header "libavcodec/avcodec.h" $FFMPEG_CFLAGS
> -     then
> -             HAVE_FFMPEG_AVCODEC_H=n
> -@@ -387,7 +387,7 @@ check_ffmpeg()
> +@@ -439,7 +439,7 @@ check_ffmpeg()
>       fi
>       # ffmpeg api changes so frequently that it is best to compile the module
>       libs="$LDDLFLAGS $FFMPEG_LIBS"
> Index: patches/patch-ffmpeg_c
> ===================================================================
> RCS file: patches/patch-ffmpeg_c
> diff -N patches/patch-ffmpeg_c
> --- patches/patch-ffmpeg_c    6 Jun 2018 12:14:44 -0000       1.1
> +++ /dev/null 1 Jan 1970 00:00:00 -0000
> @@ -1,493 +0,0 @@
> -$OpenBSD: patch-ffmpeg_c,v 1.1 2018/06/06 12:14:44 kn Exp $
> -
> -Various updates from upstream for newer ffmpeg versions.
> -
> -among other things:
> -
> -903282c: Fix ffmpeg segfault
> -98ab2a6: Replace deprecated FFmpeg API
> -ef65f69: remove dead code for ancient ffmpeg versions
> -b595b8c: Fix ffmpeg plugin build
> -
> -Index: ffmpeg.c
> ---- ffmpeg.c.orig
> -+++ ffmpeg.c
> -@@ -26,49 +26,16 @@
> - #endif
> - 
> - #include <stdio.h>
> --#ifdef HAVE_FFMPEG_AVCODEC_H
> --#include <ffmpeg/avcodec.h>
> --#include <ffmpeg/avformat.h>
> --#include <ffmpeg/avio.h>
> --#include <ffmpeg/swresample.h>
> --#include <ffmpeg/opt.h>
> --#include <ffmpeg/audioconvert.h>
> --#else
> - #include <libavcodec/avcodec.h>
> - #include <libavformat/avformat.h>
> - #include <libavformat/avio.h>
> - #include <libswresample/swresample.h>
> - #include <libavutil/opt.h>
> --#include <libavutil/audioconvert.h>
> -+#include <libavutil/channel_layout.h>
> - #ifndef AVUTIL_MATHEMATICS_H
> - #include <libavutil/mathematics.h>
> - #endif
> --#endif
> - 
> --#if (LIBAVFORMAT_VERSION_INT < ((52<<16)+(31<<8)+0))
> --# define NUM_FFMPEG_KEYS 8
> --#endif
> --
> --#if (LIBAVCODEC_VERSION_INT < ((52<<16)+(64<<8)+0))
> --# define AVMEDIA_TYPE_AUDIO CODEC_TYPE_AUDIO
> --#endif
> --
> --#if (LIBAVCODEC_VERSION_INT < ((52<<16)+(94<<8)+1))
> --#define AV_SAMPLE_FMT_U8   SAMPLE_FMT_U8
> --#define AV_SAMPLE_FMT_S16  SAMPLE_FMT_S16
> --#define AV_SAMPLE_FMT_S32  SAMPLE_FMT_S32
> --#define AV_SAMPLE_FMT_FLT  SAMPLE_FMT_FLT
> --#if (LIBAVCODEC_VERSION_INT > ((51<<16)+(64<<8)+0))
> --#define AV_SAMPLE_FMT_DBL  SAMPLE_FMT_DBL
> --#endif
> --#endif
> --
> --#if (LIBAVUTIL_VERSION_INT < ((51<<16)+(5<<8)+0))
> --#define AV_DICT_IGNORE_SUFFIX AV_METADATA_IGNORE_SUFFIX
> --#define av_dict_get av_metadata_get
> --#define AVDictionaryEntry AVMetadataTag
> --#endif
> --
> - #ifndef AVCODEC_MAX_AUDIO_FRAME_SIZE
> - #define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000
> - #endif
> -@@ -77,6 +44,7 @@ struct ffmpeg_input {
> -     AVPacket pkt;
> -     int curr_pkt_size;
> -     uint8_t *curr_pkt_buf;
> -+    int stream_index;
> - 
> -     unsigned long curr_size;
> -     unsigned long curr_duration;
> -@@ -94,7 +62,6 @@ struct ffmpeg_private {
> -     AVFormatContext *input_context;
> -     AVCodec *codec;
> -     SwrContext *swr;
> --    int stream_index;
> - 
> -     struct ffmpeg_input *input;
> -     struct ffmpeg_output *output;
> -@@ -115,7 +82,11 @@ static struct ffmpeg_input *ffmpeg_input_create(void)
> - 
> - static void ffmpeg_input_free(struct ffmpeg_input *input)
> - {
> -+#if LIBAVCODEC_VERSION_MAJOR >= 56
> -+    av_packet_unref(&input->pkt);
> -+#else
> -     av_free_packet(&input->pkt);
> -+#endif
> -     free(input);
> - }
> - 
> -@@ -157,30 +128,9 @@ static void ffmpeg_init(void)
> - 
> -     av_log_set_level(AV_LOG_QUIET);
> - 
> --#if (LIBAVFORMAT_VERSION_INT <= ((50<<16) + (4<<8) + 0))
> --    avcodec_init();
> --    register_avcodec(&wmav1_decoder);
> --    register_avcodec(&wmav2_decoder);
> --
> --    /* libavformat versions <= 50.4.0 have asf_init().  From SVN revision
> --     * 5697->5707 of asf.c, this function was removed, preferring the use of
> --     * explicit calls.  Note that version 50.5.0 coincides with SVN revision
> --     * 5729, so there is a window of incompatibility for revisions 5707 and 
> 5720
> --     * of asf.c.
> --     */
> --    asf_init();
> --
> --    /* Uncomment this for shorten (.shn) support.
> --       register_avcodec(&shorten_decoder);
> --       raw_init();
> --     */
> --
> --    register_protocol(&file_protocol);
> --#else
> -     /* We could register decoders explicitly to save memory, but we have to
> -      * be careful about compatibility. */
> -     av_register_all();
> --#endif
> - }
> - 
> - static int ffmpeg_open(struct input_plugin_data *ip_data)
> -@@ -197,22 +147,14 @@ static int ffmpeg_open(struct input_plugin_data *ip_da
> - 
> -     ffmpeg_init();
> - 
> --#if (LIBAVFORMAT_VERSION_INT <= ((53<<16)+(2<<8)+0))
> --    err = av_open_input_file(&ic, ip_data->filename, NULL, 0, NULL);
> --#else
> -     err = avformat_open_input(&ic, ip_data->filename, NULL, NULL);
> --#endif
> -     if (err < 0) {
> -             d_print("av_open failed: %d\n", err);
> -             return -IP_ERROR_FILE_FORMAT;
> -     }
> - 
> -     do {
> --#if (LIBAVFORMAT_VERSION_INT <= ((53<<16)+(5<<8)+0))
> --            err = av_find_stream_info(ic);
> --#else
> -             err = avformat_find_stream_info(ic, NULL);
> --#endif
> -             if (err < 0) {
> -                     d_print("unable to find stream info: %d\n", err);
> -                     err = -IP_ERROR_FILE_FORMAT;
> -@@ -235,20 +177,16 @@ static int ffmpeg_open(struct input_plugin_data *ip_da
> - 
> -             codec = avcodec_find_decoder(cc->codec_id);
> -             if (!codec) {
> --                    d_print("codec not found: %d, %s\n", cc->codec_id, 
> cc->codec_name);
> -+                    d_print("codec not found: %d, %s\n", cc->codec_id, 
> avcodec_get_name(cc->codec_id));
> -                     err = -IP_ERROR_UNSUPPORTED_FILE_TYPE;
> -                     break;
> -             }
> - 
> --            if (codec->capabilities & CODEC_CAP_TRUNCATED)
> --                    cc->flags |= CODEC_FLAG_TRUNCATED;
> -+            if (codec->capabilities & AV_CODEC_CAP_TRUNCATED)
> -+                    cc->flags |= AV_CODEC_FLAG_TRUNCATED;
> - 
> --#if (LIBAVCODEC_VERSION_INT < ((53<<16)+(8<<8)+0))
> --            if (avcodec_open(cc, codec) < 0) {
> --#else
> -             if (avcodec_open2(cc, codec, NULL) < 0) {
> --#endif
> --                    d_print("could not open codec: %d, %s\n", cc->codec_id, 
> cc->codec_name);
> -+                    d_print("could not open codec: %d, %s\n", cc->codec_id, 
> avcodec_get_name(cc->codec_id));
> -                     err = -IP_ERROR_UNSUPPORTED_FILE_TYPE;
> -                     break;
> -             }
> -@@ -258,11 +196,7 @@ static int ffmpeg_open(struct input_plugin_data *ip_da
> - 
> -     if (err < 0) {
> -             /* Clean up.  cc is never opened at this point.  (See above 
> assumption.) */
> --#if (LIBAVCODEC_VERSION_INT < ((53<<16)+(25<<8)+0))
> --            av_close_input_file(ic);
> --#else
> -             avformat_close_input(&ic);
> --#endif
> -             return err;
> -     }
> - 
> -@@ -270,18 +204,14 @@ static int ffmpeg_open(struct input_plugin_data *ip_da
> -     priv->codec_context = cc;
> -     priv->input_context = ic;
> -     priv->codec = codec;
> --    priv->stream_index = stream_index;
> -     priv->input = ffmpeg_input_create();
> -     if (priv->input == NULL) {
> -             avcodec_close(cc);
> --#if (LIBAVCODEC_VERSION_INT < ((53<<16)+(25<<8)+0))
> --            av_close_input_file(ic);
> --#else
> -             avformat_close_input(&ic);
> --#endif
> -             free(priv);
> -             return -IP_ERROR_INTERNAL;
> -     }
> -+    priv->input->stream_index = stream_index;
> -     priv->output = ffmpeg_output_create();
> - 
> -     /* Prepare for resampling. */
> -@@ -314,9 +244,7 @@ static int ffmpeg_open(struct input_plugin_data *ip_da
> - #ifdef WORDS_BIGENDIAN
> -     ip_data->sf |= sf_bigendian(1);
> - #endif
> --#if (LIBAVCODEC_VERSION_INT > ((52<<16)+(1<<8)+0))
> -     channel_layout = cc->channel_layout;
> --#endif
> -     channel_map_init_waveex(cc->channels, channel_layout, 
> ip_data->channel_map);
> -     return 0;
> - }
> -@@ -326,11 +254,7 @@ static int ffmpeg_close(struct input_plugin_data *ip_d
> -     struct ffmpeg_private *priv = ip_data->private;
> - 
> -     avcodec_close(priv->codec_context);
> --#if (LIBAVCODEC_VERSION_INT < ((53<<16)+(25<<8)+0))
> --    av_close_input_file(priv->input_context);
> --#else
> -     avformat_close_input(&priv->input_context);
> --#endif
> -     swr_free(&priv->swr);
> -     ffmpeg_input_free(priv->input);
> -     ffmpeg_output_free(priv->output);
> -@@ -346,62 +270,50 @@ static int ffmpeg_close(struct input_plugin_data *ip_d
> - static int ffmpeg_fill_buffer(AVFormatContext *ic, AVCodecContext *cc, 
> struct ffmpeg_input *input,
> -                           struct ffmpeg_output *output, SwrContext *swr)
> - {
> --#if (LIBAVCODEC_VERSION_INT >= ((53<<16) + (25<<8) + 0))
> -+#if LIBAVCODEC_VERSION_MAJOR >= 56
> -+    AVFrame *frame = av_frame_alloc();
> -+#else
> -     AVFrame *frame = avcodec_alloc_frame();
> --    int got_frame;
> - #endif
> -+    int got_frame;
> -     while (1) {
> --#if (LIBAVCODEC_VERSION_INT < ((53<<16) + (25<<8) + 0))
> --            /* frame_size specifies the size of output->buffer for
> --             * avcodec_decode_audio2. */
> --            int frame_size = AVCODEC_MAX_AUDIO_FRAME_SIZE;
> --#endif
> -             int len;
> - 
> -             if (input->curr_pkt_size <= 0) {
> -+#if LIBAVCODEC_VERSION_MAJOR >= 56
> -+                    av_packet_unref(&input->pkt);
> -+#else
> -                     av_free_packet(&input->pkt);
> -+#endif
> -                     if (av_read_frame(ic, &input->pkt) < 0) {
> -                             /* Force EOF once we can read no longer. */
> --#if (LIBAVCODEC_VERSION_INT >= ((53<<16) + (25<<8) + 0))
> -+#if LIBAVCODEC_VERSION_MAJOR >= 56
> -+                            av_frame_free(&frame);
> -+#else
> -                             avcodec_free_frame(&frame);
> - #endif
> -                             return 0;
> -                     }
> --                    input->curr_pkt_size = input->pkt.size;
> --                    input->curr_pkt_buf = input->pkt.data;
> --                    input->curr_size += input->pkt.size;
> --                    input->curr_duration += input->pkt.duration;
> -+                    if (input->pkt.stream_index == input->stream_index) {
> -+                            input->curr_pkt_size = input->pkt.size;
> -+                            input->curr_pkt_buf = input->pkt.data;
> -+                            input->curr_size += input->pkt.size;
> -+                            input->curr_duration += input->pkt.duration;
> -+                    }
> -                     continue;
> -             }
> - 
> --            /* The change to avcodec_decode_audio2 occurred between
> --             * 51.28.0 and 51.29.0 */
> --#if (LIBAVCODEC_VERSION_INT <= ((51<<16) + (28<<8) + 0))
> --            len = avcodec_decode_audio(cc, (int16_t *)output->buffer, 
> &frame_size,
> --                            input->curr_pkt_buf, input->curr_pkt_size);
> --            /* The change to avcodec_decode_audio3 occurred between
> --             * 52.25.0 and 52.26.0 */
> --#elif (LIBAVCODEC_VERSION_INT <= ((52<<16) + (25<<8) + 0))
> --            len = avcodec_decode_audio2(cc, (int16_t *) output->buffer, 
> &frame_size,
> --                            input->curr_pkt_buf, input->curr_pkt_size);
> --#elif (LIBAVCODEC_VERSION_INT < ((53<<16) + (25<<8) + 0))
> -             {
> -                     AVPacket avpkt;
> --                    av_init_packet(&avpkt);
> --                    avpkt.data = input->curr_pkt_buf;
> --                    avpkt.size = input->curr_pkt_size;
> --                    len = avcodec_decode_audio3(cc, (int16_t *) 
> output->buffer, &frame_size, &avpkt);
> --                    av_free_packet(&avpkt);
> --            }
> --#else
> --            {
> --                    AVPacket avpkt;
> -                     av_new_packet(&avpkt, input->curr_pkt_size);
> -                     memcpy(avpkt.data, input->curr_pkt_buf, 
> input->curr_pkt_size);
> -                     len = avcodec_decode_audio4(cc, frame, &got_frame, 
> &avpkt);
> -+#if LIBAVCODEC_VERSION_MAJOR >= 56
> -+                    av_packet_unref(&avpkt);
> -+#else
> -                     av_free_packet(&avpkt);
> --            }
> - #endif
> -+            }
> -             if (len < 0) {
> -                     /* this is often reached when seeking, not sure why */
> -                     input->curr_pkt_size = 0;
> -@@ -409,13 +321,6 @@ static int ffmpeg_fill_buffer(AVFormatContext *ic, AVC
> -             }
> -             input->curr_pkt_size -= len;
> -             input->curr_pkt_buf += len;
> --#if (LIBAVCODEC_VERSION_INT < ((53<<16) + (25<<8) + 0))
> --            if (frame_size > 0) {
> --                    output->buffer_pos = output->buffer;
> --                    output->buffer_used_len = frame_size;
> --                    return frame_size;
> --            }
> --#else
> -             if (got_frame) {
> -                     int res = swr_convert(swr,
> -                                     &output->buffer,
> -@@ -426,10 +331,13 @@ static int ffmpeg_fill_buffer(AVFormatContext *ic, AVC
> -                             res = 0;
> -                     output->buffer_pos = output->buffer;
> -                     output->buffer_used_len = res * cc->channels * 
> sizeof(int16_t);
> -+#if LIBAVCODEC_VERSION_MAJOR >= 56
> -+                    av_frame_free(&frame);
> -+#else
> -                     avcodec_free_frame(&frame);
> -+#endif
> -                     return output->buffer_used_len;
> -             }
> --#endif
> -     }
> -     /* This should never get here. */
> -     return -IP_ERROR_INTERNAL;
> -@@ -459,30 +367,16 @@ static int ffmpeg_read(struct input_plugin_data *ip_da
> - static int ffmpeg_seek(struct input_plugin_data *ip_data, double offset)
> - {
> -     struct ffmpeg_private *priv = ip_data->private;
> --    AVStream *st = priv->input_context->streams[priv->stream_index];
> -+    AVStream *st = priv->input_context->streams[priv->input->stream_index];
> -     int ret;
> - 
> --    /* There is a bug that was fixed in ffmpeg revision 5099 that affects 
> seeking.
> --     * Apparently, the stream's timebase was not used consistently in asf.c.
> --     * Prior to 5099, ASF seeking assumed seconds as inputs.  There is a
> --     * window of incompatibility, since avformat's version was not updated 
> at
> --     * the same time.  Instead, the transition to 50.3.0 occurred at
> --     * revision 5028. */
> --#if (LIBAVFORMAT_VERSION_INT < ((50<<16)+(3<<8)+0))
> --    int64_t pts = (int64_t) offset;
> --#else
> -     int64_t pts = av_rescale_q(offset * AV_TIME_BASE, AV_TIME_BASE_Q, 
> st->time_base);
> --#endif
> - 
> --#if (LIBAVFORMAT_VERSION_INT >= ((53<<16) + (25<<8) + 0))
> --    {
> --            avcodec_flush_buffers(priv->codec_context);
> --            /* Force reading a new packet in next ffmpeg_fill_buffer(). */
> --            priv->input->curr_pkt_size = 0;
> --    }
> --#endif
> -+    avcodec_flush_buffers(priv->codec_context);
> -+    /* Force reading a new packet in next ffmpeg_fill_buffer(). */
> -+    priv->input->curr_pkt_size = 0;
> - 
> --    ret = av_seek_frame(priv->input_context, priv->stream_index, pts, 0);
> -+    ret = av_seek_frame(priv->input_context, priv->input->stream_index, 
> pts, 0);
> - 
> -     if (ret < 0) {
> -             return -IP_ERROR_FUNCTION_NOT_SUPPORTED;
> -@@ -492,56 +386,30 @@ static int ffmpeg_seek(struct input_plugin_data *ip_da
> -     }
> - }
> - 
> --#if (LIBAVFORMAT_VERSION_INT < ((52<<16)+(31<<8)+0))
> --/* Return new i. */
> --static int set_comment(struct keyval *comment, int i, const char *key, 
> const char *val)
> -+static void ffmpeg_read_metadata(struct growing_keyvals *c, AVDictionary 
> *metadata)
> - {
> --    if (val[0] == 0) {
> --            return i;
> -+    AVDictionaryEntry *tag = NULL;
> -+
> -+    while ((tag = av_dict_get(metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) {
> -+            if (tag->value[0])
> -+                    comments_add_const(c, tag->key, tag->value);
> -     }
> --    comment[i].key = xstrdup(key);
> --    comment[i].val = xstrdup(val);
> --    return i + 1;
> - }
> --#endif
> - 
> - static int ffmpeg_read_comments(struct input_plugin_data *ip_data, struct 
> keyval **comments)
> - {
> -     struct ffmpeg_private *priv = ip_data->private;
> -     AVFormatContext *ic = priv->input_context;
> - 
> --#if (LIBAVFORMAT_VERSION_INT < ((52<<16)+(31<<8)+0))
> --    char buff[16];
> --    int i = 0;
> --
> --    *comments = keyvals_new(NUM_FFMPEG_KEYS);
> --
> --    i = set_comment(*comments, i, "artist", ic->author);
> --    i = set_comment(*comments, i, "album", ic->album);
> --    i = set_comment(*comments, i, "title", ic->title);
> --    i = set_comment(*comments, i, "genre", ic->genre);
> --
> --    if (ic->year != 0) {
> --            snprintf(buff, sizeof(buff), "%d", ic->year);
> --            i = set_comment(*comments, i, "date", buff);
> --    }
> --
> --    if (ic->track != 0) {
> --            snprintf(buff, sizeof(buff), "%d", ic->track);
> --            i = set_comment(*comments, i, "tracknumber", buff);
> --    }
> --#else
> -     GROWING_KEYVALS(c);
> --    AVDictionaryEntry *tag = NULL;
> - 
> --    while ((tag = av_dict_get(ic->metadata, "", tag, 
> AV_DICT_IGNORE_SUFFIX))) {
> --            if (tag && tag->value[0])
> --                    comments_add_const(&c, tag->key, tag->value);
> -+    ffmpeg_read_metadata(&c, ic->metadata);
> -+    for (unsigned i = 0; i < ic->nb_streams; i++) {
> -+            ffmpeg_read_metadata(&c, ic->streams[i]->metadata);
> -     }
> - 
> -     keyvals_terminate(&c);
> -     *comments = c.keyvals;
> --#endif
> - 
> -     return 0;
> - }
> -@@ -562,13 +430,15 @@ static long ffmpeg_bitrate(struct input_plugin_data *i
> - static long ffmpeg_current_bitrate(struct input_plugin_data *ip_data)
> - {
> -     struct ffmpeg_private *priv = ip_data->private;
> --    AVStream *st = priv->input_context->streams[priv->stream_index];
> -+    AVStream *st = priv->input_context->streams[priv->input->stream_index];
> -     long bitrate = -1;
> --#if (LIBAVFORMAT_VERSION_INT > ((51<<16)+(43<<8)+0))
> -     /* ape codec returns silly numbers */
> -+#if LIBAVCODEC_VERSION_MAJOR >= 55
> -+    if (priv->codec->id == AV_CODEC_ID_APE)
> -+#else
> -     if (priv->codec->id == CODEC_ID_APE)
> --            return -1;
> - #endif
> -+            return -1;
> -     if (priv->input->curr_duration > 0) {
> -             double seconds = priv->input->curr_duration * 
> av_q2d(st->time_base);
> -             bitrate = (8 * priv->input->curr_size) / seconds;
> -@@ -584,32 +454,11 @@ static char *ffmpeg_codec(struct input_plugin_data *ip
> -     return xstrdup(priv->codec->name);
> - }
> - 
> --#if (LIBAVCODEC_VERSION_INT < ((52<<16)+(104<<8)+0))
> --static const char *codec_profile_to_str(int profile)
> --{
> --#if (LIBAVCODEC_VERSION_INT >= ((51<<16)+(41<<8)+0))
> --    switch (profile) {
> --    case FF_PROFILE_AAC_MAIN:       return "Main";
> --    case FF_PROFILE_AAC_LOW:        return "LC";
> --    case FF_PROFILE_AAC_SSR:        return "SSR";
> --    case FF_PROFILE_AAC_LTP:        return "LTP";
> --    }
> --#endif
> --    return NULL;
> --}
> --#endif
> --
> - static char *ffmpeg_codec_profile(struct input_plugin_data *ip_data)
> - {
> -     struct ffmpeg_private *priv = ip_data->private;
> -     const char *profile;
> --
> --#if (LIBAVCODEC_VERSION_INT < ((52<<16)+(104<<8)+0))
> --    profile = codec_profile_to_str(priv->codec_context->profile);
> --#else
> -     profile = av_get_profile_name(priv->codec, 
> priv->codec_context->profile);
> --#endif
> --
> -     return profile ? xstrdup(profile) : NULL;
> - }
> - 
> Index: patches/patch-ip_ffmpeg_c
> ===================================================================
> RCS file: patches/patch-ip_ffmpeg_c
> diff -N patches/patch-ip_ffmpeg_c
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-ip_ffmpeg_c 17 Apr 2019 09:58:49 -0000
> @@ -0,0 +1,13 @@
> +$OpenBSD$
> +
> +Index: ip/ffmpeg.c
> +--- ip/ffmpeg.c.orig
> ++++ ip/ffmpeg.c
> +@@ -62,6 +62,7 @@ struct ffmpeg_private {
> +     AVFormatContext *input_context;
> +     AVCodec *codec;
> +     SwrContext *swr;
> ++    int stream_index;
> + 
> +     struct ffmpeg_input *input;
> +     struct ffmpeg_output *output;
> Index: patches/patch-sndio_c
> ===================================================================
> RCS file: patches/patch-sndio_c
> diff -N patches/patch-sndio_c
> --- patches/patch-sndio_c     18 Feb 2017 10:16:34 -0000      1.2
> +++ /dev/null 1 Jan 1970 00:00:00 -0000
> @@ -1,30 +0,0 @@
> -$OpenBSD: patch-sndio_c,v 1.2 2017/02/18 10:16:34 jca Exp $
> -
> -Support 32-bit/24-bit encoding.
> -
> -Commits 84f33584be91 and bf87f0d76f87 upstream.
> -
> ---- sndio.c.orig     Mon Jul 13 12:00:56 2015
> -+++ sndio.c  Thu Feb  9 12:11:30 2017
> -@@ -20,7 +20,6 @@
> - 
> - #include <sys/types.h>
> - #include <sys/ioctl.h>
> --#include <sys/audioio.h>
> - #include <sys/stat.h>
> - #include <errno.h>
> - #include <fcntl.h>
> -@@ -82,6 +81,13 @@ static int sndio_set_sf(sample_format_t sf)
> -             par.le = 1;
> - 
> -     switch (sf_get_bits(sndio_sf)) {
> -+    case 32:
> -+            par.bits = 32;
> -+            break;
> -+    case 24:
> -+            par.bits = 24;
> -+            par.bps = 3;
> -+            break;
> -     case 16:
> -             par.bits = 16;
> -             break;
> Index: pkg/PLIST-main
> ===================================================================
> RCS file: /cvs/ports/audio/cmus/pkg/PLIST-main,v
> retrieving revision 1.3
> diff -u -p -r1.3 PLIST-main
> --- pkg/PLIST-main    17 Jan 2016 01:16:38 -0000      1.3
> +++ pkg/PLIST-main    17 Apr 2019 09:58:49 -0000
> @@ -22,9 +22,13 @@ lib/cmus/op/sndio.so
>  share/cmus/
>  share/cmus/cyan.theme
>  share/cmus/default.theme
> +share/cmus/dracula.theme
>  share/cmus/gray-88.theme
>  share/cmus/green-mono-88.theme
>  share/cmus/green.theme
> +share/cmus/gruvbox-alt.theme
> +share/cmus/gruvbox.theme
> +share/cmus/jellybeans.theme
>  share/cmus/night.theme
>  share/cmus/rc
>  share/cmus/solarized-dark.theme

-- 
Paco Esteban.
https://onna.be/gpgkey.asc
9A6B 6083 AD9E FDC2 0EAF  5CB3 5818 130B 8A6D BC03

Reply via email to