Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
3b18857a
Commit
3b18857a
authored
May 31, 2014
by
Uwe L. Korn
Committed by
Martin Storsjö
Jun 01, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rtmppkt: Add method to read an AMF string that is not prefixed by its type
Signed-off-by:
Martin Storsjö
<
martin@martin.st
>
parent
a1859032
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
4 deletions
+27
-4
rtmppkt.c
libavformat/rtmppkt.c
+10
-4
rtmppkt.h
libavformat/rtmppkt.h
+17
-0
No files found.
libavformat/rtmppkt.c
View file @
3b18857a
...
...
@@ -102,13 +102,11 @@ int ff_amf_read_number(GetByteContext *bc, double *val)
return
0
;
}
int
ff_amf_
read
_string
(
GetByteContext
*
bc
,
uint8_t
*
str
,
int
ff_amf_
get
_string
(
GetByteContext
*
bc
,
uint8_t
*
str
,
int
strsize
,
int
*
length
)
{
int
stringlen
=
0
;
int
readsize
;
if
(
bytestream2_get_byte
(
bc
)
!=
AMF_DATA_TYPE_STRING
)
return
AVERROR_INVALIDDATA
;
stringlen
=
bytestream2_get_be16
(
bc
);
if
(
stringlen
+
1
>
strsize
)
return
AVERROR
(
EINVAL
);
...
...
@@ -122,6 +120,14 @@ int ff_amf_read_string(GetByteContext *bc, uint8_t *str,
return
0
;
}
int
ff_amf_read_string
(
GetByteContext
*
bc
,
uint8_t
*
str
,
int
strsize
,
int
*
length
)
{
if
(
bytestream2_get_byte
(
bc
)
!=
AMF_DATA_TYPE_STRING
)
return
AVERROR_INVALIDDATA
;
return
ff_amf_get_string
(
bc
,
str
,
strsize
,
length
);
}
int
ff_amf_read_null
(
GetByteContext
*
bc
)
{
if
(
bytestream2_get_byte
(
bc
)
!=
AMF_DATA_TYPE_NULL
)
...
...
libavformat/rtmppkt.h
View file @
3b18857a
...
...
@@ -277,6 +277,23 @@ int ff_amf_read_bool(GetByteContext *gbc, int *val);
*/
int
ff_amf_read_number
(
GetByteContext
*
gbc
,
double
*
val
);
/**
* Get AMF string value.
*
* This function behaves the same as ff_amf_read_string except that
* it does not expect the AMF type prepended to the actual data.
* Appends a trailing null byte to output string in order to
* ease later parsing.
*
*@param[in,out] gbc GetByteContext initialized with AMF-formatted data
*@param[out] str read string
*@param[in] strsize buffer size available to store the read string
*@param[out] length read string length
*@return 0 on success or an AVERROR code on failure
*/
int
ff_amf_get_string
(
GetByteContext
*
bc
,
uint8_t
*
str
,
int
strsize
,
int
*
length
);
/**
* Read AMF string value.
*
...
...
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