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
98bc0e32
Commit
98bc0e32
authored
Apr 05, 2012
by
Jean-Baptiste Kempf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Split FLAC picture parsing from flac.c
parent
88d6c465
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
41 deletions
+51
-41
modules/demux/flac.c
modules/demux/flac.c
+5
-40
modules/demux/vorbis.h
modules/demux/vorbis.h
+46
-1
No files found.
modules/demux/flac.c
View file @
98bc0e32
...
@@ -572,7 +572,6 @@ static void ParseSeekTable( demux_t *p_demux, const uint8_t *p_data, int i_data,
...
@@ -572,7 +572,6 @@ static void ParseSeekTable( demux_t *p_demux, const uint8_t *p_data, int i_data,
/* TODO sort it by size and remove wrong seek entry (time not increasing) */
/* TODO sort it by size and remove wrong seek entry (time not increasing) */
}
}
#define RM(x) do { i_data -= (x); p_data += (x); } while(0)
static
void
ParseComment
(
demux_t
*
p_demux
,
const
uint8_t
*
p_data
,
int
i_data
)
static
void
ParseComment
(
demux_t
*
p_demux
,
const
uint8_t
*
p_data
,
int
i_data
)
{
{
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
...
@@ -600,43 +599,13 @@ static void ParsePicture( demux_t *p_demux, const uint8_t *p_data, int i_data )
...
@@ -600,43 +599,13 @@ static void ParsePicture( demux_t *p_demux, const uint8_t *p_data, int i_data )
};
};
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
int
i_type
;
int
i_type
;
int
i_len
;
char
*
psz_mime
=
NULL
;
char
*
psz_description
=
NULL
;
input_attachment_t
*
p_attachment
;
char
psz_name
[
128
];
if
(
i_data
<
4
+
3
*
4
)
i_data
-=
4
;
p_data
+=
4
;
input_attachment_t
*
p_attachment
=
ParseFlacPicture
(
p_data
,
i_data
,
p_sys
->
i_attachments
,
&
i_type
);
if
(
p_attachment
==
NULL
)
return
;
return
;
#define RM(x) do { i_data -= (x); p_data += (x); } while(0)
RM
(
4
);
i_type
=
GetDWBE
(
p_data
);
RM
(
4
);
i_len
=
GetDWBE
(
p_data
);
RM
(
4
);
if
(
i_len
<
0
||
i_data
<
i_len
+
4
)
goto
error
;
psz_mime
=
strndup
(
(
const
char
*
)
p_data
,
i_len
);
RM
(
i_len
);
i_len
=
GetDWBE
(
p_data
);
RM
(
4
);
if
(
i_len
<
0
||
i_data
<
i_len
+
4
*
4
+
4
)
goto
error
;
psz_description
=
strndup
(
(
const
char
*
)
p_data
,
i_len
);
RM
(
i_len
);
EnsureUTF8
(
psz_description
);
RM
(
4
*
4
);
i_len
=
GetDWBE
(
p_data
);
RM
(
4
);
if
(
i_len
<
0
||
i_len
>
i_data
)
goto
error
;
msg_Dbg
(
p_demux
,
"Picture type=%d mime=%s description='%s' file length=%d"
,
i_type
,
psz_mime
,
psz_description
,
i_len
);
snprintf
(
psz_name
,
sizeof
(
psz_name
),
"picture%d"
,
p_sys
->
i_attachments
);
if
(
!
strcasecmp
(
psz_mime
,
"image/jpeg"
)
)
strcat
(
psz_name
,
".jpg"
);
else
if
(
!
strcasecmp
(
psz_mime
,
"image/png"
)
)
strcat
(
psz_name
,
".png"
);
p_attachment
=
vlc_input_attachment_New
(
psz_name
,
psz_mime
,
psz_description
,
p_data
,
i_data
);
TAB_APPEND
(
p_sys
->
i_attachments
,
p_sys
->
attachments
,
p_attachment
);
TAB_APPEND
(
p_sys
->
i_attachments
,
p_sys
->
attachments
,
p_attachment
);
if
(
i_type
>=
0
&&
(
unsigned
int
)
i_type
<
sizeof
(
pi_cover_score
)
/
sizeof
(
pi_cover_score
[
0
])
&&
if
(
i_type
>=
0
&&
(
unsigned
int
)
i_type
<
sizeof
(
pi_cover_score
)
/
sizeof
(
pi_cover_score
[
0
])
&&
...
@@ -645,9 +614,5 @@ static void ParsePicture( demux_t *p_demux, const uint8_t *p_data, int i_data )
...
@@ -645,9 +614,5 @@ static void ParsePicture( demux_t *p_demux, const uint8_t *p_data, int i_data )
p_sys
->
i_cover_idx
=
p_sys
->
i_attachments
-
1
;
p_sys
->
i_cover_idx
=
p_sys
->
i_attachments
-
1
;
p_sys
->
i_cover_score
=
pi_cover_score
[
i_type
];
p_sys
->
i_cover_score
=
pi_cover_score
[
i_type
];
}
}
error:
free
(
psz_mime
);
free
(
psz_description
);
}
}
#undef RM
modules/demux/vorbis.h
View file @
98bc0e32
...
@@ -23,6 +23,52 @@
...
@@ -23,6 +23,52 @@
#include <vlc_charset.h>
#include <vlc_charset.h>
static
input_attachment_t
*
ParseFlacPicture
(
const
uint8_t
*
p_data
,
int
i_data
,
int
i_attachments
,
int
*
i_type
)
{
int
i_len
;
char
*
psz_mime
=
NULL
;
char
psz_name
[
128
];
char
*
psz_description
=
NULL
;
input_attachment_t
*
p_attachment
=
NULL
;
if
(
i_data
<
4
+
3
*
4
)
return
NULL
;
#define RM(x) do { i_data -= (x); p_data += (x); } while(0)
*
i_type
=
GetDWBE
(
p_data
);
RM
(
4
);
i_len
=
GetDWBE
(
p_data
);
RM
(
4
);
if
(
i_len
<
0
||
i_data
<
i_len
+
4
)
goto
error
;
psz_mime
=
strndup
(
(
const
char
*
)
p_data
,
i_len
);
RM
(
i_len
);
i_len
=
GetDWBE
(
p_data
);
RM
(
4
);
if
(
i_len
<
0
||
i_data
<
i_len
+
4
*
4
+
4
)
goto
error
;
psz_description
=
strndup
(
(
const
char
*
)
p_data
,
i_len
);
RM
(
i_len
);
EnsureUTF8
(
psz_description
);
RM
(
4
*
4
);
i_len
=
GetDWBE
(
p_data
);
RM
(
4
);
if
(
i_len
<
0
||
i_len
>
i_data
)
goto
error
;
/* printf( "Picture type=%d mime=%s description='%s' file length=%d\n",
*i_type, psz_mime, psz_description, i_len ); */
snprintf
(
psz_name
,
sizeof
(
psz_name
),
"picture%d"
,
i_attachments
);
if
(
!
strcasecmp
(
psz_mime
,
"image/jpeg"
)
)
strcat
(
psz_name
,
".jpg"
);
else
if
(
!
strcasecmp
(
psz_mime
,
"image/png"
)
)
strcat
(
psz_name
,
".png"
);
p_attachment
=
vlc_input_attachment_New
(
psz_name
,
psz_mime
,
psz_description
,
p_data
,
i_data
);
error:
free
(
psz_mime
);
free
(
psz_description
);
return
p_attachment
;
}
static
inline
void
vorbis_ParseComment
(
vlc_meta_t
**
pp_meta
,
const
uint8_t
*
p_data
,
int
i_data
)
static
inline
void
vorbis_ParseComment
(
vlc_meta_t
**
pp_meta
,
const
uint8_t
*
p_data
,
int
i_data
)
{
{
int
n
;
int
n
;
...
@@ -30,7 +76,6 @@ static inline void vorbis_ParseComment( vlc_meta_t **pp_meta, const uint8_t *p_d
...
@@ -30,7 +76,6 @@ static inline void vorbis_ParseComment( vlc_meta_t **pp_meta, const uint8_t *p_d
if
(
i_data
<
8
)
if
(
i_data
<
8
)
return
;
return
;
#define RM(x) do { i_data -= (x); p_data += (x); } while(0)
n
=
GetDWLE
(
p_data
);
RM
(
4
);
n
=
GetDWLE
(
p_data
);
RM
(
4
);
if
(
n
<
0
||
n
>
i_data
)
if
(
n
<
0
||
n
>
i_data
)
return
;
return
;
...
...
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