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
ca42fbe0
Commit
ca42fbe0
authored
Jan 18, 2008
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check malloc return values and fix a few compiler warnings.
parent
db4506a7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
24 deletions
+30
-24
modules/packetizer/h264.c
modules/packetizer/h264.c
+30
-24
No files found.
modules/packetizer/h264.c
View file @
ca42fbe0
...
...
@@ -247,12 +247,14 @@ static int Open( vlc_object_t *p_this )
p_dec
->
fmt_out
.
i_extra
=
0
;
p_dec
->
fmt_out
.
p_extra
=
NULL
;
/* Set the new extradata */
p_dec
->
fmt_out
.
i_extra
=
p_sys
->
p_pps
->
i_buffer
+
p_sys
->
p_sps
->
i_buffer
;
p_dec
->
fmt_out
.
p_extra
=
(
uint8_t
*
)
malloc
(
p_dec
->
fmt_out
.
i_extra
);
if
(
p_dec
->
fmt_out
.
p_extra
)
{
p_dec
->
fmt_out
.
i_extra
=
p_sys
->
p_pps
->
i_buffer
+
p_sys
->
p_sps
->
i_buffer
;
memcpy
(
(
uint8_t
*
)
p_dec
->
fmt_out
.
p_extra
,
p_sys
->
p_sps
->
p_buffer
,
p_sys
->
p_sps
->
i_buffer
);
memcpy
(
(
uint8_t
*
)
p_dec
->
fmt_out
.
p_extra
+
p_sys
->
p_sps
->
i_buffer
,
p_sys
->
p_pps
->
p_buffer
,
p_sys
->
p_pps
->
i_buffer
);
p_sys
->
b_header
=
VLC_TRUE
;
}
/* Set callback */
p_dec
->
pf_packetize
=
PacketizeAVC1
;
}
...
...
@@ -483,6 +485,8 @@ static void nal_get_decoded( uint8_t **pp_ret, int *pi_ret,
uint8_t
*
end
=
&
src
[
i_src
];
uint8_t
*
dst
=
malloc
(
i_src
);
if
(
dst
)
{
*
pp_ret
=
dst
;
while
(
src
<
end
)
...
...
@@ -498,7 +502,7 @@ static void nal_get_decoded( uint8_t **pp_ret, int *pi_ret,
}
*
dst
++
=
*
src
++
;
}
}
*
pi_ret
=
dst
-
*
pp_ret
;
}
...
...
@@ -520,7 +524,6 @@ static inline int bs_read_se( bs_t *s )
return
val
&
0x01
?
(
val
+
1
)
/
2
:
-
(
val
/
2
);
}
/*****************************************************************************
* ParseNALBlock: parses annexB type NALs
* All p_frag blocks are required to start with 0 0 0 1 4-byte startcode
...
...
@@ -578,8 +581,8 @@ static block_t *ParseNALBlock( decoder_t *p_dec, block_t *p_frag )
}
else
if
(
i_nal_type
>=
NAL_SLICE
&&
i_nal_type
<=
NAL_SLICE_IDR
)
{
uint8_t
*
dec
;
int
i_dec
,
i_first_mb
,
i_slice_type
;
uint8_t
*
dec
=
NULL
;
int
i_dec
=
0
,
i_first_mb
,
i_slice_type
;
slice_t
slice
;
vlc_bool_t
b_pic
;
bs_t
s
;
...
...
@@ -646,7 +649,8 @@ static block_t *ParseNALBlock( decoder_t *p_dec, block_t *p_frag )
if
(
p_sys
->
i_pic_order_present_flag
&&
!
slice
.
i_field_pic_flag
)
slice
.
i_delta_pic_order_cnt_bottom
=
bs_read_se
(
&
s
);
}
else
if
(
p_sys
->
i_pic_order_cnt_type
==
1
&&
!
p_sys
->
i_delta_pic_order_always_zero_flag
)
else
if
(
(
p_sys
->
i_pic_order_cnt_type
==
1
)
&&
(
!
p_sys
->
i_delta_pic_order_always_zero_flag
)
)
{
slice
.
i_delta_pic_order_cnt0
=
bs_read_se
(
&
s
);
if
(
p_sys
->
i_pic_order_present_flag
&&
!
slice
.
i_field_pic_flag
)
...
...
@@ -661,7 +665,9 @@ static block_t *ParseNALBlock( decoder_t *p_dec, block_t *p_frag )
slice
.
i_field_pic_flag
!=
p_sys
->
slice
.
i_field_pic_flag
||
slice
.
i_nal_ref_idc
!=
p_sys
->
slice
.
i_nal_ref_idc
)
b_pic
=
VLC_TRUE
;
if
(
slice
.
i_bottom_field_flag
!=
-
1
&&
p_sys
->
slice
.
i_bottom_field_flag
!=
-
1
&&
slice
.
i_bottom_field_flag
!=
p_sys
->
slice
.
i_bottom_field_flag
)
if
(
(
slice
.
i_bottom_field_flag
!=
-
1
)
&&
(
p_sys
->
slice
.
i_bottom_field_flag
!=
-
1
)
&&
(
slice
.
i_bottom_field_flag
!=
p_sys
->
slice
.
i_bottom_field_flag
)
)
b_pic
=
VLC_TRUE
;
if
(
p_sys
->
i_pic_order_cnt_type
==
0
&&
(
slice
.
i_pic_order_cnt_lsb
!=
p_sys
->
slice
.
i_pic_order_cnt_lsb
||
...
...
@@ -687,8 +693,8 @@ static block_t *ParseNALBlock( decoder_t *p_dec, block_t *p_frag )
}
else
if
(
i_nal_type
==
NAL_SPS
)
{
uint8_t
*
dec
;
int
i_dec
;
uint8_t
*
dec
=
NULL
;
int
i_dec
=
0
;
bs_t
s
;
int
i_tmp
;
...
...
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