aboutsummaryrefslogtreecommitdiff
path: root/Src/Plugins/Input/in_dshow/header_mpg.h
blob: 7122eade51ed92090581d82d9884e3837634fe38 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef _HEADER_MPG_H
#define _HEADER_MPG_H

#include <stdio.h>
#include "Header.h"

class HeaderMpg : public Header
{
public:
	HeaderMpg();

	int getInfos(const wchar_t *filename, bool checkMetadata=false);

	int video_bitrate,audio_bitrate;

private:
	HANDLE fh;

	int decodeHeader();

	unsigned char buf[8192*8];
	unsigned char *pbuf;
	unsigned char *end;
	int sync_packet() {
		// sync packet:
		while(1){
			if(pbuf>=end) return 0;
			if(pbuf[0]==0 && pbuf[1]==0 && pbuf[2]==1) break; // synced
			pbuf++;
		}
		return 0x100|pbuf[3];
	}

	int mp3headerFromInt(unsigned long dwHdrBits);
	int m_BitrateNdx;
	int m_SampleRateNdx;
	int m_Layer;
	int m_Id;
	int m_Mode;
	int m_Idex;
};

#endif