Lines Matching defs:psf
66 static int spx_read_header (SF_PRIVATE * psf) ;
67 static int spx_close (SF_PRIVATE *psf) ;
68 static void *spx_header_read (SF_PRIVATE * psf, ogg_packet *op, spx_int32_t enh_enabled, int force_mode) ;
72 ogg_speex_open (SF_PRIVATE *psf)
73 { OGG_PRIVATE* odata = psf->container_data ;
78 { psf_log_printf (psf, "%s : odata is NULL???\n", __func__) ;
83 psf->codec_data = spx ;
87 if (psf->file.mode == SFM_RDWR)
90 if (psf->file.mode == SFM_READ)
94 if ((error = spx_read_header (psf)))
98 psf->read_short = spx_read_s ;
99 psf->read_int = spx_read_i ;
100 psf->read_float = spx_read_f ;
101 psf->read_double = spx_read_d ;
102 psf->sf.frames = spx_length (psf) ;
106 psf->codec_close = spx_close ;
108 if (psf->file.mode == SFM_WRITE)
114 psf->write_header = spx_write_header ;
115 psf->write_short = spx_write_s ;
116 psf->write_int = spx_write_i ;
117 psf->write_float = spx_write_f ;
118 psf->write_double = spx_write_d ;
121 psf->sf.frames = SF_COUNT_MAX ; /* Unknown really */
122 psf->strings.flags = SF_STR_ALLOW_START ;
125 psf->bytewidth = 1 ;
126 psf->blockwidth = psf->bytewidth * psf->sf.channels ;
129 psf->seek = spx_seek ;
130 psf->command = spx_command ;
134 psf->sf.format = SF_FORMAT_OGG | SF_FORMAT_SPEEX ;
135 psf->sf.sections = 1 ;
137 psf->datalength = 1 ;
138 psf->dataoffset = 0 ;
147 spx_read_header (SF_PRIVATE * psf)
150 OGG_PRIVATE* odata = psf->container_data ;
151 SPX_PRIVATE* spx = psf->codec_data ;
165 psf_log_printf (psf, "Speex header\n") ;
173 psf_fseek (psf, 0, SEEK_SET) ;
180 psf->sf.channels = -1 ;
181 psf->sf.samplerate = 0 ;
186 nb_read = psf_fread (data, 1, OGG_SPX_READ_SIZE, psf) ;
216 { spx->state = spx_header_read (psf, &odata->opacket, enh_enabled, force_mode) ;
234 psf_log_printf (psf, "End\n") ;
236 psf_log_printf (psf, "packet_count %d\n", packet_count) ;
237 psf_log_printf (psf, "page_nb_packets %d\n", page_nb_packets) ;
238 psf_log_printf (psf, "page_granule %lld\n", page_granule) ;
244 spx_close (SF_PRIVATE *psf)
245 { SPX_PRIVATE* spx = psf->codec_data ;
259 spx_header_read (SF_PRIVATE * psf, ogg_packet *op, spx_int32_t enh_enabled, int force_mode)
260 { SPX_PRIVATE* spx = psf->codec_data ;
269 { psf_log_printf (psf, "Cannot read Speex header\n") ;
278 { psf_log_printf (psf, "Mode number %d does not (yet/any longer) exist in this version\n", spx->header.mode) ;
289 { psf_log_printf (psf, "This file was encoded with Speex bit-stream version %d, which I don't know how to decode\n", spx->header.speex_version_id) ;
294 { psf_log_printf (psf, "The file was encoded with a newer version of Speex. You need to upgrade in order to play it.\n") ;
299 { psf_log_printf (psf, "The file was encoded with an older version of Speex. You would need to downgrade the version in order to play it.\n") ;
305 { psf_log_printf (psf, "Decoder initialization failed.\n") ;
313 if (!psf->sf.samplerate)
314 psf->sf.samplerate = spx->header.rate ;
318 { psf->sf.samplerate <<= (force_mode - spx->header.mode) ;
322 { psf->sf.samplerate >>= (spx->header.mode - force_mode) ;
327 speex_decoder_ctl (st, SPEEX_SET_SAMPLING_RATE, &psf->sf.samplerate) ;
331 if (psf->sf.channels == -1)
332 psf->sf.channels = spx->header.nb_channels ;
334 if (! (psf->sf.channels == 1))
335 { psf->sf.channels = 2 ;
344 psf_log_printf (psf, " Encoder ver : %s\n Frames/packet : %d\n",
348 psf_log_printf (psf, " Bit rate : %d\n", spx->header.bitrate) ;
350 psf_log_printf (psf, " Sample rate : %d\n Mode : %s\n VBR : %s\n Channels : %d\n",
351 psf->sf.samplerate, mode->modeName, (spx->header.vbr ? "yes" : "no"), psf->sf.channels) ;
353 psf_log_printf (psf, " Extra headers : %d\n", spx->header.extra_headers) ;
422 ogg_speex_open (SF_PRIVATE *psf)
424 psf_log_printf (psf, "This version of libsndfile was compiled without Ogg/Speex support.\n") ;