diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-02-07 21:00:19 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-02-07 21:01:52 +0100 |
commit | 7474ea74952b4d1be3bcd07efca5bd6c44b36b7a (patch) | |
tree | 5c8aec6260ba59e2cda601f6bd71b6d36486d88b /libavformat/omadec.c | |
parent | 89c7332b38256760f447f7eb81020d56278ca734 (diff) | |
parent | e352520e3ed7f08f19e63cd60e95da6bb6f037c1 (diff) | |
download | ffmpeg-7474ea74952b4d1be3bcd07efca5bd6c44b36b7a.tar.gz |
Merge commit 'e352520e3ed7f08f19e63cd60e95da6bb6f037c1'
* commit 'e352520e3ed7f08f19e63cd60e95da6bb6f037c1':
oma: Report a timestamp
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/omadec.c')
-rw-r--r-- | libavformat/omadec.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/libavformat/omadec.c b/libavformat/omadec.c index 42954130bc..b08005538c 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" @@ -412,9 +413,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; @@ -426,6 +430,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) */ |