aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/utils.c
diff options
context:
space:
mode:
authorStefano Sabatini <stefasab@gmail.com>2012-03-08 15:22:53 +0100
committerStefano Sabatini <stefasab@gmail.com>2012-06-05 18:42:17 +0200
commit62b39d41cdec2be4e4722aefbd7789305e4ab2ad (patch)
tree68b4abafa19f29df11acb9bd6f10f7a3720ce274 /libavcodec/utils.c
parent0da9bce5a317a8a5ce4f8ed72c460ff929bf5c8e (diff)
downloadffmpeg-62b39d41cdec2be4e4722aefbd7789305e4ab2ad.tar.gz
lavc: add pkt_duration field to AVFrame
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r--libavcodec/utils.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 5d3fafea65..d427a92c65 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -265,9 +265,11 @@ void ff_init_buffer_info(AVCodecContext *s, AVFrame *pic)
if (s->pkt) {
pic->pkt_pts = s->pkt->pts;
pic->pkt_pos = s->pkt->pos;
+ pic->pkt_duration = s->pkt->duration;
} else {
pic->pkt_pts = AV_NOPTS_VALUE;
pic->pkt_pos = -1;
+ pic->pkt_duration = 0;
}
pic->reordered_opaque= s->reordered_opaque;
pic->sample_aspect_ratio = s->sample_aspect_ratio;
@@ -384,9 +386,11 @@ static int audio_get_buffer(AVCodecContext *avctx, AVFrame *frame)
if (avctx->pkt) {
frame->pkt_pts = avctx->pkt->pts;
frame->pkt_pos = avctx->pkt->pos;
+ frame->pkt_duration = avctx->pkt->duration;
} else {
frame->pkt_pts = AV_NOPTS_VALUE;
frame->pkt_pos = -1;
+ frame->pkt_duration = 0;
}
frame->reordered_opaque = avctx->reordered_opaque;
@@ -521,9 +525,11 @@ static int video_get_buffer(AVCodecContext *s, AVFrame *pic)
if (s->pkt) {
pic->pkt_pts = s->pkt->pts;
pic->pkt_pos = s->pkt->pos;
+ pic->pkt_duration = s->pkt->duration;
} else {
pic->pkt_pts = AV_NOPTS_VALUE;
pic->pkt_pos = -1;
+ pic->pkt_duration = 0;
}
pic->reordered_opaque= s->reordered_opaque;
pic->sample_aspect_ratio = s->sample_aspect_ratio;
@@ -661,6 +667,7 @@ void avcodec_get_frame_defaults(AVFrame *pic){
memset(pic, 0, sizeof(AVFrame));
pic->pts = pic->pkt_dts = pic->pkt_pts = pic->best_effort_timestamp = AV_NOPTS_VALUE;
+ pic->pkt_duration = 0;
pic->pkt_pos = -1;
pic->key_frame= 1;
pic->sample_aspect_ratio = (AVRational){0, 1};
@@ -682,6 +689,7 @@ AVFrame *avcodec_alloc_frame(void){
void av_##name##_set_##field(str *s, type v) { s->field = v; }
MAKE_ACCESSORS(AVFrame, frame, int64_t, best_effort_timestamp)
+MAKE_ACCESSORS(AVFrame, frame, int64_t, pkt_duration)
MAKE_ACCESSORS(AVFrame, frame, int64_t, pkt_pos)
MAKE_ACCESSORS(AVFrame, frame, int64_t, channel_layout)
MAKE_ACCESSORS(AVFrame, frame, int, sample_rate)