Order of the Butterfly
Posts: 472 from 2003/7/25
From: Wroclaw/Poland
Has somebody tried play mp3 using SMPEG (part of PowerSDL)?
I built:
Code:
gcc `sdl-config --cflags --libs` smpeg_test.c -o smpeg_test -lSDL -lSDL_mixer -lsmpeg
this example:
Code:
#include <stdio.h>
#include <stdlib.h>
#include <SDL/SDL.h>
#include <smpeg/smpeg.h>
#include <dirent.h>
void print_info(SMPEG_Info* info)
{
if (info == NULL)
{
printf("info: NULLn");
return;
}
printf("info:n has_audio: %dn has_video: %dn audio_string: %sn audio_current_frame: %dn current_offset: %dn total_size: %dn current_time: %fn total_time: %fn", info->has_audio, info->has_video, info->audio_string, info->audio_current_frame, info->current_offset, info->total_size, info->current_time, info->total_time);
}
int main(int argc, char * argv[])
{
SDL_Surface *screen;
SMPEG *mpeg;
SMPEG_Info info;
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO);
mpeg = SMPEG_new("1.mp3", &info, 1);
print_info(&info);
SMPEG_play(mpeg);
do
{
SDL_Delay(250);
printf("SMPEG_status(mpeg) = %dn", SMPEG_status(mpeg));
SMPEG_getinfo(mpeg, &info);
print_info(&info);
}while(!SDL_QuitRequested() && SMPEG_status(mpeg)==SMPEG_PLAYING);
SMPEG_delete(mpeg);
SDL_Quit();
return(0);
}
When I run the sample, I hear silence :) and in CLI I always see:
Code:
info:
has_audio: 1
has_video: 0
audio_string: MPEG-1 Layer 3 128kbit/s 44100Hz stereo
audio_current_frame: 0
current_offset: 7940
total_size: 2977122
current_time: 0.000000
total_time: 186.070125
SMPEG_status(mpeg) = 1
In debug logs I see crash of smpeg.library. :(
[ Edited by MDW 30.08.2017 - 12:17 ]