move lsb2full to common file
[ffmpeg.git] / libavformat / nut.c
index 4c41db3..91509af 100644 (file)
@@ -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;
+}
+