Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
c5f25910
Commit
c5f25910
authored
Aug 16, 2007
by
Pierre d'Herbemont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
include/vlc_input.h: Make input items able to themselves handle item subitem added.
parent
2e251e29
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
104 additions
and
6 deletions
+104
-6
include/vlc_events.h
include/vlc_events.h
+7
-2
include/vlc_input.h
include/vlc_input.h
+25
-0
include/vlc_playlist.h
include/vlc_playlist.h
+1
-0
src/playlist/item.c
src/playlist/item.c
+71
-4
No files found.
include/vlc_events.h
View file @
c5f25910
...
@@ -108,20 +108,25 @@ typedef struct vlc_event_manager_t
...
@@ -108,20 +108,25 @@ typedef struct vlc_event_manager_t
/* List of event */
/* List of event */
typedef
enum
vlc_event_type_t
{
typedef
enum
vlc_event_type_t
{
vlc_InputItemMetaChanged
vlc_InputItemMetaChanged
,
vlc_InputItemSubItemAdded
}
vlc_event_type_t
;
}
vlc_event_type_t
;
/* Event definition */
/* Event definition */
typedef
struct
vlc_event_t
typedef
struct
vlc_event_t
{
{
vlc_event_type_t
type
;
vlc_event_type_t
type
;
void
*
p_obj
;
/* Sender object, automatically filled by
event_S
end() */
void
*
p_obj
;
/* Sender object, automatically filled by
vlc_event_s
end() */
union
vlc_event_type_specific
union
vlc_event_type_specific
{
{
struct
vlc_input_item_meta_changed
struct
vlc_input_item_meta_changed
{
{
vlc_meta_type_t
meta_type
;
vlc_meta_type_t
meta_type
;
}
input_item_meta_changed
;
}
input_item_meta_changed
;
struct
vlc_input_item_subitem_added
{
input_item_t
*
p_new_child
;
}
input_item_subitem_added
;
}
u
;
}
u
;
}
vlc_event_t
;
}
vlc_event_t
;
...
...
include/vlc_input.h
View file @
c5f25910
...
@@ -117,6 +117,8 @@ static inline void input_ItemInit( vlc_object_t *p_o, input_item_t *p_i )
...
@@ -117,6 +117,8 @@ static inline void input_ItemInit( vlc_object_t *p_o, input_item_t *p_i )
vlc_event_manager_init
(
&
p_i
->
event_manager
,
p_i
);
vlc_event_manager_init
(
&
p_i
->
event_manager
,
p_i
);
vlc_event_manager_register_event_type
(
&
p_i
->
event_manager
,
vlc_event_manager_register_event_type
(
&
p_i
->
event_manager
,
vlc_InputItemMetaChanged
);
vlc_InputItemMetaChanged
);
vlc_event_manager_register_event_type
(
&
p_i
->
event_manager
,
vlc_InputItemSubItemAdded
);
}
}
static
inline
void
input_ItemCopyOptions
(
input_item_t
*
p_parent
,
static
inline
void
input_ItemCopyOptions
(
input_item_t
*
p_parent
,
...
@@ -134,6 +136,29 @@ static inline void input_ItemCopyOptions( input_item_t *p_parent,
...
@@ -134,6 +136,29 @@ static inline void input_ItemCopyOptions( input_item_t *p_parent,
}
}
}
}
static
inline
void
input_ItemSetName
(
input_item_t
*
p_item
,
const
char
*
psz_name
)
{
if
(
p_item
->
psz_name
)
free
(
p_item
->
psz_name
);
p_item
->
psz_name
=
strdup
(
psz_name
);
}
/* This won't hold the item, but can tell to interested third parties
* Like the playlist, that there is a new sub item. With this design
* It is not the input item's responsability to keep all the ref of
* the input item children. */
static
inline
void
input_ItemAddSubItem
(
input_item_t
*
p_parent
,
input_item_t
*
p_child
)
{
vlc_event_t
event
;
p_parent
->
i_type
=
ITEM_TYPE_PLAYLIST
;
/* Notify interested third parties */
event
.
type
=
vlc_InputItemSubItemAdded
;
event
.
u
.
input_item_subitem_added
.
p_new_child
=
p_child
;
vlc_event_send
(
&
p_parent
->
event_manager
,
&
event
);
}
VLC_EXPORT
(
void
,
input_ItemAddOption
,(
input_item_t
*
,
const
char
*
)
);
VLC_EXPORT
(
void
,
input_ItemAddOption
,(
input_item_t
*
,
const
char
*
)
);
VLC_EXPORT
(
void
,
input_ItemAddOptionNoDup
,(
input_item_t
*
,
const
char
*
)
);
VLC_EXPORT
(
void
,
input_ItemAddOptionNoDup
,(
input_item_t
*
,
const
char
*
)
);
...
...
include/vlc_playlist.h
View file @
c5f25910
...
@@ -143,6 +143,7 @@ struct playlist_item_t
...
@@ -143,6 +143,7 @@ struct playlist_item_t
int
i_id
;
/**< Playlist item specific id */
int
i_id
;
/**< Playlist item specific id */
uint8_t
i_flags
;
/**< Flags */
uint8_t
i_flags
;
/**< Flags */
playlist_t
*
p_playlist
;
/**< Parent playlist */
};
};
#define PLAYLIST_SAVE_FLAG 0x0001
/**< Must it be saved */
#define PLAYLIST_SAVE_FLAG 0x0001
/**< Must it be saved */
...
...
src/playlist/item.c
View file @
c5f25910
...
@@ -34,6 +34,66 @@ static void ChangeToNode( playlist_t *p_playlist, playlist_item_t *p_item );
...
@@ -34,6 +34,66 @@ static void ChangeToNode( playlist_t *p_playlist, playlist_item_t *p_item );
static
int
DeleteInner
(
playlist_t
*
p_playlist
,
playlist_item_t
*
p_item
,
static
int
DeleteInner
(
playlist_t
*
p_playlist
,
playlist_item_t
*
p_item
,
vlc_bool_t
b_stop
);
vlc_bool_t
b_stop
);
/*****************************************************************************
* An input item has gained a subitem (Event Callback)
*****************************************************************************/
static
void
input_item_subitem_added
(
const
vlc_event_t
*
p_event
,
void
*
user_data
)
{
playlist_t
*
p_playlist
=
user_data
;
input_item_t
*
p_parent
,
*
p_child
;
vlc_bool_t
b_play
=
var_CreateGetBool
(
p_playlist
,
"playlist-autostart"
);
playlist_item_t
*
p_item_in_category
;
playlist_item_t
*
p_current
;
p_parent
=
p_event
->
p_obj
;
p_child
=
p_event
->
u
.
input_item_subitem_added
.
p_new_child
;
p_current
=
playlist_ItemGetByInput
(
p_playlist
,
p_parent
,
VLC_FALSE
);
if
(
p_current
->
i_children
==
-
1
)
p_item_in_category
=
playlist_ItemToNode
(
p_playlist
,
p_current
,
VLC_FALSE
);
else
p_item_in_category
=
p_current
;
p_item_in_category
=
p_current
;
b_play
=
b_play
&&
p_current
==
p_playlist
->
status
.
p_item
;
playlist_NodeAddInput
(
p_playlist
,
p_child
,
p_item_in_category
,
PLAYLIST_APPEND
|
PLAYLIST_SPREPARSE
,
PLAYLIST_END
,
VLC_FALSE
);
if
(
b_play
)
{
playlist_Control
(
p_playlist
,
PLAYLIST_VIEWPLAY
,
VLC_TRUE
,
p_item_in_category
,
NULL
);
vlc_object_release
(
p_playlist
);
}
}
/*****************************************************************************
* Listen to vlc_InputItemAddSubItem event
*****************************************************************************/
static
void
install_input_item_observer
(
playlist_t
*
p_playlist
,
input_item_t
*
p_input
)
{
msg_Dbg
(
p_playlist
,
"Listening to %s with %p"
,
p_input
->
psz_name
,
p_playlist
);
vlc_event_attach
(
&
p_input
->
event_manager
,
vlc_InputItemSubItemAdded
,
input_item_subitem_added
,
p_playlist
);
}
static
void
uninstall_input_item_observer
(
playlist_t
*
p_playlist
,
input_item_t
*
p_input
)
{
msg_Dbg
(
p_playlist
,
"Not Listening to %s with %p"
,
p_input
->
psz_name
,
p_playlist
);
vlc_event_detach
(
&
p_input
->
event_manager
,
vlc_InputItemSubItemAdded
,
input_item_subitem_added
,
p_playlist
);
}
/*****************************************************************************
/*****************************************************************************
* Playlist item creation
* Playlist item creation
*****************************************************************************/
*****************************************************************************/
...
@@ -68,8 +128,9 @@ playlist_item_t *__playlist_ItemNewFromInput( vlc_object_t *p_obj,
...
@@ -68,8 +128,9 @@ playlist_item_t *__playlist_ItemNewFromInput( vlc_object_t *p_obj,
p_item
->
i_children
=
-
1
;
p_item
->
i_children
=
-
1
;
p_item
->
pp_children
=
NULL
;
p_item
->
pp_children
=
NULL
;
p_item
->
i_flags
=
0
;
p_item
->
i_flags
=
0
;
p_item
->
p_playlist
=
p_playlist
;
vlc_object_release
(
p_playlis
t
);
install_input_item_observer
(
p_playlist
,
p_inpu
t
);
return
p_item
;
return
p_item
;
}
}
...
@@ -81,6 +142,9 @@ playlist_item_t *__playlist_ItemNewFromInput( vlc_object_t *p_obj,
...
@@ -81,6 +142,9 @@ playlist_item_t *__playlist_ItemNewFromInput( vlc_object_t *p_obj,
/** Delete a playlist item and detach its input item */
/** Delete a playlist item and detach its input item */
int
playlist_ItemDelete
(
playlist_item_t
*
p_item
)
int
playlist_ItemDelete
(
playlist_item_t
*
p_item
)
{
{
uninstall_input_item_observer
(
p_item
->
p_playlist
,
p_item
->
p_input
);
vlc_object_release
(
p_item
->
p_playlist
);
vlc_gc_decref
(
p_item
->
p_input
);
vlc_gc_decref
(
p_item
->
p_input
);
free
(
p_item
);
free
(
p_item
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
...
@@ -349,8 +413,12 @@ playlist_item_t *playlist_ItemToNode( playlist_t *p_playlist,
...
@@ -349,8 +413,12 @@ playlist_item_t *playlist_ItemToNode( playlist_t *p_playlist,
p_playlist
,
p_item
->
p_input
->
i_id
,
p_playlist
,
p_item
->
p_input
->
i_id
,
p_playlist
->
p_root_onelevel
,
p_playlist
->
p_root_onelevel
,
VLC_TRUE
);
VLC_TRUE
);
assert
(
p_item_in_one
);
/* We already have it, and there is nothing more to do */
ChangeToNode
(
p_playlist
,
p_item_in_category
);
ChangeToNode
(
p_playlist
,
p_item_in_category
);
if
(
!
p_item_in_one
)
return
p_item_in_category
;
/* Item in one is a root, change it to node */
/* Item in one is a root, change it to node */
if
(
p_item_in_one
->
p_parent
==
p_playlist
->
p_root_onelevel
)
if
(
p_item_in_one
->
p_parent
==
p_playlist
->
p_root_onelevel
)
ChangeToNode
(
p_playlist
,
p_item_in_one
);
ChangeToNode
(
p_playlist
,
p_item_in_one
);
...
@@ -511,8 +579,7 @@ int playlist_ItemSetName( playlist_item_t *p_item, const char *psz_name )
...
@@ -511,8 +579,7 @@ int playlist_ItemSetName( playlist_item_t *p_item, const char *psz_name )
{
{
if
(
psz_name
&&
p_item
)
if
(
psz_name
&&
p_item
)
{
{
if
(
p_item
->
p_input
->
psz_name
)
free
(
p_item
->
p_input
->
psz_name
);
input_ItemSetName
(
p_item
->
p_input
,
psz_name
);
p_item
->
p_input
->
psz_name
=
strdup
(
psz_name
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
...
...
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