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
541efe41
Commit
541efe41
authored
Nov 27, 2012
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mjpegdec: reset got_picture on errors, successful return, init and flush.
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
1c16483c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
mjpegdec.c
libavcodec/mjpegdec.c
+11
-0
No files found.
libavcodec/mjpegdec.c
View file @
541efe41
...
@@ -94,6 +94,7 @@ av_cold int ff_mjpeg_decode_init(AVCodecContext *avctx)
...
@@ -94,6 +94,7 @@ av_cold int ff_mjpeg_decode_init(AVCodecContext *avctx)
s
->
buffer
=
NULL
;
s
->
buffer
=
NULL
;
s
->
start_code
=
-
1
;
s
->
start_code
=
-
1
;
s
->
first_picture
=
1
;
s
->
first_picture
=
1
;
s
->
got_picture
=
0
;
s
->
org_height
=
avctx
->
coded_height
;
s
->
org_height
=
avctx
->
coded_height
;
avctx
->
chroma_sample_location
=
AVCHROMA_LOC_CENTER
;
avctx
->
chroma_sample_location
=
AVCHROMA_LOC_CENTER
;
...
@@ -1704,6 +1705,7 @@ eoi_parser:
...
@@ -1704,6 +1705,7 @@ eoi_parser:
}
}
*
picture
=
*
s
->
picture_ptr
;
*
picture
=
*
s
->
picture_ptr
;
*
data_size
=
sizeof
(
AVFrame
);
*
data_size
=
sizeof
(
AVFrame
);
s
->
got_picture
=
0
;
if
(
!
s
->
lossless
)
{
if
(
!
s
->
lossless
)
{
picture
->
quality
=
FFMAX3
(
s
->
qscale
[
0
],
picture
->
quality
=
FFMAX3
(
s
->
qscale
[
0
],
...
@@ -1757,6 +1759,7 @@ eoi_parser:
...
@@ -1757,6 +1759,7 @@ eoi_parser:
av_log
(
avctx
,
AV_LOG_FATAL
,
"No JPEG data found in image
\n
"
);
av_log
(
avctx
,
AV_LOG_FATAL
,
"No JPEG data found in image
\n
"
);
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
fail:
fail:
s
->
got_picture
=
0
;
return
ret
;
return
ret
;
the_end:
the_end:
if
(
s
->
upscale_h
)
{
if
(
s
->
upscale_h
)
{
...
@@ -1842,6 +1845,12 @@ av_cold int ff_mjpeg_decode_end(AVCodecContext *avctx)
...
@@ -1842,6 +1845,12 @@ av_cold int ff_mjpeg_decode_end(AVCodecContext *avctx)
return
0
;
return
0
;
}
}
static
void
decode_flush
(
AVCodecContext
*
avctx
)
{
MJpegDecodeContext
*
s
=
avctx
->
priv_data
;
s
->
got_picture
=
0
;
}
#if CONFIG_MJPEG_DECODER
#if CONFIG_MJPEG_DECODER
#define OFFSET(x) offsetof(MJpegDecodeContext, x)
#define OFFSET(x) offsetof(MJpegDecodeContext, x)
#define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
#define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
...
@@ -1866,6 +1875,7 @@ AVCodec ff_mjpeg_decoder = {
...
@@ -1866,6 +1875,7 @@ AVCodec ff_mjpeg_decoder = {
.
init
=
ff_mjpeg_decode_init
,
.
init
=
ff_mjpeg_decode_init
,
.
close
=
ff_mjpeg_decode_end
,
.
close
=
ff_mjpeg_decode_end
,
.
decode
=
ff_mjpeg_decode_frame
,
.
decode
=
ff_mjpeg_decode_frame
,
.
flush
=
decode_flush
,
.
capabilities
=
CODEC_CAP_DR1
,
.
capabilities
=
CODEC_CAP_DR1
,
.
max_lowres
=
3
,
.
max_lowres
=
3
,
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"MJPEG (Motion JPEG)"
),
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"MJPEG (Motion JPEG)"
),
...
@@ -1881,6 +1891,7 @@ AVCodec ff_thp_decoder = {
...
@@ -1881,6 +1891,7 @@ AVCodec ff_thp_decoder = {
.
init
=
ff_mjpeg_decode_init
,
.
init
=
ff_mjpeg_decode_init
,
.
close
=
ff_mjpeg_decode_end
,
.
close
=
ff_mjpeg_decode_end
,
.
decode
=
ff_mjpeg_decode_frame
,
.
decode
=
ff_mjpeg_decode_frame
,
.
flush
=
decode_flush
,
.
capabilities
=
CODEC_CAP_DR1
,
.
capabilities
=
CODEC_CAP_DR1
,
.
max_lowres
=
3
,
.
max_lowres
=
3
,
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"Nintendo Gamecube THP video"
),
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"Nintendo Gamecube THP video"
),
...
...
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