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
d9a2e87b
Commit
d9a2e87b
authored
Sep 29, 2012
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mpeg12: move mpeg_decode_frame() lower
Avoids a forward declaration of decode_chunks().
parent
85f47793
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
48 deletions
+44
-48
mpeg12.c
libavcodec/mpeg12.c
+44
-48
No files found.
libavcodec/mpeg12.c
View file @
d9a2e87b
...
...
@@ -2185,54 +2185,6 @@ int ff_mpeg1_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size,
return
END_NOT_FOUND
;
}
static
int
decode_chunks
(
AVCodecContext
*
avctx
,
AVFrame
*
picture
,
int
*
data_size
,
const
uint8_t
*
buf
,
int
buf_size
);
/* handle buffering and image synchronisation */
static
int
mpeg_decode_frame
(
AVCodecContext
*
avctx
,
void
*
data
,
int
*
data_size
,
AVPacket
*
avpkt
)
{
const
uint8_t
*
buf
=
avpkt
->
data
;
int
buf_size
=
avpkt
->
size
;
Mpeg1Context
*
s
=
avctx
->
priv_data
;
AVFrame
*
picture
=
data
;
MpegEncContext
*
s2
=
&
s
->
mpeg_enc_ctx
;
av_dlog
(
avctx
,
"fill_buffer
\n
"
);
if
(
buf_size
==
0
||
(
buf_size
==
4
&&
AV_RB32
(
buf
)
==
SEQ_END_CODE
))
{
/* special case for last picture */
if
(
s2
->
low_delay
==
0
&&
s2
->
next_picture_ptr
)
{
*
picture
=
s2
->
next_picture_ptr
->
f
;
s2
->
next_picture_ptr
=
NULL
;
*
data_size
=
sizeof
(
AVFrame
);
}
return
buf_size
;
}
if
(
s2
->
flags
&
CODEC_FLAG_TRUNCATED
)
{
int
next
=
ff_mpeg1_find_frame_end
(
&
s2
->
parse_context
,
buf
,
buf_size
,
NULL
);
if
(
ff_combine_frame
(
&
s2
->
parse_context
,
next
,
(
const
uint8_t
**
)
&
buf
,
&
buf_size
)
<
0
)
return
buf_size
;
}
if
(
s
->
mpeg_enc_ctx_allocated
==
0
&&
avctx
->
codec_tag
==
AV_RL32
(
"VCR2"
))
vcr2_init_sequence
(
avctx
);
s
->
slice_count
=
0
;
if
(
avctx
->
extradata
&&
!
avctx
->
frame_number
)
{
int
ret
=
decode_chunks
(
avctx
,
picture
,
data_size
,
avctx
->
extradata
,
avctx
->
extradata_size
);
if
(
ret
<
0
&&
(
avctx
->
err_recognition
&
AV_EF_EXPLODE
))
return
ret
;
}
return
decode_chunks
(
avctx
,
picture
,
data_size
,
buf
,
buf_size
);
}
static
int
decode_chunks
(
AVCodecContext
*
avctx
,
AVFrame
*
picture
,
int
*
data_size
,
const
uint8_t
*
buf
,
int
buf_size
)
...
...
@@ -2464,6 +2416,50 @@ static int decode_chunks(AVCodecContext *avctx,
}
}
static
int
mpeg_decode_frame
(
AVCodecContext
*
avctx
,
void
*
data
,
int
*
data_size
,
AVPacket
*
avpkt
)
{
const
uint8_t
*
buf
=
avpkt
->
data
;
int
buf_size
=
avpkt
->
size
;
Mpeg1Context
*
s
=
avctx
->
priv_data
;
AVFrame
*
picture
=
data
;
MpegEncContext
*
s2
=
&
s
->
mpeg_enc_ctx
;
av_dlog
(
avctx
,
"fill_buffer
\n
"
);
if
(
buf_size
==
0
||
(
buf_size
==
4
&&
AV_RB32
(
buf
)
==
SEQ_END_CODE
))
{
/* special case for last picture */
if
(
s2
->
low_delay
==
0
&&
s2
->
next_picture_ptr
)
{
*
picture
=
s2
->
next_picture_ptr
->
f
;
s2
->
next_picture_ptr
=
NULL
;
*
data_size
=
sizeof
(
AVFrame
);
}
return
buf_size
;
}
if
(
s2
->
flags
&
CODEC_FLAG_TRUNCATED
)
{
int
next
=
ff_mpeg1_find_frame_end
(
&
s2
->
parse_context
,
buf
,
buf_size
,
NULL
);
if
(
ff_combine_frame
(
&
s2
->
parse_context
,
next
,
(
const
uint8_t
**
)
&
buf
,
&
buf_size
)
<
0
)
return
buf_size
;
}
if
(
s
->
mpeg_enc_ctx_allocated
==
0
&&
avctx
->
codec_tag
==
AV_RL32
(
"VCR2"
))
vcr2_init_sequence
(
avctx
);
s
->
slice_count
=
0
;
if
(
avctx
->
extradata
&&
!
avctx
->
frame_number
)
{
int
ret
=
decode_chunks
(
avctx
,
picture
,
data_size
,
avctx
->
extradata
,
avctx
->
extradata_size
);
if
(
ret
<
0
&&
(
avctx
->
err_recognition
&
AV_EF_EXPLODE
))
return
ret
;
}
return
decode_chunks
(
avctx
,
picture
,
data_size
,
buf
,
buf_size
);
}
static
void
flush
(
AVCodecContext
*
avctx
)
{
Mpeg1Context
*
s
=
avctx
->
priv_data
;
...
...
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