/* print_file_info() Display information about input and output files */ static void print_file_info( SNDFILE *inputfile, SF_INFO *sfinfo ) { SF_FORMAT_INFO format_info; SF_FORMAT_INFO subformat_info; char sndlibver[128]; char *duration = NULL; // Get the format format_info.format = sfinfo->format & SF_FORMAT_TYPEMASK; sf_command (inputfile, SFC_GET_FORMAT_INFO, &format_info, sizeof(format_info)) ; // Get the sub-format info subformat_info.format = sfinfo->format & SF_FORMAT_SUBMASK; sf_command (inputfile, SFC_GET_FORMAT_INFO, &subformat_info, sizeof(subformat_info)) ; // Get the version of libsndfile sf_command (NULL, SFC_GET_LIB_VERSION, sndlibver, sizeof(sndlibver)); // Get human readable duration of the input file duration = format_duration_string( sfinfo ); MAST_INFO( "---------------------------------------------------------"); MAST_INFO( "%s (http://www.mega-nerd.com/libsndfile/)", sndlibver); MAST_INFO( "Input File: %s", g_filename ); MAST_INFO( "Input Format: %s, %s", format_info.name, subformat_info.name ); MAST_INFO( "Input Sample Rate: %d Hz", sfinfo->samplerate ); if (sfinfo->channels == 1) MAST_INFO( "Input Channels: Mono" ); else if (sfinfo->channels == 2) MAST_INFO( "Input Channels: Stereo" ); else MAST_INFO( "Input Channels: %d", sfinfo->channels ); MAST_INFO( "Input Duration: %s", duration ); MAST_INFO( "---------------------------------------------------------"); free( duration ); }
/* print_info_sndfile() Display information about input file */ static void print_info_sndfile(struct audioin_s *audioin ) { SNDFILE* file = audioin->file; SF_FORMAT_INFO format_info; SF_FORMAT_INFO subformat_info; char sndlibver[128]; char *duration = NULL; // Get the format format_info.format = audioin->sfinfo->format & SF_FORMAT_TYPEMASK; sf_command (file, SFC_GET_FORMAT_INFO, &format_info, sizeof(format_info)) ; // Get the sub-format info subformat_info.format = audioin->sfinfo->format & SF_FORMAT_SUBMASK; sf_command (file, SFC_GET_FORMAT_INFO, &subformat_info, sizeof(subformat_info)) ; // Get the version of libsndfile sf_command (file, SFC_GET_LIB_VERSION, sndlibver, sizeof(sndlibver)); // Get human readable duration of the input file duration = format_duration_string( audioin->sfinfo ); fprintf(stderr, "Input Format: %s, %s\n", format_info.name, subformat_info.name ); fprintf(stderr, "Input Duration: %s\n", duration ); fprintf(stderr, "Input Library: %s\n", sndlibver); free( duration ); }