History

lavc: add pkt_duration field to AVFrame

Stefano Sabatini committed 14 years ago

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

Unified · Split

4 files
  1. doc/APIchanges +3 −0
  2. libavcodec/avcodec.h +11 −0
  3. libavcodec/utils.c +8 −0
  4. libavcodec/version.h +1 −1
doc/APIchanges+3−0
@@ -15,6 +15,9 @@ libavutil: 2011-04-18 · 14 unmodified lines
1515
1616 API changes, most recent first:
1717
18+2012-06-05 - xxxxxxx - lavc 54.24.100
19+ Add pkt_duration field to AVFrame.
20+
1821 2012-06-04 - xxxxxxx - lafi 2.78.100
1922 Add avfilter_default_filter_name() function in avfilter.h.
2023
libavcodec/avcodec.h+11−0
@@ -1277,6 +1277,15 @@ typedef struct AVFrame { · 1276 unmodified lines
12771277 */
12781278 int64_t pkt_pos;
12791279
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;
12801289 } AVFrame;
12811290
12821291 /**
@@ -1285,10 +1294,12 @@ typedef struct AVFrame { · 2 unmodified lines
12851294 * they should not be accessed directly outside libavcodec.
12861295 */
12871296 int64_t av_frame_get_best_effort_timestamp(const AVFrame *frame);
1297+int64_t av_frame_get_pkt_duration (const AVFrame *frame);
12881298 int64_t av_frame_get_pkt_pos (const AVFrame *frame);
12891299 int64_t av_frame_get_channel_layout (const AVFrame *frame);
12901300 int av_frame_get_sample_rate (const AVFrame *frame);
12911301 void av_frame_set_best_effort_timestamp(AVFrame *frame, int64_t val);
1302+void av_frame_set_pkt_duration (AVFrame *frame, int64_t val);
12921303 void av_frame_set_pkt_pos (AVFrame *frame, int64_t val);
12931304 void av_frame_set_channel_layout (AVFrame *frame, int64_t val);
12941305 void 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
265265 if (s->pkt) {
266266 pic->pkt_pts = s->pkt->pts;
267267 pic->pkt_pos = s->pkt->pos;
268+ pic->pkt_duration = s->pkt->duration;
268269 } else {
269270 pic->pkt_pts = AV_NOPTS_VALUE;
270271 pic->pkt_pos = -1;
272+ pic->pkt_duration = 0;
271273 }
272274 pic->reordered_opaque= s->reordered_opaque;
273275 pic->sample_aspect_ratio = s->sample_aspect_ratio;
@@ -384,9 +386,11 @@ static int audio_get_buffer(AVCodecContext *avctx, AVFrame *frame) · 110 unmodified lines
384386 if (avctx->pkt) {
385387 frame->pkt_pts = avctx->pkt->pts;
386388 frame->pkt_pos = avctx->pkt->pos;
389+ frame->pkt_duration = avctx->pkt->duration;
387390 } else {
388391 frame->pkt_pts = AV_NOPTS_VALUE;
389392 frame->pkt_pos = -1;
393+ frame->pkt_duration = 0;
390394 }
391395
392396 frame->reordered_opaque = avctx->reordered_opaque;
@@ -521,9 +525,11 @@ static int video_get_buffer(AVCodecContext *s, AVFrame *pic) · 128 unmodified lines
521525 if (s->pkt) {
522526 pic->pkt_pts = s->pkt->pts;
523527 pic->pkt_pos = s->pkt->pos;
528+ pic->pkt_duration = s->pkt->duration;
524529 } else {
525530 pic->pkt_pts = AV_NOPTS_VALUE;
526531 pic->pkt_pos = -1;
532+ pic->pkt_duration = 0;
527533 }
528534 pic->reordered_opaque= s->reordered_opaque;
529535 pic->sample_aspect_ratio = s->sample_aspect_ratio;
@@ -661,6 +667,7 @@ void avcodec_get_frame_defaults(AVFrame *pic){ · 131 unmodified lines
661667 memset(pic, 0, sizeof(AVFrame));
662668
663669 pic->pts = pic->pkt_dts = pic->pkt_pts = pic->best_effort_timestamp = AV_NOPTS_VALUE;
670+ pic->pkt_duration = 0;
664671 pic->pkt_pos = -1;
665672 pic->key_frame= 1;
666673 pic->sample_aspect_ratio = (AVRational){0, 1};
@@ -682,6 +689,7 @@ AVFrame *avcodec_alloc_frame(void){ · 15 unmodified lines
682689 void av_##name##_set_##field(str *s, type v) { s->field = v; }
683690
684691 MAKE_ACCESSORS(AVFrame, frame, int64_t, best_effort_timestamp)
692+MAKE_ACCESSORS(AVFrame, frame, int64_t, pkt_duration)
685693 MAKE_ACCESSORS(AVFrame, frame, int64_t, pkt_pos)
686694 MAKE_ACCESSORS(AVFrame, frame, int64_t, channel_layout)
687695 MAKE_ACCESSORS(AVFrame, frame, int, sample_rate)
libavcodec/version.h+1−1
@@ -27,7 +27,7 @@ · 26 unmodified lines
2727 */
2828
2929 #define LIBAVCODEC_VERSION_MAJOR 54
30−#define LIBAVCODEC_VERSION_MINOR 23
30+#define LIBAVCODEC_VERSION_MINOR 24
3131 #define LIBAVCODEC_VERSION_MICRO 100
3232
3333 #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