diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2008-01-12 00:24:10 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2008-01-12 00:24:10 +0000 |
commit | f5b410312fb201e819f158c78d3a8266dd07eae9 (patch) | |
tree | 11660397a543845fcf9356a1cc4f2caa09534df0 /libavformat/raw.c | |
parent | 2024c2262b16acdb7fec850766ad06bd494355f7 (diff) | |
download | ffmpeg-streaming-f5b410312fb201e819f158c78d3a8266dd07eae9.zip ffmpeg-streaming-f5b410312fb201e819f158c78d3a8266dd07eae9.tar.gz |
Set pts/dts in raw (yuv,rgb,pcm) demuxers.
Originally committed as revision 11513 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/raw.c')
-rw-r--r-- | libavformat/raw.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/libavformat/raw.c b/libavformat/raw.c index 7efa716..d4b1389 100644 --- a/libavformat/raw.c +++ b/libavformat/raw.c @@ -105,7 +105,7 @@ static int raw_read_header(AVFormatContext *s, AVFormatParameters *ap) static int raw_read_packet(AVFormatContext *s, AVPacket *pkt) { - int ret, size; + int ret, size, bps; // AVStream *st = s->streams[0]; size= RAW_PACKET_SIZE; @@ -119,6 +119,12 @@ static int raw_read_packet(AVFormatContext *s, AVPacket *pkt) /* note: we need to modify the packet size here to handle the last packet */ pkt->size = ret; + + bps= av_get_bits_per_sample(s->streams[0]->codec->codec_id); + assert(bps); // if false there IS a bug elsewhere (NOT in this function) + pkt->dts= + pkt->pts= pkt->pos*8 / (bps * s->streams[0]->codec->channels); + return ret; } @@ -847,6 +853,8 @@ static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt) return -1; ret= av_get_packet(s->pb, pkt, packet_size); + pkt->pts= + pkt->dts= pkt->pos / packet_size; pkt->stream_index = 0; if (ret != packet_size) { |