/*
    This program is not linked against main library
    ( for compile time efficiency ). Instead, it
    depends only on two of its source files.
    It uses interface declared in include/ReadHandlers.h
    to access directly data in ASF file.
*/    

#include "AsfReadHandler.h"
#include <iostream>
#include <unistd.h>
extern int ASF_DEBUG;
int main(int argc, char** argv)
{
    ASF_DEBUG=1;
//    IMediaReadHandler* h=new ASFReadHandler("/d/movies/Eyes on me.asf");
//    IMediaReadHandler* h=new ASFReadHandler("/d/movies/Baby one more time.asf");
    char* filename="/d/test-movies/smth.asf";
    if(argc>1)filename=argv[1];
    IMediaReadHandler* h=new ASFReadHandler(filename);
//    sleep(20);
    char ttt[100000];
    IMediaReadStream* s=h->GetStream(mmioFOURCC('a', 'u', 'd', 's'), 0);
    unsigned int samp_read, bytes_read;
    s->Read(5U, &ttt, 10000U, &bytes_read, &samp_read);
    std::cout<<"Now video"<<std::endl;
	IMediaReadStream* s1=h->GetStream(mmioFOURCC('v', 'i', 'd', 's'), 0);
    for(int i=0; i<100; i++)
    {
	s1->Read(1, 0, 0, &bytes_read, &samp_read);
	std::cout<<i<<" : Size "<<bytes_read<<std::endl;
	s1->Read(1, &ttt, bytes_read, &bytes_read, &samp_read);
    }
    return 0;
}
