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
78448fe1
Commit
78448fe1
authored
Oct 31, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder_api: pass constant path pointers
parent
6d6e6158
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
43 additions
and
29 deletions
+43
-29
aac_plugin.c
src/decoder/aac_plugin.c
+4
-4
audiofile_plugin.c
src/decoder/audiofile_plugin.c
+3
-3
ffmpeg_plugin.c
src/decoder/ffmpeg_plugin.c
+1
-1
flac_plugin.c
src/decoder/flac_plugin.c
+3
-3
mod_plugin.c
src/decoder/mod_plugin.c
+20
-6
mp3_plugin.c
src/decoder/mp3_plugin.c
+2
-2
mp4_plugin.c
src/decoder/mp4_plugin.c
+2
-2
mpc_plugin.c
src/decoder/mpc_plugin.c
+2
-2
oggflac_plugin.c
src/decoder/oggflac_plugin.c
+1
-1
oggvorbis_plugin.c
src/decoder/oggvorbis_plugin.c
+1
-1
wavpack_plugin.c
src/decoder/wavpack_plugin.c
+2
-2
decoder_api.h
src/decoder_api.h
+2
-2
No files found.
src/decoder/aac_plugin.c
View file @
78448fe1
...
@@ -246,7 +246,7 @@ static void aac_parse_header(AacBuffer * b, float *length)
...
@@ -246,7 +246,7 @@ static void aac_parse_header(AacBuffer * b, float *length)
}
}
}
}
static
float
getAacFloatTotalTime
(
char
*
file
)
static
float
getAacFloatTotalTime
(
c
onst
c
har
*
file
)
{
{
AacBuffer
b
;
AacBuffer
b
;
float
length
;
float
length
;
...
@@ -290,7 +290,7 @@ static float getAacFloatTotalTime(char *file)
...
@@ -290,7 +290,7 @@ static float getAacFloatTotalTime(char *file)
return
length
;
return
length
;
}
}
static
int
getAacTotalTime
(
char
*
file
)
static
int
getAacTotalTime
(
c
onst
c
har
*
file
)
{
{
int
file_time
=
-
1
;
int
file_time
=
-
1
;
float
length
;
float
length
;
...
@@ -435,7 +435,7 @@ aac_stream_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
...
@@ -435,7 +435,7 @@ aac_stream_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
static
bool
static
bool
aac_decode
(
struct
decoder
*
mpd_decoder
,
char
*
path
)
aac_decode
(
struct
decoder
*
mpd_decoder
,
c
onst
c
har
*
path
)
{
{
float
file_time
;
float
file_time
;
float
totalTime
;
float
totalTime
;
...
@@ -569,7 +569,7 @@ aac_decode(struct decoder *mpd_decoder, char *path)
...
@@ -569,7 +569,7 @@ aac_decode(struct decoder *mpd_decoder, char *path)
return
true
;
return
true
;
}
}
static
struct
tag
*
aacTagDup
(
char
*
file
)
static
struct
tag
*
aacTagDup
(
c
onst
c
har
*
file
)
{
{
struct
tag
*
ret
=
NULL
;
struct
tag
*
ret
=
NULL
;
int
file_time
=
getAacTotalTime
(
file
);
int
file_time
=
getAacTotalTime
(
file
);
...
...
src/decoder/audiofile_plugin.c
View file @
78448fe1
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
/* pick 1020 since its devisible for 8,16,24, and 32-bit audio */
/* pick 1020 since its devisible for 8,16,24, and 32-bit audio */
#define CHUNK_SIZE 1020
#define CHUNK_SIZE 1020
static
int
getAudiofileTotalTime
(
char
*
file
)
static
int
getAudiofileTotalTime
(
c
onst
c
har
*
file
)
{
{
int
total_time
;
int
total_time
;
AFfilehandle
af_fp
=
afOpenFile
(
file
,
"r"
,
NULL
);
AFfilehandle
af_fp
=
afOpenFile
(
file
,
"r"
,
NULL
);
...
@@ -42,7 +42,7 @@ static int getAudiofileTotalTime(char *file)
...
@@ -42,7 +42,7 @@ static int getAudiofileTotalTime(char *file)
}
}
static
bool
static
bool
audiofile_decode
(
struct
decoder
*
decoder
,
char
*
path
)
audiofile_decode
(
struct
decoder
*
decoder
,
c
onst
c
har
*
path
)
{
{
int
fs
,
frame_count
;
int
fs
,
frame_count
;
AFfilehandle
af_fp
;
AFfilehandle
af_fp
;
...
@@ -115,7 +115,7 @@ audiofile_decode(struct decoder *decoder, char *path)
...
@@ -115,7 +115,7 @@ audiofile_decode(struct decoder *decoder, char *path)
return
true
;
return
true
;
}
}
static
struct
tag
*
audiofileTagDup
(
char
*
file
)
static
struct
tag
*
audiofileTagDup
(
c
onst
c
har
*
file
)
{
{
struct
tag
*
ret
=
NULL
;
struct
tag
*
ret
=
NULL
;
int
total_time
=
getAudiofileTotalTime
(
file
);
int
total_time
=
getAudiofileTotalTime
(
file
);
...
...
src/decoder/ffmpeg_plugin.c
View file @
78448fe1
...
@@ -325,7 +325,7 @@ static bool ffmpeg_tag_internal(BasePtrs *base)
...
@@ -325,7 +325,7 @@ static bool ffmpeg_tag_internal(BasePtrs *base)
}
}
//no tag reading in ffmpeg, check if playable
//no tag reading in ffmpeg, check if playable
static
struct
tag
*
ffmpeg_tag
(
char
*
file
)
static
struct
tag
*
ffmpeg_tag
(
c
onst
c
har
*
file
)
{
{
struct
input_stream
input
;
struct
input_stream
input
;
BasePtrs
base
;
BasePtrs
base
;
...
...
src/decoder/flac_plugin.c
View file @
78448fe1
...
@@ -220,7 +220,7 @@ static FLAC__StreamDecoderWriteStatus flacWrite(const flac_decoder *dec,
...
@@ -220,7 +220,7 @@ static FLAC__StreamDecoderWriteStatus flacWrite(const flac_decoder *dec,
}
}
static
struct
tag
*
static
struct
tag
*
flacMetadataDup
(
char
*
file
,
bool
*
vorbisCommentFound
)
flacMetadataDup
(
c
onst
c
har
*
file
,
bool
*
vorbisCommentFound
)
{
{
struct
tag
*
ret
=
NULL
;
struct
tag
*
ret
=
NULL
;
FLAC__Metadata_SimpleIterator
*
it
;
FLAC__Metadata_SimpleIterator
*
it
;
...
@@ -278,7 +278,7 @@ flacMetadataDup(char *file, bool *vorbisCommentFound)
...
@@ -278,7 +278,7 @@ flacMetadataDup(char *file, bool *vorbisCommentFound)
return
ret
;
return
ret
;
}
}
static
struct
tag
*
flacTagDup
(
char
*
file
)
static
struct
tag
*
flacTagDup
(
c
onst
c
har
*
file
)
{
{
struct
tag
*
ret
=
NULL
;
struct
tag
*
ret
=
NULL
;
bool
foundVorbisComment
=
false
;
bool
foundVorbisComment
=
false
;
...
@@ -386,7 +386,7 @@ flac_decode(struct decoder * decoder, struct input_stream *inStream)
...
@@ -386,7 +386,7 @@ flac_decode(struct decoder * decoder, struct input_stream *inStream)
#if defined(FLAC_API_VERSION_CURRENT) && FLAC_API_VERSION_CURRENT > 7 && \
#if defined(FLAC_API_VERSION_CURRENT) && FLAC_API_VERSION_CURRENT > 7 && \
!defined(HAVE_OGGFLAC)
!defined(HAVE_OGGFLAC)
static
struct
tag
*
oggflac_tag_dup
(
char
*
file
)
static
struct
tag
*
oggflac_tag_dup
(
c
onst
c
har
*
file
)
{
{
struct
tag
*
ret
=
NULL
;
struct
tag
*
ret
=
NULL
;
FLAC__Metadata_Iterator
*
it
;
FLAC__Metadata_Iterator
*
it
;
...
...
src/decoder/mod_plugin.c
View file @
78448fe1
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
#include "../utils.h"
#include "../utils.h"
#include "../log.h"
#include "../log.h"
#include <glib.h>
#include <mikmod.h>
#include <mikmod.h>
/* this is largely copied from alsaplayer */
/* this is largely copied from alsaplayer */
...
@@ -136,12 +137,17 @@ typedef struct _mod_Data {
...
@@ -136,12 +137,17 @@ typedef struct _mod_Data {
SBYTE
*
audio_buffer
;
SBYTE
*
audio_buffer
;
}
mod_Data
;
}
mod_Data
;
static
mod_Data
*
mod_open
(
char
*
path
)
static
mod_Data
*
mod_open
(
c
onst
c
har
*
path
)
{
{
char
*
path2
;
MODULE
*
moduleHandle
;
MODULE
*
moduleHandle
;
mod_Data
*
data
;
mod_Data
*
data
;
if
(
!
(
moduleHandle
=
Player_Load
(
path
,
128
,
0
)))
path2
=
g_strdup
(
path
);
moduleHandle
=
Player_Load
(
path2
,
128
,
0
);
g_free
(
path2
);
if
(
moduleHandle
==
NULL
)
return
NULL
;
return
NULL
;
/* Prevent module from looping forever */
/* Prevent module from looping forever */
...
@@ -166,7 +172,7 @@ static void mod_close(mod_Data * data)
...
@@ -166,7 +172,7 @@ static void mod_close(mod_Data * data)
}
}
static
bool
static
bool
mod_decode
(
struct
decoder
*
decoder
,
char
*
path
)
mod_decode
(
struct
decoder
*
decoder
,
c
onst
c
har
*
path
)
{
{
mod_Data
*
data
;
mod_Data
*
data
;
struct
audio_format
audio_format
;
struct
audio_format
audio_format
;
...
@@ -218,8 +224,9 @@ mod_decode(struct decoder *decoder, char *path)
...
@@ -218,8 +224,9 @@ mod_decode(struct decoder *decoder, char *path)
return
true
;
return
true
;
}
}
static
struct
tag
*
modTagDup
(
char
*
file
)
static
struct
tag
*
modTagDup
(
c
onst
c
har
*
file
)
{
{
char
*
path2
;
struct
tag
*
ret
=
NULL
;
struct
tag
*
ret
=
NULL
;
MODULE
*
moduleHandle
;
MODULE
*
moduleHandle
;
char
*
title
;
char
*
title
;
...
@@ -229,7 +236,11 @@ static struct tag *modTagDup(char *file)
...
@@ -229,7 +236,11 @@ static struct tag *modTagDup(char *file)
return
NULL
;
return
NULL
;
}
}
if
(
!
(
moduleHandle
=
Player_Load
(
file
,
128
,
0
)))
{
path2
=
g_strdup
(
file
);
moduleHandle
=
Player_Load
(
path2
,
128
,
0
);
g_free
(
path2
);
if
(
moduleHandle
==
NULL
)
{
DEBUG
(
"modTagDup: Failed to open file: %s
\n
"
,
file
);
DEBUG
(
"modTagDup: Failed to open file: %s
\n
"
,
file
);
MikMod_Exit
();
MikMod_Exit
();
return
NULL
;
return
NULL
;
...
@@ -240,7 +251,10 @@ static struct tag *modTagDup(char *file)
...
@@ -240,7 +251,10 @@ static struct tag *modTagDup(char *file)
ret
=
tag_new
();
ret
=
tag_new
();
ret
->
time
=
0
;
ret
->
time
=
0
;
title
=
xstrdup
(
Player_LoadTitle
(
file
));
path2
=
g_strdup
(
file
);
title
=
xstrdup
(
Player_LoadTitle
(
path2
));
g_free
(
path2
);
if
(
title
)
if
(
title
)
tag_add_item
(
ret
,
TAG_ITEM_TITLE
,
title
);
tag_add_item
(
ret
,
TAG_ITEM_TITLE
,
title
);
...
...
src/decoder/mp3_plugin.c
View file @
78448fe1
...
@@ -791,7 +791,7 @@ static void mp3_data_finish(struct mp3_data *data)
...
@@ -791,7 +791,7 @@ static void mp3_data_finish(struct mp3_data *data)
}
}
/* this is primarily used for getting total time for tags */
/* this is primarily used for getting total time for tags */
static
int
mp3_total_file_time
(
char
*
file
)
static
int
mp3_total_file_time
(
c
onst
c
har
*
file
)
{
{
struct
input_stream
input_stream
;
struct
input_stream
input_stream
;
struct
mp3_data
data
;
struct
mp3_data
data
;
...
@@ -1123,7 +1123,7 @@ mp3_decode(struct decoder *decoder, struct input_stream *input_stream)
...
@@ -1123,7 +1123,7 @@ mp3_decode(struct decoder *decoder, struct input_stream *input_stream)
return
true
;
return
true
;
}
}
static
struct
tag
*
mp3_tag_dup
(
char
*
file
)
static
struct
tag
*
mp3_tag_dup
(
c
onst
c
har
*
file
)
{
{
struct
tag
*
ret
=
NULL
;
struct
tag
*
ret
=
NULL
;
int
total_time
;
int
total_time
;
...
...
src/decoder/mp4_plugin.c
View file @
78448fe1
...
@@ -301,7 +301,7 @@ mp4_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
...
@@ -301,7 +301,7 @@ mp4_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
return
true
;
return
true
;
}
}
static
struct
tag
*
mp4DataDup
(
char
*
file
,
int
*
mp4MetadataFound
)
static
struct
tag
*
mp4DataDup
(
c
onst
c
har
*
file
,
int
*
mp4MetadataFound
)
{
{
struct
tag
*
ret
=
NULL
;
struct
tag
*
ret
=
NULL
;
struct
input_stream
inStream
;
struct
input_stream
inStream
;
...
@@ -390,7 +390,7 @@ static struct tag *mp4DataDup(char *file, int *mp4MetadataFound)
...
@@ -390,7 +390,7 @@ static struct tag *mp4DataDup(char *file, int *mp4MetadataFound)
return
ret
;
return
ret
;
}
}
static
struct
tag
*
mp4TagDup
(
char
*
file
)
static
struct
tag
*
mp4TagDup
(
c
onst
c
har
*
file
)
{
{
struct
tag
*
ret
=
NULL
;
struct
tag
*
ret
=
NULL
;
int
mp4MetadataFound
=
0
;
int
mp4MetadataFound
=
0
;
...
...
src/decoder/mpc_plugin.c
View file @
78448fe1
...
@@ -236,7 +236,7 @@ mpc_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
...
@@ -236,7 +236,7 @@ mpc_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
return
true
;
return
true
;
}
}
static
float
mpcGetTime
(
char
*
file
)
static
float
mpcGetTime
(
c
onst
c
har
*
file
)
{
{
struct
input_stream
inStream
;
struct
input_stream
inStream
;
float
total_time
=
-
1
;
float
total_time
=
-
1
;
...
@@ -274,7 +274,7 @@ static float mpcGetTime(char *file)
...
@@ -274,7 +274,7 @@ static float mpcGetTime(char *file)
return
total_time
;
return
total_time
;
}
}
static
struct
tag
*
mpcTagDup
(
char
*
file
)
static
struct
tag
*
mpcTagDup
(
c
onst
c
har
*
file
)
{
{
struct
tag
*
ret
=
NULL
;
struct
tag
*
ret
=
NULL
;
float
total_time
=
mpcGetTime
(
file
);
float
total_time
=
mpcGetTime
(
file
);
...
...
src/decoder/oggflac_plugin.c
View file @
78448fe1
...
@@ -254,7 +254,7 @@ fail:
...
@@ -254,7 +254,7 @@ fail:
}
}
/* public functions: */
/* public functions: */
static
struct
tag
*
oggflac_TagDup
(
char
*
file
)
static
struct
tag
*
oggflac_TagDup
(
c
onst
c
har
*
file
)
{
{
struct
input_stream
inStream
;
struct
input_stream
inStream
;
OggFLAC__SeekableStreamDecoder
*
decoder
;
OggFLAC__SeekableStreamDecoder
*
decoder
;
...
...
src/decoder/oggvorbis_plugin.c
View file @
78448fe1
...
@@ -329,7 +329,7 @@ oggvorbis_decode(struct decoder *decoder, struct input_stream *inStream)
...
@@ -329,7 +329,7 @@ oggvorbis_decode(struct decoder *decoder, struct input_stream *inStream)
return
true
;
return
true
;
}
}
static
struct
tag
*
oggvorbis_TagDup
(
char
*
file
)
static
struct
tag
*
oggvorbis_TagDup
(
c
onst
c
har
*
file
)
{
{
struct
tag
*
ret
;
struct
tag
*
ret
;
FILE
*
fp
;
FILE
*
fp
;
...
...
src/decoder/wavpack_plugin.c
View file @
78448fe1
...
@@ -277,7 +277,7 @@ static ReplayGainInfo *wavpack_replaygain(WavpackContext *wpc)
...
@@ -277,7 +277,7 @@ static ReplayGainInfo *wavpack_replaygain(WavpackContext *wpc)
/*
/*
* Reads metainfo from the specified file.
* Reads metainfo from the specified file.
*/
*/
static
struct
tag
*
wavpack_tagdup
(
char
*
fname
)
static
struct
tag
*
wavpack_tagdup
(
c
onst
c
har
*
fname
)
{
{
WavpackContext
*
wpc
;
WavpackContext
*
wpc
;
struct
tag
*
tag
;
struct
tag
*
tag
;
...
@@ -533,7 +533,7 @@ wavpack_streamdecode(struct decoder * decoder, struct input_stream *is)
...
@@ -533,7 +533,7 @@ wavpack_streamdecode(struct decoder * decoder, struct input_stream *is)
* Decodes a file.
* Decodes a file.
*/
*/
static
bool
static
bool
wavpack_filedecode
(
struct
decoder
*
decoder
,
char
*
fname
)
wavpack_filedecode
(
struct
decoder
*
decoder
,
c
onst
c
har
*
fname
)
{
{
char
error
[
ERRORLEN
];
char
error
[
ERRORLEN
];
WavpackContext
*
wpc
;
WavpackContext
*
wpc
;
...
...
src/decoder_api.h
View file @
78448fe1
...
@@ -86,13 +86,13 @@ struct decoder_plugin {
...
@@ -86,13 +86,13 @@ struct decoder_plugin {
*
*
* returns -1 on error, 0 on success
* returns -1 on error, 0 on success
*/
*/
bool
(
*
file_decode
)(
struct
decoder
*
,
char
*
path
);
bool
(
*
file_decode
)(
struct
decoder
*
,
c
onst
c
har
*
path
);
/**
/**
* file should be the full path! Returns NULL if a tag cannot
* file should be the full path! Returns NULL if a tag cannot
* be found or read
* be found or read
*/
*/
struct
tag
*
(
*
tag_dup
)(
char
*
file
);
struct
tag
*
(
*
tag_dup
)(
c
onst
c
har
*
file
);
/* one or more of the INPUT_PLUGIN_STREAM_* values OR'd together */
/* one or more of the INPUT_PLUGIN_STREAM_* values OR'd together */
unsigned
char
stream_types
;
unsigned
char
stream_types
;
...
...
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