Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
f869e54d
Commit
f869e54d
authored
Mar 11, 2018
by
Martin Vignali
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/hap : move parse_section_header to hap.c in order to be use by new bsf filter
parent
688060fb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
29 deletions
+32
-29
hap.c
libavcodec/hap.c
+22
-0
hap.h
libavcodec/hap.h
+6
-0
hapdec.c
libavcodec/hapdec.c
+4
-29
No files found.
libavcodec/hap.c
View file @
f869e54d
...
...
@@ -53,3 +53,25 @@ av_cold void ff_hap_free_context(HapContext *ctx)
av_freep
(
&
ctx
->
chunks
);
av_freep
(
&
ctx
->
chunk_results
);
}
int
ff_hap_parse_section_header
(
GetByteContext
*
gbc
,
int
*
section_size
,
enum
HapSectionType
*
section_type
)
{
if
(
bytestream2_get_bytes_left
(
gbc
)
<
4
)
return
AVERROR_INVALIDDATA
;
*
section_size
=
bytestream2_get_le24
(
gbc
);
*
section_type
=
bytestream2_get_byte
(
gbc
);
if
(
*
section_size
==
0
)
{
if
(
bytestream2_get_bytes_left
(
gbc
)
<
4
)
return
AVERROR_INVALIDDATA
;
*
section_size
=
bytestream2_get_le32
(
gbc
);
}
if
(
*
section_size
>
bytestream2_get_bytes_left
(
gbc
)
||
*
section_size
<
0
)
return
AVERROR_INVALIDDATA
;
else
return
0
;
}
libavcodec/hap.h
View file @
f869e54d
...
...
@@ -103,4 +103,10 @@ int ff_hap_set_chunk_count(HapContext *ctx, int count, int first_in_frame);
*/
av_cold
void
ff_hap_free_context
(
HapContext
*
ctx
);
/* The first three bytes are the size of the section past the header, or zero
* if the length is stored in the next long word. The fourth byte in the first
* long word indicates the type of the current section. */
int
ff_hap_parse_section_header
(
GetByteContext
*
gbc
,
int
*
section_size
,
enum
HapSectionType
*
section_type
);
#endif
/* AVCODEC_HAP_H */
libavcodec/hapdec.c
View file @
f869e54d
...
...
@@ -43,31 +43,6 @@
#include "texturedsp.h"
#include "thread.h"
/* The first three bytes are the size of the section past the header, or zero
* if the length is stored in the next long word. The fourth byte in the first
* long word indicates the type of the current section. */
static
int
parse_section_header
(
GetByteContext
*
gbc
,
int
*
section_size
,
enum
HapSectionType
*
section_type
)
{
if
(
bytestream2_get_bytes_left
(
gbc
)
<
4
)
return
AVERROR_INVALIDDATA
;
*
section_size
=
bytestream2_get_le24
(
gbc
);
*
section_type
=
bytestream2_get_byte
(
gbc
);
if
(
*
section_size
==
0
)
{
if
(
bytestream2_get_bytes_left
(
gbc
)
<
4
)
return
AVERROR_INVALIDDATA
;
*
section_size
=
bytestream2_get_le32
(
gbc
);
}
if
(
*
section_size
>
bytestream2_get_bytes_left
(
gbc
)
||
*
section_size
<
0
)
return
AVERROR_INVALIDDATA
;
else
return
0
;
}
static
int
hap_parse_decode_instructions
(
HapContext
*
ctx
,
int
size
)
{
GetByteContext
*
gbc
=
&
ctx
->
gbc
;
...
...
@@ -78,7 +53,7 @@ static int hap_parse_decode_instructions(HapContext *ctx, int size)
while
(
size
>
0
)
{
int
stream_remaining
=
bytestream2_get_bytes_left
(
gbc
);
ret
=
parse_section_header
(
gbc
,
&
section_size
,
&
section_type
);
ret
=
ff_hap_
parse_section_header
(
gbc
,
&
section_size
,
&
section_type
);
if
(
ret
!=
0
)
return
ret
;
...
...
@@ -159,7 +134,7 @@ static int hap_parse_frame_header(AVCodecContext *avctx)
const
char
*
compressorstr
;
int
i
,
ret
;
ret
=
parse_section_header
(
gbc
,
&
ctx
->
texture_section_size
,
&
section_type
);
ret
=
ff_hap_
parse_section_header
(
gbc
,
&
ctx
->
texture_section_size
,
&
section_type
);
if
(
ret
!=
0
)
return
ret
;
...
...
@@ -190,7 +165,7 @@ static int hap_parse_frame_header(AVCodecContext *avctx)
}
break
;
case
HAP_COMP_COMPLEX
:
ret
=
parse_section_header
(
gbc
,
&
section_size
,
&
section_type
);
ret
=
ff_hap_
parse_section_header
(
gbc
,
&
section_size
,
&
section_type
);
if
(
ret
==
0
&&
section_type
!=
HAP_ST_DECODE_INSTRUCTIONS
)
ret
=
AVERROR_INVALIDDATA
;
if
(
ret
==
0
)
...
...
@@ -342,7 +317,7 @@ static int hap_decode(AVCodecContext *avctx, void *data,
/* check for multi texture header */
if
(
ctx
->
texture_count
==
2
)
{
ret
=
parse_section_header
(
&
ctx
->
gbc
,
&
section_size
,
&
section_type
);
ret
=
ff_hap_
parse_section_header
(
&
ctx
->
gbc
,
&
section_size
,
&
section_type
);
if
(
ret
!=
0
)
return
ret
;
if
((
section_type
&
0x0F
)
!=
0x0D
)
{
...
...
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