[vlc-devel] [PATCH] demux: remove "cannot peek" messages in probes
RĂ©mi Denis-Courmont
remi at remlab.net
Wed Jul 22 16:10:16 CEST 2020
If there was an error while reading, the access should actually have
printed it already. So that leaves unexpectedly short input, in other
words not the right file format.
These messages are more confusing than helpful.
---
modules/demux/avformat/demux.c | 3 ---
modules/demux/mpeg/es.c | 8 ++------
modules/demux/mpeg/mpgv.c | 3 ---
modules/demux/mpeg/ps.c | 3 ---
modules/demux/mpeg/ts.c | 4 +---
modules/demux/nsv.c | 3 ---
modules/demux/rawdv.c | 5 +----
7 files changed, 4 insertions(+), 25 deletions(-)
diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
index ad8be31403..11c15dad24 100644
--- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c
@@ -229,10 +229,7 @@ static int avformat_ProbeDemux( vlc_object_t *p_this,
/* Init Probe data */
pd.buf_size = vlc_stream_Peek( p_demux->s, &peek, 2048 + 213 );
if( pd.buf_size <= 0 )
- {
- msg_Warn( p_demux, "cannot peek" );
return VLC_EGENERIC;
- }
pd.buf = malloc( pd.buf_size + AVPROBE_PADDING_SIZE );
if( unlikely(pd.buf == NULL) )
diff --git a/modules/demux/mpeg/es.c b/modules/demux/mpeg/es.c
index 2371ddbde3..6e98c7a472 100644
--- a/modules/demux/mpeg/es.c
+++ b/modules/demux/mpeg/es.c
@@ -820,10 +820,8 @@ static int GenericProbe( demux_t *p_demux, uint64_t *pi_offset,
const ssize_t i_peek = vlc_stream_Peek( p_demux->s, &p_peek, i_probe );
if( i_peek < 0 || (size_t)i_peek < i_skip + i_check_size )
- {
- msg_Dbg( p_demux, "cannot peek" );
return VLC_EGENERIC;
- }
+
for( ;; )
{
if( i_skip + i_check_size > i_peek )
@@ -1268,10 +1266,8 @@ static int AacProbe( demux_t *p_demux, uint64_t *pi_offset )
/* peek the begining (10 is for adts header) */
if( vlc_stream_Peek( p_demux->s, &p_peek, 10 ) < 10 )
- {
- msg_Dbg( p_demux, "cannot peek" );
return VLC_EGENERIC;
- }
+
if( !strncmp( (char *)p_peek, "ADIF", 4 ) )
{
msg_Err( p_demux, "ADIF file. Not yet supported. (Please report)" );
diff --git a/modules/demux/mpeg/mpgv.c b/modules/demux/mpeg/mpgv.c
index 234235e143..48a029c5dc 100644
--- a/modules/demux/mpeg/mpgv.c
+++ b/modules/demux/mpeg/mpgv.c
@@ -111,10 +111,7 @@ static int Open( vlc_object_t * p_this )
es_format_t fmt;
if( vlc_stream_Peek( p_demux->s, &p_peek, 8 ) < 8 )
- {
- msg_Dbg( p_demux, "cannot peek" );
return VLC_EGENERIC;
- }
if( p_demux->obj.force )
b_forced = true;
diff --git a/modules/demux/mpeg/ps.c b/modules/demux/mpeg/ps.c
index 8b0b8c0d5d..99aac651ee 100644
--- a/modules/demux/mpeg/ps.c
+++ b/modules/demux/mpeg/ps.c
@@ -140,10 +140,7 @@ static int OpenCommon( vlc_object_t *p_this, bool b_force )
i_peek = vlc_stream_Peek( p_demux->s, &p_peek, 16 );
if( i_peek < 16 )
- {
- msg_Dbg( p_demux, "cannot peek" );
return VLC_EGENERIC;
- }
if( !memcmp( p_peek, "PSMF", 4 ) &&
(GetDWBE( &p_peek[4] ) & 0x30303030) == 0x30303030 )
diff --git a/modules/demux/mpeg/ts.c b/modules/demux/mpeg/ts.c
index 3bd6d0e001..bee529720d 100644
--- a/modules/demux/mpeg/ts.c
+++ b/modules/demux/mpeg/ts.c
@@ -226,10 +226,8 @@ static int DetectPacketSize( demux_t *p_demux, unsigned *pi_header_size, int i_o
/* Check next 3 sync bytes */
int i_peek = i_offset + TS_PACKET_SIZE_MAX * 3 + i_sync + 1;
if( ( vlc_stream_Peek( p_demux->s, &p_peek, i_peek ) ) < i_peek )
- {
- msg_Dbg( p_demux, "cannot peek" );
return -1;
- }
+
if( p_peek[i_offset + i_sync + 1 * TS_PACKET_SIZE_188] == 0x47 &&
p_peek[i_offset + i_sync + 2 * TS_PACKET_SIZE_188] == 0x47 &&
p_peek[i_offset + i_sync + 3 * TS_PACKET_SIZE_188] == 0x47 )
diff --git a/modules/demux/nsv.c b/modules/demux/nsv.c
index 8e6374048c..62cd52d63e 100644
--- a/modules/demux/nsv.c
+++ b/modules/demux/nsv.c
@@ -160,10 +160,7 @@ static int Demux( demux_t *p_demux )
for( ;; )
{
if( vlc_stream_Peek( p_demux->s, &p_peek, 8 ) < 8 )
- {
- msg_Warn( p_demux, "cannot peek" );
return VLC_DEMUXER_EOF;
- }
if( !memcmp( p_peek, "NSVf", 4 ) )
{
diff --git a/modules/demux/rawdv.c b/modules/demux/rawdv.c
index 8e56b44b99..d16ad697ed 100644
--- a/modules/demux/rawdv.c
+++ b/modules/demux/rawdv.c
@@ -142,11 +142,8 @@ static int Open( vlc_object_t * p_this )
if( vlc_stream_Peek( p_demux->s, &p_peek, DV_PAL_FRAME_SIZE ) <
DV_NTSC_FRAME_SIZE )
- {
- /* Stream too short ... */
- msg_Err( p_demux, "cannot peek()" );
return VLC_EGENERIC;
- }
+
p_peek_backup = p_peek;
/* fill in the dv_id_t structure */
--
2.28.0.rc1
More information about the vlc-devel
mailing list