extract video framerate from PSI descriptiors
This commit is contained in:
parent
26cee09253
commit
dbf7b7228e
4 changed files with 15 additions and 5 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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 */
|
||||
|
|
15
psi.c
15
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;
|
||||
|
|
Loading…
Add table
Reference in a new issue