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
39c98427
Commit
39c98427
authored
Aug 15, 2014
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
meta: simplify input_ExtractAttachmentAndCacheArt()
Also improve error messages.
parent
d022a1a7
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
31 deletions
+17
-31
src/input/es_out.c
src/input/es_out.c
+1
-1
src/input/input_internal.h
src/input/input_internal.h
+2
-2
src/input/meta.c
src/input/meta.c
+14
-28
No files found.
src/input/es_out.c
View file @
39c98427
...
...
@@ -1371,7 +1371,7 @@ static void EsOutMeta( es_out_t *p_out, const vlc_meta_t *p_meta )
if
(
p_input
->
p
->
p_sout
&&
!
p_input
->
b_preparsing
)
input_item_SetArtURL
(
p_item
,
NULL
);
else
input_ExtractAttachmentAndCacheArt
(
p_input
);
input_ExtractAttachmentAndCacheArt
(
p_input
,
psz_arturl
+
13
);
}
free
(
psz_arturl
);
...
...
src/input/input_internal.h
View file @
39c98427
...
...
@@ -227,8 +227,8 @@ void input_ControlPush( input_thread_t *, int i_type, vlc_value_t * );
* Item metadata
**********************************************************************/
/* input_ExtractAttachmentAndCacheArt:
* Be
carefull; p_item lock HAS to be taken
*/
void
input_ExtractAttachmentAndCacheArt
(
input_thread_t
*
p_input
);
* Be
careful: p_item lock will be taken!
*/
void
input_ExtractAttachmentAndCacheArt
(
input_thread_t
*
,
const
char
*
name
);
/***************************************************************************
* Internal prototypes
...
...
src/input/meta.c
View file @
39c98427
...
...
@@ -204,26 +204,17 @@ void vlc_meta_Merge( vlc_meta_t *dst, const vlc_meta_t *src )
}
void
input_ExtractAttachmentAndCacheArt
(
input_thread_t
*
p_input
)
void
input_ExtractAttachmentAndCacheArt
(
input_thread_t
*
p_input
,
const
char
*
name
)
{
input_item_t
*
p_item
=
p_input
->
p
->
p_item
;
/* */
char
*
psz_arturl
=
input_item_GetArtURL
(
p_item
);
if
(
!
psz_arturl
||
strncmp
(
psz_arturl
,
"attachment://"
,
strlen
(
"attachment://"
)
)
)
{
msg_Err
(
p_input
,
"internal input error with input_ExtractAttachmentAndCacheArt"
);
free
(
psz_arturl
);
return
;
}
if
(
input_item_IsArtFetched
(
p_item
)
)
{
/* XXX Weird, we should not have end up with attachment:// art url unless there is a race
* condition */
msg_Warn
(
p_input
,
"internal input error with input_ExtractAttachmentAndCacheArt"
);
{
/* XXX Weird, we should not end up with attachment:// art URL
* unless there is a race condition */
msg_Warn
(
p_input
,
"art already fetched"
);
playlist_FindArtInCache
(
p_item
);
goto
exit
;
return
;
}
/* */
...
...
@@ -232,38 +223,33 @@ void input_ExtractAttachmentAndCacheArt( input_thread_t *p_input )
vlc_mutex_lock
(
&
p_item
->
lock
);
for
(
int
i_idx
=
0
;
i_idx
<
p_input
->
p
->
i_attachment
;
i_idx
++
)
{
if
(
!
strcmp
(
p_input
->
p
->
attachment
[
i_idx
]
->
psz_name
,
&
psz_arturl
[
strlen
(
"attachment://"
)]
)
)
input_attachment_t
*
a
=
p_input
->
p
->
attachment
[
i_idx
];
if
(
!
strcmp
(
a
->
psz_name
,
name
)
)
{
p_attachment
=
vlc_input_attachment_Duplicate
(
p_input
->
p
->
attachment
[
i_idx
]
);
p_attachment
=
vlc_input_attachment_Duplicate
(
a
);
break
;
}
}
vlc_mutex_unlock
(
&
p_item
->
lock
);
if
(
!
p_attachment
||
p_attachment
->
i_data
<=
0
)
if
(
p_attachment
==
NULL
)
{
if
(
p_attachment
)
vlc_input_attachment_Delete
(
p_attachment
);
msg_Warn
(
p_input
,
"internal input error with input_ExtractAttachmentAndCacheArt"
);
goto
exit
;
msg_Warn
(
p_input
,
"art attachment %s not found"
,
name
);
return
;
}
/* */
const
char
*
psz_type
=
NULL
;
if
(
!
strcmp
(
p_attachment
->
psz_mime
,
"image/jpeg"
)
)
psz_type
=
".jpg"
;
else
if
(
!
strcmp
(
p_attachment
->
psz_mime
,
"image/png"
)
)
psz_type
=
".png"
;
/* */
playlist_SaveArt
(
VLC_OBJECT
(
p_input
),
p_item
,
p_attachment
->
p_data
,
p_attachment
->
i_data
,
psz_type
);
vlc_input_attachment_Delete
(
p_attachment
);
exit:
free
(
psz_arturl
);
}
int
input_item_WriteMeta
(
vlc_object_t
*
obj
,
input_item_t
*
p_item
)
...
...
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