Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
b4ec645f
Commit
b4ec645f
authored
Jan 21, 2012
by
Reimar Döffinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract some duplicated code.
Signed-off-by:
Reimar Döffinger
<
Reimar.Doeffinger@gmx.de
>
parent
b64b1608
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
22 deletions
+14
-22
fraps.c
libavcodec/fraps.c
+14
-22
No files found.
libavcodec/fraps.c
View file @
b4ec645f
...
@@ -155,6 +155,20 @@ static int decode_frame(AVCodecContext *avctx,
...
@@ -155,6 +155,20 @@ static int decode_frame(AVCodecContext *avctx,
buf
+=
header_size
;
buf
+=
header_size
;
avctx
->
pix_fmt
=
version
&
1
?
PIX_FMT_BGR24
:
PIX_FMT_YUVJ420P
;
if
(
version
<
2
)
{
unsigned
needed_size
=
avctx
->
width
*
avctx
->
height
*
3
;
if
(
version
==
0
)
needed_size
/=
2
;
needed_size
+=
header_size
;
if
(
buf_size
!=
needed_size
&&
buf_size
!=
header_size
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Invalid frame length %d (should be %d)
\n
"
,
buf_size
,
needed_size
);
return
-
1
;
}
}
f
->
pict_type
=
AV_PICTURE_TYPE_I
;
f
->
pict_type
=
AV_PICTURE_TYPE_I
;
f
->
key_frame
=
1
;
f
->
key_frame
=
1
;
f
->
reference
=
3
;
f
->
reference
=
3
;
...
@@ -166,16 +180,6 @@ static int decode_frame(AVCodecContext *avctx,
...
@@ -166,16 +180,6 @@ static int decode_frame(AVCodecContext *avctx,
case
0
:
case
0
:
default
:
default
:
/* Fraps v0 is a reordered YUV420 */
/* Fraps v0 is a reordered YUV420 */
avctx
->
pix_fmt
=
PIX_FMT_YUVJ420P
;
if
(
buf_size
!=
avctx
->
width
*
avctx
->
height
*
3
/
2
+
header_size
&&
buf_size
!=
header_size
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Invalid frame length %d (should be %d)
\n
"
,
buf_size
,
avctx
->
width
*
avctx
->
height
*
3
/
2
+
header_size
);
return
-
1
;
}
if
(
(
avctx
->
width
%
8
)
!=
0
||
(
avctx
->
height
%
2
)
!=
0
)
{
if
(
(
avctx
->
width
%
8
)
!=
0
||
(
avctx
->
height
%
2
)
!=
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Invalid frame size %dx%d
\n
"
,
av_log
(
avctx
,
AV_LOG_ERROR
,
"Invalid frame size %dx%d
\n
"
,
avctx
->
width
,
avctx
->
height
);
avctx
->
width
,
avctx
->
height
);
...
@@ -211,16 +215,6 @@ static int decode_frame(AVCodecContext *avctx,
...
@@ -211,16 +215,6 @@ static int decode_frame(AVCodecContext *avctx,
case
1
:
case
1
:
/* Fraps v1 is an upside-down BGR24 */
/* Fraps v1 is an upside-down BGR24 */
avctx
->
pix_fmt
=
PIX_FMT_BGR24
;
if
(
buf_size
!=
avctx
->
width
*
avctx
->
height
*
3
+
header_size
&&
buf_size
!=
header_size
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Invalid frame length %d (should be %d)
\n
"
,
buf_size
,
avctx
->
width
*
avctx
->
height
*
3
+
header_size
);
return
-
1
;
}
if
(
avctx
->
reget_buffer
(
avctx
,
f
))
{
if
(
avctx
->
reget_buffer
(
avctx
,
f
))
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"reget_buffer() failed
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"reget_buffer() failed
\n
"
);
return
-
1
;
return
-
1
;
...
@@ -243,7 +237,6 @@ static int decode_frame(AVCodecContext *avctx,
...
@@ -243,7 +237,6 @@ static int decode_frame(AVCodecContext *avctx,
* Fraps v2 is Huffman-coded YUV420 planes
* Fraps v2 is Huffman-coded YUV420 planes
* Fraps v4 is virtually the same
* Fraps v4 is virtually the same
*/
*/
avctx
->
pix_fmt
=
PIX_FMT_YUVJ420P
;
if
(
avctx
->
reget_buffer
(
avctx
,
f
))
{
if
(
avctx
->
reget_buffer
(
avctx
,
f
))
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"reget_buffer() failed
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"reget_buffer() failed
\n
"
);
return
-
1
;
return
-
1
;
...
@@ -281,7 +274,6 @@ static int decode_frame(AVCodecContext *avctx,
...
@@ -281,7 +274,6 @@ static int decode_frame(AVCodecContext *avctx,
case
3
:
case
3
:
case
5
:
case
5
:
/* Virtually the same as version 4, but is for RGB24 */
/* Virtually the same as version 4, but is for RGB24 */
avctx
->
pix_fmt
=
PIX_FMT_BGR24
;
if
(
avctx
->
reget_buffer
(
avctx
,
f
))
{
if
(
avctx
->
reget_buffer
(
avctx
,
f
))
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"reget_buffer() failed
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"reget_buffer() failed
\n
"
);
return
-
1
;
return
-
1
;
...
...
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