int aac_get_top_sample(auds_t *auds, u_int8_t **data, int *size) { aac_t *aac=(aac_t *)auds->stream; stop_decoder(aac); run_decoder(aac); return aac_get_next_sample(auds, data, size); }
int aac_close(auds_t *auds) { aac_t *aac=(aac_t *)auds->stream; if(!aac) return -1; if(aac->inf) fclose(aac->inf); stop_decoder(aac); unlink(FIFO_NAME); if(aac->buffer) free(aac->buffer); if(aac->fname) free(aac->fname); free(aac); return 0; }
static gboolean app_run (App * app, int argc, char *argv[]) { if (argc < 2) { g_message ("no bitstream file specified"); return FALSE; } app->file_name = g_strdup (argv[1]); if (!g_file_test (app->file_name, G_FILE_TEST_IS_REGULAR)) { g_message ("failed to find file '%s'", app->file_name); return FALSE; } app->codec = identify_codec (app->file_name); if (!app->codec) { app->codec = identify_codec_from_string (g_codec_str); if (!app->codec) { g_message ("failed to identify codec for '%s'", app->file_name); return FALSE; } } g_print ("Simple decoder (%s bitstream)\n", string_from_codec (app->codec)); app->display = video_output_create_display (NULL); if (!app->display) { g_message ("failed to create VA display"); return FALSE; } app->window = video_output_create_window (app->display, app->window_width, app->window_height); if (!app->window) { g_message ("failed to create window"); return FALSE; } gst_vaapi_window_show (app->window); if (!start_decoder (app)) { g_message ("failed to start decoder thread"); return FALSE; } if (!start_renderer (app)) { g_message ("failed to start renderer thread"); return FALSE; } app_check_events (app); stop_renderer (app); stop_decoder (app); g_print ("Decoded %u frames", app->num_frames); if (g_benchmark) { const gdouble elapsed = g_timer_elapsed (app->timer, NULL); g_print (" in %.2f sec (%.1f fps)\n", elapsed, (gdouble) app->num_frames / elapsed); } g_print ("\n"); return TRUE; }