Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
5a25698b
Commit
5a25698b
authored
17 years ago
by
Emmanuel Milou
Browse files
Options
Downloads
Patches
Plain Diff
Add the HOME dir to scan for codecs at boot
parent
cc6a6a91
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/audio/codecDescriptor.cpp
+41
-21
41 additions, 21 deletions
src/audio/codecDescriptor.cpp
src/audio/codecDescriptor.h
+4
-1
4 additions, 1 deletion
src/audio/codecDescriptor.h
src/global.h
+2
-0
2 additions, 0 deletions
src/global.h
src/user_cfg.h
+0
-4
0 additions, 4 deletions
src/user_cfg.h
with
47 additions
and
26 deletions
src/audio/codecDescriptor.cpp
+
41
−
21
View file @
5a25698b
...
...
@@ -51,7 +51,6 @@ CodecDescriptor::deleteHandlePointer( void )
void
CodecDescriptor
::
init
()
{
_debug
(
"Scanning %s to find audio codecs....
\n
"
,
CODECS_DIR
);
std
::
vector
<
AudioCodec
*>
CodecDynamicList
=
scanCodecDirectory
();
_nbCodecs
=
CodecDynamicList
.
size
();
if
(
_nbCodecs
<=
0
){
...
...
@@ -194,30 +193,39 @@ CodecDescriptor::scanCodecDirectory( void )
{
std
::
vector
<
AudioCodec
*>
codecs
;
std
::
string
tmp
;
std
::
string
codecDir
=
CODECS_DIR
;
codecDir
.
append
(
"/"
);
std
::
string
current
=
"."
;
std
::
string
previous
=
".."
;
DIR
*
dir
=
opendir
(
codecDir
.
c_str
()
);
AudioCodec
*
audioCodec
;
if
(
dir
){
dirent
*
dirStruct
;
while
(
dirStruct
=
readdir
(
dir
))
{
tmp
=
dirStruct
->
d_name
;
if
(
tmp
==
current
||
tmp
==
previous
){}
else
{
if
(
seemsValid
(
tmp
)
)
{
//_debug("Codec : %s\n", tmp.c_str());
audioCodec
=
loadCodec
(
codecDir
.
append
(
tmp
)
);
codecs
.
push_back
(
audioCodec
);
codecDir
=
CODECS_DIR
;
codecDir
.
append
(
"/"
);
int
i
;
std
::
string
libDir
=
std
::
string
(
CODECS_DIR
).
append
(
"/"
);
std
::
string
homeDir
=
std
::
string
(
HOMEDIR
)
+
DIR_SEPARATOR_STR
+
"."
+
PROGDIR
+
"/"
;
std
::
vector
<
std
::
string
>
dirToScan
;
dirToScan
.
push_back
(
homeDir
);
dirToScan
.
push_back
(
libDir
);
for
(
i
=
0
;
i
<
dirToScan
.
size
()
;
i
++
)
{
std
::
string
dirStr
=
dirToScan
[
i
];
_debug
(
"Scanning %s to find audio codecs....
\n
"
,
dirStr
.
c_str
());
DIR
*
dir
=
opendir
(
dirStr
.
c_str
()
);
AudioCodec
*
audioCodec
;
if
(
dir
){
dirent
*
dirStruct
;
while
(
dirStruct
=
readdir
(
dir
))
{
tmp
=
dirStruct
->
d_name
;
if
(
tmp
==
CURRENT_DIR
||
tmp
==
PARENT_DIR
){}
else
{
if
(
seemsValid
(
tmp
)
&&
!
alreadyInCache
(
tmp
))
{
//_debug("Codec : %s\n", tmp.c_str());
_Cache
.
push_back
(
tmp
);
audioCodec
=
loadCodec
(
dirStr
.
append
(
tmp
)
);
codecs
.
push_back
(
audioCodec
);
dirStr
=
dirToScan
[
i
];
}
}
}
}
closedir
(
dir
);
}
closedir
(
dir
);
return
codecs
;
}
...
...
@@ -280,3 +288,15 @@ CodecDescriptor::seemsValid( std::string lib)
else
return
false
;
}
bool
CodecDescriptor
::
alreadyInCache
(
std
::
string
lib
)
{
int
i
;
for
(
i
=
0
;
i
<
_Cache
.
size
()
;
i
++
)
{
if
(
_Cache
[
i
]
==
lib
){
return
true
;}
}
return
false
;
}
This diff is collapsed.
Click to expand it.
src/audio/codecDescriptor.h
+
4
−
1
View file @
5a25698b
...
...
@@ -30,6 +30,7 @@
#include
<dirent.h>
#include
"../global.h"
#include
"../user_cfg.h"
#include
"codecs/audiocodec.h"
typedef
enum
{
...
...
@@ -203,7 +204,7 @@ private:
void
unloadCodec
(
CodecHandlePointer
);
bool
seemsValid
(
std
::
string
);
bool
alreadyInCache
(
std
::
string
);
/*
* Map the payload of a codec and its name
*/
...
...
@@ -219,6 +220,8 @@ private:
*/
CodecOrder
_codecOrder
;
std
::
vector
<
std
::
string
>
_Cache
;
/*
* Number of codecs loaded
*/
...
...
This diff is collapsed.
Click to expand it.
src/global.h
+
2
−
0
View file @
5a25698b
...
...
@@ -85,6 +85,8 @@ typedef short int16;
#define SFL_CODEC_VALID_PREFIX "libcodec_"
#define SFL_CODEC_VALID_EXTEN ".so"
#define CURRENT_DIR "."
#define PARENT_DIR ".."
#define SFL_PCM_BOTH 0x0021
#define SFL_PCM_PLAYBACK 0x0022
...
...
This diff is collapsed.
Click to expand it.
src/user_cfg.h
+
0
−
4
View file @
5a25698b
...
...
@@ -88,12 +88,10 @@
#define DFT_PULSE_LENGTH_STR "250"
#define SIP_INFO_STR "0"
#define DFT_DRIVER_STR "0"
#define DFT_NB_CODEC_STR "3"
// volume by default 100%
#define DFT_VOL_SPKR_STR "100"
#define DFT_VOL_MICRO_STR "100"
#define DFT_CODECS "0/8/3" // liste ordonnée de payload
#define DFT_RINGTONE "konga.ul"
#define DFT_SKIN "metal"
#define DFT_ZONE "North America"
...
...
@@ -101,8 +99,6 @@
#define DFT_FRAME_SIZE "20"
#define DFT_SAMPLE_RATE "44100"
#define SAMPLE_RATE1 "44100"
#define SAMPLE_RATE2 "48000"
#define SAMPLE_RATE3 "96000"
// zeroconfig default value
#ifdef USE_ZEROCONF
#define CONFIG_ZEROCONF_DEFAULT_STR "1"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment