Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC
Manage
Activity
Members
Labels
Plan
Issues
4k
Issue boards
Milestones
Code
Merge requests
450
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLC
Commits
15bfa0f7
Commit
15bfa0f7
authored
8 years ago
by
Rémi Denis-Courmont
Browse files
Options
Downloads
Patches
Plain Diff
sd: split generic and playlist code to different modules
parent
fde9226a
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
po/POTFILES.in
+0
-1
0 additions, 1 deletion
po/POTFILES.in
src/Makefile.am
+1
-0
1 addition, 0 deletions
src/Makefile.am
src/input/services_discovery.c
+137
-0
137 additions, 0 deletions
src/input/services_discovery.c
src/playlist/services_discovery.c
+1
-113
1 addition, 113 deletions
src/playlist/services_discovery.c
with
139 additions
and
114 deletions
po/POTFILES.in
+
0
−
1
View file @
15bfa0f7
...
...
@@ -138,7 +138,6 @@ src/playlist/item.c
src/playlist/loadsave.c
src/playlist/playlist_internal.h
src/playlist/search.c
src/playlist/services_discovery.c
src/playlist/sort.c
src/playlist/thread.c
src/playlist/tree.c
...
...
This diff is collapsed.
Click to expand it.
src/Makefile.am
+
1
−
0
View file @
15bfa0f7
...
...
@@ -253,6 +253,7 @@ libvlccore_la_SOURCES = \
input/vlm_event.h
\
input/resource.h
\
input/resource.c
\
input/services_discovery.c
\
input/stats.c
\
input/stream.c
\
input/stream_fifo.c
\
...
...
This diff is collapsed.
Click to expand it.
src/input/services_discovery.c
0 → 100644
+
137
−
0
View file @
15bfa0f7
/*****************************************************************************
* services_discovery.c : Manage playlist services_discovery modules
*****************************************************************************
* Copyright (C) 1999-2004 VLC authors and VideoLAN
* $Id$
*
* Authors: Clément Stenac <zorglub@videolan.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include
<assert.h>
#include
<vlc_common.h>
#include
<vlc_services_discovery.h>
#include
<vlc_probe.h>
#include
<vlc_modules.h>
#include
"../libvlc.h"
typedef
struct
{
char
*
name
;
char
*
longname
;
int
category
;
}
vlc_sd_probe_t
;
int
vlc_sd_probe_Add
(
vlc_probe_t
*
probe
,
const
char
*
name
,
const
char
*
longname
,
int
category
)
{
vlc_sd_probe_t
names
=
{
strdup
(
name
),
strdup
(
longname
),
category
};
if
(
unlikely
(
names
.
name
==
NULL
||
names
.
longname
==
NULL
||
vlc_probe_add
(
probe
,
&
names
,
sizeof
(
names
))))
{
free
(
names
.
name
);
free
(
names
.
longname
);
return
VLC_ENOMEM
;
}
return
VLC_PROBE_CONTINUE
;
}
#undef vlc_sd_GetNames
/**
* Gets the list of available services discovery plugins.
*/
char
**
vlc_sd_GetNames
(
vlc_object_t
*
obj
,
char
***
pppsz_longnames
,
int
**
pp_categories
)
{
size_t
count
;
vlc_sd_probe_t
*
tab
=
vlc_probe
(
obj
,
"services probe"
,
&
count
);
if
(
count
==
0
)
{
free
(
tab
);
return
NULL
;
}
char
**
names
=
malloc
(
sizeof
(
char
*
)
*
(
count
+
1
));
char
**
longnames
=
malloc
(
sizeof
(
char
*
)
*
(
count
+
1
));
int
*
categories
=
malloc
(
sizeof
(
int
)
*
(
count
+
1
));
if
(
unlikely
(
names
==
NULL
||
longnames
==
NULL
||
categories
==
NULL
))
{
free
(
names
);
free
(
longnames
);
free
(
categories
);
free
(
tab
);
return
NULL
;
}
for
(
size_t
i
=
0
;
i
<
count
;
i
++
)
{
names
[
i
]
=
tab
[
i
].
name
;
longnames
[
i
]
=
tab
[
i
].
longname
;
categories
[
i
]
=
tab
[
i
].
category
;
}
free
(
tab
);
names
[
count
]
=
longnames
[
count
]
=
NULL
;
categories
[
count
]
=
0
;
*
pppsz_longnames
=
longnames
;
if
(
pp_categories
)
*
pp_categories
=
categories
;
else
free
(
categories
);
return
names
;
}
/*
* Services discovery
* Basically you just listen to Service discovery event through the
* sd's event manager.
* That's how the playlist get's Service Discovery information
*/
services_discovery_t
*
vlc_sd_Create
(
vlc_object_t
*
parent
,
const
char
*
cfg
,
const
struct
services_discovery_owner_t
*
restrict
owner
)
{
services_discovery_t
*
sd
=
vlc_custom_create
(
parent
,
sizeof
(
*
sd
),
"services discovery"
);
if
(
unlikely
(
sd
==
NULL
))
return
NULL
;
free
(
config_ChainCreate
(
&
sd
->
psz_name
,
&
sd
->
p_cfg
,
cfg
));
sd
->
description
=
NULL
;
sd
->
owner
=
*
owner
;
sd
->
p_module
=
module_need
(
sd
,
"services_discovery"
,
sd
->
psz_name
,
true
);
if
(
sd
->
p_module
==
NULL
)
{
msg_Err
(
sd
,
"no suitable services discovery module"
);
vlc_sd_Destroy
(
sd
);
sd
=
NULL
;
}
return
sd
;
}
void
vlc_sd_Destroy
(
services_discovery_t
*
sd
)
{
if
(
sd
->
p_module
!=
NULL
)
module_unneed
(
sd
,
sd
->
p_module
);
config_ChainDestroy
(
sd
->
p_cfg
);
free
(
sd
->
psz_name
);
vlc_object_release
(
sd
);
}
This diff is collapsed.
Click to expand it.
src/playlist/services_discovery.c
+
1
−
113
View file @
15bfa0f7
...
...
@@ -26,121 +26,9 @@
#include
<assert.h>
#include
<vlc_common.h>
#include
"
vlc_playlist.h
"
#include
<
vlc_playlist.h
>
#include
<vlc_services_discovery.h>
#include
<vlc_probe.h>
#include
<vlc_modules.h>
#include
"playlist_internal.h"
#include
"../libvlc.h"
typedef
struct
{
char
*
name
;
char
*
longname
;
int
category
;
}
vlc_sd_probe_t
;
int
vlc_sd_probe_Add
(
vlc_probe_t
*
probe
,
const
char
*
name
,
const
char
*
longname
,
int
category
)
{
vlc_sd_probe_t
names
=
{
strdup
(
name
),
strdup
(
longname
),
category
};
if
(
unlikely
(
names
.
name
==
NULL
||
names
.
longname
==
NULL
||
vlc_probe_add
(
probe
,
&
names
,
sizeof
(
names
))))
{
free
(
names
.
name
);
free
(
names
.
longname
);
return
VLC_ENOMEM
;
}
return
VLC_PROBE_CONTINUE
;
}
#undef vlc_sd_GetNames
/**
* Gets the list of available services discovery plugins.
*/
char
**
vlc_sd_GetNames
(
vlc_object_t
*
obj
,
char
***
pppsz_longnames
,
int
**
pp_categories
)
{
size_t
count
;
vlc_sd_probe_t
*
tab
=
vlc_probe
(
obj
,
"services probe"
,
&
count
);
if
(
count
==
0
)
{
free
(
tab
);
return
NULL
;
}
char
**
names
=
malloc
(
sizeof
(
char
*
)
*
(
count
+
1
));
char
**
longnames
=
malloc
(
sizeof
(
char
*
)
*
(
count
+
1
));
int
*
categories
=
malloc
(
sizeof
(
int
)
*
(
count
+
1
));
if
(
unlikely
(
names
==
NULL
||
longnames
==
NULL
||
categories
==
NULL
))
{
free
(
names
);
free
(
longnames
);
free
(
categories
);
free
(
tab
);
return
NULL
;
}
for
(
size_t
i
=
0
;
i
<
count
;
i
++
)
{
names
[
i
]
=
tab
[
i
].
name
;
longnames
[
i
]
=
tab
[
i
].
longname
;
categories
[
i
]
=
tab
[
i
].
category
;
}
free
(
tab
);
names
[
count
]
=
longnames
[
count
]
=
NULL
;
categories
[
count
]
=
0
;
*
pppsz_longnames
=
longnames
;
if
(
pp_categories
)
*
pp_categories
=
categories
;
else
free
(
categories
);
return
names
;
}
/*
* Services discovery
* Basically you just listen to Service discovery event through the
* sd's event manager.
* That's how the playlist get's Service Discovery information
*/
services_discovery_t
*
vlc_sd_Create
(
vlc_object_t
*
parent
,
const
char
*
cfg
,
const
struct
services_discovery_owner_t
*
restrict
owner
)
{
services_discovery_t
*
sd
=
vlc_custom_create
(
parent
,
sizeof
(
*
sd
),
"services discovery"
);
if
(
unlikely
(
sd
==
NULL
))
return
NULL
;
free
(
config_ChainCreate
(
&
sd
->
psz_name
,
&
sd
->
p_cfg
,
cfg
));
sd
->
description
=
NULL
;
sd
->
owner
=
*
owner
;
sd
->
p_module
=
module_need
(
sd
,
"services_discovery"
,
sd
->
psz_name
,
true
);
if
(
sd
->
p_module
==
NULL
)
{
msg_Err
(
sd
,
"no suitable services discovery module"
);
vlc_sd_Destroy
(
sd
);
sd
=
NULL
;
}
return
sd
;
}
void
vlc_sd_Destroy
(
services_discovery_t
*
sd
)
{
if
(
sd
->
p_module
!=
NULL
)
module_unneed
(
sd
,
sd
->
p_module
);
config_ChainDestroy
(
sd
->
p_cfg
);
free
(
sd
->
psz_name
);
vlc_object_release
(
sd
);
}
/*
* Playlist - Services discovery bridge
*/
struct
vlc_sd_internal_t
{
...
...
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