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
a9a0b8d6
Commit
a9a0b8d6
authored
Feb 13, 2015
by
Luca Barbato
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rtp: h264: Move parse_sprop_parameter_sets parsing to a function
parent
b8df0b71
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
45 deletions
+55
-45
rtpdec_h264.c
libavformat/rtpdec_h264.c
+55
-45
No files found.
libavformat/rtpdec_h264.c
View file @
a9a0b8d6
...
@@ -93,39 +93,15 @@ static void parse_profile_level_id(AVFormatContext *s,
...
@@ -93,39 +93,15 @@ static void parse_profile_level_id(AVFormatContext *s,
h264_data
->
level_idc
=
level_idc
;
h264_data
->
level_idc
=
level_idc
;
}
}
static
int
sdp_parse_fmtp_config_h264
(
AVFormatContext
*
s
,
static
int
parse_sprop_parameter_sets
(
AVFormatContext
*
s
,
AVStream
*
stream
,
AVCodecContext
*
codec
,
PayloadContext
*
h264_data
,
char
*
value
)
char
*
attr
,
char
*
value
)
{
{
AVCodecContext
*
codec
=
stream
->
codec
;
assert
(
codec
->
codec_id
==
AV_CODEC_ID_H264
);
assert
(
h264_data
!=
NULL
);
if
(
!
strcmp
(
attr
,
"packetization-mode"
))
{
av_log
(
s
,
AV_LOG_DEBUG
,
"RTP Packetization Mode: %d
\n
"
,
atoi
(
value
));
h264_data
->
packetization_mode
=
atoi
(
value
);
/*
* Packetization Mode:
* 0 or not present: Single NAL mode (Only nals from 1-23 are allowed)
* 1: Non-interleaved Mode: 1-23, 24 (STAP-A), 28 (FU-A) are allowed.
* 2: Interleaved Mode: 25 (STAP-B), 26 (MTAP16), 27 (MTAP24), 28 (FU-A),
* and 29 (FU-B) are allowed.
*/
if
(
h264_data
->
packetization_mode
>
1
)
av_log
(
s
,
AV_LOG_ERROR
,
"Interleaved RTP mode is not supported yet.
\n
"
);
}
else
if
(
!
strcmp
(
attr
,
"profile-level-id"
))
{
if
(
strlen
(
value
)
==
6
)
parse_profile_level_id
(
s
,
h264_data
,
value
);
}
else
if
(
!
strcmp
(
attr
,
"sprop-parameter-sets"
))
{
codec
->
extradata_size
=
0
;
av_freep
(
&
codec
->
extradata
);
while
(
*
value
)
{
char
base64packet
[
1024
];
char
base64packet
[
1024
];
uint8_t
decoded_packet
[
1024
];
uint8_t
decoded_packet
[
1024
];
int
packet_size
;
int
packet_size
;
while
(
*
value
)
{
char
*
dst
=
base64packet
;
char
*
dst
=
base64packet
;
while
(
*
value
&&
*
value
!=
','
while
(
*
value
&&
*
value
!=
','
...
@@ -164,8 +140,42 @@ static int sdp_parse_fmtp_config_h264(AVFormatContext *s,
...
@@ -164,8 +140,42 @@ static int sdp_parse_fmtp_config_h264(AVFormatContext *s,
codec
->
extradata_size
+=
sizeof
(
start_sequence
)
+
packet_size
;
codec
->
extradata_size
+=
sizeof
(
start_sequence
)
+
packet_size
;
}
}
}
}
av_log
(
s
,
AV_LOG_DEBUG
,
"Extradata set to %p (size: %d)!
\n
"
,
av_log
(
s
,
AV_LOG_DEBUG
,
"Extradata set to %p (size: %d)
\n
"
,
codec
->
extradata
,
codec
->
extradata_size
);
codec
->
extradata
,
codec
->
extradata_size
);
return
0
;
}
static
int
sdp_parse_fmtp_config_h264
(
AVFormatContext
*
s
,
AVStream
*
stream
,
PayloadContext
*
h264_data
,
char
*
attr
,
char
*
value
)
{
AVCodecContext
*
codec
=
stream
->
codec
;
assert
(
codec
->
codec_id
==
AV_CODEC_ID_H264
);
assert
(
h264_data
!=
NULL
);
if
(
!
strcmp
(
attr
,
"packetization-mode"
))
{
av_log
(
s
,
AV_LOG_DEBUG
,
"RTP Packetization Mode: %d
\n
"
,
atoi
(
value
));
h264_data
->
packetization_mode
=
atoi
(
value
);
/*
* Packetization Mode:
* 0 or not present: Single NAL mode (Only nals from 1-23 are allowed)
* 1: Non-interleaved Mode: 1-23, 24 (STAP-A), 28 (FU-A) are allowed.
* 2: Interleaved Mode: 25 (STAP-B), 26 (MTAP16), 27 (MTAP24), 28 (FU-A),
* and 29 (FU-B) are allowed.
*/
if
(
h264_data
->
packetization_mode
>
1
)
av_log
(
s
,
AV_LOG_ERROR
,
"Interleaved RTP mode is not supported yet.
\n
"
);
}
else
if
(
!
strcmp
(
attr
,
"profile-level-id"
))
{
if
(
strlen
(
value
)
==
6
)
parse_profile_level_id
(
s
,
h264_data
,
value
);
}
else
if
(
!
strcmp
(
attr
,
"sprop-parameter-sets"
))
{
codec
->
extradata_size
=
0
;
av_freep
(
&
codec
->
extradata
);
return
parse_sprop_parameter_sets
(
s
,
codec
,
value
);
}
}
return
0
;
return
0
;
}
}
...
...
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