Discussion:
cmus 2.4.0-rc0
Gregory Petrosyan
2011-04-10 14:19:12 UTC
Permalink
Hurray!

I'm pleased to announce cmus 2.4.0-rc0, first (and, hopefully, last :-)
release candidate for the long-awaited version 2.4.0.

With tons of changes to cmus' internals, three features really stand out for
end-users: live filtering, playback resume support and long format options,
including new %{codec} and %{bitrate}.

Live filtering is immensely useful and addictive feature, especially if you
have a huge music library. Press 'L' and start typing, and you'll understand
what I mean. To reset the live filter, type 'L<Enter>'. Also, there's no need
to e.g. type "Björk" to filter "Björk" — "bjork" (note: no 'ö') will do, cmus
is smart!

To enable resume support, simply add "set resume=true" to your ~/.cmus/rc.

All of these awesome features were contributed by Johannes Weißl, who has
written almost 150 patches for this release. Thanks Johannes!

I'd like to encourage everybody to test this RC as hard as possible, to help
make 2.4.0 the best release of cmus ever.

Grab the source tarball here:

https://sourceforge.net/projects/cmus/files/cmus-v2.4.0-rc0.tar.bz2/download

Or get cmus via git:

$ git clone git://gitorious.org/cmus/cmus.git

Installation is a classical "./configure && make && sudo make install", as
always.

P.S. Don't hesitate to point out any mistakes or omissions in this release
announcement!

Gregory


--


Adam Hoka (2):
Cast time_t to long long and use %lld so it works on platforms where time_t is 64bit.
isspace needs its argument casted to int.

Evan (1):
USE_FALLBACK_IP config option to enable catch-all input plugin

Gregory Petrosyan (28):
Merge branch 'maint'
output.c: simplify trivial forwarding functions
Merge branch 'jl/nowakeups'
Merge branch 'jw/remote'
Merge branch 'jw/search-wrap'
Merge commit 'jasonwoof/search-aa'
Update TODO
Merge branch 'maint'
Merge branch 'maint'
http: add 'uri' field to struct http_uri
http: support HTTP proxies via $http_proxy
http: add Basic proxy authorization support
Merge branch 'xc/valgrind'
track.c: remove unused reshuffle() function
track.c: remove misleading comment
cache: fix cache invalidation bug caused by commit 594aa
Merge branch 'rbtree2'
Merge branch 'maint'
pulse: don't set useless stream properties
Merge branch 'ffmpeg-fallback'
Merge branch 'maint'
tree: better album date calculation
tree: properly update artist/album position when changing their sort attributes
roar: silence 'defined but not used' compiler warning
Make u_casefold_char() work properly on OS X and Windows
id3: fix id3_skiplen() for UTF-16 and UTF-16BE
id3: fix heavily broken comments parsing
cmus 2.4.0-rc0

Jan-Philipp Litza (1):
Use pthread_cond_* while waiting for beginning of playback

Jason Woofenden (3):
Make search wrap when reaching the end/beginning
Make albumartist tag searchable
add :w and :wq aliases

Johannes Weißl (143):
server: write info_msg() and error_msg() to client
save: add -q option for saving queue
save: add -L flag, which outputs filtered library
save: filename "-" outputs to stdout
server: move escape() from server.c to misc.c
save: add -e option for extended output
doc: save -e -L -q, cmus-remote examples
configure: add -Wformat-security to gcc options
speedup: code reordering in comments.c
speedup: use rbtree for sorted and shuffle list
rbtree: rename loop defines
fix segfault when adding to queue
fix order of sorted view (has been reversed)
add Mutt-like filter shortcuts
utils: add N_ELEMENTS macro
utf8_encode: rename to convert.[ch], generalize
strip unneeded extern keyword
faster version of u_strlen()
make using_utf8 and charset global
introduce collation comparison
do not mind diacritical marks (accents) when searching / filtering
gen_decomp.py: expand special mapping
improve string handling for short filter expressions
bugfix: recognize boolean keys in short filters
ffmpeg: fix compiler warning
ffmpeg: use new metadata API
bugfix: do_u_strncase_equal() ignores last character
track_info.c: cosmetic change
track_info_cmp(): compare filename with strcoll() instead of strcasecmp()
ui_curses.c: remove code duplication
bugfix: reintroduce safe u_strlen()
convert filter and search expressions to UTF-8
u_strcasestr_filename(): correctly handle non-utf8 cases
fix gcc-4.6 warnings
cmdline: add ctrl-w and friends
tree: add artist_new() and album_new() functions
use rbtree for the library tree view
fix sorted view (again)
editable: use rbtree for sorting
fix: put tracks with blank artist on top in view 2
speedup track info comparison
track_info_cmp(): use collation keys
tree: use collation keys for sort names
compiler.h: make __builtin_expect depend on __GNUC__
better offsetof() and container_of() macros
scripts/checks.sh: fix function test
config/checks.sh: detect -rdynamic flag
only enable colors if use_default_colors() is there
fix gcc compile warning on mipsel platforms
uchar: faster (and more usable) version of u_get_char()
portability fix: standard conform use of anonymous member
fix: sidestep glibc anomaly when using non-gnu compilers
silence tcc warning
portability: wrap add_ti_cb callback in struct
cosmetic change: replace xmalloc with xnew where possible
portability: remove conditionals with omitted operands
portability: replace zero-length arrays with flexible array members
portability: include missing headers
mp4: add com.apple.iTunes freeform tags
mpc: fix replay gain calculation
fix clang warning
utils.sh: comment $CROSS variable
checks.sh: better check for endianness
configure: use pkg-config for flac detection
expr.c: better recognition of short filter expressions
add live filter command (:live-filter)
add overlay status info for live filter
remove item from TODO
wav.c: add RIFF metadata support
utils.h: use builtin byte swapping functions
player.c: add support for 32bit softvol scaling
flac.c: use swapping functions in utils.h
oss.c: support sample size of 32bit
wav.c: add extensible wave support
wav.c: support 32bit wave files
wav.c: support seeking for other than 2ch 16/8bit
mad: only use xing.nr_frames when != 0
speedup: do fast filtering if no filter is set
ffmpeg.c: reset frame_size to AVCODEC_MAX_AUDIO_FRAME_SIZE in loop
ffmpeg.c: correctly scale seeking position
ffmpeg.c: add .mka extension
fix build error on NetBSD (bswap16/32)
cache: fix writing of tracks with more than 32 tags
flac: fix segfault when playing corrupt flac files
pulse: fix playback of multi-channel audio files
pulse: fix deadlock
roar: don't write warning messages to stderr
output.c: better autodetect output plugin
change order of output plugins
tree.c: fix infinite loop when searching
tree.c: collapse artists after continuing search
plugins: handle missing dependencies more gracefully
add backwards tab completion (s-tab)
ffmpeg.c: correctly detect sample format
player.c: support 24bit scaling
format_print.h: avoid code duplication
add long track format options
enable display / sorting of replay gain values
Doc: update sort keys / format strings
support percentage for format width
options.c: change default format_playlist
add bitrate to format options / sort keys
add codec to format options / sort keys
add input plugin priorities and better fallback
ffmpeg.c: add more file types
input.c: fix frame_size check in BUG_ON
oss: support multi channel audio
oss: better oss_buffer_space()
pcm: use native byte order
vorbis: always use native byte order
mikmod: fix playback on bigendian systems
modplug: fix playback on bigendian systems
ffmpeg: fix playback on bigendian systems
make iconv dependency optional
configure: better check when using app_config
compiler.h: use __builtin_offsetof only for gcc version > 3
ffmpeg: enable compilation for libavcodec < 51.65
id3: better date parsing
player.c: replay gain scaling works without peak
mad: enable LAME replay gain info
tree: do not use artistsort for compilations
tree: fix smart artist sort name behaviour
tree: fix sorting of albums
fix segfault when changing sort keys while adding tracks
fix live filtering for integer expressions
lib.c: do not consider live filter when doing lib_for_each()
oss.c: support sample size of 24bit
expr.c: add bitrate and codec to filter expressions
Doc: update sort keys / format strings
expr.c: fix filtering for unset date
mikmod: fix mik_read_comments()
mikmod: return codec name
modplug: return codec names
modplug: remove compressed types
add option to resume playback on startup
resume: also restore current live-filter
resume: save queue to $CMUS_HOME/queue.pl
add :shell command
spawn status_display_program in the background
ui_curses.c: cleanup usage of player_info
cmdline: change filename delimiter to just '/'
track_info_cmp: fix comparison of doubles
ui_curses.c: fix severe display errors if iconv fails

Mikhail Gonchar (1):
id3: fix UTF-16 handling

Philipp Schafft (1):
Add RoarAudio output plugin

Xavier Chantry (6):
gitignore : add backup files *~
Fix a few pointer types warning
history : fix invalid read and memory leak
track_info : fix invalid read
player : add new buffer_free on exit
ffmpeg : fix memleak in ffmpeg_input_free
gt
2011-04-11 12:59:47 UTC
Permalink
Post by Gregory Petrosyan
Hurray!
I'm pleased to announce cmus 2.4.0-rc0, first (and, hopefully, last :-)
release candidate for the long-awaited version 2.4.0.
With tons of changes to cmus' internals, three features really stand out for
end-users: live filtering, playback resume support and long format options,
including new %{codec} and %{bitrate}.
Live filtering is immensely useful and addictive feature, especially if you
have a huge music library. Press 'L' and start typing, and you'll understand
what I mean. To reset the live filter, type 'L<Enter>'. Also, there's no need
to e.g. type "Björk" to filter "Björk" — "bjork" (note: no 'ö') will do, cmus
is smart!
To enable resume support, simply add "set resume=true" to your ~/.cmus/rc.
All of these awesome features were contributed by Johannes Weißl, who has
written almost 150 patches for this release. Thanks Johannes!
I'd like to encourage everybody to test this RC as hard as possible, to help
make 2.4.0 the best release of cmus ever.
https://sourceforge.net/projects/cmus/files/cmus-v2.4.0-rc0.tar.bz2/download
$ git clone git://gitorious.org/cmus/cmus.git
Installation is a classical "./configure && make && sudo make install", as
always.
P.S. Don't hesitate to point out any mistakes or omissions in this release
announcement!
Gregory
--
Cast time_t to long long and use %lld so it works on platforms where time_t is 64bit.
isspace needs its argument casted to int.
USE_FALLBACK_IP config option to enable catch-all input plugin
Merge branch 'maint'
output.c: simplify trivial forwarding functions
Merge branch 'jl/nowakeups'
Merge branch 'jw/remote'
Merge branch 'jw/search-wrap'
Merge commit 'jasonwoof/search-aa'
Update TODO
Merge branch 'maint'
Merge branch 'maint'
http: add 'uri' field to struct http_uri
http: support HTTP proxies via $http_proxy
http: add Basic proxy authorization support
Merge branch 'xc/valgrind'
track.c: remove unused reshuffle() function
track.c: remove misleading comment
cache: fix cache invalidation bug caused by commit 594aa
Merge branch 'rbtree2'
Merge branch 'maint'
pulse: don't set useless stream properties
Merge branch 'ffmpeg-fallback'
Merge branch 'maint'
tree: better album date calculation
tree: properly update artist/album position when changing their sort attributes
roar: silence 'defined but not used' compiler warning
Make u_casefold_char() work properly on OS X and Windows
id3: fix id3_skiplen() for UTF-16 and UTF-16BE
id3: fix heavily broken comments parsing
cmus 2.4.0-rc0
Use pthread_cond_* while waiting for beginning of playback
Make search wrap when reaching the end/beginning
Make albumartist tag searchable
add :w and :wq aliases
server: write info_msg() and error_msg() to client
save: add -q option for saving queue
save: add -L flag, which outputs filtered library
save: filename "-" outputs to stdout
server: move escape() from server.c to misc.c
save: add -e option for extended output
doc: save -e -L -q, cmus-remote examples
configure: add -Wformat-security to gcc options
speedup: code reordering in comments.c
speedup: use rbtree for sorted and shuffle list
rbtree: rename loop defines
fix segfault when adding to queue
fix order of sorted view (has been reversed)
add Mutt-like filter shortcuts
utils: add N_ELEMENTS macro
utf8_encode: rename to convert.[ch], generalize
strip unneeded extern keyword
faster version of u_strlen()
make using_utf8 and charset global
introduce collation comparison
do not mind diacritical marks (accents) when searching / filtering
gen_decomp.py: expand special mapping
improve string handling for short filter expressions
bugfix: recognize boolean keys in short filters
ffmpeg: fix compiler warning
ffmpeg: use new metadata API
bugfix: do_u_strncase_equal() ignores last character
track_info.c: cosmetic change
track_info_cmp(): compare filename with strcoll() instead of strcasecmp()
ui_curses.c: remove code duplication
bugfix: reintroduce safe u_strlen()
convert filter and search expressions to UTF-8
u_strcasestr_filename(): correctly handle non-utf8 cases
fix gcc-4.6 warnings
cmdline: add ctrl-w and friends
tree: add artist_new() and album_new() functions
use rbtree for the library tree view
fix sorted view (again)
editable: use rbtree for sorting
fix: put tracks with blank artist on top in view 2
speedup track info comparison
track_info_cmp(): use collation keys
tree: use collation keys for sort names
compiler.h: make __builtin_expect depend on __GNUC__
better offsetof() and container_of() macros
scripts/checks.sh: fix function test
config/checks.sh: detect -rdynamic flag
only enable colors if use_default_colors() is there
fix gcc compile warning on mipsel platforms
uchar: faster (and more usable) version of u_get_char()
portability fix: standard conform use of anonymous member
fix: sidestep glibc anomaly when using non-gnu compilers
silence tcc warning
portability: wrap add_ti_cb callback in struct
cosmetic change: replace xmalloc with xnew where possible
portability: remove conditionals with omitted operands
portability: replace zero-length arrays with flexible array members
portability: include missing headers
mp4: add com.apple.iTunes freeform tags
mpc: fix replay gain calculation
fix clang warning
utils.sh: comment $CROSS variable
checks.sh: better check for endianness
configure: use pkg-config for flac detection
expr.c: better recognition of short filter expressions
add live filter command (:live-filter)
add overlay status info for live filter
remove item from TODO
wav.c: add RIFF metadata support
utils.h: use builtin byte swapping functions
player.c: add support for 32bit softvol scaling
flac.c: use swapping functions in utils.h
oss.c: support sample size of 32bit
wav.c: add extensible wave support
wav.c: support 32bit wave files
wav.c: support seeking for other than 2ch 16/8bit
mad: only use xing.nr_frames when != 0
speedup: do fast filtering if no filter is set
ffmpeg.c: reset frame_size to AVCODEC_MAX_AUDIO_FRAME_SIZE in loop
ffmpeg.c: correctly scale seeking position
ffmpeg.c: add .mka extension
fix build error on NetBSD (bswap16/32)
cache: fix writing of tracks with more than 32 tags
flac: fix segfault when playing corrupt flac files
pulse: fix playback of multi-channel audio files
pulse: fix deadlock
roar: don't write warning messages to stderr
output.c: better autodetect output plugin
change order of output plugins
tree.c: fix infinite loop when searching
tree.c: collapse artists after continuing search
plugins: handle missing dependencies more gracefully
add backwards tab completion (s-tab)
ffmpeg.c: correctly detect sample format
player.c: support 24bit scaling
format_print.h: avoid code duplication
add long track format options
enable display / sorting of replay gain values
Doc: update sort keys / format strings
support percentage for format width
options.c: change default format_playlist
add bitrate to format options / sort keys
add codec to format options / sort keys
add input plugin priorities and better fallback
ffmpeg.c: add more file types
input.c: fix frame_size check in BUG_ON
oss: support multi channel audio
oss: better oss_buffer_space()
pcm: use native byte order
vorbis: always use native byte order
mikmod: fix playback on bigendian systems
modplug: fix playback on bigendian systems
ffmpeg: fix playback on bigendian systems
make iconv dependency optional
configure: better check when using app_config
compiler.h: use __builtin_offsetof only for gcc version > 3
ffmpeg: enable compilation for libavcodec < 51.65
id3: better date parsing
player.c: replay gain scaling works without peak
mad: enable LAME replay gain info
tree: do not use artistsort for compilations
tree: fix smart artist sort name behaviour
tree: fix sorting of albums
fix segfault when changing sort keys while adding tracks
fix live filtering for integer expressions
lib.c: do not consider live filter when doing lib_for_each()
oss.c: support sample size of 24bit
expr.c: add bitrate and codec to filter expressions
Doc: update sort keys / format strings
expr.c: fix filtering for unset date
mikmod: fix mik_read_comments()
mikmod: return codec name
modplug: return codec names
modplug: remove compressed types
add option to resume playback on startup
resume: also restore current live-filter
resume: save queue to $CMUS_HOME/queue.pl
add :shell command
spawn status_display_program in the background
ui_curses.c: cleanup usage of player_info
cmdline: change filename delimiter to just '/'
track_info_cmp: fix comparison of doubles
ui_curses.c: fix severe display errors if iconv fails
id3: fix UTF-16 handling
Add RoarAudio output plugin
gitignore : add backup files *~
Fix a few pointer types warning
history : fix invalid read and memory leak
track_info : fix invalid read
player : add new buffer_free on exit
ffmpeg : fix memleak in ffmpeg_input_free
I have recently switched to the git version, and all these features
really rock. Thanks to all the contributors and especially Johannes.

I haven't really tested it out much, but found the bitrate feature a
bit lacking.

Firstly, using the %{bitrate} option simply lists the bitrate, without
appending Kbps. I easily added Kbps to the format option, but some users
may not be able to figure it out, I think it looks better with the unit.

Secondly i would love to see the type of bitrate, i.e., vbr, cbr, abr
etc.

And thirdly in case of vbr, if possible instead of a static value, the
actual changing value would be really nice.

Thanks again to all, and hope 2.4.0 final comes out real soon.
Johannes Weißl
2011-04-11 13:31:34 UTC
Permalink
Post by gt
I have recently switched to the git version, and all these features
really rock. Thanks to all the contributors and especially Johannes.
Thanks :-)!
Post by gt
I haven't really tested it out much, but found the bitrate feature a
bit lacking.
Firstly, using the %{bitrate} option simply lists the bitrate, without
appending Kbps. I easily added Kbps to the format option, but some users
may not be able to figure it out, I think it looks better with the unit.
Yes, I thought about it when implementing the feature! But having it as
integer has advantages... I too have " %{bitrate} kbps" in format
options, but this way every user has control ("%{bitrate} kb/s",
"%{bitrate} Kbps", "%{bitrate}kb/s", ...). Same for %{rg_track_gain},
where I append " dB".
Post by gt
Secondly i would love to see the type of bitrate, i.e., vbr, cbr, abr
etc.
Yes, this was already planned, but I didn't know how to do it best! What
about %{codec_profile} (like in foobar2000 [1]), example values: "CBR", "VBR
V2", "VBR V4", etc. What do you think?
Post by gt
And thirdly in case of vbr, if possible instead of a static value, the
actual changing value would be really nice.
Hmm, I don't know if that is easily possible, but I will check!


[1] http://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Title_Formatting_Reference#Technical_information_2


Johannes
gt
2011-04-11 15:37:55 UTC
Permalink
Post by Johannes Weißl
Post by gt
Firstly, using the %{bitrate} option simply lists the bitrate, without
appending Kbps. I easily added Kbps to the format option, but some users
may not be able to figure it out, I think it looks better with the unit.
Yes, I thought about it when implementing the feature! But having it as
integer has advantages... I too have " %{bitrate} kbps" in format
options, but this way every user has control ("%{bitrate} kb/s",
"%{bitrate} Kbps", "%{bitrate}kb/s", ...). Same for %{rg_track_gain},
where I append " dB".
Hmm.. i Guess it's ok as it is then. Maybe mention it in the man page for
inexperienced users to easily implement it.
Post by Johannes Weißl
Post by gt
Secondly i would love to see the type of bitrate, i.e., vbr, cbr, abr
etc.
Yes, this was already planned, but I didn't know how to do it best! What
about %{codec_profile} (like in foobar2000 [1]), example values: "CBR", "VBR
V2", "VBR V4", etc. What do you think?
Yes, that would be great.
Post by Johannes Weißl
Post by gt
And thirdly in case of vbr, if possible instead of a static value, the
actual changing value would be really nice.
Hmm, I don't know if that is easily possible, but I will check!
Only if it's not too problematic, then please do.
Post by Johannes Weißl
[1] http://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Title_Formatting_Reference#Technical_information_2
Thanks again.
Gregory Petrosyan
2011-04-11 15:49:05 UTC
Permalink
Post by gt
Post by Johannes Weißl
Post by gt
And thirdly in case of vbr, if possible instead of a static value, the
actual changing value would be really nice.
Hmm, I don't know if that is easily possible, but I will check!
Only if it's not too problematic, then please do.
I am not sure if it will be useful, though: current bitrate equals
average bitrate for CBR files, and has no meaning for VBR ones.

                Gregory
Johannes Weißl
2011-04-11 16:09:37 UTC
Permalink
Post by Gregory Petrosyan
Post by gt
Post by Johannes Weißl
Post by gt
And thirdly in case of vbr, if possible instead of a static value, the
actual changing value would be really nice.
Hmm, I don't know if that is easily possible, but I will check!
Only if it's not too problematic, then please do.
I am not sure if it will be useful, though: current bitrate equals
average bitrate for CBR files, and has no meaning for VBR ones.
Hmm, since bitrate is bits/time, there are multiple display options for
VBR (or ABR) files, e.g.:
- always display average over whole file (current solution), value is
guessed from XING header or first frame
- when playing, display best currently available value
(bits/(current play time), update every second
- always display current bitrate (bits/1 second), update every second

To see an example, try `madplay -v vbr.mp3`. cmus already supports changing
metadata during playback, so it should be possible. It could also be
used to update duration of aac files, where the estimation is really
poor! VLC also does this...

But this is definitely something for the next feature release of
cmus :-).


Johannes
gt
2011-04-11 17:06:54 UTC
Permalink
Post by Johannes Weißl
Post by Gregory Petrosyan
I am not sure if it will be useful, though: current bitrate equals
average bitrate for CBR files, and has no meaning for VBR ones.
Hmm, since bitrate is bits/time, there are multiple display options for
- always display average over whole file (current solution), value is
guessed from XING header or first frame
- when playing, display best currently available value
(bits/(current play time), update every second
- always display current bitrate (bits/1 second), update every second
To see an example, try `madplay -v vbr.mp3`. cmus already supports changing
metadata during playback, so it should be possible. It could also be
used to update duration of aac files, where the estimation is really
poor! VLC also does this...
But this is definitely something for the next feature release of
cmus :-).
Great, i'll be looking forward to it :D
Johannes Weißl
2011-04-15 06:06:48 UTC
Permalink
Post by Johannes Weißl
Hmm, since bitrate is bits/time, there are multiple display options for
- always display average over whole file (current solution), value is
guessed from XING header or first frame
- when playing, display best currently available value
(bits/(current play time), update every second
- always display current bitrate (bits/1 second), update every second
I wrote a patch that updates bitrate and duration dynamically for files
without good header information (mp3 without xing header and aac). It
works really well (even total library time is updated dynamically).
The bitrate is always set to the "best" value (using the highest number
of successfully decoded frames in a row).

@gt: I think %{bitrate} should always be the average bitrate, not the
current one. Do you think something like %{current_bitrate} (bitrate of
the current second) would be a valuable addition to cmus?

I will post the patch after the other patches are in master!


Johannes
gt
2011-04-15 09:03:08 UTC
Permalink
Post by Johannes Weißl
I wrote a patch that updates bitrate and duration dynamically for files
without good header information (mp3 without xing header and aac). It
works really well (even total library time is updated dynamically).
The bitrate is always set to the "best" value (using the highest number
of successfully decoded frames in a row).
@gt: I think %{bitrate} should always be the average bitrate, not the
current one. Do you think something like %{current_bitrate} (bitrate of
the current second) would be a valuable addition to cmus?
I will post the patch after the other patches are in master!
Johannes
I personally feel that in case of vbr, the bitrate should be current
value, and i think most audio players have it that way.

But if you feel otherwise, or there is unnecessary overhead, then even a
static value should do fine.
Jason Woofenden
2011-04-15 17:49:01 UTC
Permalink
Post by gt
I personally feel that in case of vbr, the bitrate should be current
value, and i think most audio players have it that way.
In the white bar at the bottom that tells you what second you're
on, it makes sense to me to show the current VBR, but up in the
library I think they should all show the same thing. And since
"current vbr" only makes sense for at most one of the tracks, I
think the library should show average VBR.

That said I don't much care about bit rates, except for streaming.

Take care, - Jason
Gregory Petrosyan
2011-04-16 11:02:40 UTC
Permalink
Post by Jason Woofenden
Post by gt
I personally feel that in case of vbr, the bitrate should be current
value, and i think most audio players have it that way.
In the white bar at the bottom that tells you what second you're
on, it makes sense to me to show the current VBR, but up in the
library I think they should all show the same thing. And since
"current vbr" only makes sense for at most one of the tracks, I
think the library should show average VBR.
Am I wrong when I think that current bitrate for VBR files has no meaning at
all? It may be a nice thing to show when playing a track, and that's it.

IMHO %{current_bitrate} and and %{bitrate} should definitely be separate.
Post by Jason Woofenden
That said I don't much care about bit rates, except for streaming.
Yes, for streaming dynamically calculating bitrate is the only way to go, since
we do not know the file size in advance.

Gregory
Johannes Weißl
2011-05-10 16:00:34 UTC
Permalink
Post by gt
I personally feel that in case of vbr, the bitrate should be current
value, and i think most audio players have it that way.
I've written a patch to show the current bitrate in the status line!
Currently it is not displayed for constant bitrate file types, should it
be displayed there as well?

https://gitorious.org/~jmuc/cmus/jw-cmus/commits/current-bitrate


Johannes
Johannes Weißl
2011-05-10 16:02:56 UTC
Permalink
Suggested-by: gt <***@gmail.com>
---
aac.c | 23 +++++++++++++++++++++++
ffmpeg.c | 20 ++++++++++++++++++++
flac.c | 6 ++++++
input.c | 5 +++++
input.h | 1 +
ip.h | 1 +
mad.c | 7 +++++++
mikmod.c | 1 +
modplug.c | 1 +
mp4.c | 23 +++++++++++++++++++++++
mpc.c | 28 +++++++++++++++++++++++++++-
nomad.c | 18 ++++++++++++++++++
nomad.h | 1 +
player.c | 6 +++++-
player.h | 1 +
ui_curses.c | 11 +++++++++--
vorbis.c | 7 +++++++
wav.c | 6 ++++++
wavpack.c | 6 ++++++
19 files changed, 168 insertions(+), 4 deletions(-)

diff --git a/aac.c b/aac.c
index 3b3552a..b5fd470 100644
--- a/aac.c
+++ b/aac.c
@@ -45,6 +45,11 @@ struct aac_private {
long bitrate;
int object_type;

+ struct {
+ unsigned long samples;
+ unsigned long bytes;
+ } current;
+
char *overflow_buf;
int overflow_buf_len;

@@ -289,6 +294,10 @@ static int decode_one_frame(struct input_plugin_data *ip_data, void *buffer, int

/* aac data -> raw pcm */
sample_buf = NeAACDecDecode(priv->decoder, &frame_info, aac_data, aac_data_size);
+ if (frame_info.error == 0 && frame_info.samples > 0) {
+ priv->current.samples += frame_info.samples;
+ priv->current.bytes += frame_info.bytesconsumed;
+ }

buffer_consume(ip_data, frame_info.bytesconsumed);

@@ -445,6 +454,19 @@ static long aac_bitrate(struct input_plugin_data *ip_data)
return priv->bitrate != -1 ? priv->bitrate : -IP_ERROR_FUNCTION_NOT_SUPPORTED;
}

+static long aac_current_bitrate(struct input_plugin_data *ip_data)
+{
+ struct aac_private *priv = ip_data->private;
+ long bitrate = -1;
+ if (priv->current.samples > 0) {
+ priv->current.samples /= priv->channels;
+ bitrate = (8 * priv->current.bytes * priv->sample_rate) / priv->current.samples;
+ priv->current.samples = 0;
+ priv->current.bytes = 0;
+ }
+ return bitrate;
+}
+
static char *aac_codec(struct input_plugin_data *ip_data)
{
return xstrdup("aac");
@@ -482,6 +504,7 @@ const struct input_plugin_ops ip_ops = {
.read_comments = aac_read_comments,
.duration = aac_duration,
.bitrate = aac_bitrate,
+ .bitrate_current = aac_current_bitrate,
.codec = aac_codec,
.codec_profile = aac_codec_profile
};
diff --git a/ffmpeg.c b/ffmpeg.c
index 8095abe..21722d3 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -52,6 +52,9 @@ struct ffmpeg_input {
AVPacket pkt;
int curr_pkt_size;
uint8_t *curr_pkt_buf;
+
+ unsigned long curr_size;
+ unsigned long curr_duration;
};

struct ffmpeg_output {
@@ -295,6 +298,8 @@ static int ffmpeg_fill_buffer(AVFormatContext *ic, AVCodecContext *cc, struct ff
}
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;
}

@@ -450,6 +455,20 @@ static long ffmpeg_bitrate(struct input_plugin_data *ip_data)
return bitrate ? bitrate : -IP_ERROR_FUNCTION_NOT_SUPPORTED;
}

+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];
+ long bitrate = -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;
+ priv->input->curr_size = 0;
+ priv->input->curr_duration = 0;
+ }
+ return bitrate;
+}
+
static char *ffmpeg_codec(struct input_plugin_data *ip_data)
{
struct ffmpeg_private *priv = ip_data->private;
@@ -493,6 +512,7 @@ const struct input_plugin_ops ip_ops = {
.read_comments = ffmpeg_read_comments,
.duration = ffmpeg_duration,
.bitrate = ffmpeg_bitrate,
+ .bitrate_current = ffmpeg_current_bitrate,
.codec = ffmpeg_codec,
.codec_profile = ffmpeg_codec_profile
};
diff --git a/flac.c b/flac.c
index 5d82833..9feb189 100644
--- a/flac.c
+++ b/flac.c
@@ -549,6 +549,11 @@ static long flac_bitrate(struct input_plugin_data *ip_data)
return file_size * 8 / priv->duration;
}

+static long flac_current_bitrate(struct input_plugin_data *ip_data)
+{
+ return -IP_ERROR_FUNCTION_NOT_SUPPORTED;
+}
+
static char *flac_codec(struct input_plugin_data *ip_data)
{
return xstrdup("flac");
@@ -568,6 +573,7 @@ const struct input_plugin_ops ip_ops = {
.read_comments = flac_read_comments,
.duration = flac_duration,
.bitrate = flac_bitrate,
+ .bitrate_current = flac_current_bitrate,
.codec = flac_codec,
.codec_profile = flac_codec_profile
};
diff --git a/input.c b/input.c
index 93c3aaa..cd5a60c 100644
--- a/input.c
+++ b/input.c
@@ -718,6 +718,11 @@ int ip_bitrate(struct input_plugin *ip)
return ip->bitrate;
}

+int ip_current_bitrate(struct input_plugin *ip)
+{
+ return ip->ops->bitrate_current(&ip->data);
+}
+
char *ip_codec(struct input_plugin *ip)
{
if (ip->data.remote)
diff --git a/input.h b/input.h
index 7fd4a63..83107ce 100644
--- a/input.h
+++ b/input.h
@@ -66,6 +66,7 @@ int ip_read_comments(struct input_plugin *ip, struct keyval **comments);

int ip_duration(struct input_plugin *ip);
int ip_bitrate(struct input_plugin *ip);
+int ip_current_bitrate(struct input_plugin *ip);
char *ip_codec(struct input_plugin *ip);
char *ip_codec_profile(struct input_plugin *ip);

diff --git a/ip.h b/ip.h
index 29f1975..865f78e 100644
--- a/ip.h
+++ b/ip.h
@@ -84,6 +84,7 @@ struct input_plugin_ops {
struct keyval **comments);
int (*duration)(struct input_plugin_data *ip_data);
long (*bitrate)(struct input_plugin_data *ip_data);
+ long (*bitrate_current)(struct input_plugin_data *ip_data);
char *(*codec)(struct input_plugin_data *ip_data);
char *(*codec_profile)(struct input_plugin_data *ip_data);
};
diff --git a/mad.c b/mad.c
index 2d868ce..6e5b1a5 100644
--- a/mad.c
+++ b/mad.c
@@ -204,6 +204,12 @@ static long mad_bitrate(struct input_plugin_data *ip_data)
return bitrate != -1 ? bitrate : -IP_ERROR_FUNCTION_NOT_SUPPORTED;
}

+static long mad_current_bitrate(struct input_plugin_data *ip_data)
+{
+ struct nomad *nomad = ip_data->private;
+ return nomad_current_bitrate(nomad);
+}
+
static char *mad_codec(struct input_plugin_data *ip_data)
{
struct nomad *nomad = ip_data->private;
@@ -263,6 +269,7 @@ const struct input_plugin_ops ip_ops = {
.read_comments = mad_read_comments,
.duration = mad_duration,
.bitrate = mad_bitrate,
+ .bitrate_current = mad_current_bitrate,
.codec = mad_codec,
.codec_profile = mad_codec_profile
};
diff --git a/mikmod.c b/mikmod.c
index 259bd9c..e762660 100644
--- a/mikmod.c
+++ b/mikmod.c
@@ -161,6 +161,7 @@ const struct input_plugin_ops ip_ops = {
.read_comments = mik_read_comments,
.duration = mik_duration,
.bitrate = mik_bitrate,
+ .bitrate_current = mik_bitrate,
.codec = mik_codec,
.codec_profile = mik_codec_profile
};
diff --git a/modplug.c b/modplug.c
index c00ecea..3dd37c5 100644
--- a/modplug.c
+++ b/modplug.c
@@ -226,6 +226,7 @@ const struct input_plugin_ops ip_ops = {
.read_comments = mod_read_comments,
.duration = mod_duration,
.bitrate = mod_bitrate,
+ .bitrate_current = mod_bitrate,
.codec = mod_codec,
.codec_profile = mod_codec_profile
};
diff --git a/mp4.c b/mp4.c
index 53aa574..c564a44 100644
--- a/mp4.c
+++ b/mp4.c
@@ -53,6 +53,11 @@ struct mp4_private {
MP4SampleId sample;
MP4SampleId num_samples;
} mp4;
+
+ struct {
+ unsigned long samples;
+ unsigned long bytes;
+ } current;
};


@@ -231,6 +236,10 @@ static int decode_one_frame(struct input_plugin_data *ip_data, void *buffer, int
}

sample_buf = NeAACDecDecode(priv->decoder, &frame_info, aac_data, aac_data_len);
+ if (frame_info.error == 0 && frame_info.samples > 0) {
+ priv->current.samples += frame_info.samples;
+ priv->current.bytes += frame_info.bytesconsumed;
+ }

free(aac_data);

@@ -473,6 +482,19 @@ static long mp4_bitrate(struct input_plugin_data *ip_data)
return bitrate ? bitrate : -IP_ERROR_FUNCTION_NOT_SUPPORTED;
}

+static long mp4_current_bitrate(struct input_plugin_data *ip_data)
+{
+ struct mp4_private *priv = ip_data->private;
+ long bitrate = -1;
+ if (priv->current.samples > 0) {
+ priv->current.samples /= priv->channels;
+ bitrate = (8 * priv->current.bytes * priv->sample_rate) / priv->current.samples;
+ priv->current.samples = 0;
+ priv->current.bytes = 0;
+ }
+ return bitrate;
+}
+
static char *mp4_codec(struct input_plugin_data *ip_data)
{
return xstrdup("aac");
@@ -514,6 +536,7 @@ const struct input_plugin_ops ip_ops = {
.read_comments = mp4_read_comments,
.duration = mp4_duration,
.bitrate = mp4_bitrate,
+ .bitrate_current = mp4_current_bitrate,
.codec = mp4_codec,
.codec_profile = mp4_codec_profile
};
diff --git a/mpc.c b/mpc.c
index 6561328..42b9dcb 100644
--- a/mpc.c
+++ b/mpc.c
@@ -70,6 +70,11 @@ struct mpc_private {
* use MPC_DECODER_BUFFER_LENGTH just to be sure it works
*/
MPC_SAMPLE_FORMAT samples[MPC_DECODER_BUFFER_LENGTH];
+
+ struct {
+ unsigned long samples;
+ unsigned long bits;
+ } current;
};

/* callbacks */
@@ -255,11 +260,15 @@ static int mpc_read(struct input_plugin_data *ip_data, char *buffer, int count)

samples = frame.samples;
priv->samples_avail = samples * priv->info.channels;
+
+ priv->current.samples += frame.samples;
+ priv->current.bits += frame.bits;
}
#else

if (priv->samples_avail == 0) {
- uint32_t status = mpc_decoder_decode(&priv->decoder, priv->samples, NULL, NULL);
+ uint32_t acc = 0, bits = 0;
+ uint32_t status = mpc_decoder_decode(&priv->decoder, priv->samples, &acc, &bits);

if (status == (uint32_t)(-1)) {
/* right ret val? */
@@ -274,6 +283,9 @@ static int mpc_read(struct input_plugin_data *ip_data, char *buffer, int count)
* the api documentation is wrong
*/
priv->samples_avail = status * priv->info.channels;
+
+ priv->current.samples += status;
+ priv->current.bits += bits;
}
#endif

@@ -386,6 +398,19 @@ static long mpc_bitrate(struct input_plugin_data *ip_data)
return -IP_ERROR_FUNCTION_NOT_SUPPORTED;
}

+static long mpc_current_bitrate(struct input_plugin_data *ip_data)
+{
+ struct mpc_private *priv = ip_data->private;
+ long bitrate = -1;
+ if (priv->current.samples > 0) {
+ bitrate = (priv->info.sample_freq * priv->current.bits) / priv->current.samples;
+ priv->current.samples = 0;
+ priv->current.bits = 0;
+ }
+ return bitrate;
+
+}
+
static char *mpc_codec(struct input_plugin_data *ip_data)
{
struct mpc_private *priv = ip_data->private;
@@ -426,6 +451,7 @@ const struct input_plugin_ops ip_ops = {
.read_comments = mpc_read_comments,
.duration = mpc_duration,
.bitrate = mpc_bitrate,
+ .bitrate_current = mpc_current_bitrate,
.codec = mpc_codec,
.codec_profile = mpc_codec_profile
};
diff --git a/nomad.c b/nomad.c
index e892d78..46e238a 100644
--- a/nomad.c
+++ b/nomad.c
@@ -78,6 +78,11 @@ struct nomad {
struct seek_idx_entry *table;
} seek_idx;

+ struct {
+ unsigned long long int bitrate_sum;
+ unsigned long nr_frames;
+ } current;
+
struct nomad_info info;
void *datasource;
int datasource_fd;
@@ -492,6 +497,8 @@ start:
goto start;
}
nomad->cur_frame++;
+ nomad->current.bitrate_sum += nomad->frame.header.bitrate;
+ nomad->current.nr_frames++;
if (nomad->info.filesize > 0) {
build_seek_index(nomad);
} else {
@@ -843,3 +850,14 @@ const struct nomad_info *nomad_info(struct nomad *nomad)
{
return &nomad->info;
}
+
+long nomad_current_bitrate(struct nomad *nomad)
+{
+ long bitrate = -1;
+ if (nomad->current.nr_frames > 0) {
+ bitrate = nomad->current.bitrate_sum / nomad->current.nr_frames;
+ nomad->current.bitrate_sum = 0;
+ nomad->current.nr_frames = 0;
+ }
+ return bitrate;
+}
diff --git a/nomad.h b/nomad.h
index 1250913..add2537 100644
--- a/nomad.h
+++ b/nomad.h
@@ -98,5 +98,6 @@ int nomad_time_seek(struct nomad *nomad, double pos);
const struct nomad_xing *nomad_xing(struct nomad *nomad);
const struct nomad_lame *nomad_lame(struct nomad *nomad);
const struct nomad_info *nomad_info(struct nomad *nomad);
+long nomad_current_bitrate(struct nomad *nomad);

#endif
diff --git a/player.c b/player.c
index 674641f..e10c24c 100644
--- a/player.c
+++ b/player.c
@@ -56,6 +56,7 @@ struct player_info player_info = {
.metadata = { 0, },
.status = PLAYER_STATUS_STOPPED,
.pos = 0,
+ .current_bitrate = -1,
.buffer_fill = 0,
.buffer_size = 0,
.error_msg = NULL,
@@ -444,6 +445,7 @@ static void player_error(const char *msg)
player_info_lock();
player_info.status = consumer_status;
player_info.pos = 0;
+ player_info.current_bitrate = -1;
player_info.buffer_fill = buffer_get_filled_chunks();
player_info.buffer_size = buffer_nr_chunks;
player_info.status_changed = 1;
@@ -517,11 +519,12 @@ static void __consumer_position_update(void)
if (consumer_status == CS_PLAYING || consumer_status == CS_PAUSED)
pos = consumer_pos / buffer_second_size();
if (pos != old_pos) {
-/* d_print("\n"); */
old_pos = pos;

player_info_lock();
player_info.pos = pos;
+
+ player_info.current_bitrate = ip_current_bitrate(ip);
player_info.position_changed = 1;
player_info_unlock();
}
@@ -541,6 +544,7 @@ static void __player_status_changed(void)
player_info_lock();
player_info.status = consumer_status;
player_info.pos = pos;
+ player_info.current_bitrate = -1;
player_info.buffer_fill = buffer_get_filled_chunks();
player_info.buffer_size = buffer_nr_chunks;
player_info.status_changed = 1;
diff --git a/player.h b/player.h
index 6bae225..72fb3d8 100644
--- a/player.h
+++ b/player.h
@@ -65,6 +65,7 @@ struct player_info {
/* status */
enum player_status status;
int pos;
+ int current_bitrate;

int buffer_fill;
int buffer_size;
diff --git a/ui_curses.c b/ui_curses.c
index 31f51d8..3557c71 100644
--- a/ui_curses.c
+++ b/ui_curses.c
@@ -270,6 +270,7 @@ enum {
SF_CONTINUE,
SF_SHUFFLE,
SF_PLAYLISTMODE,
+ SF_BITRATE,
NR_SFS
};

@@ -286,6 +287,7 @@ static struct format_option status_fopts[NR_SFS + 1] = {
DEF_FO_STR('C', NULL, 0),
DEF_FO_STR('S', NULL, 0),
DEF_FO_STR('L', NULL, 0),
+ DEF_FO_INT('B', NULL, 0),
DEF_FO_END
};

@@ -1031,6 +1033,7 @@ static void do_update_statusline(void)
fopt_set_int(&status_fopts[SF_RVOLUME], vol_right, 0);
fopt_set_int(&status_fopts[SF_BUFFER], buffer_fill, 0);
fopt_set_str(&status_fopts[SF_CONTINUE], cont_strs[player_cont]);
+ fopt_set_int(&status_fopts[SF_BITRATE], player_info.current_bitrate / 1000. + 0.5, 0);

strcpy(format, " %s %p ");
if (duration != -1)
@@ -1043,8 +1046,12 @@ static void do_update_statusline(void)
strcat(format, "vol: %v ");
}
}
- if (player_info.ti && is_url(player_info.ti->filename))
- strcat(format, "buf: %b ");
+ if (player_info.ti) {
+ if (is_url(player_info.ti->filename))
+ strcat(format, "buf: %b ");
+ if (player_info.current_bitrate > 0)
+ strcat(format, " %B kbps ");
+ }
strcat(format, "%=");
if (player_repeat_current) {
strcat(format, "repeat current");
diff --git a/vorbis.c b/vorbis.c
index a086d65..58be98c 100644
--- a/vorbis.c
+++ b/vorbis.c
@@ -303,6 +303,12 @@ static long vorbis_bitrate(struct input_plugin_data *ip_data)
return bitrate;
}

+static long vorbis_current_bitrate(struct input_plugin_data *ip_data)
+{
+ struct vorbis_private *priv = ip_data->private;
+ return ov_bitrate_instant(&priv->vf);
+}
+
static char *vorbis_codec(struct input_plugin_data *ip_data)
{
return xstrdup("vorbis");
@@ -351,6 +357,7 @@ const struct input_plugin_ops ip_ops = {
.read_comments = vorbis_read_comments,
.duration = vorbis_duration,
.bitrate = vorbis_bitrate,
+ .bitrate_current = vorbis_current_bitrate,
.codec = vorbis_codec,
.codec_profile = vorbis_codec_profile
};
diff --git a/wav.c b/wav.c
index 70efc98..a0f8d71 100644
--- a/wav.c
+++ b/wav.c
@@ -380,6 +380,11 @@ static long wav_bitrate(struct input_plugin_data *ip_data)
return sf_get_bits(sf) * sf_get_rate(sf) * sf_get_channels(sf);
}

+static long wav_current_bitrate(struct input_plugin_data *ip_data)
+{
+ return -IP_ERROR_FUNCTION_NOT_SUPPORTED;
+}
+
static char *wav_codec(struct input_plugin_data *ip_data)
{
char buf[16];
@@ -404,6 +409,7 @@ const struct input_plugin_ops ip_ops = {
.read_comments = wav_read_comments,
.duration = wav_duration,
.bitrate = wav_bitrate,
+ .bitrate_current = wav_current_bitrate,
.codec = wav_codec,
.codec_profile = wav_codec_profile
};
diff --git a/wavpack.c b/wavpack.c
index 6694cba..2545d77 100644
--- a/wavpack.c
+++ b/wavpack.c
@@ -367,6 +367,11 @@ static long wavpack_bitrate(struct input_plugin_data *ip_data)
return (long) (bitrate + 0.5);
}

+static long wavpack_current_bitrate(struct input_plugin_data *ip_data)
+{
+ return -IP_ERROR_FUNCTION_NOT_SUPPORTED;
+}
+
static char *wavpack_codec(struct input_plugin_data *ip_data)
{
return xstrdup("wavpack");
@@ -413,6 +418,7 @@ const struct input_plugin_ops ip_ops = {
.read_comments = wavpack_read_comments,
.duration = wavpack_duration,
.bitrate = wavpack_bitrate,
+ .bitrate_current = wavpack_current_bitrate,
.codec = wavpack_codec,
.codec_profile = wavpack_codec_profile
};
--
1.7.5.1
Gregory Petrosyan
2011-05-10 16:46:35 UTC
Permalink
Post by Johannes Weißl
Post by gt
I personally feel that in case of vbr, the bitrate should be current
value, and i think most audio players have it that way.
I've written a patch to show the current bitrate in the status line!
Currently it is not displayed for constant bitrate file types, should it
be displayed there as well?
Can you please explain to me what is the reason of having the current bitrate
in the status line in the first place? Right now I have

set format_current= %a - %l -%3n. %t%= %{bitrate}kbps %{codec} %{codec_profile} %y

in my rc file, and that helps me to know if I am playing 128kbps MP3, or
320kbps MP3, or FLAC. What helpful does having the current bitrate in the
status line?

Gregory
Johannes Weißl
2011-05-10 21:30:23 UTC
Permalink
Post by Gregory Petrosyan
Post by Johannes Weißl
Post by gt
I personally feel that in case of vbr, the bitrate should be current
value, and i think most audio players have it that way.
I've written a patch to show the current bitrate in the status line!
Currently it is not displayed for constant bitrate file types, should it
be displayed there as well?
Can you please explain to me what is the reason of having the current bitrate
in the status line in the first place? Right now I have
set format_current= %a - %l -%3n. %t%= %{bitrate}kbps %{codec} %{codec_profile} %y
in my rc file, and that helps me to know if I am playing 128kbps MP3, or
320kbps MP3, or FLAC. What helpful does having the current bitrate in the
status line?
Well, I can't think of a strong reason... a lot of players have this
feature, I guess it's only a matter of taste, There could be an option
to disable it, but this isn't very beautiful.

Optimal would be to configure the status bar via config option, but this
is not possible without conditionals...


Johannes
gt
2011-05-11 04:20:21 UTC
Permalink
Post by Johannes Weißl
I've written a patch to show the current bitrate in the status line!
Currently it is not displayed for constant bitrate file types, should it
be displayed there as well?
https://gitorious.org/~jmuc/cmus/jw-cmus/commits/current-bitrate
Hi Johannes, first of all thanks for the patch.

Now there is a question, if the current bitrate is displayed in the
status line, and we have the bitrate option in format_current also,
won't it be a duplication of the bitrates.

If i understand it correctly, the format_current option will display a
static value, as it is doing currently, and in the status line we'll
have varying bitrate.

The question is, isn't it possible to have the current bitrate in the
format_current field? If it isn't, then alternatively, all the bitrate
values should be displayed in the status line. Something, similar to
what moc does.
Johannes Weißl
2011-05-11 09:05:03 UTC
Permalink
Hi gt,
Post by gt
Now there is a question, if the current bitrate is displayed in the
status line, and we have the bitrate option in format_current also,
won't it be a duplication of the bitrates.
Well, we also have %{duration}, but still the current position and
duration are shown in the status bar...
Post by gt
If i understand it correctly, the format_current option will display a
static value, as it is doing currently, and in the status line we'll
have varying bitrate.
Yes, exactly!
Post by gt
The question is, isn't it possible to have the current bitrate in the
format_current field? If it isn't, then alternatively, all the bitrate
values should be displayed in the status line. Something, similar to
what moc does.
Well, the problem is that the value of %{bitrate} is equal for all
format_* options, so if it is non-static, it is in the format_playlist
option, too. Also one might be more interested in the average bitrate of
the current song, which is not possible then.


Johannes
gt
2011-05-11 10:49:32 UTC
Permalink
Post by Johannes Weißl
Hi gt,
Post by gt
Now there is a question, if the current bitrate is displayed in the
status line, and we have the bitrate option in format_current also,
won't it be a duplication of the bitrates.
Well, we also have %{duration}, but still the current position and
duration are shown in the status bar...
Post by gt
If i understand it correctly, the format_current option will display a
static value, as it is doing currently, and in the status line we'll
have varying bitrate.
Yes, exactly!
Post by gt
The question is, isn't it possible to have the current bitrate in the
format_current field? If it isn't, then alternatively, all the bitrate
values should be displayed in the status line. Something, similar to
what moc does.
Well, the problem is that the value of %{bitrate} is equal for all
format_* options, so if it is non-static, it is in the format_playlist
option, too. Also one might be more interested in the average bitrate of
the current song, which is not possible then.
Thanks for the explanation. I guess it's ok as you intended it then.

So, another option is to have the cbr displayed in the status field too,
as you asked previously. This way, those who don't want it in the
currently playing track field, can remove it from the format_current
field.
Johannes Weißl
2011-05-11 12:35:11 UTC
Permalink
Post by gt
So, another option is to have the cbr displayed in the status field too,
as you asked previously. This way, those who don't want it in the
currently playing track field, can remove it from the format_current
field.
Yes, that makes sense! I pushed the change to the current-bitrate branch.


Johannes
gt
2011-05-11 16:59:17 UTC
Permalink
Post by Johannes Weißl
Post by gt
So, another option is to have the cbr displayed in the status field too,
as you asked previously. This way, those who don't want it in the
currently playing track field, can remove it from the format_current
field.
Yes, that makes sense! I pushed the change to the current-bitrate branch.
Thanks, i just checked it out, and it works awesome.
Gregory Petrosyan
2011-05-13 08:22:49 UTC
Permalink
Post by Johannes Weißl
Post by gt
So, another option is to have the cbr displayed in the status field too,
as you asked previously. This way, those who don't want it in the
currently playing track field, can remove it from the format_current
field.
Yes, that makes sense! I pushed the change to the current-bitrate branch.
OK! I've pushed the patch to -pu for now.

Gregory

Johannes Weißl
2011-04-11 16:52:16 UTC
Permalink
Post by gt
Post by Johannes Weißl
Post by gt
Firstly, using the %{bitrate} option simply lists the bitrate, without
appending Kbps. I easily added Kbps to the format option, but some users
may not be able to figure it out, I think it looks better with the unit.
Yes, I thought about it when implementing the feature! But having it as
integer has advantages... I too have " %{bitrate} kbps" in format
options, but this way every user has control ("%{bitrate} kb/s",
"%{bitrate} Kbps", "%{bitrate}kb/s", ...). Same for %{rg_track_gain},
where I append " dB".
Hmm.. i Guess it's ok as it is then. Maybe mention it in the man page for
inexperienced users to easily implement it.
Yes, that sounds reasonable... could you write a patch?
Post by gt
Post by Johannes Weißl
Post by gt
Secondly i would love to see the type of bitrate, i.e., vbr, cbr, abr
etc.
Yes, this was already planned, but I didn't know how to do it best! What
about %{codec_profile} (like in foobar2000 [1]), example values: "CBR", "VBR
V2", "VBR V4", etc. What do you think?
[1] http://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Title_Formatting_Reference#Technical_information_2
Yes, that would be great.
What about the other $info(...) from foobar2000? I don't think we need
all of them... what about:
1. %{tool} (e.g. LAME3.97)
2. %{encoding} (e.g. lossy)
The name is a bit general, but using the same names as f2k has an
advantage.
3. %{tagtype} (e.g. id3v2,apev2)
4. %{channels} (e.g. 2)
Should this be a string ("stereo") or a number? Number would be
easier. Also for more than 2 channels it is not clear what string to
display...
Post by gt
Post by Johannes Weißl
Post by gt
And thirdly in case of vbr, if possible instead of a static value, the
actual changing value would be really nice.
Hmm, I don't know if that is easily possible, but I will check!
Only if it's not too problematic, then please do.
Am I right that this makes only sense for the status line? Or title
also? Otherwise, we would need to update the whole curses window every
second... Maybe I will implement a check if bitrate is used in format
options and only update if necessary...




Johannes
gt
2011-04-11 18:10:03 UTC
Permalink
Post by Johannes Weißl
Post by gt
Hmm.. i Guess it's ok as it is then. Maybe mention it in the man page for
inexperienced users to easily implement it.
Yes, that sounds reasonable... could you write a patch?
Patch for the man page? I can try contributing with the documentation,
but i have no programming experience.
Post by Johannes Weißl
What about the other $info(...) from foobar2000? I don't think we need
1. %{tool} (e.g. LAME3.97)
2. %{encoding} (e.g. lossy)
The name is a bit general, but using the same names as f2k has an
advantage.
3. %{tagtype} (e.g. id3v2,apev2)
4. %{channels} (e.g. 2)
Should this be a string ("stereo") or a number? Number would be
easier. Also for more than 2 channels it is not clear what string to
display...
Well, i think others members of the list can voice their opinion about
these options. For me, samplerate would be another good option.
Post by Johannes Weißl
Post by gt
And thirdly in case of vbr, if possible instead of a static value, the
actual changing value would be really nice.
Am I right that this makes only sense for the status line? Or title
also? Otherwise, we would need to update the whole curses window every
second... Maybe I will implement a check if bitrate is used in format
options and only update if necessary...
Yes this should primarily be visible in the status line. As for the
title, at least i won't be using it in the title string.
Johannes Weißl
2011-04-11 18:19:42 UTC
Permalink
Post by gt
Post by Johannes Weißl
Post by gt
Hmm.. i Guess it's ok as it is then. Maybe mention it in the man page for
inexperienced users to easily implement it.
Yes, that sounds reasonable... could you write a patch?
Patch for the man page? I can try contributing with the documentation,
but i have no programming experience.
Yes, for the man page (Doc/cmus.txt). Just do your modifications, test
them, commit them (git commit -a), generate the patch (git format-patch
HEAD~1) and send it to the mailing list for inspection.


Johannes
gt
2011-04-12 10:31:11 UTC
Permalink
Post by Johannes Weißl
Post by gt
Patch for the man page? I can try contributing with the documentation,
but i have no programming experience.
Yes, for the man page (Doc/cmus.txt). Just do your modifications, test
them, commit them (git commit -a), generate the patch (git format-patch
HEAD~1) and send it to the mailing list for inspection.
I have attached the patch for cmus.txt. It's the first patch of my life :P

Please point out any mistake.
Gregory Petrosyan
2011-04-12 14:39:39 UTC
Permalink
Post by gt
Post by Johannes Weißl
Post by gt
Patch for the man page? I can try contributing with the documentation,
but i have no programming experience.
Yes, for the man page (Doc/cmus.txt). Just do your modifications, test
them, commit them (git commit -a), generate the patch (git format-patch
HEAD~1) and send it to the mailing list for inspection.
I have attached the patch for cmus.txt. It's the first patch of my life :P
Looks good -- applied! Congrats on the first patch :-) Contributing to open
source projects is a lot of fun, hope you'll like it!
Post by gt
Please point out any mistake.
OK, a couple of nitpicks then:
gt
2011-04-13 12:44:09 UTC
Permalink
Post by Gregory Petrosyan
Post by gt
Post by Johannes Weißl
Post by gt
Patch for the man page? I can try contributing with the documentation,
but i have no programming experience.
Yes, for the man page (Doc/cmus.txt). Just do your modifications, test
them, commit them (git commit -a), generate the patch (git format-patch
HEAD~1) and send it to the mailing list for inspection.
I have attached the patch for cmus.txt. It's the first patch of my life :P
Looks good -- applied! Congrats on the first patch :-) Contributing to open
source projects is a lot of fun, hope you'll like it!
Post by gt
Please point out any mistake.
Loading...