Changeset 46112 for trunk/src/wp-includes/ID3/module.audio-video.flv.php
- Timestamp:
- 09/14/2019 07:06:09 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/ID3/module.audio-video.flv.php
r41196 r46112 2 2 ///////////////////////////////////////////////////////////////// 3 3 /// getID3() by James Heinrich <info@getid3.org> // 4 // available at http://getid3.sourceforge.net // 5 // or http://www.getid3.org // 6 // also https://github.com/JamesHeinrich/getID3 // 4 // available at https://github.com/JamesHeinrich/getID3 // 5 // or https://www.getid3.org // 6 // or http://getid3.sourceforge.net // 7 // see readme.txt for more details // 8 ///////////////////////////////////////////////////////////////// 9 // // 10 // module.audio-video.flv.php // 11 // module for analyzing Shockwave Flash Video files // 12 // dependencies: NONE // 13 // // 14 ///////////////////////////////////////////////////////////////// 7 15 // // 8 16 // FLV module by Seth Kaufman <sethØwhirl-i-gig*com> // 9 17 // // 10 18 // * version 0.1 (26 June 2005) // 11 // //12 19 // // 13 20 // * version 0.1.1 (15 July 2005) // … … 44 51 // improved AVCSequenceParameterSetReader::readData() // 45 52 // by Xander Schouwerwou <schouwerwouØgmail*com> // 46 // //47 /////////////////////////////////////////////////////////////////48 // //49 // module.audio-video.flv.php //50 // module for analyzing Shockwave Flash Video files //51 // dependencies: NONE //52 53 // /// 53 54 ///////////////////////////////////////////////////////////////// … … 74 75 define('H264_PROFILE_HIGH444_PREDICTIVE', 244); 75 76 76 class getid3_flv extends getid3_handler {77 77 class getid3_flv extends getid3_handler 78 { 78 79 const magic = 'FLV'; 79 80 80 public $max_frames = 100000; // break out of the loop if too many frames have been scanned; only scan this many if meta frame does not contain useful duration 81 81 /** 82 * Break out of the loop if too many frames have been scanned; only scan this 83 * many if meta frame does not contain useful duration. 84 * 85 * @var int 86 */ 87 public $max_frames = 100000; 88 89 /** 90 * @return bool 91 */ 82 92 public function Analyze() { 83 93 $info = &$this->getid3->info; … … 333 343 } 334 344 335 345 /** 346 * @param int $id 347 * 348 * @return string|false 349 */ 336 350 public static function audioFormatLookup($id) { 337 351 static $lookup = array( … … 356 370 } 357 371 372 /** 373 * @param int $id 374 * 375 * @return int|false 376 */ 358 377 public static function audioRateLookup($id) { 359 378 static $lookup = array( … … 366 385 } 367 386 387 /** 388 * @param int $id 389 * 390 * @return int|false 391 */ 368 392 public static function audioBitDepthLookup($id) { 369 393 static $lookup = array( … … 374 398 } 375 399 400 /** 401 * @param int $id 402 * 403 * @return string|false 404 */ 376 405 public static function videoCodecLookup($id) { 377 406 static $lookup = array( … … 387 416 } 388 417 389 class AMFStream { 418 class AMFStream 419 { 420 /** 421 * @var string 422 */ 390 423 public $bytes; 424 425 /** 426 * @var int 427 */ 391 428 public $pos; 392 429 430 /** 431 * @param string $bytes 432 */ 393 433 public function __construct(&$bytes) { 394 434 $this->bytes =& $bytes; … … 396 436 } 397 437 398 public function readByte() { 399 return getid3_lib::BigEndian2Int(substr($this->bytes, $this->pos++, 1)); 400 } 401 402 public function readInt() { 438 /** 439 * @return int 440 */ 441 public function readByte() { // 8-bit 442 return ord(substr($this->bytes, $this->pos++, 1)); 443 } 444 445 /** 446 * @return int 447 */ 448 public function readInt() { // 16-bit 403 449 return ($this->readByte() << 8) + $this->readByte(); 404 450 } 405 451 406 public function readLong() { 452 /** 453 * @return int 454 */ 455 public function readLong() { // 32-bit 407 456 return ($this->readByte() << 24) + ($this->readByte() << 16) + ($this->readByte() << 8) + $this->readByte(); 408 457 } 409 458 459 /** 460 * @return float|false 461 */ 410 462 public function readDouble() { 411 463 return getid3_lib::BigEndian2Float($this->read(8)); 412 464 } 413 465 466 /** 467 * @return string 468 */ 414 469 public function readUTF() { 415 470 $length = $this->readInt(); … … 417 472 } 418 473 474 /** 475 * @return string 476 */ 419 477 public function readLongUTF() { 420 478 $length = $this->readLong(); … … 422 480 } 423 481 482 /** 483 * @param int $length 484 * 485 * @return string 486 */ 424 487 public function read($length) { 425 488 $val = substr($this->bytes, $this->pos, $length); … … 428 491 } 429 492 493 /** 494 * @return int 495 */ 430 496 public function peekByte() { 431 497 $pos = $this->pos; … … 435 501 } 436 502 503 /** 504 * @return int 505 */ 437 506 public function peekInt() { 438 507 $pos = $this->pos; … … 442 511 } 443 512 513 /** 514 * @return int 515 */ 444 516 public function peekLong() { 445 517 $pos = $this->pos; … … 449 521 } 450 522 523 /** 524 * @return float|false 525 */ 451 526 public function peekDouble() { 452 527 $pos = $this->pos; … … 456 531 } 457 532 533 /** 534 * @return string 535 */ 458 536 public function peekUTF() { 459 537 $pos = $this->pos; … … 463 541 } 464 542 543 /** 544 * @return string 545 */ 465 546 public function peekLongUTF() { 466 547 $pos = $this->pos; … … 471 552 } 472 553 473 class AMFReader { 554 class AMFReader 555 { 556 /** 557 * @var AMFStream 558 */ 474 559 public $stream; 475 560 476 public function __construct(&$stream) { 477 $this->stream =& $stream; 478 } 479 561 /** 562 * @param AMFStream $stream 563 */ 564 public function __construct(AMFStream $stream) { 565 $this->stream = $stream; 566 } 567 568 /** 569 * @return mixed 570 */ 480 571 public function readData() { 481 572 $value = null; … … 548 639 } 549 640 641 /** 642 * @return float|false 643 */ 550 644 public function readDouble() { 551 645 return $this->stream->readDouble(); 552 646 } 553 647 648 /** 649 * @return bool 650 */ 554 651 public function readBoolean() { 555 652 return $this->stream->readByte() == 1; 556 653 } 557 654 655 /** 656 * @return string 657 */ 558 658 public function readString() { 559 659 return $this->stream->readUTF(); 560 660 } 561 661 662 /** 663 * @return array 664 */ 562 665 public function readObject() { 563 666 // Get highest numerical index - ignored … … 565 668 566 669 $data = array(); 670 $key = null; 567 671 568 672 while ($key = $this->stream->readUTF()) { … … 577 681 } 578 682 683 /** 684 * @return array 685 */ 579 686 public function readMixedArray() { 580 687 // Get highest numerical index - ignored … … 582 689 583 690 $data = array(); 691 $key = null; 584 692 585 693 while ($key = $this->stream->readUTF()) { 586 694 if (is_numeric($key)) { 587 $key = ( float) $key;695 $key = (int) $key; 588 696 } 589 697 $data[$key] = $this->readData(); … … 598 706 } 599 707 708 /** 709 * @return array 710 */ 600 711 public function readArray() { 601 712 $length = $this->stream->readLong(); … … 608 719 } 609 720 721 /** 722 * @return float|false 723 */ 610 724 public function readDate() { 611 725 $timestamp = $this->stream->readDouble(); … … 614 728 } 615 729 730 /** 731 * @return string 732 */ 616 733 public function readLongString() { 617 734 return $this->stream->readLongUTF(); 618 735 } 619 736 737 /** 738 * @return string 739 */ 620 740 public function readXML() { 621 741 return $this->stream->readLongUTF(); 622 742 } 623 743 744 /** 745 * @return array 746 */ 624 747 public function readTypedObject() { 625 748 $className = $this->stream->readUTF(); … … 628 751 } 629 752 630 class AVCSequenceParameterSetReader { 753 class AVCSequenceParameterSetReader 754 { 755 /** 756 * @var string 757 */ 631 758 public $sps; 632 759 public $start = 0; 633 760 public $currentBytes = 0; 634 761 public $currentBits = 0; 762 763 /** 764 * @var int 765 */ 635 766 public $width; 767 768 /** 769 * @var int 770 */ 636 771 public $height; 637 772 773 /** 774 * @param string $sps 775 */ 638 776 public function __construct($sps) { 639 777 $this->sps = $sps; … … 692 830 } 693 831 832 /** 833 * @param int $bits 834 */ 694 835 public function skipBits($bits) { 695 836 $newBits = $this->currentBits + $bits; … … 698 839 } 699 840 841 /** 842 * @return int 843 */ 700 844 public function getBit() { 701 845 $result = (getid3_lib::BigEndian2Int(substr($this->sps, $this->currentBytes, 1)) >> (7 - $this->currentBits)) & 0x01; … … 704 848 } 705 849 850 /** 851 * @param int $bits 852 * 853 * @return int 854 */ 706 855 public function getBits($bits) { 707 856 $result = 0; … … 712 861 } 713 862 863 /** 864 * @return int 865 */ 714 866 public function expGolombUe() { 715 867 $significantBits = 0; … … 727 879 } 728 880 881 /** 882 * @return int 883 */ 729 884 public function expGolombSe() { 730 885 $result = $this->expGolombUe(); … … 736 891 } 737 892 893 /** 894 * @return int 895 */ 738 896 public function getWidth() { 739 897 return $this->width; 740 898 } 741 899 900 /** 901 * @return int 902 */ 742 903 public function getHeight() { 743 904 return $this->height;
Note: See TracChangeset
for help on using the changeset viewer.