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
4515ac5e
Commit
4515ac5e
authored
Aug 26, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mp3: converted the MUTEFRAME_ macros to an enum
Also introduce MUTEFRAME_NONE; previously, the code used "0".
parent
95fff55d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
9 deletions
+12
-9
mp3_plugin.c
src/inputPlugins/mp3_plugin.c
+12
-9
No files found.
src/inputPlugins/mp3_plugin.c
View file @
4515ac5e
...
@@ -41,8 +41,11 @@ enum mp3_action {
...
@@ -41,8 +41,11 @@ enum mp3_action {
DECODE_OK
=
0
DECODE_OK
=
0
};
};
#define MUTEFRAME_SKIP 1
enum
muteframe
{
#define MUTEFRAME_SEEK 2
MUTEFRAME_NONE
,
MUTEFRAME_SKIP
,
MUTEFRAME_SEEK
};
/* the number of samples of silence the decoder inserts at start */
/* the number of samples of silence the decoder inserts at start */
#define DECODERDELAY 529
#define DECODERDELAY 529
...
@@ -153,7 +156,7 @@ typedef struct _mp3DecodeData {
...
@@ -153,7 +156,7 @@ typedef struct _mp3DecodeData {
mpd_sint16
outputBuffer
[
MP3_DATA_OUTPUT_BUFFER_SIZE
];
mpd_sint16
outputBuffer
[
MP3_DATA_OUTPUT_BUFFER_SIZE
];
float
totalTime
;
float
totalTime
;
float
elapsedTime
;
float
elapsedTime
;
int
muteFrame
;
enum
muteframe
muteFrame
;
long
*
frameOffset
;
long
*
frameOffset
;
mad_timer_t
*
times
;
mad_timer_t
*
times
;
unsigned
long
highestFrame
;
unsigned
long
highestFrame
;
...
@@ -176,7 +179,7 @@ typedef struct _mp3DecodeData {
...
@@ -176,7 +179,7 @@ typedef struct _mp3DecodeData {
static
void
initMp3DecodeData
(
mp3DecodeData
*
data
,
struct
decoder
*
decoder
,
static
void
initMp3DecodeData
(
mp3DecodeData
*
data
,
struct
decoder
*
decoder
,
InputStream
*
inStream
)
InputStream
*
inStream
)
{
{
data
->
muteFrame
=
0
;
data
->
muteFrame
=
MUTEFRAME_NONE
;
data
->
highestFrame
=
0
;
data
->
highestFrame
=
0
;
data
->
maxFrames
=
0
;
data
->
maxFrames
=
0
;
data
->
frameOffset
=
NULL
;
data
->
frameOffset
=
NULL
;
...
@@ -861,16 +864,16 @@ mp3Read(mp3DecodeData * data, ReplayGainInfo ** replayGainInfo)
...
@@ -861,16 +864,16 @@ mp3Read(mp3DecodeData * data, ReplayGainInfo ** replayGainInfo)
switch
(
data
->
muteFrame
)
{
switch
(
data
->
muteFrame
)
{
case
MUTEFRAME_SKIP
:
case
MUTEFRAME_SKIP
:
data
->
muteFrame
=
0
;
data
->
muteFrame
=
MUTEFRAME_NONE
;
break
;
break
;
case
MUTEFRAME_SEEK
:
case
MUTEFRAME_SEEK
:
if
(
decoder_seek_where
(
decoder
)
<=
data
->
elapsedTime
)
{
if
(
decoder_seek_where
(
decoder
)
<=
data
->
elapsedTime
)
{
decoder_clear
(
decoder
);
decoder_clear
(
decoder
);
data
->
muteFrame
=
0
;
data
->
muteFrame
=
MUTEFRAME_NONE
;
decoder_command_finished
(
decoder
);
decoder_command_finished
(
decoder
);
}
}
break
;
break
;
default
:
case
MUTEFRAME_NONE
:
mad_synth_frame
(
&
data
->
synth
,
&
data
->
frame
);
mad_synth_frame
(
&
data
->
synth
,
&
data
->
frame
);
if
(
!
data
->
foundFirstFrame
)
{
if
(
!
data
->
foundFirstFrame
)
{
...
@@ -974,7 +977,7 @@ mp3Read(mp3DecodeData * data, ReplayGainInfo ** replayGainInfo)
...
@@ -974,7 +977,7 @@ mp3Read(mp3DecodeData * data, ReplayGainInfo ** replayGainInfo)
decoder_command_finished
(
decoder
);
decoder_command_finished
(
decoder
);
}
else
}
else
decoder_seek_error
(
decoder
);
decoder_seek_error
(
decoder
);
data
->
muteFrame
=
0
;
data
->
muteFrame
=
MUTEFRAME_NONE
;
}
}
}
else
if
(
decoder_get_command
(
decoder
)
==
DECODE_COMMAND_SEEK
&&
}
else
if
(
decoder_get_command
(
decoder
)
==
DECODE_COMMAND_SEEK
&&
!
data
->
inStream
->
seekable
)
{
!
data
->
inStream
->
seekable
)
{
...
@@ -992,7 +995,7 @@ mp3Read(mp3DecodeData * data, ReplayGainInfo ** replayGainInfo)
...
@@ -992,7 +995,7 @@ mp3Read(mp3DecodeData * data, ReplayGainInfo ** replayGainInfo)
break
;
break
;
else
if
(
ret
==
DECODE_SKIP
)
else
if
(
ret
==
DECODE_SKIP
)
skip
=
1
;
skip
=
1
;
if
(
!
data
->
muteFrame
)
{
if
(
data
->
muteFrame
==
MUTEFRAME_NONE
)
{
while
((
ret
=
decodeNextFrame
(
data
))
==
DECODE_CONT
&&
while
((
ret
=
decodeNextFrame
(
data
))
==
DECODE_CONT
&&
decoder_get_command
(
decoder
)
==
DECODE_COMMAND_NONE
)
;
decoder_get_command
(
decoder
)
==
DECODE_COMMAND_NONE
)
;
if
(
ret
==
DECODE_BREAK
||
if
(
ret
==
DECODE_BREAK
||
...
...
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