Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
1eda9d86
Commit
1eda9d86
authored
Aug 20, 2007
by
Pierre d'Herbemont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
control/tag_query.c: Make tag_query_match actually match something.
parent
3374626a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
21 deletions
+60
-21
include/vlc/libvlc.h
include/vlc/libvlc.h
+6
-0
src/control/libvlc_internal.h
src/control/libvlc_internal.h
+8
-0
src/control/media_descriptor.c
src/control/media_descriptor.c
+7
-13
src/control/tag_query.c
src/control/tag_query.c
+39
-8
No files found.
include/vlc/libvlc.h
View file @
1eda9d86
...
@@ -462,6 +462,12 @@ VLC_PUBLIC_API void
...
@@ -462,6 +462,12 @@ VLC_PUBLIC_API void
VLC_PUBLIC_API
void
VLC_PUBLIC_API
void
libvlc_tag_query_retain
(
libvlc_tag_query_t
*
);
libvlc_tag_query_retain
(
libvlc_tag_query_t
*
);
VLC_PUBLIC_API
void
libvlc_tag_query_set_match_tag_and_key
(
libvlc_tag_query_t
*
p_q
,
libvlc_tag_t
tag
,
char
*
psz_tag_key
,
libvlc_exception_t
*
);
VLC_PUBLIC_API
vlc_bool_t
VLC_PUBLIC_API
vlc_bool_t
libvlc_tag_query_match
(
libvlc_tag_query_t
*
,
libvlc_media_descriptor_t
*
,
libvlc_tag_query_match
(
libvlc_tag_query_t
*
,
libvlc_media_descriptor_t
*
,
libvlc_exception_t
*
);
libvlc_exception_t
*
);
...
...
src/control/libvlc_internal.h
View file @
1eda9d86
...
@@ -63,6 +63,12 @@ struct libvlc_instance_t
...
@@ -63,6 +63,12 @@ struct libvlc_instance_t
struct
libvlc_callback_entry_list_t
*
p_callback_list
;
struct
libvlc_callback_entry_list_t
*
p_callback_list
;
};
};
struct
libvlc_tags_storage_t
{
char
**
ppsz_tags
;
int
i_count
;
};
struct
libvlc_media_descriptor_t
struct
libvlc_media_descriptor_t
{
{
libvlc_event_manager_t
*
p_event_manager
;
libvlc_event_manager_t
*
p_event_manager
;
...
@@ -77,6 +83,8 @@ struct libvlc_tag_query_t
...
@@ -77,6 +83,8 @@ struct libvlc_tag_query_t
{
{
struct
libvlc_instance_t
*
p_libvlc_instance
;
/* Parent instance */
struct
libvlc_instance_t
*
p_libvlc_instance
;
/* Parent instance */
int
i_refcount
;
int
i_refcount
;
libvlc_tag_t
tag
;
char
*
psz_tag_key
;
};
};
struct
libvlc_tree_t
struct
libvlc_tree_t
...
...
src/control/media_descriptor.c
View file @
1eda9d86
...
@@ -69,12 +69,6 @@ static const libvlc_meta_t vlc_to_libvlc_meta[] =
...
@@ -69,12 +69,6 @@ static const libvlc_meta_t vlc_to_libvlc_meta[] =
[
vlc_meta_TrackID
]
=
libvlc_meta_TrackID
[
vlc_meta_TrackID
]
=
libvlc_meta_TrackID
};
};
struct
tag_storage
{
char
**
ppsz_tags
;
int
i_count
;
};
/**************************************************************************
/**************************************************************************
* input_item_subitem_added (Private) (vlc event Callback)
* input_item_subitem_added (Private) (vlc event Callback)
**************************************************************************/
**************************************************************************/
...
@@ -246,7 +240,7 @@ void libvlc_media_descriptor_release( libvlc_media_descriptor_t *p_md )
...
@@ -246,7 +240,7 @@ void libvlc_media_descriptor_release( libvlc_media_descriptor_t *p_md )
for
(
i
=
0
;
all_keys
[
i
];
i
++
)
for
(
i
=
0
;
all_keys
[
i
];
i
++
)
{
{
int
j
;
int
j
;
struct
tag_storage
*
p_ts
=
vlc_dictionary_value_for_key
(
&
p_md
->
tags
,
all_keys
[
i
]
);
struct
libvlc_tags_storage_t
*
p_ts
=
vlc_dictionary_value_for_key
(
&
p_md
->
tags
,
all_keys
[
i
]
);
for
(
j
=
0
;
j
<
p_ts
->
i_count
;
j
++
)
for
(
j
=
0
;
j
<
p_ts
->
i_count
;
j
++
)
{
{
free
(
p_ts
->
ppsz_tags
[
j
]
);
free
(
p_ts
->
ppsz_tags
[
j
]
);
...
@@ -325,7 +319,7 @@ void libvlc_media_descriptor_add_tag( libvlc_media_descriptor_t *p_md,
...
@@ -325,7 +319,7 @@ void libvlc_media_descriptor_add_tag( libvlc_media_descriptor_t *p_md,
const
libvlc_tag_t
tag
,
const
libvlc_tag_t
tag
,
libvlc_exception_t
*
p_e
)
libvlc_exception_t
*
p_e
)
{
{
struct
tag_storage
*
p_ts
;
struct
libvlc_tags_storage_t
*
p_ts
;
if
(
!
tag
||
!
key
)
if
(
!
tag
||
!
key
)
return
;
return
;
...
@@ -334,8 +328,8 @@ void libvlc_media_descriptor_add_tag( libvlc_media_descriptor_t *p_md,
...
@@ -334,8 +328,8 @@ void libvlc_media_descriptor_add_tag( libvlc_media_descriptor_t *p_md,
if
(
!
p_ts
)
if
(
!
p_ts
)
{
{
p_ts
=
malloc
(
sizeof
(
struct
tag_storage
));
p_ts
=
malloc
(
sizeof
(
struct
libvlc_tags_storage_t
));
memset
(
p_ts
,
0
,
sizeof
(
struct
tag_storage
)
);
memset
(
p_ts
,
0
,
sizeof
(
struct
libvlc_tags_storage_t
)
);
}
}
p_ts
->
i_count
++
;
p_ts
->
i_count
++
;
...
@@ -356,7 +350,7 @@ void libvlc_media_descriptor_remove_tag( libvlc_media_descriptor_t *p_md,
...
@@ -356,7 +350,7 @@ void libvlc_media_descriptor_remove_tag( libvlc_media_descriptor_t *p_md,
const
libvlc_tag_t
tag
,
const
libvlc_tag_t
tag
,
libvlc_exception_t
*
p_e
)
libvlc_exception_t
*
p_e
)
{
{
struct
tag_storage
*
p_ts
;
struct
libvlc_tags_storage_t
*
p_ts
;
int
i
;
int
i
;
if
(
!
tag
||
!
key
)
if
(
!
tag
||
!
key
)
...
@@ -387,7 +381,7 @@ int libvlc_media_descriptor_tags_count_for_key( libvlc_media_descriptor_t *p_md,
...
@@ -387,7 +381,7 @@ int libvlc_media_descriptor_tags_count_for_key( libvlc_media_descriptor_t *p_md,
const
char
*
key
,
const
char
*
key
,
libvlc_exception_t
*
p_e
)
libvlc_exception_t
*
p_e
)
{
{
struct
tag_storage
*
p_ts
;
struct
libvlc_tags_storage_t
*
p_ts
;
if
(
!
key
)
if
(
!
key
)
return
0
;
return
0
;
...
@@ -408,7 +402,7 @@ libvlc_media_descriptor_tag_at_index_for_key( libvlc_media_descriptor_t *p_md,
...
@@ -408,7 +402,7 @@ libvlc_media_descriptor_tag_at_index_for_key( libvlc_media_descriptor_t *p_md,
const
char
*
key
,
const
char
*
key
,
libvlc_exception_t
*
p_e
)
libvlc_exception_t
*
p_e
)
{
{
struct
tag_storage
*
p_ts
;
struct
libvlc_tags_storage_t
*
p_ts
;
if
(
!
key
)
if
(
!
key
)
return
NULL
;
return
NULL
;
...
...
src/control/tag_query.c
View file @
1eda9d86
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
*/
*/
/**************************************************************************
/**************************************************************************
*
libvlc_tag_query_
new (Public)
* new (Public)
*
*
* Init an object.
* Init an object.
**************************************************************************/
**************************************************************************/
...
@@ -54,12 +54,14 @@ libvlc_tag_query_new( libvlc_instance_t * p_inst,
...
@@ -54,12 +54,14 @@ libvlc_tag_query_new( libvlc_instance_t * p_inst,
p_q
->
p_libvlc_instance
=
p_inst
;
p_q
->
p_libvlc_instance
=
p_inst
;
p_q
->
i_refcount
=
1
;
p_q
->
i_refcount
=
1
;
p_q
->
tag
=
NULL
;
p_q
->
psz_tag_key
=
NULL
;
return
p_q
;
return
p_q
;
}
}
/**************************************************************************
/**************************************************************************
*
libvlc_media_list_
release (Public)
* release (Public)
*
*
* Release an object.
* Release an object.
**************************************************************************/
**************************************************************************/
...
@@ -70,11 +72,14 @@ void libvlc_tag_query_release( libvlc_tag_query_t * p_q )
...
@@ -70,11 +72,14 @@ void libvlc_tag_query_release( libvlc_tag_query_t * p_q )
if
(
p_q
->
i_refcount
>
0
)
if
(
p_q
->
i_refcount
>
0
)
return
;
return
;
free
(
p_q
->
tag
);
free
(
p_q
->
psz_tag_key
);
free
(
p_q
);
free
(
p_q
);
}
}
/**************************************************************************
/**************************************************************************
*
libvlc_media_list_
retain (Public)
* retain (Public)
*
*
* Release an object.
* Release an object.
**************************************************************************/
**************************************************************************/
...
@@ -83,9 +88,22 @@ void libvlc_tag_query_retain( libvlc_tag_query_t * p_q )
...
@@ -83,9 +88,22 @@ void libvlc_tag_query_retain( libvlc_tag_query_t * p_q )
p_q
->
i_refcount
++
;
p_q
->
i_refcount
++
;
}
}
/**************************************************************************
* set_match_tag_and_key (Public)
**************************************************************************/
void
libvlc_tag_query_set_match_tag_and_key
(
libvlc_tag_query_t
*
p_q
,
libvlc_tag_t
tag
,
char
*
psz_tag_key
,
libvlc_exception_t
*
p_e
)
{
(
void
)
p_e
;
p_q
->
tag
=
strdup
(
tag
);
p_q
->
psz_tag_key
=
strdup
(
psz_tag_key
);
}
/**************************************************************************
/**************************************************************************
*
libvlc_query_
match (Public)
* match (Public)
*
*
* Return true if the query p_q is matched in p_md
* Return true if the query p_q is matched in p_md
**************************************************************************/
**************************************************************************/
...
@@ -94,10 +112,23 @@ libvlc_tag_query_match( libvlc_tag_query_t * p_q,
...
@@ -94,10 +112,23 @@ libvlc_tag_query_match( libvlc_tag_query_t * p_q,
libvlc_media_descriptor_t
*
p_md
,
libvlc_media_descriptor_t
*
p_md
,
libvlc_exception_t
*
p_e
)
libvlc_exception_t
*
p_e
)
{
{
(
void
)
p_q
;
int
i
;
(
void
)
p_md
;
struct
libvlc_tags_storage_t
*
p_ts
;
(
void
)
p_e
;
(
void
)
p_e
;
if
(
!
p_q
->
psz_tag_key
)
return
1
;
p_ts
=
vlc_dictionary_value_for_key
(
&
p_md
->
tags
,
p_q
->
psz_tag_key
);
if
(
!
p_q
->
tag
)
return
p_ts
->
i_count
>
0
;
for
(
i
=
0
;
i
<
p_ts
->
i_count
;
i
++
)
{
if
(
!
strcmp
(
p_ts
->
ppsz_tags
[
i
],
p_q
->
tag
)
)
return
1
;
}
/* In construction... */
/* In construction... */
return
1
;
return
0
;
}
}
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