Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
0578a544
Commit
0578a544
authored
Oct 09, 2008
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed vlc_meta_Merge.
The extra_tags values were not duplicated.
parent
350b1da9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
15 deletions
+17
-15
include/vlc_meta.h
include/vlc_meta.h
+17
-15
No files found.
include/vlc_meta.h
View file @
0578a544
...
...
@@ -94,28 +94,28 @@ struct vlc_meta_t
#define vlc_meta_SetTrackID( meta, b ) vlc_meta_Set( meta, vlc_meta_TrackID, b )
/* Free a dictonary key allocated by strdup() in vlc_meta_AddExtra() */
static
void
vlc_meta_FreeExtraKey
(
void
*
p_data
,
void
*
p_obj
)
static
inline
void
vlc_meta_FreeExtraKey
(
void
*
p_data
,
void
*
p_obj
)
{
VLC_UNUSED
(
p_obj
);
free
(
p_data
);
}
static
inline
void
vlc_meta_Set
(
vlc_meta_t
*
p_meta
,
vlc_meta_type_t
meta_type
,
const
char
*
psz_val
)
static
inline
void
vlc_meta_Set
(
vlc_meta_t
*
p_meta
,
vlc_meta_type_t
meta_type
,
const
char
*
psz_val
)
{
free
(
p_meta
->
ppsz_meta
[
meta_type
]
);
p_meta
->
ppsz_meta
[
meta_type
]
=
psz_val
?
strdup
(
psz_val
)
:
NULL
;
}
static
inline
const
char
*
vlc_meta_Get
(
const
vlc_meta_t
*
p_meta
,
vlc_meta_type_t
meta_type
)
static
inline
const
char
*
vlc_meta_Get
(
const
vlc_meta_t
*
p_meta
,
vlc_meta_type_t
meta_type
)
{
return
p_meta
->
ppsz_meta
[
meta_type
];
}
static
inline
vlc_meta_t
*
vlc_meta_New
(
void
)
{
vlc_meta_t
*
m
=
(
vlc_meta_t
*
)
malloc
(
sizeof
(
vlc_meta_t
)
);
if
(
!
m
)
return
NULL
;
vlc_meta_t
*
m
=
(
vlc_meta_t
*
)
malloc
(
sizeof
(
*
m
)
);
if
(
!
m
)
return
NULL
;
memset
(
m
->
ppsz_meta
,
0
,
sizeof
(
m
->
ppsz_meta
)
);
m
->
i_status
=
0
;
vlc_dictionary_init
(
&
m
->
extra_tags
,
0
);
...
...
@@ -127,28 +127,29 @@ static inline void vlc_meta_Delete( vlc_meta_t *m )
int
i
;
for
(
i
=
0
;
i
<
VLC_META_TYPE_COUNT
;
i
++
)
free
(
m
->
ppsz_meta
[
i
]
);
vlc_dictionary_clear
(
&
m
->
extra_tags
,
&
vlc_meta_FreeExtraKey
,
NULL
);
vlc_dictionary_clear
(
&
m
->
extra_tags
,
vlc_meta_FreeExtraKey
,
NULL
);
free
(
m
);
}
static
inline
void
vlc_meta_AddExtra
(
vlc_meta_t
*
m
,
const
char
*
psz_name
,
const
char
*
psz_value
)
{
char
*
psz_oldvalue
=
(
char
*
)
vlc_dictionary_value_for_key
(
&
m
->
extra_tags
,
psz_name
);
char
*
psz_oldvalue
=
(
char
*
)
vlc_dictionary_value_for_key
(
&
m
->
extra_tags
,
psz_name
);
if
(
psz_oldvalue
!=
kVLCDictionaryNotFound
)
{
free
(
psz_oldvalue
);
vlc_dictionary_remove_value_for_key
(
&
m
->
extra_tags
,
psz_name
,
&
vlc_meta_FreeExtraKey
,
NULL
);
vlc_meta_FreeExtraKey
,
NULL
);
}
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
)
{
char
**
ppsz_all_keys
;
char
**
ppsz_all_keys
;
int
i
;
if
(
!
dst
||
!
src
)
return
;
if
(
!
dst
||
!
src
)
return
;
for
(
i
=
0
;
i
<
VLC_META_TYPE_COUNT
;
i
++
)
{
...
...
@@ -161,12 +162,13 @@ static inline void vlc_meta_Merge( vlc_meta_t *dst, const vlc_meta_t *src )
/* XXX: If speed up are needed, it is possible */
ppsz_all_keys
=
vlc_dictionary_all_keys
(
&
src
->
extra_tags
);
for
(
i
=
0
;
ppsz_all_keys
[
i
];
i
++
)
for
(
i
=
0
;
ppsz_all_keys
&&
ppsz_all_keys
[
i
];
i
++
)
{
/* Always try to remove the previous value */
vlc_dictionary_remove_value_for_key
(
&
dst
->
extra_tags
,
ppsz_all_keys
[
i
],
NULL
,
NULL
);
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
);
vlc_dictionary_remove_value_for_key
(
&
dst
->
extra_tags
,
ppsz_all_keys
[
i
],
vlc_meta_FreeExtraKey
,
NULL
);
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
],
strdup
(
(
const
char
*
)
p_value
)
);
free
(
ppsz_all_keys
[
i
]
);
}
free
(
ppsz_all_keys
);
...
...
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