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
5e827398
Commit
5e827398
authored
Aug 19, 2007
by
Pierre d'Herbemont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
control/tree.c: Add a new structure to work with tree.
parent
17b50a65
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
324 additions
and
0 deletions
+324
-0
include/vlc/libvlc.h
include/vlc/libvlc.h
+51
-0
include/vlc/libvlc_structures.h
include/vlc/libvlc_structures.h
+16
-0
src/control/libvlc_internal.h
src/control/libvlc_internal.h
+9
-0
src/control/tree.c
src/control/tree.c
+248
-0
No files found.
include/vlc/libvlc.h
View file @
5e827398
...
@@ -121,6 +121,57 @@ VLC_PUBLIC_API void libvlc_destroy( libvlc_instance_t *, libvlc_exception_t * );
...
@@ -121,6 +121,57 @@ VLC_PUBLIC_API void libvlc_destroy( libvlc_instance_t *, libvlc_exception_t * );
/** @}*/
/** @}*/
/*****************************************************************************
* Tree
*****************************************************************************/
/** defgroup libvlc_tree Tree
* \ingroup libvlc
* LibVLC Tree. A tree holds an item plus several subtrees.
* @{
*/
VLC_PUBLIC_API
libvlc_tree_t
*
libvlc_tree_new_with_media_list_as_item
(
libvlc_media_list_t
*
p_mlist
,
libvlc_exception_t
*
p_e
);
VLC_PUBLIC_API
libvlc_tree_t
*
libvlc_tree_new_with_string_as_item
(
const
char
*
psz
,
libvlc_exception_t
*
p_e
);
VLC_PUBLIC_API
void
libvlc_tree_release
(
libvlc_tree_t
*
p_tree
);
VLC_PUBLIC_API
void
libvlc_tree_retain
(
libvlc_tree_t
*
p_tree
);
VLC_PUBLIC_API
char
*
libvlc_tree_item_as_string
(
libvlc_tree_t
*
p_tree
,
libvlc_exception_t
*
p_e
);
VLC_PUBLIC_API
libvlc_media_list_t
*
libvlc_tree_item_as_media_list
(
libvlc_tree_t
*
p_tree
,
libvlc_exception_t
*
p_e
);
VLC_PUBLIC_API
int
libvlc_tree_subtree_count
(
libvlc_tree_t
*
p_tree
,
libvlc_exception_t
*
p_e
);
VLC_PUBLIC_API
libvlc_tree_t
*
libvlc_tree_subtree_at_index
(
libvlc_tree_t
*
p_tree
,
int
index
,
libvlc_exception_t
*
p_e
);
VLC_PUBLIC_API
void
libvlc_tree_insert_subtree_at_index
(
libvlc_tree_t
*
p_tree
,
libvlc_tree_t
*
p_subtree
,
int
index
,
libvlc_exception_t
*
p_e
);
VLC_PUBLIC_API
void
libvlc_tree_remove_subtree_at_index
(
libvlc_tree_t
*
p_tree
,
int
index
,
libvlc_exception_t
*
p_e
);
/**@} */
/*****************************************************************************
/*****************************************************************************
* Media descriptor
* Media descriptor
...
...
include/vlc/libvlc_structures.h
View file @
5e827398
...
@@ -52,6 +52,22 @@ typedef struct libvlc_exception_t
...
@@ -52,6 +52,22 @@ typedef struct libvlc_exception_t
/**@} */
/**@} */
/*****************************************************************************
* Tree
*****************************************************************************/
/** defgroup libvlc_tree Tree
* \ingroup libvlc
* LibVLC Tree
* @{
*/
typedef
void
(
*
libvlc_retain_function
)(
void
*
);
typedef
void
(
*
libvlc_release_function
)(
void
*
);
typedef
struct
libvlc_tree_t
libvlc_tree_t
;
/**@} */
/*****************************************************************************
/*****************************************************************************
* Tag
* Tag
*****************************************************************************/
*****************************************************************************/
...
...
src/control/libvlc_internal.h
View file @
5e827398
...
@@ -80,6 +80,15 @@ struct libvlc_tag_query_t
...
@@ -80,6 +80,15 @@ struct libvlc_tag_query_t
};
};
struct
libvlc_tree_t
{
int
i_refcount
;
void
*
p_item
;
/* For dynamic sublist */
libvlc_retain_function
pf_item_retain
;
libvlc_release_function
pf_item_release
;
DECL_ARRAY
(
struct
libvlc_tree_t
*
)
subtrees
;
/* For dynamic sublist */
};
struct
libvlc_media_list_t
struct
libvlc_media_list_t
{
{
libvlc_event_manager_t
*
p_event_manager
;
libvlc_event_manager_t
*
p_event_manager
;
...
...
src/control/tree.c
0 → 100644
View file @
5e827398
/*****************************************************************************
* media_list.c: libvlc tree functions
*****************************************************************************
* 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 "libvlc_internal.h"
#include <vlc/libvlc.h>
#include <assert.h>
#include "vlc_arrays.h"
/*
* Private libvlc functions
*/
/**************************************************************************
* notify_subtree_addition (private)
*
* Do the appropriate action when a subtree is added.
**************************************************************************/
static
void
notify_subtree_addition
(
libvlc_tree_t
*
p_tree
,
libvlc_tree_t
*
p_subtree
,
int
index
)
{
}
/**************************************************************************
* notify_subtree_deletion (private)
*
* Do the appropriate action when a subtree is deleted.
**************************************************************************/
static
void
notify_subtree_deletion
(
libvlc_tree_t
*
p_tree
,
libvlc_tree_t
*
p_subtree
,
int
index
)
{
}
/**************************************************************************
* new (Private)
**************************************************************************/
static
libvlc_tree_t
*
libvlc_tree_new
(
libvlc_retain_function
item_retain
,
libvlc_retain_function
item_release
,
void
*
item
,
libvlc_exception_t
*
p_e
)
{
(
void
)
p_e
;
libvlc_tree_t
*
p_tree
;
p_tree
=
malloc
(
sizeof
(
libvlc_tree_t
));
if
(
!
p_tree
)
return
NULL
;
p_tree
->
i_refcount
=
1
;
p_tree
->
p_item
=
item
;
ARRAY_INIT
(
p_tree
->
subtrees
);
return
p_tree
;
}
/**************************************************************************
* item (Private)
**************************************************************************/
static
void
*
libvlc_tree_item
(
libvlc_tree_t
*
p_tree
,
libvlc_exception_t
*
p_e
)
{
if
(
p_tree
->
pf_item_retain
)
p_tree
->
pf_item_retain
(
p_tree
->
p_item
);
return
p_tree
->
p_item
;
}
/*
* Public libvlc functions
*/
/**************************************************************************
* new_with_media_list (Public)
**************************************************************************/
libvlc_tree_t
*
libvlc_tree_new_with_media_list_as_item
(
libvlc_media_list_t
*
p_mlist
,
libvlc_exception_t
*
p_e
)
{
(
void
)
p_e
;
libvlc_tree_t
*
p_tree
=
libvlc_tree_new
(
(
libvlc_retain_function
)
libvlc_media_list_retain
,
(
libvlc_release_function
)
libvlc_media_list_release
,
p_mlist
,
p_e
);
return
p_tree
;
}
/**************************************************************************
* new_with_string (Public)
**************************************************************************/
libvlc_tree_t
*
libvlc_tree_new_with_string_as_item
(
const
char
*
psz
,
libvlc_exception_t
*
p_e
)
{
(
void
)
p_e
;
libvlc_tree_t
*
p_tree
=
libvlc_tree_new
(
NULL
,
(
libvlc_release_function
)
free
,
psz
?
strdup
(
psz
)
:
NULL
,
p_e
);
return
p_tree
;
}
/**************************************************************************
* release (Public)
**************************************************************************/
void
libvlc_tree_release
(
libvlc_tree_t
*
p_tree
)
{
libvlc_tree_t
*
p_subtree
;
p_tree
->
i_refcount
--
;
if
(
p_tree
->
i_refcount
>
0
)
return
;
if
(
p_tree
->
pf_item_release
&&
p_tree
->
p_item
)
p_tree
->
pf_item_release
(
p_tree
->
p_item
);
FOREACH_ARRAY
(
p_subtree
,
p_tree
->
subtrees
)
libvlc_tree_release
(
p_subtree
);
FOREACH_END
()
free
(
p_tree
);
}
/**************************************************************************
* retain (Public)
**************************************************************************/
void
libvlc_tree_retain
(
libvlc_tree_t
*
p_tree
)
{
p_tree
->
i_refcount
++
;
}
/**************************************************************************
* item_as_string (Public)
**************************************************************************/
char
*
libvlc_tree_item_as_string
(
libvlc_tree_t
*
p_tree
,
libvlc_exception_t
*
p_e
)
{
(
void
)
p_e
;
return
p_tree
->
p_item
?
strdup
(
p_tree
->
p_item
)
:
NULL
;
}
/**************************************************************************
* item_as_media_list (Public)
**************************************************************************/
libvlc_media_list_t
*
libvlc_tree_item_as_media_list
(
libvlc_tree_t
*
p_tree
,
libvlc_exception_t
*
p_e
)
{
/* Automatically retained */
return
libvlc_tree_item
(
p_tree
,
p_e
);
}
/**************************************************************************
* count (Public)
**************************************************************************/
int
libvlc_tree_subtree_count
(
libvlc_tree_t
*
p_tree
,
libvlc_exception_t
*
p_e
)
{
(
void
)
p_e
;
return
p_tree
->
subtrees
.
i_size
;
}
/**************************************************************************
* subtree_at_index (Public)
*
* Note: The subtree won't be retained
**************************************************************************/
libvlc_tree_t
*
libvlc_tree_subtree_at_index
(
libvlc_tree_t
*
p_tree
,
int
index
,
libvlc_exception_t
*
p_e
)
{
(
void
)
p_e
;
libvlc_tree_t
*
p_subtree
;
p_subtree
=
ARRAY_VAL
(
p_tree
->
subtrees
,
index
);
libvlc_tree_retain
(
p_subtree
);
return
p_subtree
;
}
/**************************************************************************
* insert_subtree_at_index (Public)
*
* Note: The subtree won't be retained
**************************************************************************/
void
libvlc_tree_insert_subtree_at_index
(
libvlc_tree_t
*
p_tree
,
libvlc_tree_t
*
p_subtree
,
int
index
,
libvlc_exception_t
*
p_e
)
{
(
void
)
p_e
;
libvlc_tree_retain
(
p_tree
);
ARRAY_INSERT
(
p_tree
->
subtrees
,
p_subtree
,
index
);
notify_subtree_addition
(
p_tree
,
p_subtree
,
index
);
}
/**************************************************************************
* remove_subtree_at_index (Public)
**************************************************************************/
void
libvlc_tree_remove_subtree_at_index
(
libvlc_tree_t
*
p_tree
,
int
index
,
libvlc_exception_t
*
p_e
)
{
(
void
)
p_e
;
libvlc_tree_t
*
p_subtree
;
p_subtree
=
ARRAY_VAL
(
p_tree
->
subtrees
,
index
);
ARRAY_REMOVE
(
p_tree
->
subtrees
,
index
);
notify_subtree_deletion
(
p_tree
,
p_subtree
,
index
);
libvlc_tree_release
(
p_subtree
);
}
\ No newline at end of file
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