Commit ccda57b7 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Cosmetic et metadata fixes.

parent 36bde126
...@@ -166,9 +166,8 @@ static int Open( vlc_object_t *p_this ) ...@@ -166,9 +166,8 @@ static int Open( vlc_object_t *p_this )
p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) ); p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );
if( p_sys == NULL ) if( p_sys == NULL )
{
return VLC_ENOMEM; return VLC_ENOMEM;
}
memset( p_sys, 0, sizeof( demux_sys_t ) ); memset( p_sys, 0, sizeof( demux_sys_t ) );
p_sys->i_data_offset = 0; p_sys->i_data_offset = 0;
...@@ -288,10 +287,8 @@ static int Demux( demux_t *p_demux ) ...@@ -288,10 +287,8 @@ static int Demux( demux_t *p_demux )
i_pts += 1000; /* Avoid 0 pts */ i_pts += 1000; /* Avoid 0 pts */
i_flags= header[11]; /* flags 0x02 -> keyframe */ i_flags= header[11]; /* flags 0x02 -> keyframe */
#if 0
msg_Dbg( p_demux, "packet %d size=%d id=%d pts=%u", msg_Dbg( p_demux, "packet %d size=%d id=%d pts=%u",
p_sys->i_data_packets, i_size, i_id, (uint32_t)(i_pts/1000) ); p_sys->i_data_packets, i_size, i_id, (uint32_t)(i_pts/1000) );
#endif
p_sys->i_data_packets++; p_sys->i_data_packets++;
...@@ -604,7 +601,6 @@ static int Demux( demux_t *p_demux ) ...@@ -604,7 +601,6 @@ static int Demux( demux_t *p_demux )
block_t *p_block = tk->p_subpackets[tk->i_out_subpacket]; block_t *p_block = tk->p_subpackets[tk->i_out_subpacket];
tk->p_subpackets[tk->i_out_subpacket] = 0; tk->p_subpackets[tk->i_out_subpacket] = 0;
//if ( p_block->i_dts )
if ( tk->p_subpackets_timecode[tk->i_out_subpacket] ) if ( tk->p_subpackets_timecode[tk->i_out_subpacket] )
{ {
p_block->i_dts = p_block->i_pts = p_block->i_dts = p_block->i_pts =
...@@ -756,8 +752,6 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) ...@@ -756,8 +752,6 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
f = (double) va_arg( args, double ); f = (double) va_arg( args, double );
i64 = (int64_t) ( stream_Size( p_demux->s ) * f ); i64 = (int64_t) ( stream_Size( p_demux->s ) * f );
//msg_Dbg(p_demux,"Seek Real DEMUX_SET_POSITION : %f file_offset :"I64Fd" p_sys->i_pcr "I64Fd" ", f, i64 , p_sys->i_pcr );
if ( p_sys->i_index_offset == 0 && i64 != 0 ) if ( p_sys->i_index_offset == 0 && i64 != 0 )
{ {
msg_Err(p_demux,"Seek No Index Real File failed!" ); msg_Err(p_demux,"Seek No Index Real File failed!" );
...@@ -766,7 +760,6 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) ...@@ -766,7 +760,6 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
if ( i64 == 0 ) if ( i64 == 0 )
{ {
/* it is a rtsp stream , it is specials in access/rtsp/... */ /* it is a rtsp stream , it is specials in access/rtsp/... */
msg_Dbg(p_demux, "Seek in real rtsp stream!"); msg_Dbg(p_demux, "Seek in real rtsp stream!");
p_sys->i_pcr = (int64_t)1000 * ( p_sys->i_our_duration * f ); p_sys->i_pcr = (int64_t)1000 * ( p_sys->i_our_duration * f );
...@@ -783,9 +776,9 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) ...@@ -783,9 +776,9 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
{ {
if ( p_index->file_offset > i64 ) if ( p_index->file_offset > i64 )
{ {
/* msg_Dbg( p_demux, "Seek Real find! %d %d %d",
msg_Dbg(p_demux, "Seek Real find! %d %d %d", p_index->time_offset, p_index->file_offset ,(uint32_t) i64); p_index->time_offset, p_index->file_offset,
*/ (uint32_t) i64 );
if ( p_index != p_sys->p_index ) p_index --; if ( p_index != p_sys->p_index ) p_index --;
i64 = p_index->file_offset; i64 = p_index->file_offset;
break; break;
...@@ -793,7 +786,6 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) ...@@ -793,7 +786,6 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
p_index++; p_index++;
} }
//msg_Dbg(p_demux, "Seek Real pcr from :"I64Fd" to "I64Fd" ", p_sys->i_pcr , 1000 * (int64_t) p_index->time_offset );
p_sys->i_pcr = 1000 * (int64_t) p_index->time_offset; p_sys->i_pcr = 1000 * (int64_t) p_index->time_offset;
es_out_Control( p_demux->out, ES_OUT_RESET_PCR , p_sys->i_pcr ); es_out_Control( p_demux->out, ES_OUT_RESET_PCR , p_sys->i_pcr );
...@@ -802,7 +794,6 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) ...@@ -802,7 +794,6 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
} }
case DEMUX_SET_TIME: case DEMUX_SET_TIME:
i64 = (int64_t) va_arg( args, int64_t ) / 1000; i64 = (int64_t) va_arg( args, int64_t ) / 1000;
//msg_Dbg(p_demux,"DEMUX_SET_TIME :OK "I64Fd" ",i64);
p_index = p_sys->p_index; p_index = p_sys->p_index;
while( p_index->file_offset !=0 ) while( p_index->file_offset !=0 )
...@@ -877,7 +868,7 @@ static void ReadRealIndex( demux_t *p_demux ) ...@@ -877,7 +868,7 @@ static void ReadRealIndex( demux_t *p_demux )
uint32_t i_id; uint32_t i_id;
uint32_t i_size; uint32_t i_size;
int i_version; int i_version;
int i; unsigned int i;
uint32_t i_index_count; uint32_t i_index_count;
...@@ -903,16 +894,18 @@ static void ReadRealIndex( demux_t *p_demux ) ...@@ -903,16 +894,18 @@ static void ReadRealIndex( demux_t *p_demux )
msg_Dbg( p_demux, "Real Index : num : %d ", i_index_count ); msg_Dbg( p_demux, "Real Index : num : %d ", i_index_count );
if ( i_index_count == 0 ) if( i_index_count == 0 )
return; return;
if ( GetDWBE( &buffer[16] ) > 0 ) if( GetDWBE( &buffer[16] ) > 0 )
msg_Dbg( p_demux, "Real Index: next index is exist? %d ", GetDWBE( &buffer[16] ) ); msg_Dbg( p_demux, "Real Index: Does next index exist? %d ",
GetDWBE( &buffer[16] ) );
p_sys->p_index = ( rm_index_t *) malloc( sizeof(rm_index_t) * (i_index_count+1) ); p_sys->p_index =
if ( p_sys->p_index == NULL ) (rm_index_t *)malloc( sizeof( rm_index_t ) * (i_index_count+1) );
if( p_sys->p_index == NULL )
{ {
msg_Err( p_demux, "Real Index: Error , fail to malloc index buffer " ); msg_Err( p_demux, "Memory allocation error" );
return; return;
} }
...@@ -920,24 +913,25 @@ static void ReadRealIndex( demux_t *p_demux ) ...@@ -920,24 +913,25 @@ static void ReadRealIndex( demux_t *p_demux )
for( i=0; i<i_index_count; i++ ) for( i=0; i<i_index_count; i++ )
{ {
if ( stream_Read( p_demux->s, buffer, 14 ) < 14 ) if( stream_Read( p_demux->s, buffer, 14 ) < 14 )
return ; return ;
if ( GetWBE( &buffer[0] ) != 0 ) if( GetWBE( &buffer[0] ) != 0 )
{ {
msg_Dbg( p_demux, "Real Index: invaild version of index entry %d ", GetWBE( &buffer[0] ) ); msg_Dbg( p_demux, "Real Index: invaild version of index entry %d ",
GetWBE( &buffer[0] ) );
return; return;
} }
p_sys->p_index[i].time_offset = GetDWBE( &buffer[2] ); p_sys->p_index[i].time_offset = GetDWBE( &buffer[2] );
p_sys->p_index[i].file_offset = GetDWBE( &buffer[6] ); p_sys->p_index[i].file_offset = GetDWBE( &buffer[6] );
p_sys->p_index[i].frame_index = GetDWBE( &buffer[10] ); p_sys->p_index[i].frame_index = GetDWBE( &buffer[10] );
#if 0 msg_Dbg( p_demux, "Real Index: time %d file %d frame %d ",
msg_Dbg( p_demux, "Real Index: time %d file %d frame %d ", p_sys->p_index[i].time_offset, p_sys->p_index[i].file_offset , p_sys->p_index[i].frame_index ); p_sys->p_index[i].time_offset,
#endif p_sys->p_index[i].file_offset,
p_sys->p_index[i].frame_index );
} }
} }
/***************************************************************************** /*****************************************************************************
...@@ -1031,8 +1025,6 @@ static int HeaderRead( demux_t *p_demux ) ...@@ -1031,8 +1025,6 @@ static int HeaderRead( demux_t *p_demux )
EnsureUTF8( psz ); EnsureUTF8( psz );
msg_Dbg( p_demux, " - title=`%s'", psz ); msg_Dbg( p_demux, " - title=`%s'", psz );
p_sys->psz_title = psz; p_sys->psz_title = psz;
vlc_meta_Add( p_sys->p_meta, VLC_META_TITLE, psz );
free( psz );
i_skip -= i_len; i_skip -= i_len;
} }
i_skip -= 2; i_skip -= 2;
...@@ -1047,8 +1039,6 @@ static int HeaderRead( demux_t *p_demux ) ...@@ -1047,8 +1039,6 @@ static int HeaderRead( demux_t *p_demux )
EnsureUTF8( psz ); EnsureUTF8( psz );
msg_Dbg( p_demux, " - author=`%s'", psz ); msg_Dbg( p_demux, " - author=`%s'", psz );
p_sys->psz_artist = psz; p_sys->psz_artist = psz;
vlc_meta_Add( p_sys->p_meta, VLC_META_ARTIST, psz );
free( psz );
i_skip -= i_len; i_skip -= i_len;
} }
i_skip -= 2; i_skip -= 2;
...@@ -1063,8 +1053,6 @@ static int HeaderRead( demux_t *p_demux ) ...@@ -1063,8 +1053,6 @@ static int HeaderRead( demux_t *p_demux )
EnsureUTF8( psz ); EnsureUTF8( psz );
msg_Dbg( p_demux, " - copyright=`%s'", psz ); msg_Dbg( p_demux, " - copyright=`%s'", psz );
p_sys->psz_copyright = psz; p_sys->psz_copyright = psz;
vlc_meta_Add( p_sys->p_meta, VLC_META_COPYRIGHT, psz );
free( psz );
i_skip -= i_len; i_skip -= i_len;
} }
i_skip -= 2; i_skip -= 2;
...@@ -1079,8 +1067,6 @@ static int HeaderRead( demux_t *p_demux ) ...@@ -1079,8 +1067,6 @@ static int HeaderRead( demux_t *p_demux )
EnsureUTF8( psz ); EnsureUTF8( psz );
msg_Dbg( p_demux, " - comment=`%s'", psz ); msg_Dbg( p_demux, " - comment=`%s'", psz );
p_sys->psz_description = psz; p_sys->psz_description = psz;
vlc_meta_Add( p_sys->p_meta, VLC_META_DESCRIPTION, psz );
free( psz );
i_skip -= i_len; i_skip -= i_len;
} }
i_skip -= 2; i_skip -= 2;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment