#define _GNU_SOURCE
#include <sys/time.h>
#include <stdio.h>      /* standard I/O                */
#include <string.h>     /* for strcpy - 3 occurrences  */
#include <stdlib.h>     /* for exit   - 1 occurrence   */

#ifdef enable_threading
#include <pthread.h>
#endif

struct timeval starttime,endtime;
double lsmedia,media1,te0;
int i;

int Media1()
{
	system("mediadir/cleanup.run");
        gettimeofday(&starttime, NULL);
#ifdef enable_threading
#pragma omp parallel for
#endif
        for(i=0; i<4; i++) {
        system("mediadir/mp32wav.run");
	system("mediadir/wav2ogg.run");
	system("mediadir/wav2mp3.run");
        }
        gettimeofday(&endtime, NULL);
	system("mediadir/cleanup.run");
        te0=((double)(endtime.tv_sec*1000000-starttime.tv_sec*1000000+endtime.tv_usec-starttime.tv_usec))/1000000;
        media1 = 4 * 3 / te0;
        printf("\n\tTest #1:\tConversion mp3->wav->ogg->mp3 4 times: %lf/s\n", media1);
return media1;
}

int main() {
                
printf("\nRunning Media conversion tests:\n");
FILE *fp;
Media1();
lsmedia = media1 * 21;
fp=fopen("mediadir/lsmedia.log", "w");
fprintf(fp, "%f\n", lsmedia);
fclose(fp);
printf("DONE.\n");
return(1);
}

