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
b27ba687
Commit
b27ba687
authored
Aug 15, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libvlc_audio_output_list: simplify and add missing error handling
parent
f1f6ed16
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
41 deletions
+31
-41
lib/audio.c
lib/audio.c
+31
-41
No files found.
lib/audio.c
View file @
b27ba687
...
...
@@ -68,64 +68,54 @@ libvlc_audio_output_t *
libvlc_audio_output_list_get
(
libvlc_instance_t
*
p_instance
)
{
VLC_UNUSED
(
p_instance
);
libvlc_audio_output_t
*
p_list
=
NULL
,
*
p_actual
=
NULL
,
*
p_previous
=
NULL
;
libvlc_audio_output_t
*
list
=
NULL
;
module_t
**
module_list
=
module_list_get
(
NULL
);
for
(
size_t
i
=
0
;
module_list
[
i
];
i
++
)
{
module_t
*
p_
module
=
module_list
[
i
];
module_t
*
module
=
module_list
[
i
];
if
(
module_provides
(
p_module
,
"audio output"
)
)
{
if
(
p_actual
==
NULL
)
{
p_actual
=
(
libvlc_audio_output_t
*
)
malloc
(
sizeof
(
libvlc_audio_output_t
)
);
if
(
p_actual
==
NULL
)
if
(
!
module_provides
(
module
,
"audio output"
)
)
continue
;
libvlc_audio_output_t
*
item
=
malloc
(
sizeof
(
*
item
)
);
if
(
unlikely
(
item
==
NULL
)
)
{
error:
libvlc_printerr
(
"Not enough memory"
);
libvlc_audio_output_list_release
(
p_
list
);
module_list_free
(
module_list
)
;
return
NULL
;
libvlc_audio_output_list_release
(
list
);
list
=
NULL
;
break
;
}
if
(
p_list
==
NULL
)
item
->
psz_name
=
strdup
(
module_get_object
(
module
)
);
item
->
psz_description
=
strdup
(
module_get_name
(
module
,
true
)
);
if
(
unlikely
(
item
->
psz_name
==
NULL
||
item
->
psz_description
==
NULL
)
)
{
p_list
=
p_actual
;
p_previous
=
p_actual
;
}
}
p_actual
->
psz_name
=
strdup
(
module_get_object
(
p_module
)
);
p_actual
->
psz_description
=
strdup
(
module_get_name
(
p_module
,
true
)
);
p_actual
->
p_next
=
NULL
;
if
(
p_previous
!=
p_actual
)
/* not first item */
p_previous
->
p_next
=
p_actual
;
p_previous
=
p_actual
;
p_actual
=
p_actual
->
p_next
;
free
(
item
);
goto
error
;
}
item
->
p_next
=
list
;
list
=
item
;
}
module_list_free
(
module_list
);
return
p_
list
;
return
list
;
}
/********************************************
* Free the list of available audio outputs
***********************************************/
void
libvlc_audio_output_list_release
(
libvlc_audio_output_t
*
p_
list
)
void
libvlc_audio_output_list_release
(
libvlc_audio_output_t
*
list
)
{
libvlc_audio_output_t
*
p_actual
,
*
p_before
;
p_actual
=
p_list
;
while
(
p_actual
)
while
(
list
!=
NULL
)
{
free
(
p_actual
->
psz_name
);
free
(
p_actual
->
psz_description
);
p_before
=
p_actual
;
p_actual
=
p_before
->
p_next
;
free
(
p_before
);
libvlc_audio_output_t
*
next
=
list
->
p_next
;
free
(
list
->
psz_name
);
free
(
list
->
psz_description
);
free
(
list
);
list
=
next
;
}
}
...
...
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