void LSFW_SimpleMediaDecoder::GetInfoString(char *buf, int buflen, char *title, int titlelen)
{
    // lstrcpyn(title,"libsndfile supported File Properties",titlelen);
    strncpy(title,"libsndfile supported File Properties",titlelen);
    if (IsOpen())
    {
        char temp[4096],lengthbuf[128];
        format_timestr((double) m_length / (double)m_srate,lengthbuf,sizeof(lengthbuf));
        
        SF_FORMAT_INFO fi_major;
        fi_major.format=m_sfinfo.format & SF_FORMAT_TYPEMASK;
        ptr_sf_command(0,SFC_GET_FORMAT_INFO,&fi_major,sizeof(fi_major));
        
        
        SF_FORMAT_INFO fi_subformat;
        fi_subformat.format=m_sfinfo.format & SF_FORMAT_SUBMASK;
        ptr_sf_command(0,SFC_GET_FORMAT_INFO,&fi_subformat,sizeof(fi_subformat));
        
        
        sprintf(temp,"Length: %s:\r\n"
                "Samplerate: %.0f\r\n"
                "Channels: %d\r\n"
                "Bits/sample: %d\r\n"
                "Format: %s\r\n"
                "Encoding: %s\r\n"
                "libsndfile version: %s\r\n",
                lengthbuf,m_srate,m_nch,m_bps,fi_major.name,fi_subformat.name,ptr_sf_version_string());

        // lstrcpyn(buf,temp,buflen);
        strncpy(buf,temp,buflen);
        //delete[] fi.name;
    } else
        sprintf(buf,"Error: File not has been opened succesfully");

}
示例#2
0
  void GetInfoString(char *buf, int buflen, char *title, int titlelen)
  {
    lstrcpyn(title,"RAW File Properties",titlelen);

    if (IsOpen())
    {
      // todo: add any decoder specific info
      char temp[4096],lengthbuf[128];
      format_timestr((double) m_length / (double)m_srate,lengthbuf,sizeof(lengthbuf));
      sprintf(temp,"Length: %s:\r\n"
                   "Samplerate: %.0f\r\n"
                   "Channels: %d\r\n"
                   "Bits/sample: %d\r\n",  
            lengthbuf,m_srate,m_nch,m_bps);
        
      lstrcpyn(buf,temp,buflen);
    }
    else if (!m_isopened) lstrcpyn(buf,"Media offline",buflen);
    else if (m_fh) lstrcpyn(buf,"Error initializing decoder",buflen);
    else lstrcpyn(buf,"Error opening file",buflen);
  }