Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
731ea9b4
Commit
731ea9b4
authored
Jan 21, 2011
by
Yuriy Kaminskiy
Committed by
Max Kellermann
Jan 21, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mpg123 decoder: report bitrate
parent
18b30b50
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
1 deletion
+25
-1
mpg123_decoder_plugin.c
src/decoder/mpg123_decoder_plugin.c
+25
-1
No files found.
src/decoder/mpg123_decoder_plugin.c
View file @
731ea9b4
...
...
@@ -105,6 +105,7 @@ mpd_mpg123_file_decode(struct decoder *decoder, const char *path_fs)
int
error
;
off_t
num_samples
;
enum
decoder_command
cmd
;
struct
mpg123_frameinfo
info
;
/* open the file */
...
...
@@ -128,6 +129,21 @@ mpd_mpg123_file_decode(struct decoder *decoder, const char *path_fs)
(
float
)
num_samples
/
(
float
)
audio_format
.
sample_rate
);
if
(
mpg123_info
(
handle
,
&
info
)
!=
MPG123_OK
)
{
info
.
vbr
=
MPG123_CBR
;
info
.
bitrate
=
0
;
}
switch
(
info
.
vbr
)
{
case
MPG123_ABR
:
info
.
bitrate
=
info
.
abr_rate
;
break
;
case
MPG123_CBR
:
break
;
default:
info
.
bitrate
=
0
;
}
/* the decoder main loop */
do
{
...
...
@@ -144,9 +160,17 @@ mpd_mpg123_file_decode(struct decoder *decoder, const char *path_fs)
break
;
}
/* update bitrate for ABR/VBR */
if
(
info
.
vbr
!=
MPG123_CBR
)
{
/* FIXME: maybe skip, as too expensive? */
/* FIXME: maybe, (info.vbr == MPG123_VBR) ? */
if
(
mpg123_info
(
handle
,
&
info
)
!=
MPG123_OK
)
info
.
bitrate
=
0
;
}
/* send to MPD */
cmd
=
decoder_data
(
decoder
,
NULL
,
buffer
,
nbytes
,
0
);
cmd
=
decoder_data
(
decoder
,
NULL
,
buffer
,
nbytes
,
info
.
bitrate
);
/* seeking not yet implemented */
}
while
(
cmd
==
DECODE_COMMAND_NONE
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment