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
2d973ecf
Commit
2d973ecf
authored
Apr 25, 2009
by
Rémi Duraffort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a function to get the Title and fallback to the name if the title is empty.
parent
673f8026
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
49 additions
and
66 deletions
+49
-66
include/vlc_input_item.h
include/vlc_input_item.h
+1
-0
modules/gui/macosx/playlist.m
modules/gui/macosx/playlist.m
+3
-10
modules/gui/ncurses.c
modules/gui/ncurses.c
+1
-6
modules/gui/qt4/components/info_panels.cpp
modules/gui/qt4/components/info_panels.cpp
+7
-8
modules/gui/qt4/components/playlist/sorting.h
modules/gui/qt4/components/playlist/sorting.h
+1
-5
modules/gui/qt4/input_manager.cpp
modules/gui/qt4/input_manager.cpp
+1
-6
modules/meta_engine/taglib.cpp
modules/meta_engine/taglib.cpp
+1
-2
modules/misc/notify/growl.m
modules/misc/notify/growl.m
+3
-8
modules/misc/notify/growl_udp.c
modules/misc/notify/growl_udp.c
+3
-8
modules/misc/notify/msn.c
modules/misc/notify/msn.c
+1
-3
modules/misc/notify/notify.c
modules/misc/notify/notify.c
+2
-6
src/input/item.c
src/input/item.c
+22
-0
src/libvlccore.sym
src/libvlccore.sym
+1
-0
src/playlist/sort.c
src/playlist/sort.c
+2
-4
No files found.
include/vlc_input_item.h
View file @
2d973ecf
...
@@ -138,6 +138,7 @@ VLC_EXPORT( void, input_item_SetMeta, ( input_item_t *, vlc_meta_type_t meta_typ
...
@@ -138,6 +138,7 @@ VLC_EXPORT( void, input_item_SetMeta, ( input_item_t *, vlc_meta_type_t meta_typ
VLC_EXPORT
(
bool
,
input_item_MetaMatch
,
(
input_item_t
*
p_i
,
vlc_meta_type_t
meta_type
,
const
char
*
psz
)
);
VLC_EXPORT
(
bool
,
input_item_MetaMatch
,
(
input_item_t
*
p_i
,
vlc_meta_type_t
meta_type
,
const
char
*
psz
)
);
VLC_EXPORT
(
char
*
,
input_item_GetMeta
,
(
input_item_t
*
p_i
,
vlc_meta_type_t
meta_type
)
);
VLC_EXPORT
(
char
*
,
input_item_GetMeta
,
(
input_item_t
*
p_i
,
vlc_meta_type_t
meta_type
)
);
VLC_EXPORT
(
char
*
,
input_item_GetName
,
(
input_item_t
*
p_i
)
);
VLC_EXPORT
(
char
*
,
input_item_GetName
,
(
input_item_t
*
p_i
)
);
VLC_EXPORT
(
char
*
,
input_item_GetTitleFbName
,
(
input_item_t
*
p_i
)
);
VLC_EXPORT
(
char
*
,
input_item_GetURI
,
(
input_item_t
*
p_i
)
);
VLC_EXPORT
(
char
*
,
input_item_GetURI
,
(
input_item_t
*
p_i
)
);
VLC_EXPORT
(
void
,
input_item_SetURI
,
(
input_item_t
*
p_i
,
const
char
*
psz_uri
));
VLC_EXPORT
(
void
,
input_item_SetURI
,
(
input_item_t
*
p_i
,
const
char
*
psz_uri
));
VLC_EXPORT
(
mtime_t
,
input_item_GetDuration
,
(
input_item_t
*
p_i
)
);
VLC_EXPORT
(
mtime_t
,
input_item_GetDuration
,
(
input_item_t
*
p_i
)
);
...
...
modules/gui/macosx/playlist.m
View file @
2d973ecf
...
@@ -265,19 +265,12 @@
...
@@ -265,19 +265,12 @@
if
(
[[
o_tc
identifier
]
isEqualToString
:
@"name"
]
)
if
(
[[
o_tc
identifier
]
isEqualToString
:
@"name"
]
)
{
{
/* sanity check to prevent the NSString class from crashing */
/* sanity check to prevent the NSString class from crashing */
char
*
psz_title
=
input_item_GetTitle
(
p_item
->
p_input
);
char
*
psz_title
=
input_item_GetTitle
FbName
(
p_item
->
p_input
);
if
(
!
EMPTY_STR
(
psz_title
)
)
if
(
psz_title
)
{
{
o_value
=
[
NSString
stringWithUTF8String
:
psz_title
];
o_value
=
[
NSString
stringWithUTF8String
:
psz_title
];
free
(
psz_title
);
}
}
else
{
char
*
psz_name
=
input_item_GetName
(
p_item
->
p_input
);
if
(
psz_name
)
o_value
=
[
NSString
stringWithUTF8String
:
psz_name
];
free
(
psz_name
);
}
free
(
psz_title
);
}
}
else
if
(
[[
o_tc
identifier
]
isEqualToString
:
@"artist"
]
)
else
if
(
[[
o_tc
identifier
]
isEqualToString
:
@"artist"
]
)
{
{
...
...
modules/gui/ncurses.c
View file @
2d973ecf
...
@@ -2271,12 +2271,7 @@ static void PlaylistAddNode( intf_thread_t *p_intf, playlist_item_t *p_node,
...
@@ -2271,12 +2271,7 @@ static void PlaylistAddNode( intf_thread_t *p_intf, playlist_item_t *p_node,
{
{
char
*
psz_display
;
char
*
psz_display
;
p_child
=
p_node
->
pp_children
[
k
];
p_child
=
p_node
->
pp_children
[
k
];
char
*
psz_name
=
input_item_GetTitle
(
p_child
->
p_input
);
char
*
psz_name
=
input_item_GetTitleFbName
(
p_child
->
p_input
);
if
(
!
psz_name
||
!*
psz_name
)
{
free
(
psz_name
);
psz_name
=
input_item_GetName
(
p_child
->
p_input
);
}
if
(
c
&&
*
c
)
if
(
c
&&
*
c
)
{
{
...
...
modules/gui/qt4/components/info_panels.cpp
View file @
2d973ecf
...
@@ -184,15 +184,14 @@ void MetaPanel::update( input_item_t *p_item )
...
@@ -184,15 +184,14 @@ void MetaPanel::update( input_item_t *p_item )
free( psz_meta );
free( psz_meta );
/* Name / Title */
/* Name / Title */
psz_meta
=
input_item_GetTitle
(
p_item
);
psz_meta
=
input_item_GetTitle
FbName
(
p_item
);
char
*
psz_name
=
input_item_GetName
(
p_item
);
if
(
psz_meta
)
if
(
!
EMPTY_STR
(
psz_meta
)
)
{
title_text
->
setText
(
qfu
(
psz_meta
)
);
title_text
->
setText
(
qfu
(
psz_meta
)
);
else
if
(
!
EMPTY_STR
(
psz_name
)
)
free
(
psz_meta
);
title_text
->
setText
(
qfu
(
psz_name
)
);
}
else
title_text
->
setText
(
""
);
else
free
(
psz_meta
);
title_text
->
setText
(
""
);
free
(
psz_name
);
/* URL / URI */
/* URL / URI */
psz_meta
=
input_item_GetURL
(
p_item
);
psz_meta
=
input_item_GetURL
(
p_item
);
...
...
modules/gui/qt4/components/playlist/sorting.h
View file @
2d973ecf
...
@@ -63,7 +63,6 @@ static const char * psz_column_title( uint32_t i_column )
...
@@ -63,7 +63,6 @@ static const char * psz_column_title( uint32_t i_column )
* Returned value has to be freed */
* Returned value has to be freed */
static
char
*
psz_column_meta
(
input_item_t
*
p_item
,
uint32_t
i_column
)
static
char
*
psz_column_meta
(
input_item_t
*
p_item
,
uint32_t
i_column
)
{
{
char
*
psz
;
int
i_duration
;
int
i_duration
;
char
psz_duration
[
MSTRTIME_MAX_SIZE
];
char
psz_duration
[
MSTRTIME_MAX_SIZE
];
switch
(
i_column
)
switch
(
i_column
)
...
@@ -71,10 +70,7 @@ static char * psz_column_meta( input_item_t *p_item, uint32_t i_column )
...
@@ -71,10 +70,7 @@ static char * psz_column_meta( input_item_t *p_item, uint32_t i_column )
case
COLUMN_NUMBER
:
case
COLUMN_NUMBER
:
return
NULL
;
return
NULL
;
case
COLUMN_TITLE
:
case
COLUMN_TITLE
:
psz
=
input_item_GetTitle
(
p_item
);
return
input_item_GetTitleFbName
(
p_item
);
if
(
!
psz
)
psz
=
input_item_GetName
(
p_item
);
return
psz
;
case
COLUMN_DURATION
:
case
COLUMN_DURATION
:
i_duration
=
input_item_GetDuration
(
p_item
)
/
1000000
;
i_duration
=
input_item_GetDuration
(
p_item
)
/
1000000
;
secstotimestr
(
psz_duration
,
i_duration
);
secstotimestr
(
psz_duration
,
i_duration
);
...
...
modules/gui/qt4/input_manager.cpp
View file @
2d973ecf
...
@@ -420,12 +420,7 @@ void InputManager::UpdateName()
...
@@ -420,12 +420,7 @@ void InputManager::UpdateName()
QString
text
;
QString
text
;
/* Try to get the Title, then the Name */
/* Try to get the Title, then the Name */
char
*
psz_name
=
input_item_GetTitle
(
input_GetItem
(
p_input
)
);
char
*
psz_name
=
input_item_GetTitleFbName
(
input_GetItem
(
p_input
)
);
if
(
EMPTY_STR
(
psz_name
)
)
{
free
(
psz_name
);
psz_name
=
input_item_GetName
(
input_GetItem
(
p_input
)
);
}
/* Try to get the nowplaying */
/* Try to get the nowplaying */
char
*
psz_nowplaying
=
char
*
psz_nowplaying
=
...
...
modules/meta_engine/taglib.cpp
View file @
2d973ecf
...
@@ -571,8 +571,7 @@ static int WriteMeta( vlc_object_t *p_this )
...
@@ -571,8 +571,7 @@ static int WriteMeta( vlc_object_t *p_this )
// Saving all common fields
// Saving all common fields
// If the title is empty, use the name
// If the title is empty, use the name
psz_meta
=
input_item_GetTitle
(
p_item
);
psz_meta
=
input_item_GetTitleFbName
(
p_item
);
if
(
!
psz_meta
)
psz_meta
=
input_item_GetName
(
p_item
);
SET
(
Title
,
psz_meta
);
SET
(
Title
,
psz_meta
);
free
(
psz_meta
);
free
(
psz_meta
);
...
...
modules/misc/notify/growl.m
View file @
2d973ecf
...
@@ -180,17 +180,12 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
...
@@ -180,17 +180,12 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
/* Playing something ... */
/* Playing something ... */
input_item_t *p_item = input_GetItem( p_input );
input_item_t *p_item = input_GetItem( p_input );
psz_title = input_item_GetTitle( p_item );
psz_title = input_item_GetTitle
FbName
( p_item );
if( EMPTY_STR( psz_title ) )
if( EMPTY_STR( psz_title ) )
{
{
free( psz_title );
free( psz_title );
psz_title = input_item_GetName( input_GetItem( p_input ) );
vlc_object_release( p_input );
if( EMPTY_STR( psz_title ) )
return VLC_SUCCESS;
{
free( psz_title );
vlc_object_release( p_input );
return VLC_SUCCESS;
}
}
}
psz_artist = input_item_GetArtist( p_item );
psz_artist = input_item_GetArtist( p_item );
...
...
modules/misc/notify/growl_udp.c
View file @
2d973ecf
...
@@ -142,17 +142,12 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
...
@@ -142,17 +142,12 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
/* Playing something ... */
/* Playing something ... */
input_item_t
*
p_item
=
input_GetItem
(
p_input
);
input_item_t
*
p_item
=
input_GetItem
(
p_input
);
psz_title
=
input_item_GetTitle
(
p_item
);
psz_title
=
input_item_GetTitle
FbName
(
p_item
);
if
(
EMPTY_STR
(
psz_title
)
)
if
(
EMPTY_STR
(
psz_title
)
)
{
{
free
(
psz_title
);
free
(
psz_title
);
psz_title
=
input_item_GetName
(
input_GetItem
(
p_input
)
);
vlc_object_release
(
p_input
);
if
(
EMPTY_STR
(
psz_title
)
)
return
VLC_SUCCESS
;
{
free
(
psz_title
);
vlc_object_release
(
p_input
);
return
VLC_SUCCESS
;
}
}
}
psz_artist
=
input_item_GetArtist
(
p_item
);
psz_artist
=
input_item_GetArtist
(
p_item
);
...
...
modules/misc/notify/msn.c
View file @
2d973ecf
...
@@ -158,11 +158,9 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
...
@@ -158,11 +158,9 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
/* Playing something ... */
/* Playing something ... */
psz_artist
=
input_item_GetArtist
(
input_GetItem
(
p_input
)
);
psz_artist
=
input_item_GetArtist
(
input_GetItem
(
p_input
)
);
psz_album
=
input_item_GetAlbum
(
input_GetItem
(
p_input
)
);
psz_album
=
input_item_GetAlbum
(
input_GetItem
(
p_input
)
);
psz_title
=
input_item_GetTitle
(
input_GetItem
(
p_input
)
);
psz_title
=
input_item_GetTitle
FbName
(
input_GetItem
(
p_input
)
);
if
(
!
psz_artist
)
psz_artist
=
strdup
(
""
);
if
(
!
psz_artist
)
psz_artist
=
strdup
(
""
);
if
(
!
psz_album
)
psz_album
=
strdup
(
""
);
if
(
!
psz_album
)
psz_album
=
strdup
(
""
);
if
(
!
psz_title
)
psz_title
=
input_item_GetName
(
input_GetItem
(
p_input
)
);
psz_buf
=
str_format_meta
(
p_this
,
p_intf
->
p_sys
->
psz_format
);
psz_buf
=
str_format_meta
(
p_this
,
p_intf
->
p_sys
->
psz_format
);
...
...
modules/misc/notify/notify.c
View file @
2d973ecf
...
@@ -182,12 +182,8 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
...
@@ -182,12 +182,8 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
input_item_t
*
p_input_item
=
input_GetItem
(
p_input
);
input_item_t
*
p_input_item
=
input_GetItem
(
p_input
);
psz_artist
=
input_item_GetArtist
(
p_input_item
);
psz_artist
=
input_item_GetArtist
(
p_input_item
);
psz_album
=
input_item_GetAlbum
(
p_input_item
);
psz_album
=
input_item_GetAlbum
(
p_input_item
);
psz_title
=
input_item_GetTitle
(
p_input_item
);
psz_title
=
input_item_GetTitleFbName
(
p_input_item
);
if
(
EMPTY_STR
(
psz_title
)
)
{
free
(
psz_title
);
psz_title
=
input_item_GetName
(
p_input_item
);
}
if
(
EMPTY_STR
(
psz_title
)
)
if
(
EMPTY_STR
(
psz_title
)
)
{
/* Not enough metadata ... */
{
/* Not enough metadata ... */
free
(
psz_title
);
free
(
psz_title
);
...
...
src/input/item.c
View file @
2d973ecf
...
@@ -298,6 +298,28 @@ char *input_item_GetMeta( input_item_t *p_i, vlc_meta_type_t meta_type )
...
@@ -298,6 +298,28 @@ char *input_item_GetMeta( input_item_t *p_i, vlc_meta_type_t meta_type )
return
psz
;
return
psz
;
}
}
/* Get the title of a given item or fallback to the name if the title is empty */
char
*
input_item_GetTitleFbName
(
input_item_t
*
p_item
)
{
char
*
psz_ret
;
vlc_mutex_lock
(
&
p_item
->
lock
);
if
(
!
p_item
->
p_meta
)
{
vlc_mutex_unlock
(
&
p_item
->
lock
);
return
NULL
;
}
const
char
*
psz_meta
=
vlc_meta_Get
(
p_item
->
p_meta
,
vlc_meta_Title
);
if
(
!
EMPTY_STR
(
psz_meta
)
)
psz_ret
=
strdup
(
psz_meta
);
else
psz_ret
=
p_item
->
psz_name
?
strdup
(
p_item
->
psz_name
)
:
NULL
;
vlc_mutex_unlock
(
&
p_item
->
lock
);
return
psz_ret
;
}
char
*
input_item_GetName
(
input_item_t
*
p_item
)
char
*
input_item_GetName
(
input_item_t
*
p_item
)
{
{
vlc_mutex_lock
(
&
p_item
->
lock
);
vlc_mutex_lock
(
&
p_item
->
lock
);
...
...
src/libvlccore.sym
View file @
2d973ecf
...
@@ -181,6 +181,7 @@ input_item_GetDuration
...
@@ -181,6 +181,7 @@ input_item_GetDuration
input_item_GetInfo
input_item_GetInfo
input_item_GetMeta
input_item_GetMeta
input_item_GetName
input_item_GetName
input_item_GetTitleFbName
input_item_GetURI
input_item_GetURI
input_item_HasErrorWhenReading
input_item_HasErrorWhenReading
input_item_IsArtFetched
input_item_IsArtFetched
...
...
src/playlist/sort.c
View file @
2d973ecf
...
@@ -119,10 +119,8 @@ static int playlist_cmp(const void *first, const void *second)
...
@@ -119,10 +119,8 @@ static int playlist_cmp(const void *first, const void *second)
{
{
#define META_STRCASECMP_NAME( ) { \
#define META_STRCASECMP_NAME( ) { \
char *psz_i = input_item_GetTitle( (*(playlist_item_t **)first)->p_input ); \
char *psz_i = input_item_GetTitleFbName( (*(playlist_item_t **)first)->p_input ); \
char *psz_ismall = input_item_GetTitle( (*(playlist_item_t **)second)->p_input ); \
char *psz_ismall = input_item_GetTitleFbName( (*(playlist_item_t **)second)->p_input ); \
if(EMPTY_STR(psz_i)) {free(psz_i); psz_i = input_item_GetName( (*(playlist_item_t **)first)->p_input ); }\
if(EMPTY_STR(psz_ismall)) {free(psz_ismall); psz_ismall = input_item_GetName( (*(playlist_item_t **)second)->p_input ); }\
if( psz_i != NULL && psz_ismall != NULL ) i_test = strcasecmp( psz_i, psz_ismall ); \
if( psz_i != NULL && psz_ismall != NULL ) i_test = strcasecmp( psz_i, psz_ismall ); \
else if ( psz_i == NULL && psz_ismall != NULL ) i_test = 1; \
else if ( psz_i == NULL && psz_ismall != NULL ) i_test = 1; \
else if ( psz_ismall == NULL && psz_i != NULL ) i_test = -1; \
else if ( psz_ismall == NULL && psz_i != NULL ) i_test = -1; \
...
...
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