#ifndef AVIFILE_NETWORKITERATOR_H
#define AVIFILE_NETWORKITERATOR_H

#include "Iterator.h"
#include <list>

class ASFNetworkInputStream;
class ASFStreamSeekInfo;

class NetworkIterator: public Iterator
{
friend class ASFNetworkInputStream;
protected:
    bool m_bValid;
//    bool _has_undo;
    std::list<packet*>::iterator m_It;
    std::vector<std::list<packet*>::iterator> m_UndoIt;
    ASFNetworkInputStream* m_pParent;
public:
    NetworkIterator(ASFNetworkInputStream* parent);
    virtual ~NetworkIterator();
    virtual const ASFStreamSeekInfo* getSeekInfo()
    {
	return 0;
    }
    virtual HRESULT seek(double timestamp, chunk_info* pch);
    virtual HRESULT seek(int64_t timestamp, chunk_info* pch);
    virtual packet getPacket(bool& success);
    virtual void next()
    {
	m_It++;
    }
    virtual void undoPosition()
    {
	m_UndoIt.push_back(m_It);
    }
    virtual void undo() {
	if (m_UndoIt.size())
	{
	    m_It=m_UndoIt.back();
	    m_UndoIt.pop_back();
	}
    }
    virtual void forgetUndo();
    virtual void release();
    virtual void releaseInternal();
};

#endif
