os->granule = -1;
os->lastpts = AV_NOPTS_VALUE;
os->lastdts = AV_NOPTS_VALUE;
+ os->sync_pos = -1;
+ os->page_pos = 0;
os->nsegs = 0;
os->segp = 0;
os->incomplete = 0;
}
os = ogg->streams + idx;
+ os->page_pos = url_ftell(bc) - 27;
if(os->psize > 0)
ogg_new_buf(ogg, idx);
if (seg < 255)
break;
}
+ os->sync_pos = os->page_pos;
}
}else{
os->psize = 0;
+ os->sync_pos = os->page_pos;
}
if (os->bufsize - os->bufpos < size){
}
static int
-ogg_packet (AVFormatContext * s, int *str, int *dstart, int *dsize)
+ogg_packet (AVFormatContext * s, int *str, int *dstart, int *dsize, int64_t *fpos)
{
struct ogg *ogg = s->priv_data;
int idx, i;
*dstart = os->pstart;
if (dsize)
*dsize = os->psize;
+ if (fpos)
+ *fpos = os->sync_pos;
os->pstart += os->psize;
os->psize = 0;
+ os->sync_pos = os->page_pos;
}
// determine whether there are more complete packets in this page
struct ogg *ogg = s->priv_data;
do{
- if (ogg_packet (s, NULL, NULL, NULL) < 0)
+ if (ogg_packet (s, NULL, NULL, NULL, NULL) < 0)
return -1;
}while (!ogg->headers);
struct ogg_stream *os;
int idx = -1;
int pstart, psize;
+ int64_t fpos;
//Get an ogg packet
do{
- if (ogg_packet (s, &idx, &pstart, &psize) < 0)
+ if (ogg_packet (s, &idx, &pstart, &psize, &fpos) < 0)
return AVERROR(EIO);
}while (idx < 0 || !s->streams[idx]);
pkt->flags = os->pflags;
pkt->duration = os->pduration;
+ pkt->pos = fpos;
return psize;
}
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: -1 size: 1364
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 125 size: 1364
ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: NOPTS pts: NOPTS pos: -1 size: 1390
+ret: 0 st: 0 flags:1 dts: NOPTS pts: NOPTS pos: 5768 size: 1390
ret: 0 st:-1 flags:1 ts: 1.894167
ret:-EIO
ret: 0 st: 0 flags:0 ts: 0.788345
-ret: 0 st: 0 flags:1 dts: NOPTS pts: NOPTS pos: -1 size: 1365
+ret: 0 st: 0 flags:1 dts: NOPTS pts: NOPTS pos: 11410 size: 1365
ret: 0 st: 0 flags:1 ts:-0.317506
-ret: 0 st: 0 flags:1 dts: NOPTS pts: NOPTS pos: -1 size: 1384
+ret: 0 st: 0 flags:1 dts: NOPTS pts: NOPTS pos: 2936 size: 1384
ret: 0 st:-1 flags:0 ts: 2.576668
-ret: 0 st: 0 flags:1 dts: NOPTS pts: NOPTS pos: -1 size: 1223
+ret: 0 st: 0 flags:1 dts: NOPTS pts: NOPTS pos: 12808 size: 1223
ret: 0 st:-1 flags:1 ts: 1.470835
ret:-EIO
ret: 0 st: 0 flags:0 ts: 0.365011
-ret: 0 st: 0 flags:1 dts: NOPTS pts: NOPTS pos: -1 size: 1390
+ret: 0 st: 0 flags:1 dts: NOPTS pts: NOPTS pos: 5768 size: 1390
ret: 0 st: 0 flags:1 ts:-0.740839
-ret: 0 st: 0 flags:1 dts: NOPTS pts: NOPTS pos: -1 size: 1384
+ret: 0 st: 0 flags:1 dts: NOPTS pts: NOPTS pos: 2936 size: 1384
ret: 0 st:-1 flags:0 ts: 2.153336
-ret: 0 st: 0 flags:1 dts: NOPTS pts: NOPTS pos: -1 size: 1223
+ret: 0 st: 0 flags:1 dts: NOPTS pts: NOPTS pos: 12808 size: 1223
ret: 0 st:-1 flags:1 ts: 1.047503
ret:-EIO
ret: 0 st: 0 flags:0 ts:-0.058322
-ret: 0 st: 0 flags:1 dts: NOPTS pts: NOPTS pos: -1 size: 1390
+ret: 0 st: 0 flags:1 dts: NOPTS pts: NOPTS pos: 5768 size: 1390
ret: 0 st: 0 flags:1 ts: 2.835828
ret:-EIO
ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: NOPTS pts: NOPTS pos: -1 size: 1223
+ret: 0 st: 0 flags:1 dts: NOPTS pts: NOPTS pos: 12808 size: 1223
ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: NOPTS pts: NOPTS pos: -1 size: 1370
+ret: 0 st: 0 flags:1 dts: NOPTS pts: NOPTS pos: 7191 size: 1370
ret: 0 st: 0 flags:0 ts:-0.481655
-ret: 0 st: 0 flags:1 dts: NOPTS pts: NOPTS pos: -1 size: 1390
+ret: 0 st: 0 flags:1 dts: NOPTS pts: NOPTS pos: 5768 size: 1390
ret: 0 st: 0 flags:1 ts: 2.412494
ret:-EIO
ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: NOPTS pts: NOPTS pos: -1 size: 1223
+ret: 0 st: 0 flags:1 dts: NOPTS pts: NOPTS pos: 12808 size: 1223
ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: NOPTS pts: NOPTS pos: -1 size: 1384
+ret: 0 st: 0 flags:1 dts: NOPTS pts: NOPTS pos: 2936 size: 1384
ret: 0 st: 0 flags:0 ts:-0.904989
-ret: 0 st: 0 flags:1 dts: NOPTS pts: NOPTS pos: -1 size: 1390
+ret: 0 st: 0 flags:1 dts: NOPTS pts: NOPTS pos: 5768 size: 1390
ret: 0 st: 0 flags:1 ts: 1.989184
ret:-EIO
ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: NOPTS pts: NOPTS pos: -1 size: 1223
+ret: 0 st: 0 flags:1 dts: NOPTS pts: NOPTS pos: 12808 size: 1223
ret: 0 st:-1 flags:1 ts:-0.222493
-ret: 0 st: 0 flags:1 dts: NOPTS pts: NOPTS pos: -1 size: 1384
+ret: 0 st: 0 flags:1 dts: NOPTS pts: NOPTS pos: 2936 size: 1384
ret: 0 st: 0 flags:0 ts: 2.671678
-ret: 0 st: 0 flags:1 dts: NOPTS pts: NOPTS pos: -1 size: 1223
+ret: 0 st: 0 flags:1 dts: NOPTS pts: NOPTS pos: 12808 size: 1223
ret: 0 st: 0 flags:1 ts: 1.565850
ret:-EIO
ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: NOPTS pts: NOPTS pos: -1 size: 1381
+ret: 0 st: 0 flags:1 dts: NOPTS pts: NOPTS pos: 8594 size: 1381
ret: 0 st:-1 flags:1 ts:-0.645825
-ret: 0 st: 0 flags:1 dts: NOPTS pts: NOPTS pos: -1 size: 1384
+ret: 0 st: 0 flags:1 dts: NOPTS pts: NOPTS pos: 2936 size: 1384