History

lavc: add pkt_duration field to AVFrame

Stefano Sabatini committed 14 years ago

Commit 62b39d41 parent 0da9bce4 files · +23 −1Browse files

Showing the changes to libavcodec (3 of 4 files). Show all

Unified · Split

3 files
  1. libavcodec/avcodec.h +11 −0
  2. libavcodec/utils.c +8 −0
  3. libavcodec/version.h +1 −1
libavcodec/avcodec.h+11−0
@@ -1277,6 +1277,15 @@ typedef struct AVFrame { · 1276 unmodified lines
1277 */1277 */
1278 int64_t pkt_pos;1278 int64_t pkt_pos;
1279 1279
1280 /**
1281 * duration of the corresponding packet, expressed in
1282 * AVStream->time_base units, 0 if unknown.
1283 * Code outside libavcodec should access this field using:
1284 * av_frame_get_pkt_duration(frame)
1285 * - encoding: unused
1286 * - decoding: Read by user.
1287 */
1288 int64_t pkt_duration;
1280} AVFrame;1289} AVFrame;
1281 1290
1282/**1291/**
@@ -1285,10 +1294,12 @@ typedef struct AVFrame { · 2 unmodified lines
1285 * they should not be accessed directly outside libavcodec.1294 * they should not be accessed directly outside libavcodec.
1286 */1295 */
1287int64_t av_frame_get_best_effort_timestamp(const AVFrame *frame);1296int64_t av_frame_get_best_effort_timestamp(const AVFrame *frame);
1297int64_t av_frame_get_pkt_duration (const AVFrame *frame);
1288int64_t av_frame_get_pkt_pos (const AVFrame *frame);1298int64_t av_frame_get_pkt_pos (const AVFrame *frame);
1289int64_t av_frame_get_channel_layout (const AVFrame *frame);1299int64_t av_frame_get_channel_layout (const AVFrame *frame);
1290int av_frame_get_sample_rate (const AVFrame *frame);1300int av_frame_get_sample_rate (const AVFrame *frame);
1291void av_frame_set_best_effort_timestamp(AVFrame *frame, int64_t val);1301void av_frame_set_best_effort_timestamp(AVFrame *frame, int64_t val);
1302void av_frame_set_pkt_duration (AVFrame *frame, int64_t val);
1292void av_frame_set_pkt_pos (AVFrame *frame, int64_t val);1303void av_frame_set_pkt_pos (AVFrame *frame, int64_t val);
1293void av_frame_set_channel_layout (AVFrame *frame, int64_t val);1304void av_frame_set_channel_layout (AVFrame *frame, int64_t val);
1294void av_frame_set_sample_rate (AVFrame *frame, int val);1305void av_frame_set_sample_rate (AVFrame *frame, int val);
libavcodec/utils.c+8−0
@@ -265,9 +265,11 @@ void ff_init_buffer_info(AVCodecContext *s, AVFrame *pic) · 264 unmodified lines
265 if (s->pkt) {265 if (s->pkt) {
266 pic->pkt_pts = s->pkt->pts;266 pic->pkt_pts = s->pkt->pts;
267 pic->pkt_pos = s->pkt->pos;267 pic->pkt_pos = s->pkt->pos;
268 pic->pkt_duration = s->pkt->duration;
268 } else {269 } else {
269 pic->pkt_pts = AV_NOPTS_VALUE;270 pic->pkt_pts = AV_NOPTS_VALUE;
270 pic->pkt_pos = -1;271 pic->pkt_pos = -1;
272 pic->pkt_duration = 0;
271 }273 }
272 pic->reordered_opaque= s->reordered_opaque;274 pic->reordered_opaque= s->reordered_opaque;
273 pic->sample_aspect_ratio = s->sample_aspect_ratio;275 pic->sample_aspect_ratio = s->sample_aspect_ratio;
@@ -384,9 +386,11 @@ static int audio_get_buffer(AVCodecContext *avctx, AVFrame *frame) · 110 unmodified lines
384 if (avctx->pkt) {386 if (avctx->pkt) {
385 frame->pkt_pts = avctx->pkt->pts;387 frame->pkt_pts = avctx->pkt->pts;
386 frame->pkt_pos = avctx->pkt->pos;388 frame->pkt_pos = avctx->pkt->pos;
389 frame->pkt_duration = avctx->pkt->duration;
387 } else {390 } else {
388 frame->pkt_pts = AV_NOPTS_VALUE;391 frame->pkt_pts = AV_NOPTS_VALUE;
389 frame->pkt_pos = -1;392 frame->pkt_pos = -1;
393 frame->pkt_duration = 0;
390 }394 }
391 395
392 frame->reordered_opaque = avctx->reordered_opaque;396 frame->reordered_opaque = avctx->reordered_opaque;
@@ -521,9 +525,11 @@ static int video_get_buffer(AVCodecContext *s, AVFrame *pic) · 128 unmodified lines
521 if (s->pkt) {525 if (s->pkt) {
522 pic->pkt_pts = s->pkt->pts;526 pic->pkt_pts = s->pkt->pts;
523 pic->pkt_pos = s->pkt->pos;527 pic->pkt_pos = s->pkt->pos;
528 pic->pkt_duration = s->pkt->duration;
524 } else {529 } else {
525 pic->pkt_pts = AV_NOPTS_VALUE;530 pic->pkt_pts = AV_NOPTS_VALUE;
526 pic->pkt_pos = -1;531 pic->pkt_pos = -1;
532 pic->pkt_duration = 0;
527 }533 }
528 pic->reordered_opaque= s->reordered_opaque;534 pic->reordered_opaque= s->reordered_opaque;
529 pic->sample_aspect_ratio = s->sample_aspect_ratio;535 pic->sample_aspect_ratio = s->sample_aspect_ratio;
@@ -661,6 +667,7 @@ void avcodec_get_frame_defaults(AVFrame *pic){ · 131 unmodified lines
661 memset(pic, 0, sizeof(AVFrame));667 memset(pic, 0, sizeof(AVFrame));
662 668
663 pic->pts = pic->pkt_dts = pic->pkt_pts = pic->best_effort_timestamp = AV_NOPTS_VALUE;669 pic->pts = pic->pkt_dts = pic->pkt_pts = pic->best_effort_timestamp = AV_NOPTS_VALUE;
670 pic->pkt_duration = 0;
664 pic->pkt_pos = -1;671 pic->pkt_pos = -1;
665 pic->key_frame= 1;672 pic->key_frame= 1;
666 pic->sample_aspect_ratio = (AVRational){0, 1};673 pic->sample_aspect_ratio = (AVRational){0, 1};
@@ -682,6 +689,7 @@ AVFrame *avcodec_alloc_frame(void){ · 15 unmodified lines
682 void av_##name##_set_##field(str *s, type v) { s->field = v; }689 void av_##name##_set_##field(str *s, type v) { s->field = v; }
683 690
684MAKE_ACCESSORS(AVFrame, frame, int64_t, best_effort_timestamp)691MAKE_ACCESSORS(AVFrame, frame, int64_t, best_effort_timestamp)
692MAKE_ACCESSORS(AVFrame, frame, int64_t, pkt_duration)
685MAKE_ACCESSORS(AVFrame, frame, int64_t, pkt_pos)693MAKE_ACCESSORS(AVFrame, frame, int64_t, pkt_pos)
686MAKE_ACCESSORS(AVFrame, frame, int64_t, channel_layout)694MAKE_ACCESSORS(AVFrame, frame, int64_t, channel_layout)
687MAKE_ACCESSORS(AVFrame, frame, int, sample_rate)695MAKE_ACCESSORS(AVFrame, frame, int, sample_rate)
libavcodec/version.h+1−1
@@ -27,7 +27,7 @@ · 26 unmodified lines
27 */27 */
28 28
29#define LIBAVCODEC_VERSION_MAJOR 5429#define LIBAVCODEC_VERSION_MAJOR 54
30#define LIBAVCODEC_VERSION_MINOR 2330#define LIBAVCODEC_VERSION_MINOR 24
31#define LIBAVCODEC_VERSION_MICRO 10031#define LIBAVCODEC_VERSION_MICRO 100
32 32
33#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \33#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t