[vlc-commits] demux: asf: add multiple packets parameter
Francois Cartegnie
git at videolan.org
Tue Nov 17 13:13:38 CET 2020
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Nov 5 17:23:35 2020 +0100| [599e286d6239c7f33372e8610b5785691f920e74] | committer: Francois Cartegnie
demux: asf: add multiple packets parameter
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=599e286d6239c7f33372e8610b5785691f920e74
---
modules/demux/asf/asf.c | 2 ++
modules/demux/asf/asfpacket.c | 36 +++++++++++++++++++++++++++---------
modules/demux/asf/asfpacket.h | 1 +
modules/demux/mp4/mp4.c | 1 +
4 files changed, 31 insertions(+), 9 deletions(-)
diff --git a/modules/demux/asf/asf.c b/modules/demux/asf/asf.c
index e16f621bc8..6f9f0af248 100644
--- a/modules/demux/asf/asf.c
+++ b/modules/demux/asf/asf.c
@@ -179,6 +179,7 @@ static int Open( vlc_object_t * p_this )
p_sys->packet_sys.s = p_demux->s;
p_sys->packet_sys.logger = p_demux->obj.logger;
p_sys->packet_sys.b_deduplicate = false;
+ p_sys->packet_sys.b_can_hold_multiple_packets = false;
p_sys->packet_sys.pf_doskip = Packet_DoSkip;
p_sys->packet_sys.pf_send = Packet_Enqueue;
p_sys->packet_sys.pf_gettrackinfo = Packet_GetTrackInfo;
@@ -1361,6 +1362,7 @@ static int DemuxInit( demux_t *p_demux )
p_sys->packet_sys.pi_preroll = &p_sys->p_fp->i_preroll;
p_sys->packet_sys.pi_preroll_start = &p_sys->i_preroll_start;
+ p_sys->packet_sys.b_can_hold_multiple_packets = false;
return VLC_SUCCESS;
diff --git a/modules/demux/asf/asfpacket.c b/modules/demux/asf/asfpacket.c
index 2d009db3b4..bb3116ecb3 100644
--- a/modules/demux/asf/asfpacket.c
+++ b/modules/demux/asf/asfpacket.c
@@ -526,19 +526,37 @@ int DemuxASFPacket( asf_packet_sys_t *p_packetsys,
if( pkt.left > 0 )
{
+ size_t toskip;
+ if( pkt.left > pkt.padding_length &&
+ !p_packetsys->b_can_hold_multiple_packets )
+ {
+ toskip = pkt.left;
#ifdef ASF_DEBUG
- if( pkt.left > pkt.padding_length )
- vlc_warning( p_packetsys->logger, "Didn't read %"PRIu32" bytes in the packet",
- pkt.left - pkt.padding_length );
+ vlc_warning( p_packetsys->logger, "Didn't read %"PRIu32" bytes in the packet at %"PRIu64,
+ pkt.left - pkt.padding_length, vlc_stream_Tell(p_packetsys->s) );
+#endif
+ }
else if( pkt.left < pkt.padding_length )
- vlc_warning( p_packetsys->logger, "Read %"PRIu32" too much bytes in the packet",
- pkt.padding_length - pkt.left );
+ {
+ toskip = 0;
+#ifdef ASF_DEBUG
+ vlc_warning( p_packetsys->logger, "Read %"PRIu32" too much bytes from the packet",
+ pkt.padding_length - pkt.left );
#endif
- i_return = vlc_stream_Read( p_packetsys->s, NULL, pkt.left );
- if( i_return < 0 || (size_t) i_return < pkt.left )
+ }
+ else
{
- vlc_error( p_packetsys->logger, "cannot skip data, EOF ?" );
- return 0;
+ toskip = pkt.padding_length;
+ }
+
+ if( toskip )
+ {
+ i_return = vlc_stream_Read( p_packetsys->s, NULL, toskip );
+ if( i_return < 0 || (size_t) i_return < toskip )
+ {
+ vlc_error( p_packetsys->logger, "cannot skip data, EOF ?" );
+ return 0;
+ }
}
}
diff --git a/modules/demux/asf/asfpacket.h b/modules/demux/asf/asfpacket.h
index 5dae1af491..6d52a59304 100644
--- a/modules/demux/asf/asfpacket.h
+++ b/modules/demux/asf/asfpacket.h
@@ -57,6 +57,7 @@ struct asf_packet_sys_s
vlc_tick_t *pi_preroll;
vlc_tick_t *pi_preroll_start;
bool b_deduplicate; /* Flip4mac repeats data object payloads */
+ bool b_can_hold_multiple_packets; /* Flip4mac passes multiple buffers */
/* callbacks */
void (*pf_send)(asf_packet_sys_t *, uint8_t, block_t **);
diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index 55a7b8a480..e908c678cd 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -1170,6 +1170,7 @@ static int Open( vlc_object_t * p_this )
p_sys->asfpacketsys.pi_preroll = &p_sys->i_preroll;
p_sys->asfpacketsys.pi_preroll_start = &p_sys->i_preroll_start;
p_sys->asfpacketsys.b_deduplicate = true;
+ p_sys->asfpacketsys.b_can_hold_multiple_packets = false;
p_sys->asfpacketsys.pf_doskip = NULL;
p_sys->asfpacketsys.pf_send = MP4ASF_Send;
p_sys->asfpacketsys.pf_gettrackinfo = MP4ASF_GetTrackInfo;
More information about the vlc-commits
mailing list