[bTSstream-devel] [Git][videolan/bitstream][master] dvb/si/datetime: add helpers for duration in minutes (desc 58)

Christophe Massiot (@cmassiot) gitlab at videolan.org
Fri Aug 18 11:57:25 UTC 2023



Christophe Massiot pushed to branch master at VideoLAN / bitstream


Commits:
2dc17127 by Christophe Massiot at 2023-08-18T13:55:54+02:00
dvb/si/datetime: add helpers for duration in minutes (desc 58)

- - - - -


1 changed file:

- dvb/si/datetime.h


Changes:

=====================================
dvb/si/datetime.h
=====================================
@@ -75,6 +75,13 @@ static inline void dvb_time_decode_bcd(uint32_t bcd, int *seconds, int *hour, in
     if (seconds)
         *seconds = *hour * 3600 + *min * 60 + *sec;
 }
+
+static inline void dvb_time_decode_bcd16(uint16_t bcd, int *seconds, int *hour, int *min) {
+    *hour = bcd2dec( (bcd >>  8) & 0xff );
+    *min  = bcd2dec(  bcd        & 0xff );
+    if (seconds)
+        *seconds = *hour * 3600 + *min * 60;
+}
 #undef bcd2dec
 
 static inline time_t dvb_time_decode_UTC(uint64_t UTC_time) {
@@ -122,6 +129,18 @@ static inline uint32_t dvb_time_encode_duration(unsigned int duration_sec)
 
     return ret;
 }
+
+static inline uint32_t dvb_time_encode_duration16(unsigned int duration_min)
+{
+    unsigned int t_min, t_hour, ret;
+    t_min  = duration_min % 60;
+    t_hour = duration_min / 60;
+
+    ret  = dec2bcd(t_hour) << 8;
+    ret |= dec2bcd(t_min );
+
+    return ret;
+}
 #undef dec2bcd
 
 static inline time_t dvb_time_format_UTC(uint64_t UTC_time, struct tm *tm, char *output) {



View it on GitLab: https://code.videolan.org/videolan/bitstream/-/commit/2dc1712789687d90f4b28ea60a5cd39e332495e9

-- 
View it on GitLab: https://code.videolan.org/videolan/bitstream/-/commit/2dc1712789687d90f4b28ea60a5cd39e332495e9
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the biTStream-devel mailing list