]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
extract video framerate from PSI descriptiors
authorAndreas Öman <andreas@lonelycoder.com>
Sun, 10 Feb 2008 13:55:29 +0000 (13:55 +0000)
committerAndreas Öman <andreas@lonelycoder.com>
Sun, 10 Feb 2008 13:55:29 +0000 (13:55 +0000)
dvb_support.h
parsers.c
parsers.h
psi.c

index cbf4264bc4fb2edfd79172eb99ed6669826f77a4..49cc480571cd2c03b7505adf819014db438fd861 100644 (file)
@@ -26,6 +26,7 @@
 #ifndef DVB_SUPPORT_H
 #define DVB_SUPPORT_H
 
+#define DVB_DESC_VIDEO_STREAM 0x02
 #define DVB_DESC_CA           0x09
 #define DVB_DESC_LANGUAGE     0x0a
 
index d2efaae180bee7633397c8a80de5dab07337a5ec..be7f5ce00188b3a771fd895fb14328f6a2920539 100644 (file)
--- a/parsers.c
+++ b/parsers.c
@@ -409,7 +409,7 @@ parse_pes_header(th_transport_t *t, th_stream_t *st, uint8_t *buf, size_t len)
 /**
  * MPEG2VIDEO frame duration table (in 90kHz clock domain)
  */
-const static unsigned int mpeg2video_framedurations[16] = {
+const unsigned int mpeg2video_framedurations[16] = {
   0,
   3753,
   3750,
index 2f6c9488dba36e30c008bb8ba27a904762054661..6b610e14e6b315529af13e5fa71c3f1c31eb1f60 100644 (file)
--- a/parsers.h
+++ b/parsers.h
@@ -29,4 +29,6 @@ void parse_compute_pts(th_transport_t *t, th_stream_t *st, th_pkt_t *pkt);
 
 void parser_enqueue_packet(th_transport_t *t, th_stream_t *st, th_pkt_t *pkt);
 
+extern const unsigned int mpeg2video_framedurations[16];
+
 #endif /* PARSERS_H */
diff --git a/psi.c b/psi.c
index 8e35930540a752870a1e0a6120cc729815db9dcb..203fe5ec7bebe9a9f71f731ff06622d53c5e844b 100644 (file)
--- a/psi.c
+++ b/psi.c
@@ -30,6 +30,7 @@
 #include "dvb_support.h"
 #include "tsdemux.h"
 #include "strtab.h"
+#include "parsers.h"
 
 int
 psi_section_reassemble(psi_section_t *ps, uint8_t *data, int len, 
@@ -177,7 +178,7 @@ psi_parse_pmt(th_transport_t *t, uint8_t *ptr, int len, int chksvcid)
   tv_streamtype_t hts_stream_type;
   th_stream_t *st;
   char lang[4];
-
+  int frameduration;
   if(len < 9)
     return -1;
 
@@ -222,7 +223,7 @@ psi_parse_pmt(th_transport_t *t, uint8_t *ptr, int len, int chksvcid)
 
     ptr += 5;
     len -= 5;
-
+    frameduration = 0;
     hts_stream_type = 0;
 
     switch(estype) {
@@ -253,6 +254,10 @@ psi_parse_pmt(th_transport_t *t, uint8_t *ptr, int len, int chksvcid)
        break;
 
       switch(dtag) {
+      case DVB_DESC_VIDEO_STREAM:
+       frameduration = mpeg2video_framedurations[(ptr[0] >> 3) & 0xf];
+       break;
+
       case DVB_DESC_LANGUAGE:
        memcpy(lang, ptr, 3);
        break;
@@ -276,10 +281,12 @@ psi_parse_pmt(th_transport_t *t, uint8_t *ptr, int len, int chksvcid)
     if(hts_stream_type != 0) {
       st = transport_add_stream(t, pid, hts_stream_type);
       st->st_tb = (AVRational){1, 90000};
-
       memcpy(st->st_lang, lang, 4);
+
+      if(st->st_frame_duration == 0)
+       st->st_frame_duration = frameduration;
     }
-  } 
+  }
 
   t->tht_pmt_seen = 1;
   return 0;