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
5c47e150
Commit
5c47e150
authored
Aug 13, 2007
by
Pierre d'Herbemont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
include/vlc_meta.h: Use the vlc_dictionary to store extra meta tags.
parent
74da5425
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
42 deletions
+41
-42
include/vlc_meta.h
include/vlc_meta.h
+23
-35
src/input/es_out.c
src/input/es_out.c
+9
-3
src/input/input.c
src/input/input.c
+9
-4
No files found.
include/vlc_meta.h
View file @
5c47e150
...
@@ -28,6 +28,8 @@
...
@@ -28,6 +28,8 @@
#ifndef _VLC_META_H
#ifndef _VLC_META_H
#define _VLC_META_H 1
#define _VLC_META_H 1
#include <vlc_arrays.h>
/* VLC meta name */
/* VLC meta name */
#define VLC_META_INFO_CAT N_("Meta-information")
#define VLC_META_INFO_CAT N_("Meta-information")
#define VLC_META_TITLE N_("Title")
#define VLC_META_TITLE N_("Title")
...
@@ -77,9 +79,7 @@ struct vlc_meta_t
...
@@ -77,9 +79,7 @@ struct vlc_meta_t
char
*
psz_arturl
;
char
*
psz_arturl
;
char
*
psz_trackid
;
char
*
psz_trackid
;
int
i_extra
;
vlc_dictionary_t
extra_tags
;
char
**
ppsz_extra_name
;
char
**
ppsz_extra_value
;
int
i_status
;
int
i_status
;
...
@@ -130,18 +130,13 @@ static inline vlc_meta_t *vlc_meta_New( void )
...
@@ -130,18 +130,13 @@ static inline vlc_meta_t *vlc_meta_New( void )
m
->
psz_arturl
=
NULL
;
m
->
psz_arturl
=
NULL
;
m
->
psz_trackid
=
NULL
;
m
->
psz_trackid
=
NULL
;
m
->
i_extra
=
0
;
m
->
ppsz_extra_name
=
NULL
;
m
->
ppsz_extra_value
=
NULL
;
m
->
i_status
=
0
;
m
->
i_status
=
0
;
vlc_dictionary_init
(
&
m
->
extra_tags
,
32
/* "ought to be enough for anybody" */
);
return
m
;
return
m
;
}
}
static
inline
void
vlc_meta_Delete
(
vlc_meta_t
*
m
)
static
inline
void
vlc_meta_Delete
(
vlc_meta_t
*
m
)
{
{
int
i
;
free
(
m
->
psz_title
);
free
(
m
->
psz_title
);
free
(
m
->
psz_artist
);
free
(
m
->
psz_artist
);
free
(
m
->
psz_genre
);
free
(
m
->
psz_genre
);
...
@@ -159,26 +154,22 @@ static inline void vlc_meta_Delete( vlc_meta_t *m )
...
@@ -159,26 +154,22 @@ static inline void vlc_meta_Delete( vlc_meta_t *m )
free
(
m
->
psz_encodedby
);
free
(
m
->
psz_encodedby
);
free
(
m
->
psz_trackid
);
free
(
m
->
psz_trackid
);
free
(
m
->
psz_arturl
);
free
(
m
->
psz_arturl
);
for
(
i
=
0
;
i
<
m
->
i_extra
;
i
++
)
vlc_dictionary_clear
(
&
m
->
extra_tags
);
{
free
(
m
->
ppsz_extra_name
[
i
]
);
free
(
m
->
ppsz_extra_value
[
i
]
);
}
free
(
m
->
ppsz_extra_name
);
free
(
m
->
ppsz_extra_value
);
free
(
m
);
free
(
m
);
}
}
static
inline
void
vlc_meta_AddExtra
(
vlc_meta_t
*
m
,
const
char
*
psz_name
,
const
char
*
psz_value
)
static
inline
void
vlc_meta_AddExtra
(
vlc_meta_t
*
m
,
const
char
*
psz_name
,
const
char
*
psz_value
)
{
{
int
i_extra
=
m
->
i_extra
;
char
*
psz_oldvalue
=
(
char
*
)
vlc_dictionary_value_for_key
(
&
m
->
extra_tags
,
psz_name
);
TAB_APPEND_CPP
(
char
,
m
->
i_extra
,
m
->
ppsz_extra_name
,
strdup
(
psz_name
)
);
if
(
psz_oldvalue
!=
kVLCDictionaryNotFound
)
TAB_APPEND_CPP
(
char
,
i_extra
,
m
->
ppsz_extra_value
,
strdup
(
psz_value
)
);
{
free
(
psz_oldvalue
);
vlc_dictionary_remove_value_for_key
(
&
m
->
extra_tags
,
psz_name
);
}
vlc_dictionary_insert
(
&
m
->
extra_tags
,
psz_name
,
strdup
(
psz_value
)
);
}
}
static
inline
void
vlc_meta_Merge
(
vlc_meta_t
*
dst
,
const
vlc_meta_t
*
src
)
static
inline
void
vlc_meta_Merge
(
vlc_meta_t
*
dst
,
const
vlc_meta_t
*
src
)
{
{
int
i
;
if
(
!
dst
||
!
src
)
return
;
if
(
!
dst
||
!
src
)
return
;
#define COPY_FIELD( a ) \
#define COPY_FIELD( a ) \
if( src->psz_ ## a ) { \
if( src->psz_ ## a ) { \
...
@@ -203,22 +194,19 @@ static inline void vlc_meta_Merge( vlc_meta_t *dst, const vlc_meta_t *src )
...
@@ -203,22 +194,19 @@ static inline void vlc_meta_Merge( vlc_meta_t *dst, const vlc_meta_t *src )
COPY_FIELD
(
trackid
);
COPY_FIELD
(
trackid
);
COPY_FIELD
(
arturl
);
COPY_FIELD
(
arturl
);
#undef COPY_FIELD
#undef COPY_FIELD
char
**
ppsz_all_keys
;
for
(
i
=
0
;
i
<
src
->
i_extra
;
i
++
)
int
i
;
{
/* XXX: If speed up are needed, it is possible */
int
j
;
ppsz_all_keys
=
vlc_dictionary_all_keys
(
&
src
->
extra_tags
);
for
(
j
=
0
;
j
<
dst
->
i_extra
;
j
++
)
for
(
i
=
0
;
ppsz_all_keys
[
i
];
i
++
)
{
if
(
!
strcmp
(
dst
->
ppsz_extra_name
[
j
],
src
->
ppsz_extra_name
[
i
]
)
)
{
{
free
(
dst
->
ppsz_extra_value
[
j
]
);
/* Always try to remove the previous value */
dst
->
ppsz_extra_value
[
j
]
=
strdup
(
src
->
ppsz_extra_value
[
i
]
);
vlc_dictionary_remove_value_for_key
(
&
dst
->
extra_tags
,
ppsz_all_keys
[
i
]
);
break
;
void
*
p_value
=
vlc_dictionary_value_for_key
(
&
src
->
extra_tags
,
ppsz_all_keys
[
i
]
);
}
vlc_dictionary_insert
(
&
dst
->
extra_tags
,
ppsz_all_keys
[
i
],
p_value
);
}
free
(
ppsz_all_keys
[
i
]
);
if
(
j
>=
dst
->
i_extra
)
vlc_meta_AddExtra
(
dst
,
src
->
ppsz_extra_name
[
i
],
src
->
ppsz_extra_value
[
i
]
);
}
}
free
(
ppsz_all_keys
);
}
}
enum
{
enum
{
...
...
src/input/es_out.c
View file @
5c47e150
...
@@ -612,7 +612,7 @@ static void EsOutProgramMeta( es_out_t *out, int i_group, vlc_meta_t *p_meta )
...
@@ -612,7 +612,7 @@ static void EsOutProgramMeta( es_out_t *out, int i_group, vlc_meta_t *p_meta )
msg_Dbg
(
p_input
,
"EsOutProgramMeta: number=%d"
,
i_group
);
msg_Dbg
(
p_input
,
"EsOutProgramMeta: number=%d"
,
i_group
);
/* Check against empty meta data (empty for what we handle) */
/* Check against empty meta data (empty for what we handle) */
if
(
!
p_meta
->
psz_title
&&
!
p_meta
->
psz_nowplaying
&&
!
p_meta
->
psz_publisher
&&
p_meta
->
i_extra
<=
0
)
if
(
!
p_meta
->
psz_title
&&
!
p_meta
->
psz_nowplaying
&&
!
p_meta
->
psz_publisher
&&
vlc_dictionary_keys_count
(
&
p_meta
->
extra_tags
)
<=
0
)
return
;
return
;
/* Find program */
/* Find program */
for
(
i
=
0
;
i
<
p_sys
->
i_pgrm
;
i
++
)
for
(
i
=
0
;
i
<
p_sys
->
i_pgrm
;
i
++
)
...
@@ -676,8 +676,14 @@ static void EsOutProgramMeta( es_out_t *out, int i_group, vlc_meta_t *p_meta )
...
@@ -676,8 +676,14 @@ static void EsOutProgramMeta( es_out_t *out, int i_group, vlc_meta_t *p_meta )
}
}
input_Control
(
p_input
,
INPUT_ADD_INFO
,
psz_cat
,
_
(
VLC_META_PUBLISHER
),
psz_provider
);
input_Control
(
p_input
,
INPUT_ADD_INFO
,
psz_cat
,
_
(
VLC_META_PUBLISHER
),
psz_provider
);
}
}
for
(
i
=
0
;
i
<
p_meta
->
i_extra
;
i
++
)
char
**
ppsz_all_keys
=
vlc_dictionary_all_keys
(
&
p_meta
->
extra_tags
);
input_Control
(
p_input
,
INPUT_ADD_INFO
,
psz_cat
,
_
(
p_meta
->
ppsz_extra_name
[
i
]),
p_meta
->
ppsz_extra_value
[
i
]
);
for
(
i
=
0
;
ppsz_all_keys
[
i
];
i
++
)
{
input_Control
(
p_input
,
INPUT_ADD_INFO
,
psz_cat
,
_
(
ppsz_all_keys
[
i
]),
vlc_dictionary_value_for_key
(
&
p_meta
->
extra_tags
,
ppsz_all_keys
[
i
]
)
);
free
(
ppsz_all_keys
[
i
]
);
}
free
(
ppsz_all_keys
);
free
(
psz_cat
);
free
(
psz_cat
);
}
}
...
...
src/input/input.c
View file @
5c47e150
...
@@ -2547,7 +2547,7 @@ static void InputUpdateMeta( input_thread_t *p_input, vlc_meta_t *p_meta )
...
@@ -2547,7 +2547,7 @@ static void InputUpdateMeta( input_thread_t *p_input, vlc_meta_t *p_meta )
/* A bit ugly */
/* A bit ugly */
p_meta
=
NULL
;
p_meta
=
NULL
;
if
(
p_item
->
p_meta
->
i_extra
>
0
)
if
(
vlc_dictionary_keys_count
(
&
p_item
->
p_meta
->
extra_tags
)
>
0
)
{
{
p_meta
=
vlc_meta_New
();
p_meta
=
vlc_meta_New
();
vlc_meta_Merge
(
p_meta
,
p_item
->
p_meta
);
vlc_meta_Merge
(
p_meta
,
p_item
->
p_meta
);
...
@@ -2562,9 +2562,14 @@ static void InputUpdateMeta( input_thread_t *p_input, vlc_meta_t *p_meta )
...
@@ -2562,9 +2562,14 @@ static void InputUpdateMeta( input_thread_t *p_input, vlc_meta_t *p_meta )
if
(
p_meta
)
if
(
p_meta
)
{
{
for
(
i
=
0
;
i
<
p_meta
->
i_extra
;
i
++
)
char
**
ppsz_all_keys
=
vlc_dictionary_all_keys
(
&
p_meta
->
extra_tags
);
input_Control
(
p_input
,
INPUT_ADD_INFO
,
_
(
VLC_META_INFO_CAT
),
for
(
i
=
0
;
ppsz_all_keys
[
i
];
i
++
)
_
(
p_meta
->
ppsz_extra_name
[
i
]),
"%s"
,
p_meta
->
ppsz_extra_value
[
i
]
);
{
input_Control
(
p_input
,
INPUT_ADD_INFO
,
_
(
VLC_META_INFO_CAT
),
_
(
ppsz_all_keys
[
i
]),
vlc_dictionary_value_for_key
(
&
p_meta
->
extra_tags
,
ppsz_all_keys
[
i
]
)
);
free
(
ppsz_all_keys
[
i
]
);
}
free
(
ppsz_all_keys
);
vlc_meta_Delete
(
p_meta
);
vlc_meta_Delete
(
p_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