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
8633fb47
Commit
8633fb47
authored
Feb 23, 2015
by
Martin Storsjö
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rtpdec_hevc: Share the implementation of parsing a=framesize with h264
Signed-off-by:
Martin Storsjö
<
martin@martin.st
>
parent
5956f489
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
47 deletions
+25
-47
rtpdec_formats.h
libavformat/rtpdec_formats.h
+1
-0
rtpdec_h264.c
libavformat/rtpdec_h264.c
+23
-20
rtpdec_hevc.c
libavformat/rtpdec_hevc.c
+1
-27
No files found.
libavformat/rtpdec_formats.h
View file @
8633fb47
...
...
@@ -42,6 +42,7 @@ int ff_h264_handle_aggregated_packet(AVFormatContext *ctx, AVPacket *pkt,
const
uint8_t
*
buf
,
int
len
,
int
start_skip
,
int
*
nal_counters
,
int
nal_mask
);
void
ff_h264_parse_framesize
(
AVCodecContext
*
codec
,
const
char
*
p
);
extern
RTPDynamicProtocolHandler
ff_ac3_dynamic_handler
;
extern
RTPDynamicProtocolHandler
ff_amr_nb_dynamic_handler
;
...
...
libavformat/rtpdec_h264.c
View file @
8633fb47
...
...
@@ -177,6 +177,28 @@ static int sdp_parse_fmtp_config_h264(AVFormatContext *s,
return
0
;
}
void
ff_h264_parse_framesize
(
AVCodecContext
*
codec
,
const
char
*
p
)
{
char
buf1
[
50
];
char
*
dst
=
buf1
;
// remove the protocol identifier
while
(
*
p
&&
*
p
==
' '
)
p
++
;
// strip spaces.
while
(
*
p
&&
*
p
!=
' '
)
p
++
;
// eat protocol identifier
while
(
*
p
&&
*
p
==
' '
)
p
++
;
// strip trailing spaces.
while
(
*
p
&&
*
p
!=
'-'
&&
(
dst
-
buf1
)
<
sizeof
(
buf1
)
-
1
)
*
dst
++
=
*
p
++
;
*
dst
=
'\0'
;
// a='framesize:96 320-240'
// set our parameters
codec
->
width
=
atoi
(
buf1
);
codec
->
height
=
atoi
(
p
+
1
);
// skip the -
}
int
ff_h264_handle_aggregated_packet
(
AVFormatContext
*
ctx
,
AVPacket
*
pkt
,
const
uint8_t
*
buf
,
int
len
,
int
skip_between
,
int
*
nal_counters
,
...
...
@@ -361,34 +383,15 @@ static int parse_h264_sdp_line(AVFormatContext *s, int st_index,
PayloadContext
*
h264_data
,
const
char
*
line
)
{
AVStream
*
stream
;
AVCodecContext
*
codec
;
const
char
*
p
=
line
;
if
(
st_index
<
0
)
return
0
;
stream
=
s
->
streams
[
st_index
];
codec
=
stream
->
codec
;
if
(
av_strstart
(
p
,
"framesize:"
,
&
p
))
{
char
buf1
[
50
];
char
*
dst
=
buf1
;
// remove the protocol identifier
while
(
*
p
&&
*
p
==
' '
)
p
++
;
// strip spaces.
while
(
*
p
&&
*
p
!=
' '
)
p
++
;
// eat protocol identifier
while
(
*
p
&&
*
p
==
' '
)
p
++
;
// strip trailing spaces.
while
(
*
p
&&
*
p
!=
'-'
&&
(
dst
-
buf1
)
<
sizeof
(
buf1
)
-
1
)
*
dst
++
=
*
p
++
;
*
dst
=
'\0'
;
// a='framesize:96 320-240'
// set our parameters
codec
->
width
=
atoi
(
buf1
);
codec
->
height
=
atoi
(
p
+
1
);
// skip the -
ff_h264_parse_framesize
(
stream
->
codec
,
p
);
}
else
if
(
av_strstart
(
p
,
"fmtp:"
,
&
p
))
{
return
ff_parse_fmtp
(
s
,
stream
,
h264_data
,
p
,
sdp_parse_fmtp_config_h264
);
}
else
if
(
av_strstart
(
p
,
"cliprect:"
,
&
p
))
{
...
...
libavformat/rtpdec_hevc.c
View file @
8633fb47
...
...
@@ -138,33 +138,7 @@ static av_cold int hevc_parse_sdp_line(AVFormatContext *ctx, int st_index,
codec
=
current_stream
->
codec
;
if
(
av_strstart
(
sdp_line_ptr
,
"framesize:"
,
&
sdp_line_ptr
))
{
char
str_video_width
[
50
];
char
*
str_video_width_ptr
=
str_video_width
;
/*
* parse "a=framesize:96 320-240"
*/
/* ignore spaces */
while
(
*
sdp_line_ptr
&&
*
sdp_line_ptr
==
' '
)
sdp_line_ptr
++
;
/* ignore RTP payload ID */
while
(
*
sdp_line_ptr
&&
*
sdp_line_ptr
!=
' '
)
sdp_line_ptr
++
;
/* ignore spaces */
while
(
*
sdp_line_ptr
&&
*
sdp_line_ptr
==
' '
)
sdp_line_ptr
++
;
/* extract the actual video resolution description */
while
(
*
sdp_line_ptr
&&
*
sdp_line_ptr
!=
'-'
&&
(
str_video_width_ptr
-
str_video_width
)
<
sizeof
(
str_video_width
)
-
1
)
*
str_video_width_ptr
++
=
*
sdp_line_ptr
++
;
/* add trailing zero byte */
*
str_video_width_ptr
=
'\0'
;
/* determine the width value */
codec
->
width
=
atoi
(
str_video_width
);
/* jump beyond the "-" and determine the height value */
codec
->
height
=
atoi
(
sdp_line_ptr
+
1
);
ff_h264_parse_framesize
(
codec
,
sdp_line_ptr
);
}
else
if
(
av_strstart
(
sdp_line_ptr
,
"fmtp:"
,
&
sdp_line_ptr
))
{
int
ret
=
ff_parse_fmtp
(
ctx
,
current_stream
,
hevc_data
,
sdp_line_ptr
,
hevc_sdp_parse_fmtp_config
);
...
...
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