es_out_id_t *p_es;
+ /* Avi Index */
avi_entry_t *p_index;
- unsigned int i_idxnb;
- unsigned int i_idxmax;
+ unsigned int i_idxnb;
+ unsigned int i_idxmax;
- unsigned int i_idxposc; /* numero of chunk */
- unsigned int i_idxposb; /* byte in the current chunk */
+ unsigned int i_idxposc; /* numero of chunk */
+ unsigned int i_idxposb; /* byte in the current chunk */
/* For VBR audio only */
- unsigned int i_blockno;
- unsigned int i_blocksize;
+ unsigned int i_blockno;
+ unsigned int i_blocksize;
+
+ /* For muxed streams */
+ stream_t *p_out_muxed;
} avi_track_t;
struct demux_sys_t
mtime_t i_length;
vlc_bool_t b_seekable;
+ vlc_bool_t b_muxed;
avi_chunk_t ck_root;
vlc_bool_t b_odml;
p_sys->i_length = 0;
p_sys->i_movi_lastchunk_pos = 0;
p_sys->b_odml = VLC_FALSE;
+ p_sys->b_muxed = VLC_FALSE;
p_sys->i_track = 0;
p_sys->track = NULL;
p_sys->meta = NULL;
/* now read info on each stream and create ES */
for( i = 0 ; i < i_track; i++ )
{
- avi_track_t *tk = malloc( sizeof( avi_track_t ) );
- avi_chunk_list_t *p_strl = AVI_ChunkFind( p_hdrl, AVIFOURCC_strl, i );
- avi_chunk_strh_t *p_strh = AVI_ChunkFind( p_strl, AVIFOURCC_strh, 0 );
- avi_chunk_STRING_t *p_strn = AVI_ChunkFind( p_strl, AVIFOURCC_strn, 0 );
- avi_chunk_strf_auds_t *p_auds;
- avi_chunk_strf_vids_t *p_vids;
+ avi_track_t *tk = malloc( sizeof( avi_track_t ) );
+ avi_chunk_list_t *p_strl = AVI_ChunkFind( p_hdrl, AVIFOURCC_strl, i );
+ avi_chunk_strh_t *p_strh = AVI_ChunkFind( p_strl, AVIFOURCC_strh, 0 );
+ avi_chunk_STRING_t *p_strn = AVI_ChunkFind( p_strl, AVIFOURCC_strn, 0 );
+ avi_chunk_strf_auds_t *p_auds = NULL;
+ avi_chunk_strf_vids_t *p_vids = NULL;
es_format_t fmt;
tk->b_activated = VLC_FALSE;
tk->i_blockno = 0;
tk->i_blocksize = 0;
+ tk->p_es = NULL;
+ tk->p_out_muxed = NULL;
+
p_vids = (avi_chunk_strf_vids_t*)AVI_ChunkFind( p_strl, AVIFOURCC_strf, 0 );
p_auds = (avi_chunk_strf_auds_t*)AVI_ChunkFind( p_strl, AVIFOURCC_strf, 0 );
es_format_Init( &fmt, SPU_ES, tk->i_codec );
break;
+ case( AVIFOURCC_iavs):
+ case( AVIFOURCC_ivas):
+ p_sys->b_muxed = VLC_TRUE;
+ msg_Dbg( p_demux, "stream[%d] iavs with handler %4.4s", i, (char *)&p_strh->i_handler );
+ if( p_strh->i_handler == FOURCC_dvsd ||
+ p_strh->i_handler == FOURCC_dvhd ||
+ p_strh->i_handler == FOURCC_dvsl )
+ {
+ tk->p_out_muxed = stream_DemuxNew( p_demux, "rawdv", p_demux->out );
+ if( !tk->p_out_muxed )
+ msg_Err( p_demux, "could not load the DV parser" );
+ else break;
+ }
+ free( tk );
+ continue;
+
case( AVIFOURCC_mids):
msg_Dbg( p_demux, "stream[%d] midi is UNSUPPORTED", i );
default:
- msg_Warn( p_demux, "stream[%d] unknown type", i );
+ msg_Warn( p_demux, "stream[%d] unknown type %4.4s", i, (char *)&p_strh->i_type );
free( tk );
continue;
}
EnsureUTF8( p_strn->p_str );
fmt.psz_description = strdup( p_strn->p_str );
}
- tk->p_es = es_out_Add( p_demux->out, &fmt );
+ if( tk->p_out_muxed == NULL )
+ tk->p_es = es_out_Add( p_demux->out, &fmt );
TAB_APPEND( p_sys->i_track, p_sys->track, tk );
}
{
if( p_sys->track[i] )
{
+ if( p_sys->track[i]->p_out_muxed )
+ stream_DemuxDelete( p_sys->track[i]->p_out_muxed );
FREENULL( p_sys->track[i]->p_index );
free( p_sys->track[i] );
}
avi_track_t *tk = p_sys->track[i_track];
vlc_bool_t b;
+ if( p_sys->b_muxed && tk->p_out_muxed )
+ {
+ i_track_count++;
+ tk->b_activated = VLC_TRUE;
+ continue;
+ }
+
es_out_Control( p_demux->out, ES_OUT_GET_ES_STATE, tk->p_es, &b );
if( b && !tk->b_activated )
{
}
//p_pes->i_rate = p_demux->stream.control.i_rate;
- es_out_Send( p_demux->out, tk->p_es, p_frame );
+ if( tk->p_out_muxed )
+ stream_DemuxSend( tk->p_out_muxed, p_frame );
+ else
+ es_out_Send( p_demux->out, tk->p_es, p_frame );
}
}
unsigned int i_stream;
unsigned int i_packet;
+ if( p_sys->b_muxed )
+ {
+ msg_Err( p_demux, "Can not yet process muxed avi substreams without seeking" );
+ return VLC_EGENERIC;
+ }
+
es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_sys->i_time + 1 );
/* *** find master stream for data packet skipping algo *** */
if( tk->i_idxposc >= tk->i_idxnb )
{
tk->b_activated = VLC_FALSE;
- es_out_Control( p_demux->out, ES_OUT_SET_ES_STATE, tk->p_es, VLC_FALSE );
+ if( tk->p_es ) es_out_Control( p_demux->out, ES_OUT_SET_ES_STATE, tk->p_es, VLC_FALSE );
}
else
{
#define AVIFOURCC_vids VLC_FOURCC('v','i','d','s')
#define AVIFOURCC_txts VLC_FOURCC('t','x','t','s')
#define AVIFOURCC_mids VLC_FOURCC('m','i','d','s')
+#define AVIFOURCC_iavs VLC_FOURCC('i','a','v','s')
+#define AVIFOURCC_ivas VLC_FOURCC('i','v','a','s')
#define AVIFOURCC_IARL VLC_FOURCC('I','A','R','L')
#define AVIFOURCC_IART VLC_FOURCC('I','A','R','T')
#define FOURCC_H264 VLC_FOURCC('H','2','6','4')
#define FOURCC_h264 VLC_FOURCC('h','2','6','4')
#define FOURCC_VSSH VLC_FOURCC('V','S','S','H')
+
+ /* DV */
+#define FOURCC_dvsd VLC_FOURCC('d','v','s','d')
+#define FOURCC_dvhd VLC_FOURCC('d','v','h','d')
+#define FOURCC_dvsl VLC_FOURCC('d','v','s','l')