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
39793dd2
Commit
39793dd2
authored
Jun 17, 2007
by
Pierre d'Herbemont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Libvlc add a media descriptor object.
parent
20e45438
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
178 additions
and
0 deletions
+178
-0
include/vlc/libvlc.h
include/vlc/libvlc.h
+39
-0
include/vlc/libvlc_structures.h
include/vlc/libvlc_structures.h
+33
-0
src/Makefile.am
src/Makefile.am
+1
-0
src/control/media_descriptor.c
src/control/media_descriptor.c
+105
-0
No files found.
include/vlc/libvlc.h
View file @
39793dd2
...
...
@@ -121,6 +121,45 @@ VLC_PUBLIC_API void libvlc_destroy( libvlc_instance_t *, libvlc_exception_t * );
/** @}*/
/*****************************************************************************
* Media descriptor
*****************************************************************************/
/** defgroup libvlc_media_descriptor Media Descriptor
* \ingroup libvlc
* LibVLC Media Descriptor
* @{
*/
/**
* Create a media descriptor with the given mrl.
* \param p_instance the instance
* \param psz_mrl the mrl to read
*/
VLC_PUBLIC_API
libvlc_media_descriptor_t
*
libvlc_media_descriptor_new
(
libvlc_instance_t
*
p_instance
,
const
char
*
psz_mrl
,
libvlc_exception_t
*
p_e
);
/**
* Destroy a media descriptor object.
* \param p_meta_desc the md to destroy
*/
VLC_PUBLIC_API
void
libvlc_media_descriptor_destroy
(
libvlc_media_descriptor_t
*
p_meta_desc
);
/**
* Read the meta of the media descriptor.
* \param p_meta_desc the media descriptor to read
* \param p_meta_desc the meta to read
*/
VLC_PUBLIC_API
char
*
libvlc_media_descriptor_get_meta
(
libvlc_media_descriptor_t
*
p_meta_desc
,
libvlc_meta_t
e_meta
,
libvlc_exception_t
*
p_e
);
/** @}*/
/*****************************************************************************
* Playlist
*****************************************************************************/
...
...
include/vlc/libvlc_structures.h
View file @
39793dd2
...
...
@@ -52,6 +52,39 @@ typedef struct
/**@} */
/*****************************************************************************
* Media Descriptor
*****************************************************************************/
/** defgroup libvlc_media_descriptor MediaDescriptor
* \ingroup libvlc
* LibVLC Media Descriptor handling
* @{
*/
/* Meta Handling */
/** defgroup libvlc_meta Meta
* \ingroup libvlc_media_descriptor
* LibVLC Media Meta
* @{
*/
typedef
enum
{
libvlc_meta_Title
,
libvlc_meta_Artist
}
libvlc_meta_t
;
/**@} */
typedef
struct
{
bool
b_preparsed
;
input_item_t
*
p_input_item
;
libvlc_instance_t
*
p_libvlc_instance
;
}
libvlc_media_descriptor_t
;
/**@} */
/*****************************************************************************
* Playlist
*****************************************************************************/
...
...
src/Makefile.am
View file @
39793dd2
...
...
@@ -323,6 +323,7 @@ SOURCES_libvlc_control = \
control/video.c
\
control/audio.c
\
control/event.c
\
control/media_descriptor.c
\
control/mediacontrol_internal.h
\
control/mediacontrol_core.c
\
control/mediacontrol_util.c
\
...
...
src/control/media_descriptor.c
0 → 100644
View file @
39793dd2
/*****************************************************************************
* media_descriptor.c: Libvlc API media descriport management
*****************************************************************************
* Copyright (C) 2007 the VideoLAN team
* $Id$
*
* Authors: Pierre d'Herbemont <pdherbemont@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 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 General Public License for more details.
*
* You should have received a copy of the GNU 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.
*****************************************************************************/
#include <vlc/libvlc.h>
#include <vlc_input.h>
#include <vlc_meta.h>
#include "libvlc_internal.h"
/**************************************************************************
* Create a new media descriptor object (Private)
**************************************************************************/
static
void
preparse_if_needed
(
libvlc_media_descriptor_t
*
p_media_desc
)
{
/* XXX: need some locking here */
if
(
!
p_media_desc
->
b_preparsed
)
{
input_Preparse
(
p_media_desc
->
p_libvlc_instance
->
p_libvlc_int
,
p_media_desc
->
p_input_item
);
p_media_desc
->
b_preparsed
=
TRUE
;
}
}
/**************************************************************************
* Create a new media descriptor object
**************************************************************************/
libvlc_media_descriptor_t
*
libvlc_media_descriptor_new
(
libvlc_instance_t
*
p_instance
,
const
char
*
psz_mrl
,
libvlc_exception_t
*
p_e
)
{
input_item_t
*
p_input_item
;
libvlc_media_descriptor_t
*
p_media_desc
;
p_input_item
=
input_ItemNew
(
p_instance
->
p_libvlc_int
,
psz_mrl
,
psz_mrl
);
if
(
!
p_input_item
)
return
NULL
;
/* XXX: throw an exception */
p_media_desc
=
malloc
(
sizeof
(
libvlc_input_t
)
);
p_media_desc
->
p_libvlc_instance
=
p_instance
;
p_media_desc
->
p_input_item
=
p_input_item
;
p_media_desc
->
b_preparsed
=
FALSE
;
return
p_media_desc
;
}
/**************************************************************************
* Delete a media descriptor object
**************************************************************************/
void
libvlc_media_descriptor_destroy
(
libvlc_media_descriptor_t
*
p_meta_desc
)
{
if
(
!
p_meta_desc
)
return
;
/* XXX: locking */
input_ItemClean
(
p_meta_desc
->
p_input_item
);
free
(
p_meta_desc
);
}
/**************************************************************************
* Getters for meta information
**************************************************************************/
static
const
int
meta_conversion
[]
=
{
[
libvlc_meta_Title
]
=
0
,
/* Offset in the vlc_meta_t structure */
[
libvlc_meta_Artist
]
=
1
};
char
*
libvlc_media_descriptor_get_meta
(
libvlc_media_descriptor_t
*
p_meta_desc
,
libvlc_meta_t
e_meta
,
libvlc_exception_t
*
p_e
)
{
char
**
ppsz_meta
;
/* XXX: locking */
preparse_if_needed
(
p_meta_desc
);
ppsz_meta
=
(
char
**
)
p_meta_desc
->
p_input_item
->
p_meta
;
return
strdup
(
ppsz_meta
[
meta_conversion
[
e_meta
]
]
);
}
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