diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2007-08-09 18:37:28 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2007-08-09 18:37:28 +0000 |
commit | f13ea4e00c583d819f279a455d3f0a02e40ef0ae (patch) | |
tree | 5a2b305b2b29614e48e5b9047cb5894798820543 /libavformat | |
parent | 9031aeb1cd8b0a5b5d4e6c11824a86c9c11ddcb2 (diff) | |
download | ffmpeg-f13ea4e00c583d819f279a455d3f0a02e40ef0ae.tar.gz |
move lsb2full to common file
Originally committed as revision 10025 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/nut.c | 7 | ||||
-rw-r--r-- | libavformat/nut.h | 1 | ||||
-rw-r--r-- | libavformat/nutdec.c | 8 |
3 files changed, 9 insertions, 7 deletions
diff --git a/libavformat/nut.c b/libavformat/nut.c index 4c41db35dc..91509afbd8 100644 --- a/libavformat/nut.c +++ b/libavformat/nut.c @@ -35,3 +35,10 @@ void ff_nut_reset_ts(NUTContext *nut, AVRational time_base, int64_t val){ AV_ROUND_DOWN); } } + +int64_t ff_lsb2full(StreamContext *stream, int64_t lsb){ + int64_t mask = (1<<stream->msb_pts_shift)-1; + int64_t delta= stream->last_pts - mask/2; + return ((lsb - delta)&mask) + delta; +} + diff --git a/libavformat/nut.h b/libavformat/nut.h index a96d111d50..3c518acd4e 100644 --- a/libavformat/nut.h +++ b/libavformat/nut.h @@ -94,5 +94,6 @@ typedef struct { unsigned long av_crc04C11DB7_update(unsigned long checksum, const uint8_t *buf, unsigned int len); void ff_nut_reset_ts(NUTContext *nut, AVRational time_base, int64_t val); +int64_t ff_lsb2full(StreamContext *stream, int64_t lsb); #endif /* AVFORMAT_NUT_H */ diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c index 322ed2518e..3143f384d0 100644 --- a/libavformat/nutdec.c +++ b/libavformat/nutdec.c @@ -155,12 +155,6 @@ static int64_t find_startcode(ByteIOContext *bc, uint64_t code, int64_t pos){ } } -static int64_t lsb2full(StreamContext *stream, int64_t lsb){ - int64_t mask = (1<<stream->msb_pts_shift)-1; - int64_t delta= stream->last_pts - mask/2; - return ((lsb - delta)&mask) + delta; -} - static int nut_probe(AVProbeData *p){ int i; uint64_t code= 0; @@ -655,7 +649,7 @@ static int decode_frame_header(NUTContext *nut, int64_t *pts, int *stream_id, in int coded_pts= get_v(bc); //FIXME check last_pts validity? if(coded_pts < (1<<stc->msb_pts_shift)){ - *pts=lsb2full(stc, coded_pts); + *pts=ff_lsb2full(stc, coded_pts); }else *pts=coded_pts - (1<<stc->msb_pts_shift); }else |