ReactOS 0.4.15-dev-5666-gc548b97
frame.h File Reference
#include <stdio.h>
#include "config.h"
#include "mpg123.h"
#include "optimize.h"
#include "id3.h"
#include "icy.h"
#include "reader.h"
#include "index.h"
#include "synths.h"
Include dependency graph for frame.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  al_table
 
struct  outbuffer
 
struct  audioformat
 
struct  mpg123_pars_struct
 
struct  mpg123_handle_struct
 

Macros

#define MAXFRAMESIZE   3456
 
#define NUM_CHANNELS   2
 
#define SINGLE_STEREO   -1
 
#define SINGLE_LEFT   0
 
#define SINGLE_RIGHT   1
 
#define SINGLE_MIX   3
 
#define GAPLESS_DELAY   529
 

Enumerations

enum  frame_state_flags { FRAME_ACCURATE = 0x1 , FRAME_FRANKENSTEIN = 0x2 , FRAME_FRESH_DECODER = 0x4 }
 

Functions

void invalidate_format (struct audioformat *af)
 
void frame_init (mpg123_handle *fr)
 
void frame_init_par (mpg123_handle *fr, mpg123_pars *mp)
 
int frame_outbuffer (mpg123_handle *fr)
 
int frame_output_format (mpg123_handle *fr)
 
int frame_buffers (mpg123_handle *fr)
 
int frame_reset (mpg123_handle *fr)
 
int frame_buffers_reset (mpg123_handle *fr)
 
void frame_exit (mpg123_handle *fr)
 
int mpg123_print_index (mpg123_handle *fr, FILE *out)
 
off_t frame_index_find (mpg123_handle *fr, off_t want_frame, off_t *get_frame)
 
int frame_index_setup (mpg123_handle *fr)
 
void do_volume (mpg123_handle *fr, double factor)
 
void do_rva (mpg123_handle *fr)
 
void frame_gapless_init (mpg123_handle *fr, off_t framecount, off_t bskip, off_t eskip)
 
void frame_gapless_realinit (mpg123_handle *fr)
 
void frame_gapless_update (mpg123_handle *mh, off_t total_samples)
 
off_t frame_expect_outsamples (mpg123_handle *fr)
 
void frame_skip (mpg123_handle *fr)
 
off_t frame_ins2outs (mpg123_handle *fr, off_t ins)
 
off_t frame_outs (mpg123_handle *fr, off_t num)
 
off_t frame_expect_outsampels (mpg123_handle *fr)
 
off_t frame_offset (mpg123_handle *fr, off_t outs)
 
void frame_set_frameseek (mpg123_handle *fr, off_t fe)
 
void frame_set_seek (mpg123_handle *fr, off_t sp)
 
off_t frame_tell_seek (mpg123_handle *fr)
 
int frame_fill_toc (mpg123_handle *fr, unsigned char *in)
 

Macro Definition Documentation

◆ GAPLESS_DELAY

#define GAPLESS_DELAY   529

Definition at line 390 of file frame.h.

◆ MAXFRAMESIZE

#define MAXFRAMESIZE   3456

Definition at line 30 of file frame.h.

◆ NUM_CHANNELS

#define NUM_CHANNELS   2

Definition at line 72 of file frame.h.

◆ SINGLE_LEFT

#define SINGLE_LEFT   0

Definition at line 189 of file frame.h.

◆ SINGLE_MIX

#define SINGLE_MIX   3

Definition at line 191 of file frame.h.

◆ SINGLE_RIGHT

#define SINGLE_RIGHT   1

Definition at line 190 of file frame.h.

◆ SINGLE_STEREO

#define SINGLE_STEREO   -1

Definition at line 188 of file frame.h.

Enumeration Type Documentation

◆ frame_state_flags

Enumerator
FRAME_ACCURATE 

0001 Positions are considered accurate.

FRAME_FRANKENSTEIN 

0010 This stream is concatenated.

FRAME_FRESH_DECODER 

0100 Decoder is fleshly initialized.

Definition at line 90 of file frame.h.

91{
92 FRAME_ACCURATE = 0x1
93 ,FRAME_FRANKENSTEIN = 0x2
95};
@ FRAME_FRESH_DECODER
Definition: frame.h:94
@ FRAME_ACCURATE
Definition: frame.h:92
@ FRAME_FRANKENSTEIN
Definition: frame.h:93

Function Documentation

◆ do_rva()

void do_rva ( mpg123_handle fr)

Definition at line 1014 of file frame.c.

1015{
1016 double peak = 0;
1017 double gain = 0;
1018 double newscale;
1019 double rvafact = 1;
1020 if(get_rva(fr, &peak, &gain))
1021 {
1022 if(NOQUIET && fr->p.verbose > 1) fprintf(stderr, "Note: doing RVA with gain %f\n", gain);
1023 rvafact = pow(10,gain/20);
1024 }
1025
1026 newscale = fr->p.outscale*rvafact;
1027
1028 /* if peak is unknown (== 0) this check won't hurt */
1029 if((peak*newscale) > 1.0)
1030 {
1031 newscale = 1.0/peak;
1032 warning2("limiting scale value to %f to prevent clipping with indicated peak factor of %f", newscale, peak);
1033 }
1034 /* first rva setting is forced with fr->lastscale < 0 */
1035 if(newscale != fr->lastscale || fr->decoder_change)
1036 {
1037 debug3("changing scale value from %f to %f (peak estimated to %f)", fr->lastscale != -1 ? fr->lastscale : fr->p.outscale, newscale, (double) (newscale*peak));
1038 fr->lastscale = newscale;
1039 /* It may be too early, actually. */
1040 if(fr->make_decode_tables != NULL) fr->make_decode_tables(fr); /* the actual work */
1041 }
1042}
#define NULL
Definition: types.h:112
double pow(double x, double y)
Definition: freeldr.c:110
#define stderr
Definition: stdio.h:100
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
#define NOQUIET
#define warning2(s, a, b)
Definition: debug.h:85
#define debug3(s, a, b, c)
Definition: debug.h:63
static int get_rva(mpg123_handle *fr, double *peak, double *gain)
Definition: frame.c:991
struct mpg123_pars_struct p
Definition: frame.h:289
double lastscale
Definition: frame.h:237
void(* make_decode_tables)(mpg123_handle *fr)
Definition: frame.h:184

◆ do_volume()

void do_volume ( mpg123_handle fr,
double  factor 
)

◆ frame_buffers()

int frame_buffers ( mpg123_handle fr)

Definition at line 268 of file frame.c.

269{
270 int buffssize = 0;
271 debug1("frame %p buffer", (void*)fr);
272/*
273 the used-to-be-static buffer of the synth functions, has some subtly different types/sizes
274
275 2to1, 4to1, ntom, generic, i386: real[2][2][0x110]
276 mmx, sse: short[2][2][0x110]
277 i586(_dither): 4352 bytes; int/long[2][2][0x110]
278 i486: int[2][2][17*FIR_BUFFER_SIZE]
279 altivec: static real __attribute__ ((aligned (16))) buffs[4][4][0x110]
280
281 Huh, altivec looks like fun. Well, let it be large... then, the 16 byte alignment seems to be implicit on MacOSX malloc anyway.
282 Let's make a reasonable attempt to allocate enough memory...
283 Keep in mind: biggest ones are i486 and altivec (mutually exclusive!), then follows i586 and normal real.
284 mmx/sse use short but also real for resampling.
285 Thus, minimum is 2*2*0x110*sizeof(real).
286*/
287 if(fr->cpu_opts.type == altivec) buffssize = 4*4*0x110*sizeof(real);
288#ifdef OPT_I486
289 else if(fr->cpu_opts.type == ivier) buffssize = 2*2*17*FIR_BUFFER_SIZE*sizeof(int);
290#endif
291 else if(fr->cpu_opts.type == ifuenf || fr->cpu_opts.type == ifuenf_dither || fr->cpu_opts.type == dreidnow)
292 buffssize = 2*2*0x110*4; /* don't rely on type real, we need 4352 bytes */
293
294 if(2*2*0x110*sizeof(real) > buffssize)
295 buffssize = 2*2*0x110*sizeof(real);
296 buffssize += 15; /* For 16-byte alignment (SSE likes that). */
297
298 if(fr->rawbuffs != NULL && fr->rawbuffss != buffssize)
299 {
300 free(fr->rawbuffs);
301 fr->rawbuffs = NULL;
302 }
303
304 if(fr->rawbuffs == NULL) fr->rawbuffs = (unsigned char*) malloc(buffssize);
305 if(fr->rawbuffs == NULL) return -1;
306 fr->rawbuffss = buffssize;
307 fr->short_buffs[0][0] = aligned_pointer(fr->rawbuffs,short,16);
308 fr->short_buffs[0][1] = fr->short_buffs[0][0] + 0x110;
309 fr->short_buffs[1][0] = fr->short_buffs[0][1] + 0x110;
310 fr->short_buffs[1][1] = fr->short_buffs[1][0] + 0x110;
311 fr->real_buffs[0][0] = aligned_pointer(fr->rawbuffs,real,16);
312 fr->real_buffs[0][1] = fr->real_buffs[0][0] + 0x110;
313 fr->real_buffs[1][0] = fr->real_buffs[0][1] + 0x110;
314 fr->real_buffs[1][1] = fr->real_buffs[1][0] + 0x110;
315#ifdef OPT_I486
316 if(fr->cpu_opts.type == ivier)
317 {
318 fr->int_buffs[0][0] = (int*) fr->rawbuffs;
319 fr->int_buffs[0][1] = fr->int_buffs[0][0] + 17*FIR_BUFFER_SIZE;
320 fr->int_buffs[1][0] = fr->int_buffs[0][1] + 17*FIR_BUFFER_SIZE;
321 fr->int_buffs[1][1] = fr->int_buffs[1][0] + 17*FIR_BUFFER_SIZE;
322 }
323#endif
324#ifdef OPT_ALTIVEC
325 if(fr->cpu_opts.type == altivec)
326 {
327 int i,j;
328 fr->areal_buffs[0][0] = (real*) fr->rawbuffs;
329 for(i=0; i<4; ++i) for(j=0; j<4; ++j)
330 fr->areal_buffs[i][j] = fr->areal_buffs[0][0] + (i*4+j)*0x110;
331 }
332#endif
333 /* now the different decwins... all of the same size, actually */
334 /* The MMX ones want 32byte alignment, which I'll try to ensure manually */
335 {
336 int decwin_size = (512+32)*sizeof(real);
337#ifdef OPT_MMXORSSE
338#ifdef OPT_MULTI
339 if(fr->cpu_opts.class == mmxsse)
340 {
341#endif
342 /* decwin_mmx will share, decwins will be appended ... sizeof(float)==4 */
343 if(decwin_size < (512+32)*4) decwin_size = (512+32)*4;
344
345 /* the second window + alignment zone -- we align for 32 bytes for SSE as
346 requirement, 64 byte for matching cache line size (that matters!) */
347 decwin_size += (512+32)*4 + 63;
348 /* (512+32)*4/32 == 2176/32 == 68, so one decwin block retains alignment for 32 or 64 bytes */
349#ifdef OPT_MULTI
350 }
351#endif
352#endif
353#if defined(OPT_ALTIVEC) || defined(OPT_ARM)
354 /* sizeof(real) >= 4 ... yes, it could be 8, for example.
355 We got it intialized to at least (512+32)*sizeof(real).*/
356 decwin_size += 512*sizeof(real);
357#endif
358 /* Hm, that's basically realloc() ... */
359 if(fr->rawdecwin != NULL && fr->rawdecwins != decwin_size)
360 {
361 free(fr->rawdecwin);
362 fr->rawdecwin = NULL;
363 }
364
365 if(fr->rawdecwin == NULL)
366 fr->rawdecwin = (unsigned char*) malloc(decwin_size);
367
368 if(fr->rawdecwin == NULL) return -1;
369
370 fr->rawdecwins = decwin_size;
371 fr->decwin = (real*) fr->rawdecwin;
372#ifdef OPT_MMXORSSE
373#ifdef OPT_MULTI
374 if(fr->cpu_opts.class == mmxsse)
375 {
376#endif
377 /* align decwin, assign that to decwin_mmx, append decwins */
378 /* I need to add to decwin what is missing to the next full 64 byte -- also I want to make gcc -pedantic happy... */
379 fr->decwin = aligned_pointer(fr->rawdecwin,real,64);
380 debug1("aligned decwin: %p", (void*)fr->decwin);
381 fr->decwin_mmx = (float*)fr->decwin;
382 fr->decwins = fr->decwin_mmx+512+32;
383#ifdef OPT_MULTI
384 }
385 else debug("no decwins/decwin_mmx for that class");
386#endif
387#endif
388 }
389
390 /* Layer scratch buffers are of compile-time fixed size, so allocate only once. */
391 if(fr->layerscratch == NULL)
392 {
393 /* Allocate specific layer1/2/3 buffers, so that we know they'll work for SSE. */
394 size_t scratchsize = 0;
395 real *scratcher;
396#ifndef NO_LAYER1
397 scratchsize += sizeof(real) * 2 * SBLIMIT;
398#endif
399#ifndef NO_LAYER2
400 scratchsize += sizeof(real) * 2 * 4 * SBLIMIT;
401#endif
402#ifndef NO_LAYER3
403 scratchsize += sizeof(real) * 2 * SBLIMIT * SSLIMIT; /* hybrid_in */
404 scratchsize += sizeof(real) * 2 * SSLIMIT * SBLIMIT; /* hybrid_out */
405#endif
406 /*
407 Now figure out correct alignment:
408 We need 16 byte minimum, smallest unit of the blocks is 2*SBLIMIT*sizeof(real), which is 64*4=256. Let's do 64bytes as heuristic for cache line (as proven useful in buffs above).
409 */
410 fr->layerscratch = malloc(scratchsize+63);
411 if(fr->layerscratch == NULL) return -1;
412
413 /* Get aligned part of the memory, then divide it up. */
414 scratcher = aligned_pointer(fr->layerscratch,real,64);
415 /* Those funky pointer casts silence compilers...
416 One might change the code at hand to really just use 1D arrays, but in practice, that would not make a (positive) difference. */
417#ifndef NO_LAYER1
418 fr->layer1.fraction = (real(*)[SBLIMIT])scratcher;
419 scratcher += 2 * SBLIMIT;
420#endif
421#ifndef NO_LAYER2
422 fr->layer2.fraction = (real(*)[4][SBLIMIT])scratcher;
423 scratcher += 2 * 4 * SBLIMIT;
424#endif
425#ifndef NO_LAYER3
426 fr->layer3.hybrid_in = (real(*)[SBLIMIT][SSLIMIT])scratcher;
427 scratcher += 2 * SBLIMIT * SSLIMIT;
428 fr->layer3.hybrid_out = (real(*)[SSLIMIT][SBLIMIT])scratcher;
429 scratcher += 2 * SSLIMIT * SBLIMIT;
430#endif
431 /* Note: These buffers don't need resetting here. */
432 }
433
434 /* Only reset the buffers we created just now. */
436
437 debug1("frame %p buffer done", (void*)fr);
438 return 0;
439}
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define debug(msg)
Definition: key_call.c:71
#define real
#define SBLIMIT
#define SSLIMIT
@ mmxsse
Definition: optimize.h:166
@ ivier
Definition: optimize.h:100
@ dreidnow
Definition: optimize.h:104
@ ifuenf
Definition: optimize.h:101
@ altivec
Definition: optimize.h:106
@ ifuenf_dither
Definition: optimize.h:102
#define debug1(s, a)
Definition: debug.h:61
#define aligned_pointer(p, type, alignment)
Definition: frame.c:18
static void frame_decode_buffers_reset(mpg123_handle *fr)
Definition: frame.c:262
real * real_buffs[2][2]
Definition: frame.h:106
short * short_buffs[2][2]
Definition: frame.h:105
unsigned char * rawdecwin
Definition: frame.h:117
unsigned char * rawbuffs
Definition: frame.h:107
struct mpg123_handle_struct::@3433 layer3
struct mpg123_handle_struct::@3429 cpu_opts
real * layerscratch
Definition: frame.h:314
struct mpg123_handle_struct::@3432 layer2
struct mpg123_handle_struct::@3431 layer1

◆ frame_buffers_reset()

int frame_buffers_reset ( mpg123_handle fr)

Definition at line 441 of file frame.c.

442{
443 fr->buffer.fill = 0; /* hm, reset buffer fill... did we do a flush? */
444 fr->bsnum = 0;
445 /* Wondering: could it be actually _wanted_ to retain buffer contents over different files? (special gapless / cut stuff) */
446 fr->bsbuf = fr->bsspace[1];
447 fr->bsbufold = fr->bsbuf;
448 fr->bitreservoir = 0;
450 memset(fr->bsspace, 0, 2*(MAXFRAMESIZE+512));
451 memset(fr->ssave, 0, 34);
452 fr->hybrid_blc[0] = fr->hybrid_blc[1] = 0;
453 memset(fr->hybrid_block, 0, sizeof(real)*2*2*SBLIMIT*SSLIMIT);
454 return 0;
455}
#define MAXFRAMESIZE
Definition: frame.h:30
#define memset(x, y, z)
Definition: compat.h:39
unsigned char * bsbufold
Definition: frame.h:255
unsigned int bitreservoir
Definition: frame.h:252
int hybrid_blc[2]
Definition: frame.h:103
struct outbuffer buffer
Definition: frame.h:267
real hybrid_block[2][2][SBLIMIT *SSLIMIT]
Definition: frame.h:102
unsigned char ssave[34]
Definition: frame.h:130
unsigned char * bsbuf
Definition: frame.h:254
unsigned char bsspace[2][MAXFRAMESIZE+512+4]
Definition: frame.h:253

◆ frame_exit()

void frame_exit ( mpg123_handle fr)

Definition at line 593 of file frame.c.

594{
595 if(fr->buffer.rdata != NULL)
596 {
597 debug1("freeing buffer at %p", (void*)fr->buffer.rdata);
598 free(fr->buffer.rdata);
599 }
600 fr->buffer.rdata = NULL;
602 frame_free_toc(fr);
603#ifdef FRAME_INDEX
604 fi_exit(&fr->index);
605#endif
606#ifdef OPT_DITHER
607 if(fr->dithernoise != NULL)
608 {
609 free(fr->dithernoise);
610 fr->dithernoise = NULL;
611 }
612#endif
613 exit_id3(fr);
614 clear_icy(&fr->icy);
615 /* Clean up possible mess from LFS wrapper. */
616 if(fr->wrapperclean != NULL)
617 {
618 fr->wrapperclean(fr->wrapperdata);
619 fr->wrapperdata = NULL;
620 }
621#ifndef NO_FEEDER
622 bc_cleanup(&fr->rdat.buffer);
623#endif
624}
#define bc_cleanup
Definition: intsym.h:248
#define clear_icy
Definition: intsym.h:209
#define exit_id3
Definition: intsym.h:212
#define fi_exit
Definition: intsym.h:218
static void frame_free_toc(mpg123_handle *fr)
Definition: frame.c:467
static void frame_free_buffers(mpg123_handle *fr)
Definition: frame.c:578
struct frame_index index
Definition: frame.h:263
struct icy_meta icy
Definition: frame.h:303
void * wrapperdata
Definition: frame.h:337
struct reader_data rdat
Definition: frame.h:288
void(* wrapperclean)(void *)
Definition: frame.h:339

◆ frame_expect_outsampels()

off_t frame_expect_outsampels ( mpg123_handle fr)

◆ frame_expect_outsamples()

off_t frame_expect_outsamples ( mpg123_handle fr)

Definition at line 797 of file frame.c.

798{
799 off_t outs = 0;
800 switch(fr->down_sample)
801 {
802 case 0:
803# ifndef NO_DOWNSAMPLE
804 case 1:
805 case 2:
806# endif
807 outs = fr->spf>>fr->down_sample;
808 break;
809#ifndef NO_NTOM
810 case 3: outs = ntom_frame_outsamples(fr); break;
811#endif
812 default: if(NOQUIET)
813 merror( "Bad down_sample (%i) ... should not be possible!!"
814 , fr->down_sample );
815 }
816 return outs;
817}
__kernel_off_t off_t
Definition: linux.h:201
#define ntom_frame_outsamples
Definition: intsym.h:156
#define merror(s,...)
Definition: debug.h:122

◆ frame_fill_toc()

int frame_fill_toc ( mpg123_handle fr,
unsigned char in 
)

Definition at line 473 of file frame.c.

474{
475 if(fr->xing_toc == NULL) fr->xing_toc = malloc(100);
476 if(fr->xing_toc != NULL)
477 {
478 memcpy(fr->xing_toc, in, 100);
479#ifdef DEBUG
480 debug("Got a TOC! Showing the values...");
481 {
482 int i;
483 for(i=0; i<100; ++i)
484 debug2("entry %i = %i", i, fr->xing_toc[i]);
485 }
486#endif
487 return TRUE;
488 }
489 return FALSE;
490}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
GLuint in
Definition: glext.h:9616
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define debug2(s, a, b)
Definition: debug.h:62
unsigned char * xing_toc
Definition: frame.h:222

◆ frame_gapless_init()

void frame_gapless_init ( mpg123_handle fr,
off_t  framecount,
off_t  bskip,
off_t  eskip 
)

◆ frame_gapless_realinit()

void frame_gapless_realinit ( mpg123_handle fr)

◆ frame_gapless_update()

void frame_gapless_update ( mpg123_handle mh,
off_t  total_samples 
)

◆ frame_index_find()

off_t frame_index_find ( mpg123_handle fr,
off_t  want_frame,
off_t get_frame 
)

Definition at line 706 of file frame.c.

707{
708 /* default is file start if no index position */
709 off_t gopos = 0;
710 *get_frame = 0;
711#ifdef FRAME_INDEX
712 /* Possibly use VBRI index, too? I'd need an example for this... */
713 if(fr->index.fill)
714 {
715 /* find in index */
716 size_t fi;
717 /* at index fi there is frame step*fi... */
718 fi = want_frame/fr->index.step;
719 if(fi >= fr->index.fill) /* If we are beyond the end of frame index...*/
720 {
721 /* When fuzzy seek is allowed, we have some limited tolerance for the frames we want to read rather then jump over. */
722 if(fr->p.flags & MPG123_FUZZY && want_frame - (fr->index.fill-1)*fr->index.step > 10)
723 {
724 gopos = frame_fuzzy_find(fr, want_frame, get_frame);
725 if(gopos > fr->audio_start) return gopos; /* Only in that case, we have a useful guess. */
726 /* Else... just continue, fuzzyness didn't help. */
727 }
728 /* Use the last available position, slowly advancing from that one. */
729 fi = fr->index.fill - 1;
730 }
731 /* We have index position, that yields frame and byte offsets. */
732 *get_frame = fi*fr->index.step;
733 gopos = fr->index.data[fi];
734 fr->state_flags |= FRAME_ACCURATE; /* When using the frame index, we are accurate. */
735 }
736 else
737 {
738#endif
739 if(fr->p.flags & MPG123_FUZZY)
740 return frame_fuzzy_find(fr, want_frame, get_frame);
741 /* A bit hackish here... but we need to be fresh when looking for the first header again. */
742 fr->firsthead = 0;
743 fr->oldhead = 0;
744#ifdef FRAME_INDEX
745 }
746#endif
747 debug2("index: 0x%lx for frame %li", (unsigned long)gopos, (long) *get_frame);
748 return gopos;
749}
@ MPG123_FUZZY
Definition: mpg123.h:223
static off_t frame_fuzzy_find(mpg123_handle *fr, off_t want_frame, off_t *get_frame)
Definition: frame.c:658
unsigned long oldhead
Definition: frame.h:258
unsigned long firsthead
Definition: frame.h:260

◆ frame_index_setup()

int frame_index_setup ( mpg123_handle fr)

◆ frame_init()

void frame_init ( mpg123_handle fr)

Definition at line 70 of file frame.c.

71{
73}
#define frame_init_par
Definition: intsym.h:180

◆ frame_init_par()

void frame_init_par ( mpg123_handle fr,
mpg123_pars mp 
)

Definition at line 75 of file frame.c.

76{
77 fr->own_buffer = TRUE;
78 fr->buffer.data = NULL;
79 fr->buffer.rdata = NULL;
80 fr->buffer.fill = 0;
81 fr->buffer.size = 0;
82 fr->rawbuffs = NULL;
83 fr->rawbuffss = 0;
84 fr->rawdecwin = NULL;
85 fr->rawdecwins = 0;
86#ifndef NO_8BIT
87 fr->conv16to8_buf = NULL;
88#endif
89#ifdef OPT_DITHER
90 fr->dithernoise = NULL;
91#endif
92 fr->layerscratch = NULL;
93 fr->xing_toc = NULL;
94 fr->cpu_opts.type = defdec();
95 fr->cpu_opts.class = decclass(fr->cpu_opts.type);
96#ifndef NO_NTOM
97 /* these two look unnecessary, check guarantee for synth_ntom_set_step (in control_generic, even)! */
98 fr->ntom_val[0] = NTOM_MUL>>1;
99 fr->ntom_val[1] = NTOM_MUL>>1;
100 fr->ntom_step = NTOM_MUL;
101#endif
102 /* unnecessary: fr->buffer.size = fr->buffer.fill = 0; */
103 mpg123_reset_eq(fr);
104 init_icy(&fr->icy);
105 init_id3(fr);
106 /* frame_outbuffer is missing... */
107 /* frame_buffers is missing... that one needs cpu opt setting! */
108 /* after these... frame_reset is needed before starting full decode */
109 invalidate_format(&fr->af);
110 fr->rdat.r_read = NULL;
111 fr->rdat.r_lseek = NULL;
112 fr->rdat.iohandle = NULL;
113 fr->rdat.r_read_handle = NULL;
114 fr->rdat.r_lseek_handle = NULL;
115 fr->rdat.cleanup_handle = NULL;
116 fr->wrapperdata = NULL;
117 fr->wrapperclean = NULL;
118 fr->decoder_change = 1;
119 fr->err = MPG123_OK;
120 if(mp == NULL) frame_default_pars(&fr->p);
121 else memcpy(&fr->p, mp, sizeof(struct mpg123_pars_struct));
122
123#ifndef NO_FEEDER
124 bc_prepare(&fr->rdat.buffer, fr->p.feedpool, fr->p.feedbuffer);
125#endif
126
127 fr->down_sample = 0; /* Initialize to silence harmless errors when debugging. */
128 fr->id3v2_raw = NULL;
129 frame_fixed_reset(fr); /* Reset only the fixed data, dynamic buffers are not there yet! */
130 fr->synth = NULL;
131 fr->synth_mono = NULL;
133#ifdef FRAME_INDEX
134 fi_init(&fr->index);
135 frame_index_setup(fr); /* Apply the size setting. */
136#endif
137#ifndef NO_MOREINFO
138 fr->pinfo = NULL;
139#endif
140}
@ MPG123_OK
Definition: mpg123.h:383
int attribute_align_arg mpg123_reset_eq(mpg123_handle *mh)
Definition: frame.c:172
#define invalidate_format
Definition: intsym.h:178
#define fi_init
Definition: intsym.h:217
#define decclass
Definition: intsym.h:235
#define bc_prepare
Definition: intsym.h:247
#define frame_index_setup
Definition: intsym.h:188
#define init_icy
Definition: intsym.h:208
#define init_id3
Definition: intsym.h:211
#define defdec
Definition: intsym.h:234
static void frame_default_pars(mpg123_pars *mp)
Definition: frame.c:36
#define NTOM_MUL
Definition: frame.c:16
static void frame_fixed_reset(mpg123_handle *fr)
Definition: frame.c:507
func_synth_mono synth_mono
Definition: frame.h:182
unsigned long ntom_step
Definition: frame.h:150
unsigned long ntom_val[2]
Definition: frame.h:149
unsigned char * id3v2_raw
Definition: frame.h:300
unsigned char * conv16to8_buf
Definition: frame.h:134
struct mpg123_moreinfo * pinfo
Definition: frame.h:343
struct audioformat af
Definition: frame.h:268
func_synth synth
Definition: frame.h:180

◆ frame_ins2outs()

off_t frame_ins2outs ( mpg123_handle fr,
off_t  ins 
)

Definition at line 751 of file frame.c.

752{
753 off_t outs = 0;
754 switch(fr->down_sample)
755 {
756 case 0:
757# ifndef NO_DOWNSAMPLE
758 case 1:
759 case 2:
760# endif
761 outs = ins>>fr->down_sample;
762 break;
763# ifndef NO_NTOM
764 case 3: outs = ntom_ins2outs(fr, ins); break;
765# endif
766 default: if(NOQUIET)
767 merror( "Bad down_sample (%i) ... should not be possible!!"
768 , fr->down_sample );
769 }
770 return outs;
771}
#define ntom_ins2outs
Definition: intsym.h:158

◆ frame_offset()

off_t frame_offset ( mpg123_handle fr,
off_t  outs 
)

Definition at line 819 of file frame.c.

820{
821 off_t num = 0;
822 switch(fr->down_sample)
823 {
824 case 0:
825# ifndef NO_DOWNSAMPLE
826 case 1:
827 case 2:
828# endif
829 num = outs/(fr->spf>>fr->down_sample);
830 break;
831#ifndef NO_NTOM
832 case 3: num = ntom_frameoff(fr, outs); break;
833#endif
834 default: if(NOQUIET)
835 error("Bad down_sample ... should not be possible!!");
836 }
837 return num;
838}
GLuint GLuint num
Definition: glext.h:9618
#define ntom_frameoff
Definition: intsym.h:159
#define error(str)
Definition: mkdosfs.c:1605

◆ frame_outbuffer()

int frame_outbuffer ( mpg123_handle fr)

Definition at line 183 of file frame.c.

184{
185 size_t size = fr->outblock;
186 if(!fr->own_buffer)
187 {
188 if(fr->buffer.size < size)
189 {
191 if(NOQUIET)
192 merror( "have external buffer of size %"SIZE_P", need %"SIZE_P
193 , (size_p)fr->buffer.size, (size_p)size );
194 return MPG123_ERR;
195 }
196 }
197
198 debug1("need frame buffer of %"SIZE_P, (size_p)size);
199 if(fr->buffer.rdata != NULL && fr->buffer.size != size)
200 {
201 free(fr->buffer.rdata);
202 fr->buffer.rdata = NULL;
203 }
204 fr->buffer.size = size;
205 fr->buffer.data = NULL;
206 /* be generous: use 16 byte alignment */
207 if(fr->buffer.rdata == NULL) fr->buffer.rdata = (unsigned char*) malloc(fr->buffer.size+15);
208 if(fr->buffer.rdata == NULL)
209 {
211 return MPG123_ERR;
212 }
213 fr->buffer.data = aligned_pointer(fr->buffer.rdata, unsigned char*, 16);
214 fr->own_buffer = TRUE;
215 fr->buffer.fill = 0;
216 return MPG123_OK;
217}
GLsizeiptr size
Definition: glext.h:5919
@ MPG123_BAD_BUFFER
Definition: mpg123.h:389
@ MPG123_ERR
Definition: mpg123.h:382
@ MPG123_OUT_OF_MEM
Definition: mpg123.h:390
#define SIZE_P
Definition: compat.h:139
unsigned long size_p
Definition: compat.h:140

◆ frame_output_format()

int frame_output_format ( mpg123_handle fr)

Definition at line 226 of file format.c.

227{
228 struct audioformat nf;
229 int f0=0;
230 int f2=MPG123_ENCODINGS+1; // Include all encodings by default.
231 mpg123_pars *p = &fr->p;
232 int try_float = (p->flags & MPG123_FLOAT_FALLBACK) ? 0 : 1;
233 /* initialize new format, encoding comes later */
234 nf.channels = fr->stereo;
235
236 // I intended the forcing stuff to be weaved into the format support table,
237 // but this probably will never happen, as this would change library behaviour.
238 // One could introduce an additional effective format table that takes for
239 // forcings into account, but that would have to be updated on any flag
240 // change. Tedious.
241 if(p->flags & MPG123_FORCE_8BIT)
242 {
243 f0 = enc_8bit_range[0];
244 f2 = enc_8bit_range[1];
245 }
246 if(p->flags & MPG123_FORCE_FLOAT)
247 {
248 try_float = 1;
249 f0 = enc_float_range[0];
250 f2 = enc_float_range[1];
251 }
252
253 /* force stereo is stronger */
254 if(p->flags & MPG123_FORCE_MONO) nf.channels = 1;
255 if(p->flags & MPG123_FORCE_STEREO) nf.channels = 2;
256
257 // Strategy update: Avoid too early triggering of the NtoM decoder.
258 // Main target is the native rate, with any encoding.
259 // Then, native rate with any channel count and any encoding.
260 // Then, it's down_sample from native rate.
261 // As last resort: NtoM rate.
262 // So the priority is 1. rate 2. channels 3. encoding.
263 // As encodings go, 16 bit is tranditionally preferred as efficient choice.
264 // Next in line are wider float and integer encodings, then 8 bit as
265 // last resort.
266
267#ifndef NO_NTOM
268 if(p->force_rate)
269 {
270 if(enc_chan_fit(p, p->force_rate, &nf, f0, f2, try_float))
271 goto end;
272 // Keep the order consistent if float is considered fallback only.
273 if(!try_float &&
274 enc_chan_fit(p, p->force_rate, &nf, f0, f2, TRUE))
275 goto end;
276
277 merror( "Unable to set up output format! Constraints: %s%s%liHz."
278 , ( p->flags & MPG123_FORCE_STEREO ? "stereo, " :
279 (p->flags & MPG123_FORCE_MONO ? "mono, " : "") )
280 , ( p->flags & MPG123_FORCE_FLOAT ? "float, " :
281 (p->flags & MPG123_FORCE_8BIT ? "8bit, " : "") )
282 , p->force_rate );
283/* if(NOQUIET && p->verbose <= 1) print_capabilities(fr); */
284
286 return -1;
287 }
288#endif
289 // Native decoder rate first.
290 if(enc_chan_fit(p, frame_freq(fr)>>p->down_sample, &nf, f0, f2, try_float))
291 goto end;
292 // Then downsamplings.
293 if(p->flags & MPG123_AUTO_RESAMPLE && p->down_sample < 2)
294 {
295 if(enc_chan_fit( p, frame_freq(fr)>>(p->down_sample+1), &nf
296 , f0, f2, try_float ))
297 goto end;
298 if(p->down_sample < 1 && enc_chan_fit( p, frame_freq(fr)>>2, &nf
299 , f0, f2, try_float ))
300 goto end;
301 }
302 // And again the whole deal with float fallback.
303 if(!try_float)
304 {
305 if(enc_chan_fit(p, frame_freq(fr)>>p->down_sample, &nf, f0, f2, TRUE))
306 goto end;
307 // Then downsamplings.
308 if(p->flags & MPG123_AUTO_RESAMPLE && p->down_sample < 2)
309 {
310 if(enc_chan_fit( p, frame_freq(fr)>>(p->down_sample+1), &nf
311 , f0, f2, TRUE ))
312 goto end;
313 if(p->down_sample < 1 && enc_chan_fit( p, frame_freq(fr)>>2, &nf
314 , f0, f2, TRUE ))
315 goto end;
316 }
317 }
318#ifndef NO_NTOM
319 // Try to find any rate that works and resample using NtoM hackery.
320 if( p->flags & MPG123_AUTO_RESAMPLE && fr->p.down_sample == 0)
321 {
322 int i;
323 int rn = rate2num(p, frame_freq(fr));
324 int rrn;
325 if(rn < 0) return 0;
326 /* Try higher rates first. */
327 for(rrn=rn+1; rrn<MPG123_RATES; ++rrn)
328 if(enc_chan_fit(p, my_rates[rrn], &nf, f0, f2, try_float))
329 goto end;
330 /* Then lower rates. */
331 for(i=f0;i<f2;i++) for(rrn=rn-1; rrn>=0; --rrn)
332 if(enc_chan_fit(p, my_rates[rrn], &nf, f0, f2, try_float))
333 goto end;
334 // And again for float fallback.
335 if(!try_float)
336 {
337 /* Try higher rates first. */
338 for(rrn=rn+1; rrn<MPG123_RATES; ++rrn)
339 if(enc_chan_fit(p, my_rates[rrn], &nf, f0, f2, TRUE))
340 goto end;
341 /* Then lower rates. */
342 for(i=f0;i<f2;i++) for(rrn=rn-1; rrn>=0; --rrn)
343 if(enc_chan_fit(p, my_rates[rrn], &nf, f0, f2, TRUE))
344 goto end;
345 }
346 }
347#endif
348
349 /* Here is the _bad_ end. */
350 merror( "Unable to set up output format! Constraints: %s%s%li, %li or %liHz."
351 , ( p->flags & MPG123_FORCE_STEREO ? "stereo, " :
352 (p->flags & MPG123_FORCE_MONO ? "mono, " : "") )
353 , ( p->flags & MPG123_FORCE_FLOAT ? "float, " :
354 (p->flags & MPG123_FORCE_8BIT ? "8bit, " : "") )
355 , frame_freq(fr), frame_freq(fr)>>1, frame_freq(fr)>>2 );
356/* if(NOQUIET && p->verbose <= 1) print_capabilities(fr); */
357
359 return -1;
360
361end: /* Here is the _good_ end. */
362 /* we had a successful match, now see if there's a change */
363 if(nf.rate == fr->af.rate && nf.channels == fr->af.channels && nf.encoding == fr->af.encoding)
364 {
365 debug2("Old format with %i channels, and FORCE_MONO=%li", nf.channels, p->flags & MPG123_FORCE_MONO);
366 return 0; /* the same format as before */
367 }
368 else /* a new format */
369 {
370 debug1("New format with %i channels!", nf.channels);
371 fr->af.rate = nf.rate;
372 fr->af.channels = nf.channels;
373 fr->af.encoding = nf.encoding;
374 /* Cache the size of one sample in bytes, for ease of use. */
375 fr->af.encsize = mpg123_encsize(fr->af.encoding);
376 if(fr->af.encsize < 1)
377 {
378 error1("Some unknown encoding??? (%i)", fr->af.encoding);
379
381 return -1;
382 }
383 /* Set up the decoder synth format. Might differ. */
384#ifdef NO_SYNTH32
385 /* Without high-precision synths, 16 bit signed is the basis for
386 everything higher than 8 bit. */
387 if(fr->af.encsize > 2)
388 fr->af.dec_enc = MPG123_ENC_SIGNED_16;
389 else
390 {
391#endif
392 switch(fr->af.encoding)
393 {
394#ifndef NO_32BIT
398 fr->af.dec_enc = MPG123_ENC_SIGNED_32;
399 break;
400#endif
401#ifndef NO_16BIT
403 fr->af.dec_enc = MPG123_ENC_SIGNED_16;
404 break;
405#endif
406 default:
407 fr->af.dec_enc = fr->af.encoding;
408 }
409#ifdef NO_SYNTH32
410 }
411#endif
412 fr->af.dec_encsize = mpg123_encsize(fr->af.dec_enc);
413 return 1;
414 }
415}
GLuint GLuint end
Definition: gl.h:1545
GLfloat GLfloat p
Definition: glext.h:8902
@ MPG123_ENC_UNSIGNED_32
Definition: fmt123.h:72
@ MPG123_ENC_SIGNED_16
Definition: fmt123.h:58
@ MPG123_ENC_UNSIGNED_24
Definition: fmt123.h:76
@ MPG123_ENC_SIGNED_24
Definition: fmt123.h:74
@ MPG123_ENC_SIGNED_32
Definition: fmt123.h:70
@ MPG123_ENC_UNSIGNED_16
Definition: fmt123.h:60
@ MPG123_BAD_OUTFORMAT
Definition: mpg123.h:384
@ MPG123_FORCE_MONO
Definition: mpg123.h:213
@ MPG123_FORCE_FLOAT
Definition: mpg123.h:224
@ MPG123_FORCE_8BIT
Definition: mpg123.h:218
@ MPG123_FORCE_STEREO
Definition: mpg123.h:217
@ MPG123_AUTO_RESAMPLE
Definition: mpg123.h:229
@ MPG123_FLOAT_FALLBACK
Definition: mpg123.h:253
int attribute_align_arg mpg123_encsize(int encoding)
Definition: format.c:131
#define frame_freq
Definition: intsym.h:239
#define MPG123_RATES
#define MPG123_ENCODINGS
#define error1(s, a)
Definition: debug.h:125
static int enc_chan_fit(mpg123_pars *p, long rate, struct audioformat *nnf, int f0, int f2, int try_float)
Definition: format.c:188
static const long my_rates[MPG123_RATES]
Definition: format.c:33
static int rate2num(mpg123_pars *mp, long r)
Definition: format.c:138
static const int enc_8bit_range[2]
Definition: format.c:63
static const int enc_float_range[2]
Definition: format.c:61
#define f2(x, y, z)
Definition: sha1.c:31

◆ frame_outs()

off_t frame_outs ( mpg123_handle fr,
off_t  num 
)

Definition at line 773 of file frame.c.

774{
775 off_t outs = 0;
776 switch(fr->down_sample)
777 {
778 case 0:
779# ifndef NO_DOWNSAMPLE
780 case 1:
781 case 2:
782# endif
783 outs = (fr->spf>>fr->down_sample)*num;
784 break;
785#ifndef NO_NTOM
786 case 3: outs = ntom_frmouts(fr, num); break;
787#endif
788 default: if(NOQUIET)
789 merror( "Bad down_sample (%i) ... should not be possible!!"
790 , fr->down_sample );
791 }
792 return outs;
793}
#define ntom_frmouts
Definition: intsym.h:157

◆ frame_reset()

int frame_reset ( mpg123_handle fr)

Definition at line 494 of file frame.c.

495{
498 frame_free_toc(fr);
499#ifdef FRAME_INDEX
500 fi_reset(&fr->index);
501#endif
502
503 return 0;
504}
#define fi_reset
Definition: intsym.h:222
#define frame_buffers_reset
Definition: intsym.h:185

◆ frame_set_frameseek()

void frame_set_frameseek ( mpg123_handle fr,
off_t  fe 
)

Definition at line 913 of file frame.c.

914{
915 fr->firstframe = fe;
916#ifdef GAPLESS
917 if(fr->p.flags & MPG123_GAPLESS && fr->gapless_frames > 0)
918 {
919 /* Take care of the beginning... */
920 off_t beg_f = frame_offset(fr, fr->begin_os);
921 if(fe <= beg_f)
922 {
923 fr->firstframe = beg_f;
924 fr->firstoff = fr->begin_os - frame_outs(fr, beg_f);
925 }
926 else fr->firstoff = 0;
927 /* The end is set once for a track at least, on the frame_set_frameseek called in get_next_frame() */
928 if(fr->end_os > 0)
929 {
930 fr->lastframe = frame_offset(fr,fr->end_os);
931 fr->lastoff = fr->end_os - frame_outs(fr, fr->lastframe);
932 } else {fr->lastframe = -1; fr->lastoff = 0; }
933 } else { fr->firstoff = fr->lastoff = 0; fr->lastframe = -1; }
934#endif
935 fr->ignoreframe = ignoreframe(fr);
936#ifdef GAPLESS
937 debug5("frame_set_frameseek: begin at %li frames and %li samples, end at %li and %li; ignore from %li",
938 (long) fr->firstframe, (long) fr->firstoff,
939 (long) fr->lastframe, (long) fr->lastoff, (long) fr->ignoreframe);
940#else
941 debug3("frame_set_frameseek: begin at %li frames, end at %li; ignore from %li",
942 (long) fr->firstframe, (long) fr->lastframe, (long) fr->ignoreframe);
943#endif
944}
@ MPG123_GAPLESS
Definition: mpg123.h:220
#define frame_outs
Definition: intsym.h:199
#define frame_offset
Definition: intsym.h:201
#define debug5(s, a, b, c, d, e)
Definition: debug.h:65
static off_t ignoreframe(mpg123_handle *fr)
Definition: frame.c:898
off_t gapless_frames
Definition: frame.h:277

◆ frame_set_seek()

void frame_set_seek ( mpg123_handle fr,
off_t  sp 
)

Definition at line 955 of file frame.c.

956{
957 fr->firstframe = frame_offset(fr, sp);
958 debug1("frame_set_seek: from %"OFF_P, fr->num);
959#ifndef NO_NTOM
960 if(fr->down_sample == 3) ntom_set_ntom(fr, fr->firstframe);
961#endif
962 fr->ignoreframe = ignoreframe(fr);
963#ifdef GAPLESS /* The sample offset is used for non-gapless mode, too! */
964 fr->firstoff = sp - frame_outs(fr, fr->firstframe);
965 debug5("frame_set_seek: begin at %li frames and %li samples, end at %li and %li; ignore from %li",
966 (long) fr->firstframe, (long) fr->firstoff,
967 (long) fr->lastframe, (long) fr->lastoff, (long) fr->ignoreframe);
968#else
969 debug3("frame_set_seek: begin at %li frames, end at %li; ignore from %li",
970 (long) fr->firstframe, (long) fr->lastframe, (long) fr->ignoreframe);
971#endif
972}
#define ntom_set_ntom
Definition: intsym.h:32
static const WCHAR sp[]
Definition: suminfo.c:287
#define OFF_P
Definition: compat.h:131

◆ frame_skip()

void frame_skip ( mpg123_handle fr)

Definition at line 946 of file frame.c.

947{
948#ifndef NO_LAYER3
949 if(fr->lay == 3) set_pointer(fr, 1, 512);
950#endif
951}
#define set_pointer
Definition: intsym.h:242

◆ frame_tell_seek()

off_t frame_tell_seek ( mpg123_handle fr)

◆ invalidate_format()

void invalidate_format ( struct audioformat af)

Definition at line 550 of file format.c.

551{
552 af->encoding = 0;
553 af->rate = 0;
554 af->channels = 0;
555}
int encoding
Definition: frame.h:50
int channels
Definition: frame.h:54
long rate
Definition: frame.h:55

◆ mpg123_print_index()

int mpg123_print_index ( mpg123_handle fr,
FILE out 
)