/*
 * See the README file for copyright information and how to reach the author.
 *
 */

#ifndef __PVRUSB2_READER_H
#define __PVRUSB2_READER_H

#include "common.h"

class cRMReader:
    public cThread
{
    private:
        cRMDevice* parent;
        bool active;

	uint8_t ts_buffer[188];
	uint8_t video_counter;
	uint8_t audio_counter;
	uint8_t text_counter;

	uint32_t pes_offset;
	uint8_t pes_buffer[64 * 1024];
	uint8_t pes_stream_id;
	uint32_t pes_length;
	uint32_t pes_tmp;

	void ParseProgramStream(uint8_t * Data, uint32_t Length);
	void PesToTs(uint8_t * Data, uint32_t Length);

    protected:
        virtual bool GetPESPacket();
        virtual void Action(void);

    public:
        cRMReader(cRMDevice* _parent);
        virtual ~cRMReader();
};

#endif // __PVRUSB2_READER_H


