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
1a8ead40
Commit
1a8ead40
authored
Feb 07, 2014
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add addons management API
parent
d05bec79
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
743 additions
and
1 deletion
+743
-1
include/vlc_addons.h
include/vlc_addons.h
+216
-0
include/vlc_common.h
include/vlc_common.h
+1
-0
include/vlc_events.h
include/vlc_events.h
+11
-1
src/Makefile.am
src/Makefile.am
+1
-0
src/libvlccore.sym
src/libvlccore.sym
+9
-0
src/misc/addons.c
src/misc/addons.c
+505
-0
No files found.
include/vlc_addons.h
0 → 100644
View file @
1a8ead40
/*****************************************************************************
* vlc_addons.h : addons handling and describing
*****************************************************************************
* Copyright (C) 2013 VideoLAN and authors
*
* 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.
*****************************************************************************/
#ifndef VLC_ADDONS_H
#define VLC_ADDONS_H 1
#include <vlc_arrays.h>
#include <vlc_events.h>
# ifdef __cplusplus
extern
"C"
{
# endif
typedef
enum
addon_type_t
{
ADDON_UNKNOWN
=
0
,
ADDON_EXTENSION
,
ADDON_PLAYLIST_PARSER
,
ADDON_SERVICE_DISCOVERY
,
ADDON_SKIN2
,
ADDON_PLUGIN
,
ADDON_OTHER
}
addon_type_t
;
typedef
enum
addon_state_t
{
ADDON_NOTINSTALLED
=
0
,
ADDON_INSTALLING
,
ADDON_INSTALLED
,
ADDON_UNINSTALLING
}
addon_state_t
;
typedef
enum
addon_flags_t
{
ADDON_BROKEN
=
1
,
/* Have install inconsistency */
ADDON_MANAGEABLE
=
1
<<
1
,
/* Have manifest, can install or uninstall files */
ADDON_UPDATABLE
=
1
<<
2
,
}
addon_flags_t
;
#define ADDON_UUID_SIZE 16
#define ADDON_UUID_PSZ_SIZE (ADDON_UUID_SIZE * 2 + 4)
typedef
uint8_t
addon_uuid_t
[
ADDON_UUID_SIZE
];
typedef
struct
addon_file_t
{
addon_type_t
e_filetype
;
char
*
psz_download_uri
;
char
*
psz_filename
;
}
addon_file_t
;
struct
addon_entry_t
{
vlc_mutex_t
lock
;
addon_type_t
e_type
;
addon_state_t
e_state
;
addon_flags_t
e_flags
;
/* data describing addon */
addon_uuid_t
uuid
;
char
*
psz_name
;
char
*
psz_summary
;
char
*
psz_description
;
char
*
psz_author
;
char
*
psz_source_uri
;
/* webpage, ... */
char
*
psz_image_uri
;
char
*
psz_image_data
;
/* base64, png */
char
*
psz_version
;
/* stats */
long
int
i_downloads
;
long
int
i_score
;
/* Lister */
char
*
psz_source_module
;
/* files list */
char
*
psz_archive_uri
;
/* Archive */
DECL_ARRAY
(
addon_file_t
*
)
files
;
/* custom data storage (if needed by module/source) */
void
*
p_custom
;
};
typedef
struct
addon_entry_t
addon_entry_t
;
typedef
struct
addons_finder_t
addons_finder_t
;
typedef
struct
addons_finder_sys_t
addons_finder_sys_t
;
struct
addons_finder_t
{
VLC_COMMON_MEMBERS
int
(
*
pf_find
)(
addons_finder_t
*
);
int
(
*
pf_retrieve
)(
addons_finder_t
*
,
addon_entry_t
*
);
DECL_ARRAY
(
addon_entry_t
*
)
entries
;
char
*
psz_uri
;
addons_finder_sys_t
*
p_sys
;
};
typedef
struct
addons_storage_t
addons_storage_t
;
typedef
struct
addons_storage_sys_t
addons_storage_sys_t
;
struct
addons_storage_t
{
VLC_COMMON_MEMBERS
int
(
*
pf_install
)(
addons_storage_t
*
,
addon_entry_t
*
);
int
(
*
pf_remove
)(
addons_storage_t
*
,
addon_entry_t
*
);
int
(
*
pf_catalog
)
(
addons_storage_t
*
,
addon_entry_t
**
,
int
);
addons_storage_sys_t
*
p_sys
;
};
typedef
struct
addons_manager_private_t
addons_manager_private_t
;
struct
addons_manager_t
{
vlc_event_manager_t
*
p_event_manager
;
addons_manager_private_t
*
p_priv
;
};
typedef
struct
addons_manager_t
addons_manager_t
;
/**
* addon entry lifecycle
*/
VLC_API
addon_entry_t
*
addon_entry_New
(
void
);
VLC_API
addon_entry_t
*
addon_entry_Hold
(
addon_entry_t
*
);
VLC_API
void
addon_entry_Release
(
addon_entry_t
*
);
/**
* addons manager lifecycle
*/
VLC_API
addons_manager_t
*
addons_manager_New
(
vlc_object_t
*
);
VLC_API
void
addons_manager_Delete
(
addons_manager_t
*
);
/**
* Charge currently installed, usable and manageable addons
* (default "addons storage" module)
*/
VLC_API
int
addons_manager_LoadCatalog
(
addons_manager_t
*
);
/**
* Gather addons info from repository (default "addons finder" module)
* If psz_uri is not NULL, only gather info from the pointed package.
*/
VLC_API
void
addons_manager_Gather
(
addons_manager_t
*
,
const
char
*
psz_uri
);
/**
* Install or Remove the addon identified by its uuid
*/
VLC_API
int
addons_manager_Install
(
addons_manager_t
*
p_manager
,
const
addon_uuid_t
uuid
);
VLC_API
int
addons_manager_Remove
(
addons_manager_t
*
p_manager
,
const
addon_uuid_t
uuid
);
/**
* String uuid to binary uuid helpers
*/
static
inline
bool
addons_uuid_read
(
const
char
*
psz_uuid
,
addon_uuid_t
*
p_uuid
)
{
if
(
!
psz_uuid
)
return
false
;
if
(
strlen
(
psz_uuid
)
<
ADDON_UUID_PSZ_SIZE
)
return
false
;
int
i
=
0
,
j
=
0
;
while
(
i
<
ADDON_UUID_PSZ_SIZE
)
{
if
(
*
(
psz_uuid
+
i
)
==
'-'
)
i
++
;
int
v
;
sscanf
(
psz_uuid
+
i
,
"%02x"
,
&
v
);
(
*
p_uuid
)[
j
++
]
=
v
&
0xFF
;
i
+=
2
;
}
return
true
;
}
static
inline
char
*
addons_uuid_to_psz
(
const
addon_uuid_t
*
p_uuid
)
{
char
*
psz
=
(
char
*
)
calloc
(
ADDON_UUID_PSZ_SIZE
+
1
,
sizeof
(
char
)
);
if
(
psz
)
{
int
i
=
0
;
char
*
p
=
psz
;
while
(
i
<
ADDON_UUID_SIZE
)
{
if
(
i
==
4
||
i
==
7
||
i
==
9
||
i
==
11
)
*
p
++
=
'-'
;
int
v
=
0xFF
&
(
*
p_uuid
)[
i
];
sprintf
(
p
,
"%02x"
,
v
);
p
+=
2
;
i
++
;
}
}
return
psz
;
}
# ifdef __cplusplus
}
# endif
#endif
include/vlc_common.h
View file @
1a8ead40
...
...
@@ -335,6 +335,7 @@ typedef struct vlm_message_t vlm_message_t;
/* misc */
typedef
struct
vlc_meta_t
vlc_meta_t
;
typedef
struct
input_stats_t
input_stats_t
;
typedef
struct
addon_entry_t
addon_entry_t
;
/* Update */
typedef
struct
update_t
update_t
;
...
...
include/vlc_events.h
View file @
1a8ead40
...
...
@@ -129,7 +129,12 @@ typedef enum vlc_event_type_t {
vlc_ServicesDiscoveryItemRemoved
,
vlc_ServicesDiscoveryItemRemoveAll
,
vlc_ServicesDiscoveryStarted
,
vlc_ServicesDiscoveryEnded
vlc_ServicesDiscoveryEnded
,
/* Addons Manager events */
vlc_AddonFound
,
vlc_AddonsDiscoveryEnded
,
vlc_AddonChanged
}
vlc_event_type_t
;
/* Event definition */
...
...
@@ -202,6 +207,11 @@ typedef struct vlc_event_t
void
*
unused
;
}
services_discovery_ended
;
/* Addons */
struct
vlc_addon_generic_event
{
addon_entry_t
*
p_entry
;
}
addon_generic_event
;
}
u
;
}
vlc_event_t
;
...
...
src/Makefile.am
View file @
1a8ead40
...
...
@@ -475,6 +475,7 @@ SOURCES_libvlc_common = \
misc/xml.c
\
extras/libc.c
\
extras/tdestroy.c
\
misc/addons.c
\
misc/filter.c
\
misc/filter_chain.c
\
misc/http_auth.c
\
...
...
src/libvlccore.sym
View file @
1a8ead40
...
...
@@ -641,3 +641,12 @@ vlc_keycode2str
vlc_str2keycode
fingerprinter_Create
fingerprinter_Destroy
addons_manager_New
addons_manager_Delete
addons_manager_Gather
addons_manager_LoadCatalog
addons_manager_Install
addons_manager_Remove
addon_entry_New
addon_entry_Hold
addon_entry_Release
src/misc/addons.c
0 → 100644
View file @
1a8ead40
This diff is collapsed.
Click to expand it.
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