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
d49a678a
Commit
d49a678a
authored
Aug 15, 2007
by
Pierre d'Herbemont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src/control/media_descriptor.c: Forward vlc_InputItemMetaChanged events.
parent
e1aeed2e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
117 additions
and
51 deletions
+117
-51
include/vlc/libvlc_structures.h
include/vlc/libvlc_structures.h
+6
-1
src/control/libvlc_internal.h
src/control/libvlc_internal.h
+1
-0
src/control/media_descriptor.c
src/control/media_descriptor.c
+110
-50
No files found.
include/vlc/libvlc_structures.h
View file @
d49a678a
...
@@ -91,7 +91,7 @@ typedef enum libvlc_meta_t {
...
@@ -91,7 +91,7 @@ typedef enum libvlc_meta_t {
libvlc_meta_Description
,
libvlc_meta_Description
,
libvlc_meta_Rating
,
libvlc_meta_Rating
,
libvlc_meta_Date
,
libvlc_meta_Date
,
libvlc_meta_Setting
s
,
libvlc_meta_Setting
,
libvlc_meta_URL
,
libvlc_meta_URL
,
libvlc_meta_Language
,
libvlc_meta_Language
,
libvlc_meta_NowPlaying
,
libvlc_meta_NowPlaying
,
...
@@ -241,6 +241,7 @@ typedef struct libvlc_log_message_t
...
@@ -241,6 +241,7 @@ typedef struct libvlc_log_message_t
*/
*/
typedef
enum
libvlc_event_type_t
{
typedef
enum
libvlc_event_type_t
{
libvlc_MediaDescriptorMetaChanged
,
libvlc_MediaInstanceReachedEnd
,
libvlc_MediaInstanceReachedEnd
,
libvlc_MediaListItemAdded
,
libvlc_MediaListItemAdded
,
libvlc_MediaListItemDeleted
,
libvlc_MediaListItemDeleted
,
...
@@ -260,6 +261,10 @@ typedef struct libvlc_event_t
...
@@ -260,6 +261,10 @@ typedef struct libvlc_event_t
void
*
p_obj
;
void
*
p_obj
;
union
event_type_specific
union
event_type_specific
{
{
struct
{
libvlc_meta_t
meta_type
;
}
media_descriptor_meta_changed
;
struct
struct
{
{
libvlc_media_descriptor_t
*
item
;
libvlc_media_descriptor_t
*
item
;
...
...
src/control/libvlc_internal.h
View file @
d49a678a
...
@@ -65,6 +65,7 @@ struct libvlc_instance_t
...
@@ -65,6 +65,7 @@ struct libvlc_instance_t
struct
libvlc_media_descriptor_t
struct
libvlc_media_descriptor_t
{
{
libvlc_event_manager_t
*
p_event_manager
;
int
b_preparsed
;
int
b_preparsed
;
input_item_t
*
p_input_item
;
input_item_t
*
p_input_item
;
int
i_refcount
;
int
i_refcount
;
...
...
src/control/media_descriptor.c
View file @
d49a678a
...
@@ -27,6 +27,88 @@
...
@@ -27,6 +27,88 @@
#include "libvlc_internal.h"
#include "libvlc_internal.h"
static
const
vlc_meta_type_t
libvlc_to_vlc_meta
[]
=
{
[
libvlc_meta_Title
]
=
vlc_meta_Title
,
[
libvlc_meta_Artist
]
=
vlc_meta_Artist
,
[
libvlc_meta_Genre
]
=
vlc_meta_Genre
,
[
libvlc_meta_Copyright
]
=
vlc_meta_Copyright
,
[
libvlc_meta_Album
]
=
vlc_meta_Album
,
[
libvlc_meta_TrackNumber
]
=
vlc_meta_TrackNumber
,
[
libvlc_meta_Description
]
=
vlc_meta_Description
,
[
libvlc_meta_Rating
]
=
vlc_meta_Rating
,
[
libvlc_meta_Date
]
=
vlc_meta_Date
,
[
libvlc_meta_Setting
]
=
vlc_meta_Setting
,
[
libvlc_meta_URL
]
=
vlc_meta_URL
,
[
libvlc_meta_Language
]
=
vlc_meta_Language
,
[
libvlc_meta_NowPlaying
]
=
vlc_meta_NowPlaying
,
[
libvlc_meta_Publisher
]
=
vlc_meta_Publisher
,
[
libvlc_meta_EncodedBy
]
=
vlc_meta_EncodedBy
,
[
libvlc_meta_ArtworkURL
]
=
vlc_meta_ArtworkURL
,
[
libvlc_meta_TrackID
]
=
vlc_meta_TrackID
};
static
const
libvlc_meta_t
vlc_to_libvlc_meta
[]
=
{
[
vlc_meta_Title
]
=
libvlc_meta_Title
,
[
vlc_meta_Artist
]
=
libvlc_meta_Artist
,
[
vlc_meta_Genre
]
=
libvlc_meta_Genre
,
[
vlc_meta_Copyright
]
=
libvlc_meta_Copyright
,
[
vlc_meta_Album
]
=
libvlc_meta_Album
,
[
vlc_meta_TrackNumber
]
=
libvlc_meta_TrackNumber
,
[
vlc_meta_Description
]
=
libvlc_meta_Description
,
[
vlc_meta_Rating
]
=
libvlc_meta_Rating
,
[
vlc_meta_Date
]
=
libvlc_meta_Date
,
[
vlc_meta_Setting
]
=
libvlc_meta_Setting
,
[
vlc_meta_URL
]
=
libvlc_meta_URL
,
[
vlc_meta_Language
]
=
libvlc_meta_Language
,
[
vlc_meta_NowPlaying
]
=
libvlc_meta_NowPlaying
,
[
vlc_meta_Publisher
]
=
libvlc_meta_Publisher
,
[
vlc_meta_EncodedBy
]
=
libvlc_meta_EncodedBy
,
[
vlc_meta_ArtworkURL
]
=
libvlc_meta_ArtworkURL
,
[
vlc_meta_TrackID
]
=
libvlc_meta_TrackID
};
/**************************************************************************
* input_item_meta_changed (Private) (vlc event Callback)
**************************************************************************/
static
void
input_item_meta_changed
(
const
vlc_event_t
*
p_event
,
void
*
user_data
)
{
libvlc_media_descriptor_t
*
p_md
=
user_data
;
libvlc_event_t
event
;
/* Construct the event */
event
.
type
=
libvlc_MediaDescriptorMetaChanged
;
event
.
u
.
media_descriptor_meta_changed
.
meta_type
=
vlc_to_libvlc_meta
[
p_event
->
u
.
input_item_meta_changed
.
meta_type
];
/* Send the event */
libvlc_event_send
(
p_md
->
p_event_manager
,
&
event
);
}
/**************************************************************************
* Install event handler (Private)
**************************************************************************/
static
void
install_input_item_observer
(
libvlc_media_descriptor_t
*
p_md
)
{
vlc_event_attach
(
&
p_md
->
p_input_item
->
event_manager
,
vlc_InputItemMetaChanged
,
input_item_meta_changed
,
p_md
);
}
/**************************************************************************
* Uninstall event handler (Private)
**************************************************************************/
static
void
uninstall_input_item_observer
(
libvlc_media_descriptor_t
*
p_md
)
{
vlc_event_detach
(
&
p_md
->
p_input_item
->
event_manager
,
vlc_InputItemMetaChanged
,
input_item_meta_changed
,
p_md
);
}
/**************************************************************************
/**************************************************************************
* Preparse if not already done (Private)
* Preparse if not already done (Private)
...
@@ -43,59 +125,59 @@ static void preparse_if_needed( libvlc_media_descriptor_t *p_md )
...
@@ -43,59 +125,59 @@ static void preparse_if_needed( libvlc_media_descriptor_t *p_md )
}
}
/**************************************************************************
/**************************************************************************
* Create a new media descriptor object
* Create a new media descriptor object from an input_item
* (libvlc internal)
* That's the generic constructor
**************************************************************************/
**************************************************************************/
libvlc_media_descriptor_t
*
libvlc_media_descriptor_new
(
libvlc_media_descriptor_t
*
libvlc_media_descriptor_new
_from_input_item
(
libvlc_instance_t
*
p_instance
,
libvlc_instance_t
*
p_instance
,
const
char
*
psz_mrl
,
input_item_t
*
p_input_item
,
libvlc_exception_t
*
p_e
)
libvlc_exception_t
*
p_e
)
{
{
input_item_t
*
p_input_item
;
libvlc_media_descriptor_t
*
p_md
;
libvlc_media_descriptor_t
*
p_md
;
p_input_item
=
input_ItemNew
(
p_instance
->
p_libvlc_int
,
psz_mrl
,
psz_mrl
);
if
(
!
p_input_item
)
if
(
!
p_input_item
)
{
{
libvlc_exception_raise
(
p_e
,
"
Can't create md's input_item
"
);
libvlc_exception_raise
(
p_e
,
"
No input item given
"
);
return
NULL
;
return
NULL
;
}
}
p_md
=
malloc
(
sizeof
(
libvlc_media_descriptor_t
)
);
p_md
=
malloc
(
sizeof
(
libvlc_media_descriptor_t
)
);
p_md
->
p_libvlc_instance
=
p_instance
;
p_md
->
p_libvlc_instance
=
p_instance
;
p_md
->
p_input_item
=
p_input_item
;
p_md
->
p_input_item
=
p_input_item
;
p_md
->
b_preparsed
=
VLC_
FALS
E
;
p_md
->
b_preparsed
=
VLC_
TRU
E
;
p_md
->
i_refcount
=
1
;
p_md
->
i_refcount
=
1
;
p_md
->
p_event_manager
=
libvlc_event_manager_new
(
p_md
,
p_instance
,
p_e
);
libvlc_event_manager_register_event_type
(
p_md
->
p_event_manager
,
libvlc_MediaDescriptorMetaChanged
,
p_e
);
vlc_gc_incref
(
p_md
->
p_input_item
);
vlc_gc_incref
(
p_md
->
p_input_item
);
install_input_item_observer
(
p_md
);
return
p_md
;
return
p_md
;
}
}
/**************************************************************************
/**************************************************************************
* Create a new media descriptor object from an input_item
* Create a new media descriptor object
* (libvlc internal)
**************************************************************************/
**************************************************************************/
libvlc_media_descriptor_t
*
libvlc_media_descriptor_new
_from_input_item
(
libvlc_media_descriptor_t
*
libvlc_media_descriptor_new
(
libvlc_instance_t
*
p_instance
,
libvlc_instance_t
*
p_instance
,
input_item_t
*
p_input_item
,
const
char
*
psz_mrl
,
libvlc_exception_t
*
p_e
)
libvlc_exception_t
*
p_e
)
{
{
input_item_t
*
p_input_item
;
libvlc_media_descriptor_t
*
p_md
;
libvlc_media_descriptor_t
*
p_md
;
p_input_item
=
input_ItemNew
(
p_instance
->
p_libvlc_int
,
psz_mrl
,
psz_mrl
);
if
(
!
p_input_item
)
if
(
!
p_input_item
)
{
{
libvlc_exception_raise
(
p_e
,
"
No input item given
"
);
libvlc_exception_raise
(
p_e
,
"
Can't create md's input_item
"
);
return
NULL
;
return
NULL
;
}
}
p_md
=
malloc
(
sizeof
(
libvlc_media_descriptor_t
)
);
p_md
=
libvlc_media_descriptor_new_from_input_item
(
p_instance
,
p_md
->
p_libvlc_instance
=
p_instance
;
p_input_item
,
p_e
);
p_md
->
p_input_item
=
p_input_item
;
p_md
->
b_preparsed
=
VLC_TRUE
;
p_md
->
i_refcount
=
1
;
vlc_gc_incref
(
p_md
->
p_input_item
);
return
p_md
;
return
p_md
;
}
}
...
@@ -110,12 +192,12 @@ void libvlc_media_descriptor_release( libvlc_media_descriptor_t *p_md )
...
@@ -110,12 +192,12 @@ void libvlc_media_descriptor_release( libvlc_media_descriptor_t *p_md )
p_md
->
i_refcount
--
;
p_md
->
i_refcount
--
;
/* XXX: locking */
vlc_gc_decref
(
p_md
->
p_input_item
);
if
(
p_md
->
i_refcount
>
0
)
if
(
p_md
->
i_refcount
>
0
)
return
;
return
;
uninstall_input_item_observer
(
p_md
);
vlc_gc_decref
(
p_md
->
p_input_item
);
free
(
p_md
);
free
(
p_md
);
}
}
...
@@ -128,9 +210,6 @@ void libvlc_media_descriptor_retain( libvlc_media_descriptor_t *p_md )
...
@@ -128,9 +210,6 @@ void libvlc_media_descriptor_retain( libvlc_media_descriptor_t *p_md )
return
;
return
;
p_md
->
i_refcount
++
;
p_md
->
i_refcount
++
;
/* XXX: locking */
vlc_gc_incref
(
p_md
->
p_input_item
);
}
}
/**************************************************************************
/**************************************************************************
...
@@ -140,7 +219,7 @@ libvlc_media_descriptor_t *
...
@@ -140,7 +219,7 @@ libvlc_media_descriptor_t *
libvlc_media_descriptor_duplicate
(
libvlc_media_descriptor_t
*
p_md_orig
)
libvlc_media_descriptor_duplicate
(
libvlc_media_descriptor_t
*
p_md_orig
)
{
{
return
libvlc_media_descriptor_new_from_input_item
(
return
libvlc_media_descriptor_new_from_input_item
(
p_md
->
p_libvlc_instance
,
p_md_orig
->
p_input_item
);
p_md
_orig
->
p_libvlc_instance
,
p_md_orig
->
p_input_item
,
NULL
);
}
}
/**************************************************************************
/**************************************************************************
...
@@ -157,26 +236,6 @@ libvlc_media_descriptor_get_mrl( libvlc_media_descriptor_t * p_md,
...
@@ -157,26 +236,6 @@ libvlc_media_descriptor_get_mrl( libvlc_media_descriptor_t * p_md,
/**************************************************************************
/**************************************************************************
* Getter for meta information
* Getter for meta information
**************************************************************************/
**************************************************************************/
static
const
vlc_meta_type_t
meta_conversion
[]
=
{
[
libvlc_meta_Title
]
=
vlc_meta_Title
,
[
libvlc_meta_Artist
]
=
vlc_meta_Artist
,
[
libvlc_meta_Genre
]
=
vlc_meta_Genre
,
[
libvlc_meta_Copyright
]
=
vlc_meta_Copyright
,
[
libvlc_meta_Album
]
=
vlc_meta_Album
,
[
libvlc_meta_TrackNumber
]
=
vlc_meta_TrackNumber
,
[
libvlc_meta_Description
]
=
vlc_meta_Description
,
[
libvlc_meta_Rating
]
=
vlc_meta_Rating
,
[
libvlc_meta_Date
]
=
vlc_meta_Date
,
[
libvlc_meta_Settings
]
=
vlc_meta_Setting
,
[
libvlc_meta_URL
]
=
vlc_meta_URL
,
[
libvlc_meta_Language
]
=
vlc_meta_Language
,
[
libvlc_meta_NowPlaying
]
=
vlc_meta_NowPlaying
,
[
libvlc_meta_Publisher
]
=
vlc_meta_Publisher
,
[
libvlc_meta_EncodedBy
]
=
vlc_meta_EncodedBy
,
[
libvlc_meta_ArtworkURL
]
=
vlc_meta_ArtworkURL
,
[
libvlc_meta_TrackID
]
=
vlc_meta_TrackID
};
char
*
libvlc_media_descriptor_get_meta
(
libvlc_media_descriptor_t
*
p_md
,
char
*
libvlc_media_descriptor_get_meta
(
libvlc_media_descriptor_t
*
p_md
,
libvlc_meta_t
e_meta
,
libvlc_meta_t
e_meta
,
...
@@ -188,7 +247,8 @@ char * libvlc_media_descriptor_get_meta( libvlc_media_descriptor_t *p_md,
...
@@ -188,7 +247,8 @@ char * libvlc_media_descriptor_get_meta( libvlc_media_descriptor_t *p_md,
preparse_if_needed
(
p_md
);
preparse_if_needed
(
p_md
);
psz_meta
=
input_item_GetMeta
(
p_md
->
p_input_item
,
meta_conversion
[
e_meta
]
);
psz_meta
=
input_item_GetMeta
(
p_md
->
p_input_item
,
libvlc_to_vlc_meta
[
e_meta
]
);
/* Should be integrated in core */
/* Should be integrated in core */
if
(
!
psz_meta
&&
e_meta
==
libvlc_meta_Title
&&
p_md
->
p_input_item
->
psz_name
)
if
(
!
psz_meta
&&
e_meta
==
libvlc_meta_Title
&&
p_md
->
p_input_item
->
psz_name
)
...
...
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