Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
2887a459
Commit
2887a459
authored
Feb 04, 2009
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cosmetics (mod).
parent
37acd67e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
67 additions
and
86 deletions
+67
-86
modules/demux/mod.c
modules/demux/mod.c
+67
-86
No files found.
modules/demux/mod.c
View file @
2887a459
/*****************************************************************************
* mod.c: MOD file demuxer (using libmodplug)
*****************************************************************************
* Copyright (C) 2004 the VideoLAN team
* Copyright (C) 2004
-2009
the VideoLAN team
* $Id$
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
...
...
@@ -120,7 +120,7 @@ struct demux_sys_t
static
int
Demux
(
demux_t
*
p_demux
);
static
int
Control
(
demux_t
*
p_demux
,
int
i_query
,
va_list
args
);
static
const
char
*
mod_ext
[]
=
static
const
char
*
ppsz_
mod_ext
[]
=
{
"mod"
,
"s3m"
,
"xm"
,
"it"
,
"669"
,
"amf"
,
"ams"
,
"dbm"
,
"dmf"
,
"dsm"
,
"far"
,
"mdl"
,
"med"
,
"mtm"
,
"okt"
,
"ptm"
,
"stm"
,
"ult"
,
"umx"
,
"mt2"
,
...
...
@@ -135,26 +135,24 @@ static int Open( vlc_object_t *p_this )
demux_t
*
p_demux
=
(
demux_t
*
)
p_this
;
demux_sys_t
*
p_sys
;
ModPlug_Settings
settings
;
vlc_value_t
val
;
/* We accept file based on extension match */
if
(
!
p_demux
->
b_force
)
{
char
*
ext
;
char
*
psz_
ext
;
int
i
;
if
(
(
ext
=
strrchr
(
p_demux
->
psz_path
,
'.'
)
)
==
NULL
||
if
(
(
psz_
ext
=
strrchr
(
p_demux
->
psz_path
,
'.'
)
)
==
NULL
||
stream_Size
(
p_demux
->
s
)
==
0
)
return
VLC_EGENERIC
;
ext
++
;
/* skip . */
for
(
i
=
0
;
mod_ext
[
i
]
!=
NULL
;
i
++
)
{
if
(
!
strcasecmp
(
ext
,
mod_ext
[
i
]
)
)
psz_ext
++
;
/* skip . */
for
(
i
=
0
;
ppsz_mod_ext
[
i
]
!=
NULL
;
i
++
)
{
if
(
!
strcasecmp
(
psz_ext
,
ppsz_mod_ext
[
i
]
)
)
break
;
}
}
if
(
mod_ext
[
i
]
==
NULL
)
return
VLC_EGENERIC
;
msg_Dbg
(
p_demux
,
"running MOD demuxer (ext=%s)"
,
mod_ext
[
i
]
);
if
(
ppsz_mod_ext
[
i
]
==
NULL
)
return
VLC_EGENERIC
;
msg_Dbg
(
p_demux
,
"running MOD demuxer (ext=%s)"
,
ppsz_
mod_ext
[
i
]
);
}
/* Fill p_demux field */
...
...
@@ -173,17 +171,6 @@ static int Open( vlc_object_t *p_this )
free
(
p_sys
);
return
VLC_EGENERIC
;
}
/* Create our config variable */
var_Create
(
p_demux
,
"mod-noisereduction"
,
VLC_VAR_BOOL
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_demux
,
"mod-reverb"
,
VLC_VAR_BOOL
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_demux
,
"mod-reverb-level"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_demux
,
"mod-reverb-delay"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_demux
,
"mod-megabass"
,
VLC_VAR_BOOL
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_demux
,
"mod-megabass-level"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_demux
,
"mod-megabass-range"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_demux
,
"mod-surround"
,
VLC_VAR_BOOL
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_demux
,
"mod-surround-level"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_demux
,
"mod-surround-delay"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
/* Configure modplug before loading the file */
ModPlug_GetSettings
(
&
settings
);
...
...
@@ -193,29 +180,23 @@ static int Open( vlc_object_t *p_this )
settings
.
mFrequency
=
44100
;
settings
.
mResamplingMode
=
MODPLUG_RESAMPLE_FIR
;
var_Get
(
p_demux
,
"mod-noisereduction"
,
&
val
);
if
(
val
.
b_bool
)
settings
.
mFlags
|=
MODPLUG_ENABLE_NOISE_REDUCTION
;
var_Get
(
p_demux
,
"mod-reverb"
,
&
val
);
if
(
val
.
b_bool
)
settings
.
mFlags
|=
MODPLUG_ENABLE_REVERB
;
var_Get
(
p_demux
,
"mod-reverb-level"
,
&
val
);
settings
.
mReverbDepth
=
val
.
i_int
;
var_Get
(
p_demux
,
"mod-reverb-delay"
,
&
val
);
settings
.
mReverbDelay
=
val
.
i_int
;
var_Get
(
p_demux
,
"mod-megabass"
,
&
val
);
if
(
val
.
b_bool
)
settings
.
mFlags
|=
MODPLUG_ENABLE_MEGABASS
;
var_Get
(
p_demux
,
"mod-megabass-level"
,
&
val
);
settings
.
mBassAmount
=
val
.
i_int
;
var_Get
(
p_demux
,
"mod-megabass-range"
,
&
val
);
settings
.
mBassRange
=
val
.
i_int
;
var_Get
(
p_demux
,
"mod-surround"
,
&
val
);
if
(
val
.
b_bool
)
settings
.
mFlags
|=
MODPLUG_ENABLE_SURROUND
;
var_Get
(
p_demux
,
"mod-surround-level"
,
&
val
);
settings
.
mSurroundDepth
=
val
.
i_int
;
var_Get
(
p_demux
,
"mod-surround-delay"
,
&
val
);
settings
.
mSurroundDelay
=
val
.
i_int
;
if
(
var_CreateGetBool
(
p_demux
,
"mod-noisereduction"
)
)
settings
.
mFlags
|=
MODPLUG_ENABLE_NOISE_REDUCTION
;
if
(
var_CreateGetBool
(
p_demux
,
"mod-reverb"
)
)
settings
.
mFlags
|=
MODPLUG_ENABLE_REVERB
;
settings
.
mReverbDepth
=
var_CreateGetInteger
(
p_demux
,
"mod-reverb-level"
);
settings
.
mReverbDelay
=
var_CreateGetInteger
(
p_demux
,
"mod-reverb-delay"
);
if
(
var_CreateGetBool
(
p_demux
,
"mod-megabass"
)
)
settings
.
mFlags
|=
MODPLUG_ENABLE_MEGABASS
;
settings
.
mBassAmount
=
var_CreateGetInteger
(
p_demux
,
"mod-megabass-level"
);
settings
.
mBassRange
=
var_CreateGetInteger
(
p_demux
,
"mod-megabass-range"
);
if
(
var_CreateGetBool
(
p_demux
,
"mod-surround"
)
)
settings
.
mFlags
|=
MODPLUG_ENABLE_SURROUND
;
settings
.
mSurroundDepth
=
var_CreateGetInteger
(
p_demux
,
"mod-surround-level"
);
settings
.
mSurroundDelay
=
var_CreateGetInteger
(
p_demux
,
"mod-surround-delay"
);
ModPlug_SetSettings
(
&
settings
);
...
...
@@ -231,7 +212,7 @@ static int Open( vlc_object_t *p_this )
/* init time */
p_sys
->
i_time
=
1
;
p_sys
->
i_length
=
ModPlug_GetLength
(
p_sys
->
f
)
*
(
int64_t
)
1000
;
p_sys
->
i_length
=
ModPlug_GetLength
(
p_sys
->
f
)
*
INT64_C
(
1000
)
;
msg_Dbg
(
p_demux
,
"MOD loaded name=%s lenght=%"
PRId64
"ms"
,
ModPlug_GetName
(
p_sys
->
f
),
...
...
@@ -290,7 +271,7 @@ static int Demux( demux_t *p_demux )
es_out_Control
(
p_demux
->
out
,
ES_OUT_SET_PCR
,
(
int64_t
)
p_sys
->
i_time
);
/* We should use p_frame->i_buffer */
p_sys
->
i_time
+=
(
int64_t
)
1000000
*
p_frame
->
i_buffer
/
i_bk
/
p_sys
->
fmt
.
audio
.
i_rate
;
p_sys
->
i_time
+=
INT64_C
(
1000000
)
*
p_frame
->
i_buffer
/
i_bk
/
p_sys
->
fmt
.
audio
.
i_rate
;
/* Send data */
p_frame
->
i_dts
=
p_frame
->
i_pts
=
p_sys
->
i_time
;
...
...
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