"== Starting playing %s, with %d/%d CPU bandwidth\n",
args->file, args->budget, args->period);
- snprintf(cmd, 255, "mplayer %s", args->file);
+ snprintf(cmd, 255, PLAYER_BINARY PLAYER_ARGS " %s", args->file);
fprintf(stdout, "== Issuing command:\n %s\n", cmd);
- execlp("mplayer", "mplayer", "-fs", "-zoom", args->file, (char*) NULL);
+ execlp(PLAYER_BINARY, PLAYER_BINARY, PLAYER_ARGS, args->file, (char*) NULL);
}
int main(int argc, char *argv[])
void *player(void *thread_args)
{
- struct player_args args = *((struct player_args*) thread_args);
+ struct player_args *args = (struct player_args*) thread_args;
frsh_rel_time_t player_budget, player_period;
frsh_contract_t player_contract;
fprintf(stdout,
"== Starting playing %s, with %d/%d CPU bandwidth\n",
- args.file, args.budget, args.period);
+ args->file, args->budget, args->period);
- player_budget = fosa_usec_to_rel_time(args.budget);
- player_period = fosa_usec_to_rel_time(args.period);
+ player_budget = fosa_usec_to_rel_time(args->budget);
+ player_period = fosa_usec_to_rel_time(args->period);
PXW(frsh_contract_init(&player_contract));
PXW(frsh_contract_set_basic_params(&player_contract,
&player_budget,
PXW(frsh_thread_bind(player_vres, fosa_thread_self()));
fprintf(stdout, "== Player thread bound to its contract\n");
- snprintf(cmd, 255, "mplayer -fs -zoom %s", args.file);
+ snprintf(cmd, 255, PLAYER_BINARY PLAYER_ARGS " %s", args->file);
fprintf(stdout, "== Issuing command:\n %s\n", cmd);
}
PXW(frsh_init());
+ fprintf(stdout, "FRSH initialized\n");
- terror = pthread_create(&player_thread, &player_attr, player, NULL);
+ terror = pthread_attr_init(&player_attr);
if (terror) assert_perror(errno);
+ terror = pthread_create(&player_thread, &player_attr, player, (void*) &args);
+ if (terror) assert_perror(errno);
+ fprintf(stdout, "FRSH thread created, waiting for its termination...\n");
+
terror = pthread_join(player_thread, NULL);
if (terror) assert_perror(errno);
+ fprintf(stdout, "FRSH thread ended. Exiting\n\n");
exit(EXIT_SUCCESS);
}