summaryrefslogtreecommitdiff
path: root/libavformat/omadec.c
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2015-01-29 01:17:43 +0100
committerLuca Barbato <lu_zero@gentoo.org>2015-02-07 15:36:15 +0100
commite352520e3ed7f08f19e63cd60e95da6bb6f037c1 (patch)
tree5be996cfa86b3bd41bc6228f7e98c2b68d3d2f2f /libavformat/omadec.c
parent8029af586fd5a5f2a0803001f9eff386e5545fe2 (diff)
oma: Report a timestamp
Reported-By: jb@videolan.org Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Diffstat (limited to 'libavformat/omadec.c')
-rw-r--r--libavformat/omadec.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/libavformat/omadec.c b/libavformat/omadec.c
index 9d9c7264f7..8dc35d17c2 100644
--- a/libavformat/omadec.c
+++ b/libavformat/omadec.c
@@ -47,6 +47,7 @@
#include "internal.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/des.h"
+#include "libavutil/mathematics.h"
#include "oma.h"
#include "pcm.h"
#include "id3v2.h"
@@ -418,9 +419,12 @@ static int oma_read_header(AVFormatContext *s)
static int oma_read_packet(AVFormatContext *s, AVPacket *pkt)
{
- OMAContext *oc = s->priv_data;
- int packet_size = s->streams[0]->codec->block_align;
- int ret = av_get_packet(s->pb, pkt, packet_size);
+ OMAContext *oc = s->priv_data;
+ AVStream *st = s->streams[0];
+ int packet_size = st->codec->block_align;
+ int byte_rate = st->codec->bit_rate >> 3;
+ int64_t pos = avio_tell(s->pb);
+ int ret = av_get_packet(s->pb, pkt, packet_size);
if (ret < packet_size)
pkt->flags |= AV_PKT_FLAG_CORRUPT;
@@ -432,6 +436,12 @@ static int oma_read_packet(AVFormatContext *s, AVPacket *pkt)
pkt->stream_index = 0;
+ if (pos > 0) {
+ pkt->pts =
+ pkt->dts = av_rescale(pos, st->time_base.den,
+ byte_rate * (int64_t)st->time_base.num);
+ }
+
if (oc->encrypted) {
/* previous unencrypted block saved in IV for
* the next packet (CBC mode) */