Changeset 379 for dsfilters/demux_mpc/src/mpc_pin.cpp
- Timestamp:
- 01/05/08 11:40:24 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
dsfilters/demux_mpc/src/mpc_pin.cpp
r373 r379 638 638 } 639 639 640 int CMPCReader::ReadSwapped(void *buf, int size) 641 { 642 // this method should only be used to read smaller chunks of data - 643 // one maximum MPC SV7 frame 644 uint8 temp[16*1024]; 645 646 // 32-bit aligned words 647 __int64 cur, av; 648 GetPosition(&cur, &av); 649 650 int preroll = cur & 0x03; 651 __int64 aligned_pos = cur - preroll; 652 int read_size = ((size + preroll) + 0x03) &~ 0x03; // alignment 653 654 // read the data 655 Seek(aligned_pos); 656 int ret = Read(temp, read_size); 657 if (ret < 0) return ret; 658 659 // swap bytes 660 uint8 *bcur = temp; 661 #define SWAP(a,b) do { uint8 t=(a); (a)=(b); (b)=t; } while (0) 662 while (read_size > 3) { 663 SWAP(bcur[0], bcur[3]); 664 SWAP(bcur[1], bcur[2]); 665 bcur += 4; 666 read_size -= 4; 667 } 668 #undef SWAP 669 670 // copy data 671 bcur = temp + preroll; 672 memcpy(buf, bcur, size); 673 674 // advance 675 Seek(cur + size); 676 677 return 0; 678 } 679 680 640 681 // reading syntax elements 641 682 int CMPCReader::GetMagick(uint32 &elm)
Note: See TracChangeset
for help on using the changeset viewer.