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
f021e86c
Commit
f021e86c
authored
Oct 08, 2012
by
Martin Storsjö
Committed by
Jean-Baptiste Kempf
Oct 08, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
omxil: Move code for in-buffer conversion of H264 to annex b to h264_nal.h
Signed-off-by:
Jean-Baptiste Kempf
<
jb@videolan.org
>
parent
f420b5a5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
20 deletions
+27
-20
modules/codec/h264_nal.h
modules/codec/h264_nal.h
+22
-0
modules/codec/omxil/omxil.c
modules/codec/omxil/omxil.c
+5
-20
No files found.
modules/codec/h264_nal.h
View file @
f021e86c
...
...
@@ -96,3 +96,25 @@ static int convert_sps_pps( decoder_t *p_dec, const uint8_t *p_buf,
return
VLC_SUCCESS
;
}
/* Convert H.264 NAL format to annex b in-place */
static
void
convert_h264_to_annexb
(
uint8_t
*
p_buf
,
uint32_t
i_len
,
int
i_nal_size
)
{
if
(
i_nal_size
<
3
||
i_nal_size
>
4
)
return
;
/* This only works for NAL sizes 3-4 */
while
(
i_len
>=
i_nal_size
)
{
uint32_t
nal_len
=
0
;
for
(
int
i
=
0
;
i
<
i_nal_size
;
i
++
)
{
nal_len
=
(
nal_len
<<
8
)
|
p_buf
[
i
];
p_buf
[
i
]
=
0
;
}
p_buf
[
i_nal_size
-
1
]
=
1
;
if
(
nal_len
>
INT_MAX
||
nal_len
>
(
unsigned
int
)
i_len
)
break
;
p_buf
+=
nal_len
+
i_nal_size
;
i_len
-=
nal_len
+
i_nal_size
;
}
}
modules/codec/omxil/omxil.c
View file @
f021e86c
...
...
@@ -1363,26 +1363,11 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
block_Release
(
p_block
);
}
/* Convert H.264 NAL format to annex b */
if
(
p_sys
->
i_nal_size_length
>=
3
&&
p_sys
->
i_nal_size_length
<=
4
)
{
/* This only works for NAL sizes 3-4 */
int
i_len
=
p_header
->
nFilledLen
,
i
;
uint8_t
*
ptr
=
p_header
->
pBuffer
;
while
(
i_len
>=
p_sys
->
i_nal_size_length
)
{
uint32_t
nal_len
=
0
;
for
(
i
=
0
;
i
<
p_sys
->
i_nal_size_length
;
i
++
)
{
nal_len
=
(
nal_len
<<
8
)
|
ptr
[
i
];
ptr
[
i
]
=
0
;
}
ptr
[
p_sys
->
i_nal_size_length
-
1
]
=
1
;
if
(
nal_len
>
INT_MAX
||
nal_len
>
(
unsigned
int
)
i_len
)
break
;
ptr
+=
nal_len
+
p_sys
->
i_nal_size_length
;
i_len
-=
nal_len
+
p_sys
->
i_nal_size_length
;
}
}
/* Convert H.264 NAL format to annex b. Doesn't do anything if
* i_nal_size_length == 0, which is the case for codecs other
* than H.264 */
convert_h264_to_annexb
(
p_header
->
pBuffer
,
p_header
->
nFilledLen
,
p_sys
->
i_nal_size_length
);
#ifdef OMXIL_EXTRA_DEBUG
msg_Dbg
(
p_dec
,
"EmptyThisBuffer %p, %p, %i"
,
p_header
,
p_header
->
pBuffer
,
(
int
)
p_header
->
nFilledLen
);
...
...
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