* - dnet is twisted "The byte order of the data is reversed
* from standard AC3" but ok
* - 28_8 is ok.
- * - sipr should be fine, but our decoder suxx :)
+ * - sipr doesn't work
* - ralf is unsupported, but hardly any sample exist.
* - mp3 is unsupported, one sample exists...
*
#include <vlc_charset.h>
#include <vlc_meta.h>
+#include <assert.h>
+
/*****************************************************************************
* Module descriptor
*****************************************************************************/
int i_track;
real_track_t **track;
- int i_buffer;
+ size_t i_buffer;
uint8_t buffer[65536];
int64_t i_pcr;
p_sys->i_data_offset = 0;
p_sys->i_track = 0;
p_sys->track = NULL;
- p_sys->i_pcr = 0;
+ p_sys->i_pcr = VLC_TS_INVALID;
p_sys->b_seek = false;
p_sys->b_real_audio = b_real_audio;
if( stream_Read( p_demux->s, header, 12 ) < 12 )
return 0;
//const int i_version = GetWBE( &header[0] );
- const int i_size = GetWBE( &header[2] ) - 12;
+ const size_t i_size = GetWBE( &header[2] ) - 12;
const int i_id = GetWBE( &header[4] );
- const int64_t i_pts = 1 + 1000 * GetDWBE( &header[6] );
+ const int64_t i_pts = VLC_TS_0 + 1000 * GetDWBE( &header[6] );
const int i_flags= header[11]; /* flags 0x02 -> keyframe */
p_sys->i_data_packets++;
-
- if( i_size <= 0 )
+ if( i_size > sizeof(p_sys->buffer) )
{
msg_Err( p_demux, "Got a NUKK size to read. (Invalid format?)" );
return 1;
}
- assert( i_size <= sizeof(p_sys->buffer) );
-
p_sys->i_buffer = stream_Read( p_demux->s, p_sys->buffer, i_size );
if( p_sys->i_buffer < i_size )
return 0;
}
/* Update PCR */
- mtime_t i_pcr = 0;
+ mtime_t i_pcr = VLC_TS_INVALID;
for( int i = 0; i < p_sys->i_track; i++ )
{
real_track_t *tk = p_sys->track[i];
- if( i_pcr <= 0 || ( tk->i_last_dts > 0 && tk->i_last_dts < i_pcr ) )
+ if( i_pcr <= VLC_TS_INVALID || ( tk->i_last_dts > VLC_TS_INVALID && tk->i_last_dts < i_pcr ) )
i_pcr = tk->i_last_dts;
}
- if( i_pcr > 0 && i_pcr != p_sys->i_pcr )
+ if( i_pcr > VLC_TS_INVALID && i_pcr != p_sys->i_pcr )
{
p_sys->i_pcr = i_pcr;
es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_sys->i_pcr );
so use duration to determin the position at first */
if( p_sys->i_our_duration > 0 )
{
- *pf = (double)p_sys->i_pcr / 1000.0 / p_sys->i_our_duration;
+ if( p_sys->i_pcr > VLC_TS_INVALID )
+ *pf = (double)p_sys->i_pcr / 1000.0 / p_sys->i_our_duration;
+ else
+ *pf = 0.0;
return VLC_SUCCESS;
}
- *pf = 0.0;
i64 = stream_Size( p_demux->s );
if( i64 > 0 )
*pf = (double)1.0*stream_Tell( p_demux->s ) / (double)i64;
+ else
+ *pf = 0.0;
return VLC_SUCCESS;
case DEMUX_GET_TIME:
if( p_sys->i_our_duration > 0 )
{
- *pi64 = p_sys->i_pcr;
+ *pi64 = p_sys->i_pcr > VLC_TS_INVALID ? p_sys->i_pcr : 0;
return VLC_SUCCESS;
}
{
/* it is a rtsp stream , it is specials in access/rtsp/... */
msg_Dbg(p_demux, "Seek in real rtsp stream!");
- p_sys->i_pcr = INT64_C(1000) * ( p_sys->i_our_duration * f );
+ p_sys->i_pcr = VLC_TS_0 + INT64_C(1000) * ( p_sys->i_our_duration * f );
p_sys->b_seek = true;
- return stream_Seek( p_demux->s, p_sys->i_pcr );
+ return stream_Seek( p_demux->s, p_sys->i_pcr - VLC_TS_0 );
}
return ControlSeekByte( p_demux, i64 );
case DEMUX_GET_LENGTH:
pi64 = (int64_t*)va_arg( args, int64_t * );
- *pi64 = 0;
if( p_sys->i_our_duration <= 0 )
+ {
+ *pi64 = 0;
return VLC_EGENERIC;
+ }
/* our stored duration is in ms, so... */
*pi64 = INT64_C(1000) * p_sys->i_our_duration;
{
demux_sys_t *p_sys = p_demux->p_sys;
- if( i_dts > 0 )
+ if( i_dts > VLC_TS_INVALID )
tk->i_last_dts = i_dts;
- if( p_sys->i_pcr > 0 || i_dts <= 0 )
+ if( p_sys->i_pcr > VLC_TS_INVALID || i_dts <= VLC_TS_INVALID )
return;
p_sys->i_pcr = i_dts;
}
tk->p_frame->i_dts = i_dts;
- tk->p_frame->i_pts = 0;
+ tk->p_frame->i_pts = VLC_TS_INVALID;
if( i_flags & 0x02 )
tk->p_frame->i_flags |= BLOCK_FLAG_TYPE_I;
- i_dts = 0;
+ i_dts = VLC_TS_INVALID;
}
int i_frame_data;
memcpy( p_block->p_buffer, p_buf, tk->i_subpacket_size );
p_block->i_dts =
- p_block->i_pts = 0;
+ p_block->i_pts = VLC_TS_INVALID;
p_buf += tk->i_subpacket_size;
memcpy( p_block->p_buffer, p_buf, tk->i_coded_frame_size );
p_block->i_dts =
- p_block->i_pts = i_index == 0 ? i_pts : 0;
+ p_block->i_pts = i_index == 0 ? i_pts : VLC_TS_INVALID;
p_buf += tk->i_coded_frame_size;
if( p_sys->i_buffer < 2 )
return;
- int i_sub = (p_sys->buffer[1] >> 4)&0x0f;
+ unsigned i_sub = (p_sys->buffer[1] >> 4)&0x0f;
if( p_sys->i_buffer < 2+2*i_sub )
return;
uint8_t *p_sub = &p_sys->buffer[2+2*i_sub];
- for( int i = 0; i < i_sub; i++ )
+ for( unsigned i = 0; i < i_sub; i++ )
{
const int i_sub_size = GetWBE( &p_sys->buffer[2+i*2] );
block_t *p_block = block_New( p_demux, i_sub_size );
p_sub += i_sub_size;
p_block->i_dts =
- p_block->i_pts = ( i == 0 ? i_pts : 0 );
+ p_block->i_pts = i == 0 ? i_pts : VLC_TS_INVALID;
CheckPcr( p_demux, tk, p_block->i_pts );
es_out_Send( p_demux->out, tk->p_es, p_block );
if( i_size > 0 )
{
CodecParse( p_demux, i_size, i_num );
- if( stream_Read( p_demux->s, NULL, i_size ) < i_size )
+ unsigned size = stream_Read( p_demux->s, NULL, i_size );
+ if( size < i_size )
return VLC_EGENERIC;
}
return VLC_SUCCESS;
if( i_data < 6 )
return VLC_EGENERIC;
-
+
int i_flavor = 0;
int i_coded_frame_size = 0;
int i_subpacket_h = 0;