Browse Source

oma: Report a timestamp

Reported-By: jb@videolan.org

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
tags/n2.6
Luca Barbato 10 years ago
parent
commit
e352520e3e
1 changed files with 13 additions and 3 deletions
  1. +13
    -3
      libavformat/omadec.c

+ 13
- 3
libavformat/omadec.c View File

@@ -47,6 +47,7 @@
#include "internal.h" #include "internal.h"
#include "libavutil/intreadwrite.h" #include "libavutil/intreadwrite.h"
#include "libavutil/des.h" #include "libavutil/des.h"
#include "libavutil/mathematics.h"
#include "oma.h" #include "oma.h"
#include "pcm.h" #include "pcm.h"
#include "id3v2.h" #include "id3v2.h"
@@ -418,9 +419,12 @@ static int oma_read_header(AVFormatContext *s)


static int oma_read_packet(AVFormatContext *s, AVPacket *pkt) 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) if (ret < packet_size)
pkt->flags |= AV_PKT_FLAG_CORRUPT; pkt->flags |= AV_PKT_FLAG_CORRUPT;
@@ -432,6 +436,12 @@ static int oma_read_packet(AVFormatContext *s, AVPacket *pkt)


pkt->stream_index = 0; 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) { if (oc->encrypted) {
/* previous unencrypted block saved in IV for /* previous unencrypted block saved in IV for
* the next packet (CBC mode) */ * the next packet (CBC mode) */


Loading…
Cancel
Save