#include < stdio.h > #include < stdlib.h > #include < string.h > #include < signal.h > #include < unistd.h > #include < errno.h > #include < sys/types.h > #include < sys/stat.h > #include < sys/ioctl.h > #include < sys/time.h > #include "smpeg.h" void usage(char *argv0) { printf("\n\nHi,\n\n%s \n\nÉste es el uso normal.\n",argv0); } int main(int argc, char *argv[]) { int volume; SMPEG *mpeg; SMPEG_Info info; volume = 100; //Nivel del volumen /* Si no hubiera argumentos,simplemente sacar el uso por pantalla */ if (argc == 1) { usage(argv[0]); return(0); } mpeg = SMPEG_new(argv[1], &info;, 1); if ( SMPEG_error(mpeg) ) { fprintf(stderr, "%s: %s\n", argv[1], SMPEG_error(mpeg)); SMPEG_delete(mpeg); } SMPEG_enableaudio(mpeg, 1); SMPEG_setvolume(mpeg, volume); /* Sacar información sobre el audio */ if ( info.has_audio ) { printf("%s: Flujo de audio MPEG\n", argv[1]); if ( info.has_audio ) printf("\tAudio %s\n", info.audio_string); if ( info.total_size ) printf("\tSize: %d\n", info.total_size); if ( info.total_time ) printf("\tTotal time: %f\n", info.total_time); /* Lo toca, y espera a que termine la reproducción */ SMPEG_play(mpeg); while(SMPEG_status(mpeg)==SMPEG_PLAYING); SMPEG_delete(mpeg); //entrega la estructura } return(0); }