#ifndef AVIFILE_AVIREAD_H
#define AVIFILE_AVIREAD_H

/********************************************************

    Classes for reading AVIs
    Copyright 2000 Eugene Kuznetsov  (divx@euro.ru)

*********************************************************/

#include "Cache.h"
#include "AviReadStream.h"

class AviReadFile: public IAviReadFile
{
    MainAVIHeader m_header;
    IMediaReadHandler* m_pIFile;
    std::vector<AviReadStream*> m_streams;
    int m_vcount;
    int m_acount;
    void _destruct();
public:
    AviReadFile(const char* name);
    ~AviReadFile();
    unsigned int StreamCount();
    unsigned int VideoStreamCount();
    unsigned int AudioStreamCount();
    IAviReadStream* GetStream(streamid_t stream_id, AviStream::StreamType type);
    //virtual HRESULT GetHeader(MainAVIHeader* header);
    virtual HRESULT GetHeader(void* header, size_t size) const;
    virtual bool IsOpened() const { return m_pIFile->IsOpened(); }
    virtual bool IsValid() const { return m_pIFile->IsValid(); }
    virtual bool IsRedirector() const { return m_pIFile->IsRedirector(); }
    virtual bool GetURLs(std::vector<std::string>& urls) const { return m_pIFile->GetURLs(urls); }
};

#endif
