Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
e9198f61
Commit
e9198f61
authored
11 years ago
by
Anton Khirnov
Browse files
Options
Downloads
Patches
Plain Diff
mss2: use the AVFrame API properly.
parent
acaffdca
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libavcodec/mss2.c
+18
-12
18 additions, 12 deletions
libavcodec/mss2.c
with
18 additions
and
12 deletions
libavcodec/mss2.c
+
18
−
12
View file @
e9198f61
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
typedef
struct
MSS2Context
{
typedef
struct
MSS2Context
{
VC1Context
v
;
VC1Context
v
;
int
split_position
;
int
split_position
;
AVFrame
last_pic
;
AVFrame
*
last_pic
;
MSS12Context
c
;
MSS12Context
c
;
MSS2DSPContext
dsp
;
MSS2DSPContext
dsp
;
SliceContext
sc
[
2
];
SliceContext
sc
[
2
];
...
@@ -523,8 +523,8 @@ static int mss2_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
...
@@ -523,8 +523,8 @@ static int mss2_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
avctx
->
pix_fmt
=
is_555
?
AV_PIX_FMT_RGB555
:
AV_PIX_FMT_RGB24
;
avctx
->
pix_fmt
=
is_555
?
AV_PIX_FMT_RGB555
:
AV_PIX_FMT_RGB24
;
if
(
ctx
->
last_pic
.
format
!=
avctx
->
pix_fmt
)
if
(
ctx
->
last_pic
->
format
!=
avctx
->
pix_fmt
)
av_frame_unref
(
&
ctx
->
last_pic
);
av_frame_unref
(
ctx
->
last_pic
);
if
(
has_wmv9
)
{
if
(
has_wmv9
)
{
bytestream2_init
(
&
gB
,
buf
,
buf_size
+
ARITH2_PADDING
);
bytestream2_init
(
&
gB
,
buf
,
buf_size
+
ARITH2_PADDING
);
...
@@ -603,20 +603,20 @@ static int mss2_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
...
@@ -603,20 +603,20 @@ static int mss2_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
return
ret
;
return
ret
;
}
}
if
(
ctx
->
last_pic
.
data
[
0
])
{
if
(
ctx
->
last_pic
->
data
[
0
])
{
av_assert0
(
frame
->
linesize
[
0
]
==
ctx
->
last_pic
.
linesize
[
0
]);
av_assert0
(
frame
->
linesize
[
0
]
==
ctx
->
last_pic
->
linesize
[
0
]);
c
->
last_rgb_pic
=
ctx
->
last_pic
.
data
[
0
]
+
c
->
last_rgb_pic
=
ctx
->
last_pic
->
data
[
0
]
+
ctx
->
last_pic
.
linesize
[
0
]
*
(
avctx
->
height
-
1
);
ctx
->
last_pic
->
linesize
[
0
]
*
(
avctx
->
height
-
1
);
}
else
{
}
else
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Missing keyframe
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"Missing keyframe
\n
"
);
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
}
}
}
else
{
}
else
{
if
((
ret
=
ff_reget_buffer
(
avctx
,
&
ctx
->
last_pic
))
<
0
)
{
if
((
ret
=
ff_reget_buffer
(
avctx
,
ctx
->
last_pic
))
<
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"reget_buffer() failed
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"reget_buffer() failed
\n
"
);
return
ret
;
return
ret
;
}
}
if
((
ret
=
av_frame_ref
(
frame
,
&
ctx
->
last_pic
))
<
0
)
if
((
ret
=
av_frame_ref
(
frame
,
ctx
->
last_pic
))
<
0
)
return
ret
;
return
ret
;
c
->
last_rgb_pic
=
NULL
;
c
->
last_rgb_pic
=
NULL
;
...
@@ -730,8 +730,8 @@ static int mss2_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
...
@@ -730,8 +730,8 @@ static int mss2_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
av_log
(
avctx
,
AV_LOG_WARNING
,
"buffer not fully consumed
\n
"
);
av_log
(
avctx
,
AV_LOG_WARNING
,
"buffer not fully consumed
\n
"
);
if
(
c
->
mvX
<
0
||
c
->
mvY
<
0
)
{
if
(
c
->
mvX
<
0
||
c
->
mvY
<
0
)
{
av_frame_unref
(
&
ctx
->
last_pic
);
av_frame_unref
(
ctx
->
last_pic
);
ret
=
av_frame_ref
(
&
ctx
->
last_pic
,
frame
);
ret
=
av_frame_ref
(
ctx
->
last_pic
,
frame
);
if
(
ret
<
0
)
if
(
ret
<
0
)
return
ret
;
return
ret
;
}
}
...
@@ -806,7 +806,7 @@ static av_cold int mss2_decode_end(AVCodecContext *avctx)
...
@@ -806,7 +806,7 @@ static av_cold int mss2_decode_end(AVCodecContext *avctx)
{
{
MSS2Context
*
const
ctx
=
avctx
->
priv_data
;
MSS2Context
*
const
ctx
=
avctx
->
priv_data
;
av_frame_
un
re
f
(
&
ctx
->
last_pic
);
av_frame_
f
re
e
(
&
ctx
->
last_pic
);
ff_mss12_decode_end
(
&
ctx
->
c
);
ff_mss12_decode_end
(
&
ctx
->
c
);
av_freep
(
&
ctx
->
c
.
pal_pic
);
av_freep
(
&
ctx
->
c
.
pal_pic
);
...
@@ -840,6 +840,12 @@ static av_cold int mss2_decode_init(AVCodecContext *avctx)
...
@@ -840,6 +840,12 @@ static av_cold int mss2_decode_init(AVCodecContext *avctx)
avctx
->
pix_fmt
=
c
->
free_colours
==
127
?
AV_PIX_FMT_RGB555
avctx
->
pix_fmt
=
c
->
free_colours
==
127
?
AV_PIX_FMT_RGB555
:
AV_PIX_FMT_RGB24
;
:
AV_PIX_FMT_RGB24
;
ctx
->
last_pic
=
av_frame_alloc
();
if
(
!
ctx
->
last_pic
)
{
mss2_decode_end
(
avctx
);
return
AVERROR
(
ENOMEM
);
}
return
0
;
return
0
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment