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
ee88a208
Commit
ee88a208
authored
Jul 18, 2014
by
Carl Eugen Hoyos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Parse dri when receiving jpg via rtp.
Based on a patch by contact at iridiummobile ru. Fixes ticket #3780.
parent
0e70266b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
3 deletions
+20
-3
rtpdec_jpeg.c
libavformat/rtpdec_jpeg.c
+20
-3
No files found.
libavformat/rtpdec_jpeg.c
View file @
ee88a208
...
...
@@ -106,7 +106,8 @@ static void jpeg_put_marker(PutByteContext *pbc, int code)
}
static
int
jpeg_create_header
(
uint8_t
*
buf
,
int
size
,
uint32_t
type
,
uint32_t
w
,
uint32_t
h
,
const
uint8_t
*
qtable
,
int
nb_qtable
)
uint32_t
h
,
const
uint8_t
*
qtable
,
int
nb_qtable
,
int
dri
)
{
PutByteContext
pbc
;
uint8_t
*
dht_size_ptr
;
...
...
@@ -132,6 +133,12 @@ static int jpeg_create_header(uint8_t *buf, int size, uint32_t type, uint32_t w,
bytestream2_put_byte
(
&
pbc
,
0
);
bytestream2_put_byte
(
&
pbc
,
0
);
if
(
dri
)
{
jpeg_put_marker
(
&
pbc
,
DRI
);
bytestream2_put_be16
(
&
pbc
,
4
);
bytestream2_put_be16
(
&
pbc
,
dri
);
}
/* DQT */
jpeg_put_marker
(
&
pbc
,
DQT
);
bytestream2_put_be16
(
&
pbc
,
2
+
nb_qtable
*
(
1
+
64
));
...
...
@@ -226,7 +233,7 @@ static int jpeg_parse_packet(AVFormatContext *ctx, PayloadContext *jpeg,
const
uint8_t
*
qtables
=
NULL
;
uint16_t
qtable_len
;
uint32_t
off
;
int
ret
;
int
ret
,
dri
=
0
;
if
(
len
<
8
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Too short RTP/JPEG packet.
\n
"
);
...
...
@@ -242,6 +249,16 @@ static int jpeg_parse_packet(AVFormatContext *ctx, PayloadContext *jpeg,
buf
+=
8
;
len
-=
8
;
if
(
type
&
0x40
)
{
if
(
len
<
4
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Too short RTP/JPEG packet.
\n
"
);
return
AVERROR_INVALIDDATA
;
}
dri
=
AV_RB16
(
buf
);
buf
+=
4
;
len
-=
4
;
type
&=
~
0x40
;
}
/* Parse the restart marker header. */
if
(
type
>
63
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
...
...
@@ -332,7 +349,7 @@ static int jpeg_parse_packet(AVFormatContext *ctx, PayloadContext *jpeg,
* interchange format. */
jpeg
->
hdr_size
=
jpeg_create_header
(
hdr
,
sizeof
(
hdr
),
type
,
width
,
height
,
qtables
,
qtable_len
/
64
);
qtable_len
/
64
,
dri
);
/* Copy JPEG header to frame buffer. */
avio_write
(
jpeg
->
frame
,
hdr
,
jpeg
->
hdr_size
);
...
...
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