Skip to content

Commit

Permalink
cmus: update to 2.11.0
Browse files Browse the repository at this point in the history
Link ffmpeg6, new debug variant
  • Loading branch information
i0ntempest committed May 12, 2024
1 parent f475201 commit cd90aeb
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 7 deletions.
25 changes: 18 additions & 7 deletions audio/cmus/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ PortGroup compiler_blacklist_versions 1.0
# Tiger: add missing PTHREAD_RWLOCK_INITIALIZER definition for pthread.h
PortGroup legacysupport 1.0

github.setup cmus cmus 2.10.0 v
revision 3
github.setup cmus cmus 2.11.0 v
revision 0
categories audio
maintainers {@Traace hotmail.de:xxtraacexx} \
openmaintainer
Expand All @@ -18,9 +18,9 @@ long_description cmus is a small and fast text mode music player for Linux \
and many other UNIX like operating systems.
homepage https://cmus.github.io/

checksums rmd160 a6cb051f8cba5832662fb018efa29f2f954347ba \
sha256 d8758c50319605d58c10d10276199ce357d409d4f9d5c07963132b099af774a8 \
size 324203
checksums rmd160 3bea87fdffbdfc19777699587144525a1616ad0e \
sha256 643fdfdd8c865d162a7ec5b2bfb6d44df91dbb6a12d44666db8893fd9359ff0e \
size 335395

depends_build port:pkgconfig
depends_lib port:libao \
Expand Down Expand Up @@ -62,7 +62,8 @@ configure.args prefix=${prefix} CONFIG_FLAC=n CONFIG_MIKMOD=n \
CONFIG_JACK=n CONFIG_COREAUDIO=y CONFIG_SAMPLERATE=n \
HOSTCC="${configure.cc}" \
HOST_CFLAGS="${configure.cflags}" \
HOST_LDFLAGS="${configure.ldflags}"
HOST_LDFLAGS="${configure.ldflags}" \
DEBUG=0


# darwin < 12 cannot build coreaudio output
Expand Down Expand Up @@ -119,9 +120,14 @@ variant opus description {Support Opus files} {
}

variant ffmpeg description {Support ffmpeg} {
depends_lib-append path:lib/libavcodec.dylib:ffmpeg
depends_lib-append port:ffmpeg6
configure.pkg_config_path-prepend \
${prefix}/libexec/ffmpeg6/lib/pkgconfig
configure.args-delete CONFIG_FFMPEG=n
configure.args-append CONFIG_FFMPEG=y
# Revert commit 3a7d9ee which causes configure failure
# See https://github.com/cmus/cmus/issues/1329
patchfiles-append patch-revert-new-channel-layout.diff
}

variant cdda description {Support audio CD playback} {
Expand Down Expand Up @@ -151,3 +157,8 @@ variant jack description {Support native JACK output} {
configure.args-delete CONFIG_JACK=n CONFIG_SAMPLERATE=n
configure.args-append CONFIG_JACK=y CONFIG_SAMPLERATE=y
}

variant debug description {Build debug binaries} {
configure.args-replace \
DEBUG=0 DEBUG=2
}
74 changes: 74 additions & 0 deletions audio/cmus/files/patch-revert-new-channel-layout.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
--- ip/ffmpeg.c.orig 2024-05-11 16:04:09
+++ ip/ffmpeg.c 2024-05-11 21:19:10
@@ -60,7 +60,7 @@
struct ffmpeg_private {
AVCodecContext *codec_context;
AVFormatContext *input_context;
- AVCodec const *codec;
+ AVCodec *codec;
SwrContext *swr;

struct ffmpeg_input *input;
@@ -141,7 +141,8 @@
int err = 0;
int i;
int stream_index = -1;
- AVCodec const *codec;
+ int64_t channel_layout = 0;
+ AVCodec *codec;
AVCodecContext *cc = NULL;
AVFormatContext *ic = NULL;
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 48, 101)
@@ -238,26 +239,15 @@

/* Prepare for resampling. */
swr = swr_alloc();
-#if LIBAVCODEC_VERSION_MAJOR >= 58
- if (cc->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC)
- av_channel_layout_default(&cc->ch_layout, cc->ch_layout.nb_channels);
- av_opt_set_chlayout(swr, "in_chlayout", &cc->ch_layout, 0);
- av_opt_set_chlayout(swr, "out_chlayout", &cc->ch_layout, 0);
-#else
av_opt_set_int(swr, "in_channel_layout", av_get_default_channel_layout(cc->channels), 0);
av_opt_set_int(swr, "out_channel_layout", av_get_default_channel_layout(cc->channels), 0);
-#endif
av_opt_set_int(swr, "in_sample_rate", cc->sample_rate, 0);
av_opt_set_int(swr, "out_sample_rate", cc->sample_rate, 0);
av_opt_set_sample_fmt(swr, "in_sample_fmt", cc->sample_fmt, 0);
priv->swr = swr;

ip_data->private = priv;
-#if LIBAVCODEC_VERSION_MAJOR >= 58
- ip_data->sf = sf_rate(cc->sample_rate) | sf_channels(cc->ch_layout.nb_channels);
-#else
ip_data->sf = sf_rate(cc->sample_rate) | sf_channels(cc->channels);
-#endif
switch (cc->sample_fmt) {
case AV_SAMPLE_FMT_U8:
ip_data->sf |= sf_bits(8) | sf_signed(0);
@@ -275,11 +265,8 @@
}
swr_init(swr);
ip_data->sf |= sf_host_endian();
-#if LIBAVCODEC_VERSION_MAJOR >= 58
- channel_map_init_waveex(cc->ch_layout.nb_channels, cc->ch_layout.u.mask, ip_data->channel_map);
-#else
- channel_map_init_waveex(cc->channels, cc->channel_layout, ip_data->channel_map);
-#endif
+ channel_layout = cc->channel_layout;
+ channel_map_init_waveex(cc->channels, channel_layout, ip_data->channel_map);
return 0;
}

@@ -391,11 +378,7 @@
if (res < 0)
res = 0;
output->buffer_pos = output->buffer;
-#if LIBAVCODEC_VERSION_MAJOR >= 58
- output->buffer_used_len = res * cc->ch_layout.nb_channels * sizeof(int16_t);
-#else
output->buffer_used_len = res * cc->channels * sizeof(int16_t);
-#endif
#if LIBAVCODEC_VERSION_MAJOR >= 56
av_frame_free(&frame);
#else

0 comments on commit cd90aeb

Please sign in to comment.