Fplay: fixed broken rewind in software decoder mode

git-svn-id: svn://kolibrios.org@6301 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2016-03-03 02:14:18 +00:00
parent 52d53bf71f
commit 2b4519e34d
3 changed files with 14 additions and 16 deletions

View File

@ -25,12 +25,11 @@ volatile enum player_state sound_state;
static SNDBUF hBuff;
static int snd_format;
int sample_rate;
static uint32_t samples_written = 0;
int init_audio(int format)
int init_audio(vst_t* vst)
{
int err;
int version =-1;
@ -49,9 +48,7 @@ int init_audio(int format)
goto exit_whith_error;
}
snd_format = format;
create_thread(audio_thread, 0, 163840);
create_thread(audio_thread, vst, 32768);
return 1;
@ -252,7 +249,7 @@ int audio_thread(void *param)
char *errstr;
int active;
if((err = CreateBuffer(snd_format|PCM_RING,0, &hBuff)) != 0)
if((err = CreateBuffer(vst->snd_format|PCM_RING,0, &hBuff)) != 0)
{
errstr = "Cannot create sound buffer\n\r";
goto exit_whith_error;

View File

@ -151,9 +151,9 @@ int main( int argc, char *argv[])
sample_rate = vst.aCtx->sample_rate;
fmt = test_wav(&whdr);
vst.snd_format = test_wav(&whdr);
if( init_audio(fmt) )
if( init_audio(&vst) )
{
decoder_buffer = (uint8_t*)av_mallocz(192000*2+64);
if( decoder_buffer != NULL )
@ -347,7 +347,7 @@ void decoder(vst_t* vst)
rewind_pos, INT64_MAX, 0);
decoder_state = STOP;
break;
continue;
case REWIND:
while(sound_state != STOP)
@ -376,7 +376,7 @@ void decoder(vst_t* vst)
(double)rewind_pos / AV_TIME_BASE);
}
decoder_state = PREPARE;
break;
continue;
}
};
};

View File

@ -152,12 +152,13 @@ struct vstate
struct list_head output_list;
struct decoder *decoder;
int snd_format;
volatile int frames_count;
int has_sound:1;
int audio_timer_valid:1;
int blit_bitmap:1; /* hardware RGBA blitter */
int blit_texture:1; /* hardware RGBA blit and scale */
int blit_planar:1; /* hardbare YUV blit and scale */
unsigned int has_sound:1;
unsigned int audio_timer_valid:1;
unsigned int blit_bitmap:1; /* hardware RGBA blitter */
unsigned int blit_texture:1; /* hardware RGBA blit and scale */
unsigned int blit_planar:1; /* hardbare YUV blit and scale */
};
@ -177,7 +178,7 @@ void render_draw_client(render_t *render);
int fplay_init_context(vst_t *vst);
int init_audio(int format);
int init_audio(vst_t* vst);
int audio_thread(void *param);
void set_audio_volume(int left, int right);