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
3567b91e
Commit
3567b91e
authored
Feb 23, 2015
by
Martin Storsjö
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rtpdec_hevc: Share the implementation of fragmented packets with h264
Signed-off-by:
Martin Storsjö
<
martin@martin.st
>
parent
f3449062
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
35 deletions
+29
-35
rtpdec_formats.h
libavformat/rtpdec_formats.h
+3
-0
rtpdec_h264.c
libavformat/rtpdec_h264.c
+24
-17
rtpdec_hevc.c
libavformat/rtpdec_hevc.c
+2
-18
No files found.
libavformat/rtpdec_formats.h
View file @
3567b91e
...
@@ -42,6 +42,9 @@ int ff_h264_handle_aggregated_packet(AVFormatContext *ctx, AVPacket *pkt,
...
@@ -42,6 +42,9 @@ int ff_h264_handle_aggregated_packet(AVFormatContext *ctx, AVPacket *pkt,
const
uint8_t
*
buf
,
int
len
,
const
uint8_t
*
buf
,
int
len
,
int
start_skip
,
int
*
nal_counters
,
int
start_skip
,
int
*
nal_counters
,
int
nal_mask
);
int
nal_mask
);
int
ff_h264_handle_frag_packet
(
AVPacket
*
pkt
,
const
uint8_t
*
buf
,
int
len
,
int
start_bit
,
const
uint8_t
*
nal_header
,
int
nal_header_len
);
void
ff_h264_parse_framesize
(
AVCodecContext
*
codec
,
const
char
*
p
);
void
ff_h264_parse_framesize
(
AVCodecContext
*
codec
,
const
char
*
p
);
extern
RTPDynamicProtocolHandler
ff_ac3_dynamic_handler
;
extern
RTPDynamicProtocolHandler
ff_ac3_dynamic_handler
;
...
...
libavformat/rtpdec_h264.c
View file @
3567b91e
...
@@ -257,12 +257,32 @@ int ff_h264_handle_aggregated_packet(AVFormatContext *ctx, AVPacket *pkt,
...
@@ -257,12 +257,32 @@ int ff_h264_handle_aggregated_packet(AVFormatContext *ctx, AVPacket *pkt,
return
0
;
return
0
;
}
}
int
ff_h264_handle_frag_packet
(
AVPacket
*
pkt
,
const
uint8_t
*
buf
,
int
len
,
int
start_bit
,
const
uint8_t
*
nal_header
,
int
nal_header_len
)
{
int
ret
;
int
tot_len
=
len
;
int
pos
=
0
;
if
(
start_bit
)
tot_len
+=
sizeof
(
start_sequence
)
+
nal_header_len
;
if
((
ret
=
av_new_packet
(
pkt
,
tot_len
))
<
0
)
return
ret
;
if
(
start_bit
)
{
memcpy
(
pkt
->
data
+
pos
,
start_sequence
,
sizeof
(
start_sequence
));
pos
+=
sizeof
(
start_sequence
);
memcpy
(
pkt
->
data
+
pos
,
nal_header
,
nal_header_len
);
pos
+=
nal_header_len
;
}
memcpy
(
pkt
->
data
+
pos
,
buf
,
len
);
return
0
;
}
static
int
h264_handle_packet_fu_a
(
AVFormatContext
*
ctx
,
AVPacket
*
pkt
,
static
int
h264_handle_packet_fu_a
(
AVFormatContext
*
ctx
,
AVPacket
*
pkt
,
const
uint8_t
*
buf
,
int
len
,
const
uint8_t
*
buf
,
int
len
,
int
*
nal_counters
,
int
nal_mask
)
int
*
nal_counters
,
int
nal_mask
)
{
{
uint8_t
fu_indicator
,
fu_header
,
start_bit
,
nal_type
,
nal
;
uint8_t
fu_indicator
,
fu_header
,
start_bit
,
nal_type
,
nal
;
int
ret
;
if
(
len
<
3
)
{
if
(
len
<
3
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Too short data for FU-A H264 RTP packet
\n
"
);
av_log
(
ctx
,
AV_LOG_ERROR
,
"Too short data for FU-A H264 RTP packet
\n
"
);
...
@@ -279,22 +299,9 @@ static int h264_handle_packet_fu_a(AVFormatContext *ctx, AVPacket *pkt,
...
@@ -279,22 +299,9 @@ static int h264_handle_packet_fu_a(AVFormatContext *ctx, AVPacket *pkt,
buf
+=
2
;
buf
+=
2
;
len
-=
2
;
len
-=
2
;
if
(
start_bit
)
{
if
(
start_bit
&&
nal_counters
)
if
(
nal_counters
)
nal_counters
[
nal_type
&
nal_mask
]
++
;
nal_counters
[
nal_type
&
nal_mask
]
++
;
/* copy in the start sequence, and the reconstructed nal */
return
ff_h264_handle_frag_packet
(
pkt
,
buf
,
len
,
start_bit
,
&
nal
,
1
);
if
((
ret
=
av_new_packet
(
pkt
,
sizeof
(
start_sequence
)
+
sizeof
(
nal
)
+
len
))
<
0
)
return
ret
;
memcpy
(
pkt
->
data
,
start_sequence
,
sizeof
(
start_sequence
));
pkt
->
data
[
sizeof
(
start_sequence
)]
=
nal
;
memcpy
(
pkt
->
data
+
sizeof
(
start_sequence
)
+
sizeof
(
nal
),
buf
,
len
);
}
else
{
if
((
ret
=
av_new_packet
(
pkt
,
len
))
<
0
)
return
ret
;
memcpy
(
pkt
->
data
,
buf
,
len
);
}
return
0
;
}
}
// return 0 on packet, no more left, 1 on packet, 1 on partial packet
// return 0 on packet, no more left, 1 on packet, 1 on partial packet
...
...
libavformat/rtpdec_hevc.c
View file @
3567b91e
...
@@ -331,24 +331,8 @@ static int hevc_handle_packet(AVFormatContext *ctx, PayloadContext *rtp_hevc_ctx
...
@@ -331,24 +331,8 @@ static int hevc_handle_packet(AVFormatContext *ctx, PayloadContext *rtp_hevc_ctx
new_nal_header
[
0
]
=
(
rtp_pl
[
0
]
&
0x81
)
|
(
fu_type
<<
1
);
new_nal_header
[
0
]
=
(
rtp_pl
[
0
]
&
0x81
)
|
(
fu_type
<<
1
);
new_nal_header
[
1
]
=
rtp_pl
[
1
];
new_nal_header
[
1
]
=
rtp_pl
[
1
];
/* start fragment vs. subsequent fragments */
res
=
ff_h264_handle_frag_packet
(
pkt
,
buf
,
len
,
first_fragment
,
if
(
first_fragment
)
{
new_nal_header
,
sizeof
(
new_nal_header
));
/* create A/V packet which is big enough */
if
((
res
=
av_new_packet
(
pkt
,
sizeof
(
start_sequence
)
+
sizeof
(
new_nal_header
)
+
len
))
<
0
)
return
res
;
/* A/V packet: copy start sequence */
memcpy
(
pkt
->
data
,
start_sequence
,
sizeof
(
start_sequence
));
/* A/V packet: copy new NAL header */
memcpy
(
pkt
->
data
+
sizeof
(
start_sequence
),
new_nal_header
,
sizeof
(
new_nal_header
));
/* A/V packet: copy NAL unit data */
memcpy
(
pkt
->
data
+
sizeof
(
start_sequence
)
+
sizeof
(
new_nal_header
),
buf
,
len
);
}
else
{
/* create A/V packet */
if
((
res
=
av_new_packet
(
pkt
,
len
))
<
0
)
return
res
;
/* A/V packet: copy NAL unit data */
memcpy
(
pkt
->
data
,
buf
,
len
);
}
break
;
break
;
/* PACI packet */
/* PACI packet */
...
...
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