| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Ogg bitstream support | 2 * Ogg bitstream support |
| 3 * Luca Barbato <lu_zero@gentoo.org> | 3 * Luca Barbato <lu_zero@gentoo.org> |
| 4 * Based on tcvp implementation | 4 * Based on tcvp implementation |
| 5 * | 5 * |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 Copyright (C) 2005 Michael Ahlberg, Måns Rullgård | 9 Copyright (C) 2005 Michael Ahlberg, Måns Rullgård |
| 10 | 10 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 for (i = 0; i < ogg->nstreams; i++){ | 125 for (i = 0; i < ogg->nstreams; i++){ |
| 126 struct ogg_stream *os = ogg->streams + i; | 126 struct ogg_stream *os = ogg->streams + i; |
| 127 os->bufpos = 0; | 127 os->bufpos = 0; |
| 128 os->pstart = 0; | 128 os->pstart = 0; |
| 129 os->psize = 0; | 129 os->psize = 0; |
| 130 os->granule = -1; | 130 os->granule = -1; |
| 131 os->lastpts = AV_NOPTS_VALUE; | 131 os->lastpts = AV_NOPTS_VALUE; |
| 132 os->lastdts = AV_NOPTS_VALUE; | 132 os->lastdts = AV_NOPTS_VALUE; |
| 133 os->nsegs = 0; | 133 os->nsegs = 0; |
| 134 os->segp = 0; | 134 os->segp = 0; |
| 135 os->incomplete = 0; |
| 135 } | 136 } |
| 136 | 137 |
| 137 ogg->curidx = -1; | 138 ogg->curidx = -1; |
| 138 | 139 |
| 139 return 0; | 140 return 0; |
| 140 } | 141 } |
| 141 | 142 |
| 142 static const struct ogg_codec * | 143 static const struct ogg_codec * |
| 143 ogg_find_codec (uint8_t * buf, int size) | 144 ogg_find_codec (uint8_t * buf, int size) |
| 144 { | 145 { |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 if (get_buffer (bc, os->segments, nsegs) < nsegs) | 273 if (get_buffer (bc, os->segments, nsegs) < nsegs) |
| 273 return -1; | 274 return -1; |
| 274 | 275 |
| 275 os->nsegs = nsegs; | 276 os->nsegs = nsegs; |
| 276 os->segp = 0; | 277 os->segp = 0; |
| 277 | 278 |
| 278 size = 0; | 279 size = 0; |
| 279 for (i = 0; i < nsegs; i++) | 280 for (i = 0; i < nsegs; i++) |
| 280 size += os->segments[i]; | 281 size += os->segments[i]; |
| 281 | 282 |
| 282 if (flags & OGG_FLAG_CONT){ | 283 if (flags & OGG_FLAG_CONT || os->incomplete){ |
| 283 if (!os->psize){ | 284 if (!os->psize){ |
| 284 while (os->segp < os->nsegs){ | 285 while (os->segp < os->nsegs){ |
| 285 int seg = os->segments[os->segp++]; | 286 int seg = os->segments[os->segp++]; |
| 286 os->pstart += seg; | 287 os->pstart += seg; |
| 287 if (seg < 255) | 288 if (seg < 255) |
| 288 break; | 289 break; |
| 289 } | 290 } |
| 290 } | 291 } |
| 291 }else{ | 292 }else{ |
| 292 os->psize = 0; | 293 os->psize = 0; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 int ss = os->segments[os->segp++]; | 368 int ss = os->segments[os->segp++]; |
| 368 os->psize += ss; | 369 os->psize += ss; |
| 369 if (ss < 255){ | 370 if (ss < 255){ |
| 370 complete = 1; | 371 complete = 1; |
| 371 break; | 372 break; |
| 372 } | 373 } |
| 373 } | 374 } |
| 374 | 375 |
| 375 if (!complete && os->segp == os->nsegs){ | 376 if (!complete && os->segp == os->nsegs){ |
| 376 ogg->curidx = -1; | 377 ogg->curidx = -1; |
| 378 os->incomplete = 1; |
| 377 } | 379 } |
| 378 }while (!complete); | 380 }while (!complete); |
| 379 | 381 |
| 380 #if 0 | 382 #if 0 |
| 381 av_log (s, AV_LOG_DEBUG, | 383 av_log (s, AV_LOG_DEBUG, |
| 382 "ogg_packet: idx %i, frame size %i, start %i\n", | 384 "ogg_packet: idx %i, frame size %i, start %i\n", |
| 383 idx, os->psize, os->pstart); | 385 idx, os->psize, os->pstart); |
| 384 #endif | 386 #endif |
| 385 | 387 |
| 386 ogg->curidx = idx; | 388 ogg->curidx = idx; |
| 389 os->incomplete = 0; |
| 387 | 390 |
| 388 if (os->header < 0){ | 391 if (!ogg->headers){ |
| 389 int hdr = os->codec->header (s, idx); | 392 int hdr = os->codec->header (s, idx); |
| 393 os->header = os->seq; |
| 390 if (!hdr){ | 394 if (!hdr){ |
| 391 os->header = os->seq; | |
| 392 os->segp = segp; | 395 os->segp = segp; |
| 393 os->psize = psize; | 396 os->psize = psize; |
| 394 ogg->headers = 1; | 397 ogg->headers = 1; |
| 395 }else{ | 398 }else{ |
| 396 os->pstart += os->psize; | 399 os->pstart += os->psize; |
| 397 os->psize = 0; | 400 os->psize = 0; |
| 398 } | 401 } |
| 399 } | 402 } |
| 400 | 403 |
| 401 if (os->header > -1 && os->seq > os->header){ | 404 if (os->header > -1 && os->seq > os->header){ |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 sizeof (struct ogg), | 640 sizeof (struct ogg), |
| 638 ogg_probe, | 641 ogg_probe, |
| 639 ogg_read_header, | 642 ogg_read_header, |
| 640 ogg_read_packet, | 643 ogg_read_packet, |
| 641 ogg_read_close, | 644 ogg_read_close, |
| 642 NULL, | 645 NULL, |
| 643 ogg_read_timestamp, | 646 ogg_read_timestamp, |
| 644 .extensions = "ogg", | 647 .extensions = "ogg", |
| 645 .metadata_conv = ff_vorbiscomment_metadata_conv, | 648 .metadata_conv = ff_vorbiscomment_metadata_conv, |
| 646 }; | 649 }; |
| OLD | NEW |