diff options
author | Clément Bœsch <ubitux@gmail.com> | 2012-04-14 21:45:36 +0200 |
---|---|---|
committer | Clément Bœsch <ubitux@gmail.com> | 2012-04-27 19:19:36 +0200 |
commit | e40981b8c498da55752c42061cc401a1bb858e68 (patch) | |
tree | 67af53a40cf9484706234f06cdec80afad0f776f | |
parent | 3e1d3ebf5e1ce96675a7ec692524b96a1aaed5dd (diff) | |
download | ffmpeg-streaming-e40981b8c498da55752c42061cc401a1bb858e68.zip ffmpeg-streaming-e40981b8c498da55752c42061cc401a1bb858e68.tar.gz |
lavf/microdvd: set packet duration.
-rw-r--r-- | libavformat/microdvddec.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libavformat/microdvddec.c b/libavformat/microdvddec.c index b1b784c..4055ee1 100644 --- a/libavformat/microdvddec.c +++ b/libavformat/microdvddec.c @@ -90,6 +90,15 @@ static int64_t get_pts(const char *buf) return AV_NOPTS_VALUE; } +static int get_duration(const char *buf) +{ + int frame_start, frame_end; + + if (sscanf(buf, "{%d}{%d}", &frame_start, &frame_end) == 2) + return frame_end - frame_start; + return 0; +} + static int microdvd_read_packet(AVFormatContext *s, AVPacket *pkt) { MicroDVDContext *microdvd = s->priv_data; @@ -114,6 +123,8 @@ static int microdvd_read_packet(AVFormatContext *s, AVPacket *pkt) pkt->flags |= AV_PKT_FLAG_KEY; pkt->pos = pos; pkt->pts = pkt->dts = get_pts(buffer); + if (pkt->pts != AV_NOPTS_VALUE) // TODO: handle "{}" duration + pkt->duration = get_duration(buffer); } return res; } |