header_mpg.h 693 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #ifndef _HEADER_MPG_H
  2. #define _HEADER_MPG_H
  3. #include <stdio.h>
  4. #include "Header.h"
  5. class HeaderMpg : public Header
  6. {
  7. public:
  8. HeaderMpg();
  9. int getInfos(const wchar_t *filename, bool checkMetadata=false);
  10. int video_bitrate,audio_bitrate;
  11. private:
  12. HANDLE fh;
  13. int decodeHeader();
  14. unsigned char buf[8192*8];
  15. unsigned char *pbuf;
  16. unsigned char *end;
  17. int sync_packet() {
  18. // sync packet:
  19. while(1){
  20. if(pbuf>=end) return 0;
  21. if(pbuf[0]==0 && pbuf[1]==0 && pbuf[2]==1) break; // synced
  22. pbuf++;
  23. }
  24. return 0x100|pbuf[3];
  25. }
  26. int mp3headerFromInt(unsigned long dwHdrBits);
  27. int m_BitrateNdx;
  28. int m_SampleRateNdx;
  29. int m_Layer;
  30. int m_Id;
  31. int m_Mode;
  32. int m_Idex;
  33. };
  34. #endif