Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
0
Merge Requests
0
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Jean-Baptiste Kempf
vlc
Commits
6302901c
Commit
6302901c
authored
May 03, 2018
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
aiff: use vlc_obj_calloc()
parent
a8282e0e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
25 deletions
+8
-25
modules/demux/aiff.c
modules/demux/aiff.c
+8
-25
No files found.
modules/demux/aiff.c
View file @
6302901c
...
...
@@ -42,14 +42,13 @@
* Module descriptor
*****************************************************************************/
static
int
Open
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
vlc_module_begin
()
set_category
(
CAT_INPUT
)
set_subcategory
(
SUBCAT_INPUT_DEMUX
)
set_description
(
N_
(
"AIFF demuxer"
)
)
set_capability
(
"demux"
,
10
)
set_callbacks
(
Open
,
Close
)
set_callbacks
(
Open
,
NULL
)
add_shortcut
(
"aiff"
)
vlc_module_end
()
...
...
@@ -117,7 +116,7 @@ static int Open( vlc_object_t *p_this )
return
VLC_EGENERIC
;
/* Fill p_demux field */
demux_sys_t
*
p_sys
=
calloc
(
1
,
sizeof
(
*
p_sys
)
);
demux_sys_t
*
p_sys
=
vlc_obj_calloc
(
p_this
,
1
,
sizeof
(
*
p_sys
)
);
es_format_Init
(
&
p_sys
->
fmt
,
AUDIO_ES
,
VLC_FOURCC
(
't'
,
'w'
,
'o'
,
's'
)
);
p_sys
->
i_time
=
0
;
p_sys
->
i_ssnd_pos
=
-
1
;
...
...
@@ -125,7 +124,7 @@ static int Open( vlc_object_t *p_this )
for
(
;;
)
{
if
(
vlc_stream_Peek
(
p_demux
->
s
,
&
p_peek
,
8
)
<
8
)
goto
error
;
return
VLC_EGENERIC
;
uint32_t
i_data_size
=
GetDWBE
(
&
p_peek
[
4
]
);
uint64_t
i_chunk_size
=
UINT64_C
(
8
)
+
i_data_size
+
(
i_data_size
&
1
);
...
...
@@ -136,7 +135,7 @@ static int Open( vlc_object_t *p_this )
if
(
!
memcmp
(
p_peek
,
"COMM"
,
4
)
)
{
if
(
vlc_stream_Peek
(
p_demux
->
s
,
&
p_peek
,
18
+
8
)
<
18
+
8
)
goto
error
;
return
VLC_EGENERIC
;
p_sys
->
fmt
.
audio
.
i_channels
=
GetWBE
(
&
p_peek
[
8
]
);
p_sys
->
fmt
.
audio
.
i_bitspersample
=
GetWBE
(
&
p_peek
[
14
]
);
...
...
@@ -149,7 +148,7 @@ static int Open( vlc_object_t *p_this )
else
if
(
!
memcmp
(
p_peek
,
"SSND"
,
4
)
)
{
if
(
vlc_stream_Peek
(
p_demux
->
s
,
&
p_peek
,
8
+
8
)
<
8
+
8
)
goto
error
;
return
VLC_EGENERIC
;
p_sys
->
i_ssnd_pos
=
vlc_stream_Tell
(
p_demux
->
s
);
p_sys
->
i_ssnd_size
=
i_data_size
;
...
...
@@ -176,7 +175,7 @@ static int Open( vlc_object_t *p_this )
if
(
vlc_stream_Read
(
p_demux
->
s
,
NULL
,
i_req
)
!=
i_req
)
{
msg_Warn
(
p_demux
,
"incomplete file"
);
goto
error
;
return
VLC_EGENERIC
;
}
}
}
...
...
@@ -190,7 +189,7 @@ static int Open( vlc_object_t *p_this )
if
(
p_sys
->
i_ssnd_fsize
<=
0
||
p_sys
->
fmt
.
audio
.
i_rate
==
0
)
{
msg_Err
(
p_demux
,
"invalid audio parameters"
);
goto
error
;
return
VLC_EGENERIC
;
}
if
(
p_sys
->
i_ssnd_size
<=
0
)
...
...
@@ -203,7 +202,7 @@ static int Open( vlc_object_t *p_this )
if
(
vlc_stream_Seek
(
p_demux
->
s
,
p_sys
->
i_ssnd_start
)
)
{
msg_Err
(
p_demux
,
"cannot seek to data chunk"
);
goto
error
;
return
VLC_EGENERIC
;
}
/* */
...
...
@@ -214,24 +213,8 @@ static int Open( vlc_object_t *p_this )
p_demux
->
p_sys
=
p_sys
;
return
VLC_SUCCESS
;
error:
free
(
p_sys
);
return
VLC_EGENERIC
;
}
/*****************************************************************************
* Close
*****************************************************************************/
static
void
Close
(
vlc_object_t
*
p_this
)
{
demux_t
*
p_demux
=
(
demux_t
*
)
p_this
;
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
free
(
p_sys
);
}
/*****************************************************************************
* Demux:
*****************************************************************************/
...
...
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