|
|
@@ -268,6 +268,8 @@ jsmpeg.prototype.stopRecording = function() {
|
|
268
|
268
|
// Loading via Ajax
|
|
269
|
269
|
|
|
270
|
270
|
jsmpeg.prototype.intraFrames = [];
|
|
|
271
|
+jsmpeg.prototype.currentFrame = -1;
|
|
|
272
|
+jsmpeg.prototype.currentTime = 0;
|
|
271
|
273
|
jsmpeg.prototype.frameCount = 0;
|
|
272
|
274
|
jsmpeg.prototype.duration = 0;
|
|
273
|
275
|
|
|
|
@@ -368,14 +370,16 @@ jsmpeg.prototype.seekToFrame = function(seekFrame, seekExact) {
|
|
368
|
370
|
}
|
|
369
|
371
|
|
|
370
|
372
|
this.buffer.index = target.index;
|
|
|
373
|
+ this.currentFrame = target.frame-1;
|
|
371
|
374
|
|
|
372
|
375
|
// If we're seeking to the exact frame, we may have to decode some more frames before
|
|
373
|
376
|
// the one we want
|
|
374
|
377
|
if( seekExact ) {
|
|
375
|
|
- for( var currentFrame = target.frame; currentFrame < seekFrame-1; currentFrame++ ) {
|
|
|
378
|
+ for( var frame = target.frame; frame < seekFrame-1; frame++ ) {
|
|
376
|
379
|
this.decodePicture(DECODE_SKIP_OUTPUT);
|
|
377
|
380
|
this.findStartCode(START_PICTURE);
|
|
378
|
381
|
}
|
|
|
382
|
+ this.currentFrame = seekFrame-1;
|
|
379
|
383
|
}
|
|
380
|
384
|
|
|
381
|
385
|
// Decode and display the picture we have seeked to
|
|
|
@@ -399,6 +403,7 @@ jsmpeg.prototype.pause = function(file) {
|
|
399
|
403
|
};
|
|
400
|
404
|
|
|
401
|
405
|
jsmpeg.prototype.stop = function(file) {
|
|
|
406
|
+ this.currentFrame = -1;
|
|
402
|
407
|
if( this.buffer ) {
|
|
403
|
408
|
this.buffer.index = this.firstSequenceHeader;
|
|
404
|
409
|
}
|
|
|
@@ -636,6 +641,9 @@ jsmpeg.prototype.forwardF = 0;
|
|
636
|
641
|
|
|
637
|
642
|
|
|
638
|
643
|
jsmpeg.prototype.decodePicture = function(skipOutput) {
|
|
|
644
|
+ this.currentFrame++;
|
|
|
645
|
+ this.currentTime = this.currentFrame / this.pictureRate;
|
|
|
646
|
+
|
|
639
|
647
|
this.buffer.advance(10); // skip temporalReference
|
|
640
|
648
|
this.pictureCodingType = this.buffer.getBits(3);
|
|
641
|
649
|
this.buffer.advance(16); // skip vbv_delay
|