Changeset 069f260a8179fa8f3462c121c6ff790300d321b0
- Timestamp:
- 22/08/08 17:57:59
(3 months ago)
- Author:
- Laurent Aimar <fenrir@videolan.org>
- git-committer:
- Laurent Aimar <fenrir@videolan.org> 1219420679 +0200
- git-parent:
[b1cea0a301d6bc450edc0b8ec03c4af54f5d9e35]
- git-author:
- Laurent Aimar <fenrir@videolan.org> 1219420679 +0200
- Message:
Fixed input slave reading of a52/dts/flac/m4a/mpga (close #1818).
Input slave method needs that PCR of master and slave input use the same origin.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| 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_PACKET_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 | } |
|---|
| re81f6fc |
r069f260 |
|
| 63 | 63 | decoder_t *p_packetizer; |
|---|
| 64 | 64 | |
|---|
| | 65 | mtime_t i_pts; |
|---|
| | 66 | mtime_t i_time_offset; |
|---|
| | 67 | |
|---|
| 65 | 68 | int i_mux_rate; |
|---|
| 66 | 69 | }; |
|---|
| … | … | |
| 157 | 160 | |
|---|
| 158 | 161 | DEMUX_INIT_COMMON(); p_sys = p_demux->p_sys; |
|---|
| | 162 | p_sys->i_mux_rate = 0; |
|---|
| | 163 | p_sys->i_pts = 0; |
|---|
| | 164 | p_sys->i_time_offset = 0; |
|---|
| 159 | 165 | |
|---|
| 160 | 166 | INIT_APACKETIZER( p_sys->p_packetizer, 'd','t','s',' ' ); |
|---|
| … | … | |
| 215 | 221 | } |
|---|
| 216 | 222 | |
|---|
| | 223 | /* Correct timestamp */ |
|---|
| | 224 | p_block_out->i_pts += p_sys->i_time_offset; |
|---|
| | 225 | p_block_out->i_dts += p_sys->i_time_offset; |
|---|
| | 226 | |
|---|
| 217 | 227 | /* set PCR */ |
|---|
| 218 | 228 | es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_block_out->i_dts ); |
|---|
| … | … | |
| 233 | 243 | { |
|---|
| 234 | 244 | demux_sys_t *p_sys = p_demux->p_sys; |
|---|
| 235 | | if( i_query == DEMUX_SET_TIME ) |
|---|
| 236 | | return VLC_EGENERIC; |
|---|
| 237 | | else |
|---|
| 238 | | return demux_vaControlHelper( p_demux->s, |
|---|
| | 245 | bool *pb_bool; |
|---|
| | 246 | int64_t *pi64; |
|---|
| | 247 | int i_ret; |
|---|
| | 248 | |
|---|
| | 249 | switch( i_query ) |
|---|
| | 250 | { |
|---|
| | 251 | case DEMUX_HAS_UNSUPPORTED_META: |
|---|
| | 252 | pb_bool = (bool*)va_arg( args, bool* ); |
|---|
| | 253 | *pb_bool = true; |
|---|
| | 254 | return VLC_SUCCESS; |
|---|
| | 255 | |
|---|
| | 256 | case DEMUX_GET_TIME: |
|---|
| | 257 | pi64 = (int64_t*)va_arg( args, int64_t * ); |
|---|
| | 258 | *pi64 = p_sys->i_pts + p_sys->i_time_offset; |
|---|
| | 259 | return VLC_SUCCESS; |
|---|
| | 260 | |
|---|
| | 261 | case DEMUX_SET_TIME: /* TODO implement a high precicsion seek */ |
|---|
| | 262 | default: |
|---|
| | 263 | i_ret = demux_vaControlHelper( p_demux->s, |
|---|
| 239 | 264 | 0, -1, |
|---|
| 240 | 265 | 8*p_sys->i_mux_rate, 1, i_query, args ); |
|---|
| | 266 | if( !i_ret && p_sys->i_mux_rate > 0 && |
|---|
| | 267 | ( i_query == DEMUX_SET_POSITION || i_query == DEMUX_SET_TIME ) ) |
|---|
| | 268 | { |
|---|
| | 269 | |
|---|
| | 270 | const int64_t i_time = INT64_C(1000000) * stream_Tell(p_demux->s) / |
|---|
| | 271 | p_sys->i_mux_rate; |
|---|
| | 272 | |
|---|
| | 273 | /* Fix time_offset */ |
|---|
| | 274 | if( i_time >= 0 ) |
|---|
| | 275 | p_sys->i_time_offset = i_time - p_sys->i_pts; |
|---|
| | 276 | } |
|---|
| | 277 | return i_ret; |
|---|
| | 278 | } |
|---|
| 241 | 279 | } |
|---|
| 242 | 280 | |
|---|
| r2e4d57c |
r069f260 |
|
| 231 | 231 | } |
|---|
| 232 | 232 | |
|---|
| | 233 | p_sys->i_pts = p_block_out->i_dts; |
|---|
| | 234 | |
|---|
| | 235 | /* Correct timestamp */ |
|---|
| | 236 | p_block_out->i_pts += p_sys->i_time_offset; |
|---|
| | 237 | p_block_out->i_dts += p_sys->i_time_offset; |
|---|
| | 238 | |
|---|
| 233 | 239 | /* set PCR */ |
|---|
| 234 | | if( p_block_out->i_dts >= p_sys->i_pts_start ) |
|---|
| | 240 | if( p_block_out->i_dts >= p_sys->i_pts_start + p_sys->i_time_offset ) |
|---|
| 235 | 241 | es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_block_out->i_dts ); |
|---|
| 236 | 242 | else |
|---|
| 237 | 243 | es_out_Control( p_demux->out, ES_OUT_RESET_PCR ); |
|---|
| 238 | 244 | |
|---|
| 239 | | p_sys->i_pts = p_block_out->i_dts; |
|---|
| 240 | 245 | es_out_Send( p_demux->out, p_sys->p_es, p_block_out ); |
|---|
| 241 | 246 | |
|---|
| … | … | |
| 310 | 315 | p_sys->i_time_offset = p_sys->seekpoint[i]->i_time_offset - p_sys->i_pts; |
|---|
| 311 | 316 | p_sys->i_pts_start = p_sys->i_pts+i_delta_time; |
|---|
| 312 | | es_out_Control( p_demux->out, ES_OUT_SET_NEXT_DISPLAY_TIME, p_sys->p_es, p_sys->i_pts_start ); |
|---|
| | 317 | es_out_Control( p_demux->out, ES_OUT_SET_NEXT_DISPLAY_TIME, p_sys->p_es, p_sys->i_pts_start + p_sys->i_time_offset ); |
|---|
| 313 | 318 | } |
|---|
| 314 | 319 | else |
|---|
| r3561b9b |
r069f260 |
|
| 161 | 161 | } |
|---|
| 162 | 162 | |
|---|
| 163 | | es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_block_out->i_dts ); |
|---|
| 164 | | |
|---|
| 165 | | p_block_out->p_next = NULL; |
|---|
| 166 | | |
|---|
| 167 | 163 | p_sys->i_pts = p_block_out->i_pts; |
|---|
| 168 | 164 | if( p_sys->i_pts > M4A_PTS_START + INT64_C(500000) ) |
|---|
| … | … | |
| 171 | 167 | |
|---|
| 172 | 168 | p_sys->i_bytes += p_block_out->i_buffer; |
|---|
| | 169 | |
|---|
| | 170 | /* Correct timestamp */ |
|---|
| | 171 | p_block_out->i_pts += p_sys->i_time_offset; |
|---|
| | 172 | p_block_out->i_dts += p_sys->i_time_offset; |
|---|
| | 173 | |
|---|
| | 174 | /* */ |
|---|
| | 175 | es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_block_out->i_dts ); |
|---|
| | 176 | |
|---|
| 173 | 177 | es_out_Send( p_demux->out, p_sys->p_es, p_block_out ); |
|---|
| 174 | 178 | |
|---|
| r1035469 |
r069f260 |
|
| 304 | 304 | block_t *p_next = p_block_out->p_next; |
|---|
| 305 | 305 | |
|---|
| | 306 | p_sys->i_pts = p_block_out->i_pts; |
|---|
| | 307 | |
|---|
| | 308 | /* Correct timestamp */ |
|---|
| | 309 | p_block_out->i_pts += p_sys->i_time_offset; |
|---|
| | 310 | p_block_out->i_dts += p_sys->i_time_offset; |
|---|
| | 311 | |
|---|
| 306 | 312 | es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_block_out->i_dts ); |
|---|
| 307 | 313 | |
|---|
| 308 | | p_block_out->p_next = NULL; |
|---|
| 309 | | p_sys->i_pts = p_block_out->i_pts; |
|---|
| 310 | 314 | es_out_Send( p_demux->out, p_sys->p_es, p_block_out ); |
|---|
| 311 | 315 | |
|---|
| … | … | |
| 394 | 398 | |
|---|
| 395 | 399 | /* Fix time_offset */ |
|---|
| 396 | | if( i_time >= 0 ) p_sys->i_time_offset = i_time - p_sys->i_pts; |
|---|
| | 400 | if( i_time >= 0 ) |
|---|
| | 401 | p_sys->i_time_offset = i_time - p_sys->i_pts; |
|---|
| 397 | 402 | } |
|---|
| 398 | 403 | return i_ret; |
|---|