mirror of
http://mpg123.de/trunk/.git
synced 2025-10-25 04:37:34 +03:00
Merge in mpg123_framepos().
git-svn-id: svn://scm.orgis.org/mpg123/trunk@2954 35dc7657-300d-0410-a2e5-dc2837fedb53
This commit is contained in:
@@ -480,6 +480,7 @@ static void frame_fixed_reset(mpg123_handle *fr)
|
|||||||
fr->metaflags = 0;
|
fr->metaflags = 0;
|
||||||
fr->outblock = mpg123_safe_buffer();
|
fr->outblock = mpg123_safe_buffer();
|
||||||
fr->num = -1;
|
fr->num = -1;
|
||||||
|
fr->input_offset = -1;
|
||||||
fr->playnum = -1;
|
fr->playnum = -1;
|
||||||
fr->accurate = TRUE;
|
fr->accurate = TRUE;
|
||||||
fr->silent_resync = 0;
|
fr->silent_resync = 0;
|
||||||
@@ -1004,3 +1005,9 @@ int attribute_align_arg mpg123_getvolume(mpg123_handle *mh, double *base, double
|
|||||||
return MPG123_OK;
|
return MPG123_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
off_t attribute_align_arg mpg123_framepos(mpg123_handle *mh)
|
||||||
|
{
|
||||||
|
if(mh == NULL) return MPG123_ERR;
|
||||||
|
|
||||||
|
return mh->input_offset;
|
||||||
|
}
|
||||||
|
|||||||
@@ -201,6 +201,7 @@ struct mpg123_handle_struct
|
|||||||
int freesize; /* free format frame size */
|
int freesize; /* free format frame size */
|
||||||
enum mpg123_vbr vbr; /* 1 if variable bitrate was detected */
|
enum mpg123_vbr vbr; /* 1 if variable bitrate was detected */
|
||||||
off_t num; /* frame offset ... */
|
off_t num; /* frame offset ... */
|
||||||
|
off_t input_offset; /* byte offset of this frame in input stream */
|
||||||
off_t playnum; /* playback offset... includes repetitions, reset at seeks */
|
off_t playnum; /* playback offset... includes repetitions, reset at seeks */
|
||||||
off_t audio_start; /* The byte offset in the file where audio data begins. */
|
off_t audio_start; /* The byte offset in the file where audio data begins. */
|
||||||
char accurate; /* Flag to see if we trust the frame number. */
|
char accurate; /* Flag to see if we trust the frame number. */
|
||||||
|
|||||||
@@ -131,6 +131,14 @@ int attribute_align_arg ALIAS_NAME(mpg123_framebyframe_decode)(mpg123_handle *mh
|
|||||||
return NATIVE_NAME(mpg123_framebyframe_decode)(mh, num, audio, bytes);
|
return NATIVE_NAME(mpg123_framebyframe_decode)(mh, num, audio, bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef mpg123_framepos
|
||||||
|
#undef mpg123_framepos
|
||||||
|
#endif
|
||||||
|
int attribute_align_arg ALIAS_NAME(mpg123_framepos)(mpg123_handle *mh)
|
||||||
|
{
|
||||||
|
return NATIVE_NAME(mpg123_framepos)(mh);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef mpg123_tell
|
#ifdef mpg123_tell
|
||||||
#undef mpg123_tell
|
#undef mpg123_tell
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ if(/^\s*EXPORT\s+(\S+)\s+(mpg123_\S+)\((.*)\);\s*$/)
|
|||||||
|
|
||||||
mpg123_decode_frame
|
mpg123_decode_frame
|
||||||
mpg123_framebyframe_decode
|
mpg123_framebyframe_decode
|
||||||
|
mpg123_framepos
|
||||||
mpg123_tell
|
mpg123_tell
|
||||||
mpg123_tellframe
|
mpg123_tellframe
|
||||||
mpg123_tell_stream
|
mpg123_tell_stream
|
||||||
@@ -58,6 +59,7 @@ mpg123_set_index
|
|||||||
mpg123_position
|
mpg123_position
|
||||||
mpg123_length
|
mpg123_length
|
||||||
mpg123_set_filesize
|
mpg123_set_filesize
|
||||||
|
mpg123_decode_raw ... that's experimental.
|
||||||
|
|
||||||
Let's work on them in that order.
|
Let's work on them in that order.
|
||||||
*/
|
*/
|
||||||
@@ -199,6 +201,23 @@ int attribute_align_arg mpg123_framebyframe_decode(mpg123_handle *mh, long *num,
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#undef mpg123_framepos
|
||||||
|
/* off_t mpg123_framepos(mpg123_handle *mh); */
|
||||||
|
long attribute_align_arg mpg123_framepos(mpg123_handle *mh)
|
||||||
|
{
|
||||||
|
long val;
|
||||||
|
off_t largeval;
|
||||||
|
|
||||||
|
largeval = MPG123_LARGENAME(mpg123_tell)(mh);
|
||||||
|
val = largeval;
|
||||||
|
if(val != largeval)
|
||||||
|
{
|
||||||
|
mh->err = MPG123_LFS_OVERFLOW;
|
||||||
|
return MPG123_ERR;
|
||||||
|
}
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
#undef mpg123_tell
|
#undef mpg123_tell
|
||||||
/* off_t mpg123_tell(mpg123_handle *mh); */
|
/* off_t mpg123_tell(mpg123_handle *mh); */
|
||||||
long attribute_align_arg mpg123_tell(mpg123_handle *mh)
|
long attribute_align_arg mpg123_tell(mpg123_handle *mh)
|
||||||
|
|||||||
@@ -82,6 +82,7 @@
|
|||||||
#define mpg123_set_filesize MPG123_LARGENAME(mpg123_set_filesize)
|
#define mpg123_set_filesize MPG123_LARGENAME(mpg123_set_filesize)
|
||||||
#define mpg123_replace_reader MPG123_LARGENAME(mpg123_replace_reader)
|
#define mpg123_replace_reader MPG123_LARGENAME(mpg123_replace_reader)
|
||||||
#define mpg123_replace_reader_handle MPG123_LARGENAME(mpg123_replace_reader_handle)
|
#define mpg123_replace_reader_handle MPG123_LARGENAME(mpg123_replace_reader_handle)
|
||||||
|
#define mpg123_framepos MPG123_LARGENAME(mpg123_framepos)
|
||||||
|
|
||||||
#endif /* largefile hackery */
|
#endif /* largefile hackery */
|
||||||
|
|
||||||
@@ -538,6 +539,11 @@ EXPORT int mpg123_framebyframe_next(mpg123_handle *mh);
|
|||||||
*/
|
*/
|
||||||
EXPORT int mpg123_framedata(mpg123_handle *mh, unsigned long *header, unsigned char **bodydata, size_t *bodybytes);
|
EXPORT int mpg123_framedata(mpg123_handle *mh, unsigned long *header, unsigned char **bodydata, size_t *bodybytes);
|
||||||
|
|
||||||
|
/** Get the input position (byte offset in stream) of the last parsed frame.
|
||||||
|
* This can be used for external seek index building, for example.
|
||||||
|
* It just returns the internally stored offset, regardless of validity -- you ensure that a valid frame has been parsed before! */
|
||||||
|
EXPORT off_t mpg123_framepos(mpg123_handle *mh);
|
||||||
|
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -565,6 +565,7 @@ init_resync:
|
|||||||
halfspeed_prepare(fr);
|
halfspeed_prepare(fr);
|
||||||
|
|
||||||
/* index the position */
|
/* index the position */
|
||||||
|
fr->input_offset = framepos;
|
||||||
#ifdef FRAME_INDEX
|
#ifdef FRAME_INDEX
|
||||||
/* Keep track of true frame positions in our frame index.
|
/* Keep track of true frame positions in our frame index.
|
||||||
but only do so when we are sure that the frame number is accurate... */
|
but only do so when we are sure that the frame number is accurate... */
|
||||||
|
|||||||
Reference in New Issue
Block a user