[vlc-devel] [PATCH 15/16] demux:asf: handle the i_pkt_time in mtime_t instead of milliseconds
Steve Lhomme
robux4 at ycbcr.xyz
Thu Jun 7 11:59:59 CEST 2018
---
modules/demux/asf/asfpacket.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/modules/demux/asf/asfpacket.c b/modules/demux/asf/asfpacket.c
index b80fc9bc3c..9e6d6e5277 100644
--- a/modules/demux/asf/asfpacket.c
+++ b/modules/demux/asf/asfpacket.c
@@ -207,7 +207,7 @@ static int DemuxPayload(asf_packet_sys_t *p_packetsys, asf_packet_t *pkt, int i_
if (GetValue2b(&i_replicated_data_length, pkt->p_peek, &pkt->i_skip, pkt->left - pkt->i_skip, pkt->property) < 0)
return -1;
- int64_t i_pkt_time;
+ mtime_t i_pkt_time;
uint8_t i_pkt_time_delta = 0;
uint32_t i_payload_data_length = 0;
uint32_t i_temp_payload_length = 0;
@@ -229,20 +229,20 @@ static int DemuxPayload(asf_packet_sys_t *p_packetsys, asf_packet_t *pkt, int i_
if( i_replicated_data_length > 7 ) // should be at least 8 bytes
{
/* Followed by 2 optional DWORDS, offset in media and *media* presentation time */
- i_pkt_time = (mtime_t)GetDWLE( pkt->p_peek + pkt->i_skip + 4 );
+ i_pkt_time = MS_TO_MTIME(GetDWLE( pkt->p_peek + pkt->i_skip + 4 ));
/* Parsing extensions, See 7.3.1 */
ParsePayloadExtensions( p_packetsys, p_tkinfo,
&pkt->p_peek[pkt->i_skip + 8],
i_replicated_data_length - 8,
&b_packet_keyframe );
- i_pkt_time -= *p_packetsys->pi_preroll/1000;
+ i_pkt_time -= *p_packetsys->pi_preroll;
pkt->i_skip += i_replicated_data_length;
}
else if ( i_replicated_data_length == 0 )
{
/* optional DWORDS missing */
- i_pkt_time = pkt->send_time/1000;
+ i_pkt_time = pkt->send_time;
}
/* Compressed payload */
else if( i_replicated_data_length == 1 )
@@ -251,8 +251,8 @@ static int DemuxPayload(asf_packet_sys_t *p_packetsys, asf_packet_t *pkt, int i_
/* Next byte is *media* Presentation Time Delta */
i_pkt_time_delta = pkt->p_peek[pkt->i_skip];
b_ignore_pts = false;
- i_pkt_time = (mtime_t)i_media_object_offset;
- i_pkt_time -= *p_packetsys->pi_preroll/1000;
+ i_pkt_time = MS_TO_MTIME(i_media_object_offset);
+ i_pkt_time -= *p_packetsys->pi_preroll;
pkt->i_skip++;
i_media_object_offset = 0;
}
@@ -273,7 +273,6 @@ static int DemuxPayload(asf_packet_sys_t *p_packetsys, asf_packet_t *pkt, int i_
bool b_preroll_done = ( pkt->send_time > (*p_packetsys->pi_preroll_start + *p_packetsys->pi_preroll) );
if (i_pkt_time < 0) i_pkt_time = 0; // FIXME?
- i_pkt_time *= 1000;
if( pkt->multiple ) {
if (GetValue2b(&i_temp_payload_length, pkt->p_peek, &pkt->i_skip, pkt->left - pkt->i_skip, pkt->length_type) < 0)
--
2.17.0
More information about the vlc-devel
mailing list