Changeset 069f260a8179fa8f3462c121c6ff790300d321b0 for modules/demux/a52.c
- Timestamp:
- 22/08/08 17:57:59 (3 months ago)
- git-parent:
- Files:
-
- modules/demux/a52.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modules/demux/a52.c
re81f6fc r069f260 67 67 decoder_t *p_packetizer; 68 68 69 mtime_t i_pts; 70 mtime_t i_time_offset; 71 69 72 int i_mux_rate; 70 73 bool b_big_endian; … … 74 77 75 78 #define PCM_FRAME_SIZE (1536 * 4) 76 #define A52_PACKET_SIZE (4 * PCM_FRAME_SIZE) 79 #define A52_PACKET_SIZE (1024) 80 #define A52_PEEK_SIZE (4 * PCM_FRAME_SIZE) 77 81 #define A52_PROBE_SIZE (512*1024) 78 82 #define A52_MAX_HEADER_SIZE 10 … … 110 114 /* Some A52 wav files don't begin with a sync code so we do a more 111 115 * extensive search */ 112 int i_size = stream_Peek( p_demux->s, &p_peek, i_peek + A52_P ACKET_SIZE * 2);116 int i_size = stream_Peek( p_demux->s, &p_peek, i_peek + A52_PEEK_SIZE * 2); 113 117 i_size -= (PCM_FRAME_SIZE + A52_MAX_HEADER_SIZE); 114 118 … … 151 155 p_sys->i_mux_rate = 0; 152 156 p_sys->b_big_endian = b_big_endian; 157 p_sys->i_pts = 0; 158 p_sys->i_time_offset = 0; 153 159 154 160 /* Load the A52 packetizer */ … … 234 240 p_block_out->i_buffer * INT64_C(1000000)/p_block_out->i_length; 235 241 } 242 p_sys->i_pts = p_block_out->i_pts; 243 244 /* Correct timestamp */ 245 p_block_out->i_pts += p_sys->i_time_offset; 246 p_block_out->i_dts += p_sys->i_time_offset; 236 247 237 248 /* set PCR */ … … 253 264 { 254 265 demux_sys_t *p_sys = p_demux->p_sys; 255 if( i_query == DEMUX_SET_TIME ) 256 { 257 return VLC_EGENERIC; 258 } 259 else if( i_query == DEMUX_HAS_UNSUPPORTED_META ) 260 { 261 bool *pb_bool = (bool*)va_arg( args, bool* ); 266 bool *pb_bool; 267 int64_t *pi64; 268 int i_ret; 269 270 switch( i_query ) 271 { 272 case DEMUX_HAS_UNSUPPORTED_META: 273 pb_bool = (bool*)va_arg( args, bool* ); 262 274 *pb_bool = true; 263 275 return VLC_SUCCESS; 264 } 265 else 266 { 267 return demux_vaControlHelper( p_demux->s, 276 277 case DEMUX_GET_TIME: 278 pi64 = (int64_t*)va_arg( args, int64_t * ); 279 *pi64 = p_sys->i_pts + p_sys->i_time_offset; 280 return VLC_SUCCESS; 281 282 case DEMUX_SET_TIME: /* TODO implement a high precicsion seek */ 283 default: 284 i_ret = demux_vaControlHelper( p_demux->s, 268 285 0, -1, 269 286 8*p_sys->i_mux_rate, 1, i_query, args ); 287 if( !i_ret && p_sys->i_mux_rate > 0 && 288 ( i_query == DEMUX_SET_POSITION || i_query == DEMUX_SET_TIME ) ) 289 { 290 291 const int64_t i_time = INT64_C(1000000) * stream_Tell(p_demux->s) / 292 p_sys->i_mux_rate; 293 294 /* Fix time_offset */ 295 if( i_time >= 0 ) 296 p_sys->i_time_offset = i_time - p_sys->i_pts; 297 } 298 return i_ret; 270 299 } 271 300 }
