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
cc38ca67
Commit
cc38ca67
authored
12 years ago
by
Michael Niedermayer
Browse files
Options
Downloads
Patches
Plain Diff
avcodec/utils: use AVFrame accessor functions
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
30806ddc
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libavcodec/utils.c
+28
-26
28 additions, 26 deletions
libavcodec/utils.c
with
28 additions
and
26 deletions
libavcodec/utils.c
+
28
−
26
View file @
cc38ca67
...
@@ -549,14 +549,14 @@ void ff_init_buffer_info(AVCodecContext *s, AVFrame *frame)
...
@@ -549,14 +549,14 @@ void ff_init_buffer_info(AVCodecContext *s, AVFrame *frame)
{
{
if
(
s
->
pkt
)
{
if
(
s
->
pkt
)
{
frame
->
pkt_pts
=
s
->
pkt
->
pts
;
frame
->
pkt_pts
=
s
->
pkt
->
pts
;
frame
->
pkt_pos
=
s
->
pkt
->
pos
;
av_
frame
_set_
pkt_pos
(
frame
,
s
->
pkt
->
pos
)
;
frame
->
pkt_duration
=
s
->
pkt
->
duration
;
av_
frame
_set_
pkt_duration
(
frame
,
s
->
pkt
->
duration
)
;
frame
->
pkt_size
=
s
->
pkt
->
size
;
av_
frame
_set_
pkt_size
(
frame
,
s
->
pkt
->
size
)
;
}
else
{
}
else
{
frame
->
pkt_pts
=
AV_NOPTS_VALUE
;
frame
->
pkt_pts
=
AV_NOPTS_VALUE
;
frame
->
pkt_pos
=
-
1
;
av_
frame
_set_
pkt_pos
(
frame
,
-
1
)
;
frame
->
pkt_duration
=
0
;
av_
frame
_set_
pkt_duration
(
frame
,
0
)
;
frame
->
pkt_size
=
-
1
;
av_
frame
_set_
pkt_size
(
frame
,
-
1
)
;
}
}
frame
->
reordered_opaque
=
s
->
reordered_opaque
;
frame
->
reordered_opaque
=
s
->
reordered_opaque
;
...
@@ -571,7 +571,7 @@ void ff_init_buffer_info(AVCodecContext *s, AVFrame *frame)
...
@@ -571,7 +571,7 @@ void ff_init_buffer_info(AVCodecContext *s, AVFrame *frame)
frame
->
sample_rate
=
s
->
sample_rate
;
frame
->
sample_rate
=
s
->
sample_rate
;
frame
->
format
=
s
->
sample_fmt
;
frame
->
format
=
s
->
sample_fmt
;
frame
->
channel_layout
=
s
->
channel_layout
;
frame
->
channel_layout
=
s
->
channel_layout
;
frame
->
channels
=
s
->
channels
;
av_
frame
_set_
channels
(
frame
,
s
->
channels
)
;
break
;
break
;
}
}
}
}
...
@@ -714,11 +714,11 @@ void avcodec_get_frame_defaults(AVFrame *frame)
...
@@ -714,11 +714,11 @@ void avcodec_get_frame_defaults(AVFrame *frame)
frame
->
pts
=
frame
->
pts
=
frame
->
pkt_dts
=
frame
->
pkt_dts
=
frame
->
pkt_pts
=
frame
->
pkt_pts
=
AV_NOPTS_VALUE
;
frame
->
best_effort_timestamp
=
AV_NOPTS_VALUE
;
av_
frame
_set_
best_effort_timestamp
(
frame
,
AV_NOPTS_VALUE
)
;
frame
->
pkt_duration
=
0
;
av_
frame
_set_
pkt_duration
(
frame
,
0
)
;
frame
->
pkt_pos
=
-
1
;
av_
frame
_set_
pkt_pos
(
frame
,
-
1
)
;
frame
->
pkt_size
=
-
1
;
av_
frame
_set_
pkt_size
(
frame
,
-
1
)
;
frame
->
key_frame
=
1
;
frame
->
key_frame
=
1
;
frame
->
sample_aspect_ratio
=
(
AVRational
)
{
0
,
1
};
frame
->
sample_aspect_ratio
=
(
AVRational
)
{
0
,
1
};
frame
->
format
=
-
1
;
/* unknown */
frame
->
format
=
-
1
;
/* unknown */
...
@@ -1650,13 +1650,13 @@ static int add_metadata_from_side_data(AVCodecContext *avctx, AVFrame *frame)
...
@@ -1650,13 +1650,13 @@ static int add_metadata_from_side_data(AVCodecContext *avctx, AVFrame *frame)
while
(
side_metadata
<
end
)
{
while
(
side_metadata
<
end
)
{
const
uint8_t
*
key
=
side_metadata
;
const
uint8_t
*
key
=
side_metadata
;
const
uint8_t
*
val
=
side_metadata
+
strlen
(
key
)
+
1
;
const
uint8_t
*
val
=
side_metadata
+
strlen
(
key
)
+
1
;
int
ret
=
av_dict_set
(
&
frame
->
metadata
,
key
,
val
,
0
);
int
ret
=
av_dict_set
(
ff_
frame
_get_
metadata
p
(
frame
)
,
key
,
val
,
0
);
if
(
ret
<
0
)
if
(
ret
<
0
)
break
;
break
;
side_metadata
=
val
+
strlen
(
val
)
+
1
;
side_metadata
=
val
+
strlen
(
val
)
+
1
;
}
}
end:
end:
avctx
->
metadata
=
frame
->
metadata
;
avctx
->
metadata
=
av_
frame
_get_
metadata
(
frame
)
;
return
ret
;
return
ret
;
}
}
...
@@ -1692,7 +1692,7 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi
...
@@ -1692,7 +1692,7 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi
picture
->
pkt_dts
=
avpkt
->
dts
;
picture
->
pkt_dts
=
avpkt
->
dts
;
if
(
!
avctx
->
has_b_frames
){
if
(
!
avctx
->
has_b_frames
){
picture
->
pkt_pos
=
avpkt
->
pos
;
av_frame_set_pkt_pos
(
picture
,
avpkt
->
pos
)
;
}
}
//FIXME these should be under if(!avctx->has_b_frames)
//FIXME these should be under if(!avctx->has_b_frames)
/* get_buffer is supposed to set frame parameters */
/* get_buffer is supposed to set frame parameters */
...
@@ -1716,9 +1716,10 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi
...
@@ -1716,9 +1716,10 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi
if
(
*
got_picture_ptr
){
if
(
*
got_picture_ptr
){
avctx
->
frame_number
++
;
avctx
->
frame_number
++
;
picture
->
best_effort_timestamp
=
guess_correct_pts
(
avctx
,
av_frame_set_best_effort_timestamp
(
picture
,
picture
->
pkt_pts
,
guess_correct_pts
(
avctx
,
picture
->
pkt_dts
);
picture
->
pkt_pts
,
picture
->
pkt_dts
));
}
}
}
else
}
else
ret
=
0
;
ret
=
0
;
...
@@ -1813,15 +1814,16 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx,
...
@@ -1813,15 +1814,16 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx,
if
(
ret
>=
0
&&
*
got_frame_ptr
)
{
if
(
ret
>=
0
&&
*
got_frame_ptr
)
{
avctx
->
frame_number
++
;
avctx
->
frame_number
++
;
frame
->
pkt_dts
=
avpkt
->
dts
;
frame
->
pkt_dts
=
avpkt
->
dts
;
frame
->
best_effort_timestamp
=
guess_correct_pts
(
avctx
,
av_frame_set_best_effort_timestamp
(
frame
,
frame
->
pkt_pts
,
guess_correct_pts
(
avctx
,
frame
->
pkt_dts
);
frame
->
pkt_pts
,
frame
->
pkt_dts
));
if
(
frame
->
format
==
AV_SAMPLE_FMT_NONE
)
if
(
frame
->
format
==
AV_SAMPLE_FMT_NONE
)
frame
->
format
=
avctx
->
sample_fmt
;
frame
->
format
=
avctx
->
sample_fmt
;
if
(
!
frame
->
channel_layout
)
if
(
!
frame
->
channel_layout
)
frame
->
channel_layout
=
avctx
->
channel_layout
;
frame
->
channel_layout
=
avctx
->
channel_layout
;
if
(
!
frame
->
channels
)
if
(
!
av_
frame
_get_
channels
(
frame
)
)
frame
->
channels
=
avctx
->
channels
;
av_
frame
_set_
channels
(
frame
,
avctx
->
channels
)
;
if
(
!
frame
->
sample_rate
)
if
(
!
frame
->
sample_rate
)
frame
->
sample_rate
=
avctx
->
sample_rate
;
frame
->
sample_rate
=
avctx
->
sample_rate
;
}
}
...
@@ -1850,8 +1852,8 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx,
...
@@ -1850,8 +1852,8 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx,
frame
->
pkt_pts
+=
diff_ts
;
frame
->
pkt_pts
+=
diff_ts
;
if
(
frame
->
pkt_dts
!=
AV_NOPTS_VALUE
)
if
(
frame
->
pkt_dts
!=
AV_NOPTS_VALUE
)
frame
->
pkt_dts
+=
diff_ts
;
frame
->
pkt_dts
+=
diff_ts
;
if
(
frame
->
pkt_duration
>=
diff_ts
)
if
(
av_
frame
_get_
pkt_duration
(
frame
)
>=
diff_ts
)
frame
->
pkt_duration
-
=
diff_ts
;
av_
frame
_set_
pkt_duration
(
frame
,
av_frame_get_pkt_duration
(
frame
)
-
diff_ts
)
;
}
else
{
}
else
{
av_log
(
avctx
,
AV_LOG_WARNING
,
"Could not update timestamps for skipped samples.
\n
"
);
av_log
(
avctx
,
AV_LOG_WARNING
,
"Could not update timestamps for skipped samples.
\n
"
);
}
}
...
@@ -1875,7 +1877,7 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx,
...
@@ -1875,7 +1877,7 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx,
* extended_data are doing it correctly */
* extended_data are doing it correctly */
if
(
*
got_frame_ptr
)
{
if
(
*
got_frame_ptr
)
{
planar
=
av_sample_fmt_is_planar
(
frame
->
format
);
planar
=
av_sample_fmt_is_planar
(
frame
->
format
);
channels
=
frame
->
channels
;
channels
=
av_
frame
_get_
channels
(
frame
)
;
if
(
!
(
planar
&&
channels
>
AV_NUM_DATA_POINTERS
))
if
(
!
(
planar
&&
channels
>
AV_NUM_DATA_POINTERS
))
frame
->
extended_data
=
frame
->
data
;
frame
->
extended_data
=
frame
->
data
;
}
else
{
}
else
{
...
...
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