mirror of
https://github.com/mpv-player/mpv
synced 2025-01-09 01:36:25 +01:00
stream, demux: replace off_t with int64_t
On reasonable systems, these types were the same anyway. Even on unreasonable systems (seriously, which?), this may reduce potential breakage.
This commit is contained in:
parent
51dac4e070
commit
ddffcce678
@ -2922,8 +2922,8 @@ int get_percent_pos(struct MPContext *mpctx)
|
||||
;
|
||||
else {
|
||||
int len = (demuxer->movi_end - demuxer->movi_start) / 100;
|
||||
off_t pos = demuxer->filepos > 0 ?
|
||||
demuxer->filepos : stream_tell(demuxer->stream);
|
||||
int64_t pos = demuxer->filepos > 0 ?
|
||||
demuxer->filepos : stream_tell(demuxer->stream);
|
||||
if (len > 0)
|
||||
ans = (pos - demuxer->movi_start) / len;
|
||||
else
|
||||
|
@ -49,8 +49,8 @@ static int odml_get_vstream_id(int id, unsigned char res[])
|
||||
|
||||
static int avi_idx_cmp(const void *elem1, const void *elem2)
|
||||
{
|
||||
register off_t a = AVI_IDX_OFFSET((AVIINDEXENTRY *)elem1);
|
||||
register off_t b = AVI_IDX_OFFSET((AVIINDEXENTRY *)elem2);
|
||||
register int64_t a = AVI_IDX_OFFSET((AVIINDEXENTRY *)elem1);
|
||||
register int64_t b = AVI_IDX_OFFSET((AVIINDEXENTRY *)elem2);
|
||||
return (a > b) - (b > a);
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ int stream_id=-1;
|
||||
int idxfix_videostream=0;
|
||||
int idxfix_divx=0;
|
||||
avi_priv_t* priv=demuxer->priv;
|
||||
off_t list_end=0;
|
||||
int64_t list_end=0;
|
||||
|
||||
//---- AVI header:
|
||||
priv->idx_size=0;
|
||||
@ -480,7 +480,7 @@ if (priv->isodml && (index_mode==-1 || index_mode==0 || index_mode==1)) {
|
||||
for (j=0; j<cx->nEntriesInUse; j++) {
|
||||
int ret1, ret2;
|
||||
memset(&cx->stdidx[j], 0, 32);
|
||||
ret1 = stream_seek(demuxer->stream, (off_t)cx->aIndex[j].qwOffset);
|
||||
ret1 = stream_seek(demuxer->stream, (int64_t)cx->aIndex[j].qwOffset);
|
||||
ret2 = stream_read(demuxer->stream, (char *)&cx->stdidx[j], 32);
|
||||
if (ret1 != 1 || ret2 != 32 || cx->stdidx[j].nEntriesInUse==0) {
|
||||
// this is a broken file (probably incomplete) let the standard
|
||||
@ -596,7 +596,7 @@ if(index_mode>=2 || (priv->idx_size==0 && index_mode==1)){
|
||||
while(1){
|
||||
int id;
|
||||
unsigned len;
|
||||
off_t skip;
|
||||
int64_t skip;
|
||||
AVIINDEXENTRY* idx;
|
||||
unsigned int c;
|
||||
demuxer->filepos=stream_tell(demuxer->stream);
|
||||
@ -638,9 +638,9 @@ if(index_mode>=2 || (priv->idx_size==0 && index_mode==1)){
|
||||
}
|
||||
|
||||
// update status line:
|
||||
{ static off_t lastpos;
|
||||
off_t pos;
|
||||
off_t len=demuxer->movi_end-demuxer->movi_start;
|
||||
{ static int64_t lastpos;
|
||||
int64_t pos;
|
||||
int64_t len=demuxer->movi_end-demuxer->movi_start;
|
||||
if(len){
|
||||
pos=100*(demuxer->filepos-demuxer->movi_start)/len; // %
|
||||
} else {
|
||||
|
@ -348,14 +348,14 @@ typedef struct {
|
||||
// index stuff:
|
||||
void* idx;
|
||||
int idx_size;
|
||||
off_t idx_pos;
|
||||
off_t idx_pos_a;
|
||||
off_t idx_pos_v;
|
||||
off_t idx_offset; // ennyit kell hozzaadni az index offset ertekekhez
|
||||
int64_t idx_pos;
|
||||
int64_t idx_pos_a;
|
||||
int64_t idx_pos_v;
|
||||
int64_t idx_offset; // ennyit kell hozzaadni az index offset ertekekhez
|
||||
// bps-based PTS stuff:
|
||||
int video_pack_no;
|
||||
int audio_block_size;
|
||||
off_t audio_block_no;
|
||||
int64_t audio_block_no;
|
||||
// interleaved PTS stuff:
|
||||
int skip_video_frames;
|
||||
int audio_streams;
|
||||
|
@ -559,7 +559,7 @@ static void get_parser(sh_common_t *sh, AVCodecContext **avctx, AVCodecParserCon
|
||||
sh->parser = *parser;
|
||||
}
|
||||
|
||||
int ds_parse(demux_stream_t *ds, uint8_t **buffer, int *len, double pts, off_t pos)
|
||||
int ds_parse(demux_stream_t *ds, uint8_t **buffer, int *len, double pts, int64_t pos)
|
||||
{
|
||||
AVCodecContext *avctx;
|
||||
AVCodecParserContext *parser;
|
||||
@ -584,7 +584,7 @@ void ds_clear_parser(demux_stream_t *ds)
|
||||
}
|
||||
|
||||
void ds_read_packet(demux_stream_t *ds, stream_t *stream, int len,
|
||||
double pts, off_t pos, bool keyframe)
|
||||
double pts, int64_t pos, bool keyframe)
|
||||
{
|
||||
demux_packet_t *dp = new_demux_packet(len);
|
||||
len = stream_read(stream, dp->buffer, len);
|
||||
|
@ -116,8 +116,8 @@ typedef struct demux_stream {
|
||||
double pts; // current buffer's pts
|
||||
int pts_bytes; // number of bytes read after last pts stamp
|
||||
int eof; // end of demuxed stream? (true if all buffer empty)
|
||||
off_t pos; // position in the input stream (file)
|
||||
off_t dpos; // position in the demuxed stream
|
||||
int64_t pos; // position in the input stream (file)
|
||||
int64_t dpos; // position in the demuxed stream
|
||||
int pack_no; // serial number of packet
|
||||
bool keyframe; // keyframe flag of current packet
|
||||
//---------------
|
||||
@ -216,9 +216,9 @@ struct demuxer_params {
|
||||
typedef struct demuxer {
|
||||
const demuxer_desc_t *desc; ///< Demuxer description structure
|
||||
const char *filetype; // format name when not identified by demuxer (libavformat)
|
||||
off_t filepos; // input stream current pos.
|
||||
off_t movi_start;
|
||||
off_t movi_end;
|
||||
int64_t filepos; // input stream current pos.
|
||||
int64_t movi_start;
|
||||
int64_t movi_end;
|
||||
struct stream *stream;
|
||||
double stream_pts; // current stream pts, if applicable (e.g. dvd)
|
||||
double reference_clock;
|
||||
@ -306,12 +306,12 @@ struct sh_stream *ds_gsh(struct demux_stream *ds);
|
||||
|
||||
void ds_add_packet(struct demux_stream *ds, struct demux_packet *dp);
|
||||
void ds_read_packet(struct demux_stream *ds, struct stream *stream, int len,
|
||||
double pts, off_t pos, bool keyframe);
|
||||
double pts, int64_t pos, bool keyframe);
|
||||
|
||||
int demux_fill_buffer(struct demuxer *demux, struct demux_stream *ds);
|
||||
int ds_fill_buffer(struct demux_stream *ds);
|
||||
|
||||
static inline off_t ds_tell(struct demux_stream *ds)
|
||||
static inline int64_t ds_tell(struct demux_stream *ds)
|
||||
{
|
||||
return (ds->dpos - ds->buffer_size) + ds->buffer_pos;
|
||||
}
|
||||
@ -340,7 +340,7 @@ int ds_get_packet_sub(struct demux_stream *ds, unsigned char **start);
|
||||
struct demux_packet *ds_get_packet2(struct demux_stream *ds, bool repeat_last);
|
||||
double ds_get_next_pts(struct demux_stream *ds);
|
||||
int ds_parse(struct demux_stream *sh, uint8_t **buffer, int *len, double pts,
|
||||
off_t pos);
|
||||
int64_t pos);
|
||||
void ds_clear_parser(struct demux_stream *sh);
|
||||
|
||||
static inline int avi_stream_id(unsigned int id)
|
||||
|
@ -561,11 +561,11 @@ static void demux_seek_asf(demuxer_t *demuxer,float rel_seek_secs,float audio_de
|
||||
|
||||
//================= seek in ASF ==========================
|
||||
float p_rate=asf->packetrate; // packets / sec
|
||||
off_t rel_seek_packs=(flags&SEEK_FACTOR)? // FIXME: int may be enough?
|
||||
int64_t rel_seek_packs=(flags&SEEK_FACTOR)? // FIXME: int may be enough?
|
||||
(rel_seek_secs*(demuxer->movi_end-demuxer->movi_start)/asf->packetsize):
|
||||
(rel_seek_secs*p_rate);
|
||||
off_t rel_seek_bytes=rel_seek_packs*asf->packetsize;
|
||||
off_t newpos;
|
||||
int64_t rel_seek_bytes=rel_seek_packs*asf->packetsize;
|
||||
int64_t newpos;
|
||||
//printf("ASF: packs: %d duration: %d \n",(int)fileh.packets,*((int*)&fileh.duration));
|
||||
// printf("ASF_seek: %d secs -> %d packs -> %d bytes \n",
|
||||
// rel_seek_secs,rel_seek_packs,rel_seek_bytes);
|
||||
|
@ -222,7 +222,7 @@ do{
|
||||
int flags=1;
|
||||
AVIINDEXENTRY *idx=NULL;
|
||||
if(priv->idx_size>0 && priv->idx_pos<priv->idx_size){
|
||||
off_t pos;
|
||||
int64_t pos;
|
||||
|
||||
idx=&((AVIINDEXENTRY *)priv->idx)[priv->idx_pos++];
|
||||
|
||||
@ -239,7 +239,7 @@ do{
|
||||
continue; // skip this chunk
|
||||
}
|
||||
|
||||
pos = (off_t)priv->idx_offset+AVI_IDX_OFFSET(idx);
|
||||
pos = (int64_t)priv->idx_offset+AVI_IDX_OFFSET(idx);
|
||||
if((pos<demux->movi_start || pos>=demux->movi_end) && (demux->movi_end>demux->movi_start) && (demux->stream->flags & MP_STREAM_SEEK)){
|
||||
mp_msg(MSGT_DEMUX,MSGL_V,"ChunkOffset out of range! idx=0x%"PRIX64" \n",(int64_t)pos);
|
||||
continue;
|
||||
@ -327,7 +327,7 @@ do{
|
||||
idx_pos=priv->idx_pos++;
|
||||
|
||||
if(priv->idx_size>0 && idx_pos<priv->idx_size){
|
||||
off_t pos;
|
||||
int64_t pos;
|
||||
idx=&((AVIINDEXENTRY *)priv->idx)[idx_pos];
|
||||
|
||||
if(idx->dwFlags&AVIIF_LIST){
|
||||
@ -384,7 +384,7 @@ avi_priv_t *priv=demux->priv;
|
||||
unsigned int id=0;
|
||||
unsigned int len;
|
||||
int ret=0;
|
||||
off_t *fpos=NULL;
|
||||
int64_t *fpos=NULL;
|
||||
|
||||
if(ds==demux->video) fpos=&priv->idx_pos_v; else
|
||||
if(ds==demux->audio) fpos=&priv->idx_pos_a; else
|
||||
@ -477,12 +477,12 @@ static demuxer_t* demux_open_avi(demuxer_t* demuxer){
|
||||
if(priv->idx_size>0){
|
||||
// check that file is non-interleaved:
|
||||
int i;
|
||||
off_t a_pos=-1;
|
||||
off_t v_pos=-1;
|
||||
int64_t a_pos=-1;
|
||||
int64_t v_pos=-1;
|
||||
for(i=0;i<priv->idx_size;i++){
|
||||
AVIINDEXENTRY* idx=&((AVIINDEXENTRY *)priv->idx)[i];
|
||||
demux_stream_t* ds=demux_avi_select_stream(demuxer,idx->ckid);
|
||||
off_t pos = priv->idx_offset + AVI_IDX_OFFSET(idx);
|
||||
int64_t pos = priv->idx_offset + AVI_IDX_OFFSET(idx);
|
||||
if(a_pos==-1 && ds==demuxer->audio){
|
||||
a_pos=pos;
|
||||
if(v_pos!=-1) break;
|
||||
|
@ -142,7 +142,7 @@ typedef struct mkv_index {
|
||||
} mkv_index_t;
|
||||
|
||||
typedef struct mkv_demuxer {
|
||||
off_t segment_start;
|
||||
int64_t segment_start;
|
||||
|
||||
double duration, last_pts;
|
||||
uint64_t last_filepos;
|
||||
@ -159,7 +159,7 @@ typedef struct mkv_demuxer {
|
||||
mkv_index_t *indexes;
|
||||
int num_indexes;
|
||||
|
||||
off_t *parsed_pos;
|
||||
int64_t *parsed_pos;
|
||||
int num_parsed_pos;
|
||||
bool parsed_info;
|
||||
bool parsed_tracks;
|
||||
@ -198,7 +198,7 @@ static void *grow_array(void *array, int nelem, size_t elsize)
|
||||
return array;
|
||||
}
|
||||
|
||||
static bool is_parsed_header(struct mkv_demuxer *mkv_d, off_t pos)
|
||||
static bool is_parsed_header(struct mkv_demuxer *mkv_d, int64_t pos)
|
||||
{
|
||||
int low = 0;
|
||||
int high = mkv_d->num_parsed_pos;
|
||||
@ -212,7 +212,7 @@ static bool is_parsed_header(struct mkv_demuxer *mkv_d, off_t pos)
|
||||
if (mkv_d->num_parsed_pos && mkv_d->parsed_pos[low] == pos)
|
||||
return true;
|
||||
if (!(mkv_d->num_parsed_pos & 31))
|
||||
mkv_d->parsed_pos = talloc_realloc(mkv_d, mkv_d->parsed_pos, off_t,
|
||||
mkv_d->parsed_pos = talloc_realloc(mkv_d, mkv_d->parsed_pos, int64_t,
|
||||
mkv_d->num_parsed_pos + 32);
|
||||
mkv_d->num_parsed_pos++;
|
||||
for (int i = mkv_d->num_parsed_pos - 1; i > low; i--)
|
||||
@ -919,7 +919,7 @@ static int demux_mkv_read_attachments(demuxer_t *demuxer)
|
||||
}
|
||||
|
||||
static int read_header_element(struct demuxer *demuxer, uint32_t id,
|
||||
off_t at_filepos);
|
||||
int64_t at_filepos);
|
||||
|
||||
static int demux_mkv_read_seekhead(demuxer_t *demuxer)
|
||||
{
|
||||
@ -936,7 +936,7 @@ static int demux_mkv_read_seekhead(demuxer_t *demuxer)
|
||||
goto out;
|
||||
}
|
||||
/* off now holds the position of the next element after the seek head. */
|
||||
off_t off = stream_tell(s);
|
||||
int64_t off = stream_tell(s);
|
||||
for (int i = 0; i < seekhead.n_seek; i++) {
|
||||
struct ebml_seek *seek = &seekhead.seek[i];
|
||||
if (seek->n_seek_id != 1 || seek->n_seek_position != 1) {
|
||||
@ -967,7 +967,7 @@ static int demux_mkv_read_seekhead(demuxer_t *demuxer)
|
||||
return res;
|
||||
}
|
||||
|
||||
static bool seek_pos_id(struct stream *s, off_t pos, uint32_t id)
|
||||
static bool seek_pos_id(struct stream *s, int64_t pos, uint32_t id)
|
||||
{
|
||||
if (!stream_seek(s, pos)) {
|
||||
mp_msg(MSGT_DEMUX, MSGL_WARN, "[mkv] Failed to seek in file\n");
|
||||
@ -981,11 +981,11 @@ static bool seek_pos_id(struct stream *s, off_t pos, uint32_t id)
|
||||
}
|
||||
|
||||
static int read_header_element(struct demuxer *demuxer, uint32_t id,
|
||||
off_t at_filepos)
|
||||
int64_t at_filepos)
|
||||
{
|
||||
struct mkv_demuxer *mkv_d = demuxer->priv;
|
||||
stream_t *s = demuxer->stream;
|
||||
off_t pos = stream_tell(s) - 4;
|
||||
int64_t pos = stream_tell(s) - 4;
|
||||
int res = 1;
|
||||
|
||||
switch(id) {
|
||||
@ -2290,7 +2290,7 @@ static int seek_creating_index(struct demuxer *demuxer, float rel_seek_secs,
|
||||
}
|
||||
|
||||
if (target_tc_ns > max_tc) {
|
||||
if ((off_t) max_filepos > stream_tell(s))
|
||||
if ((int64_t) max_filepos > stream_tell(s))
|
||||
stream_seek(s, max_filepos);
|
||||
else
|
||||
stream_seek(s, stream_tell(s) + mkv_d->cluster_size);
|
||||
|
@ -61,7 +61,7 @@ typedef struct mpg_demuxer {
|
||||
} mpg_demuxer_t;
|
||||
|
||||
static int mpeg_pts_error=0;
|
||||
off_t ps_probe = 0;
|
||||
int64_t ps_probe = 0;
|
||||
|
||||
static int parse_psm(demuxer_t *demux, int len) {
|
||||
unsigned char c, id, type;
|
||||
@ -134,7 +134,7 @@ static int parse_psm(demuxer_t *demux, int len) {
|
||||
//returns the first pts found within TIME_STAMP_PROBE_LEN bytes after stream_pos in demuxer's stream.
|
||||
//if no pts is found or an error occurs, -1.0 is returned.
|
||||
//Packs are freed.
|
||||
static float read_first_mpeg_pts_at_position(demuxer_t* demuxer, off_t stream_pos)
|
||||
static float read_first_mpeg_pts_at_position(demuxer_t* demuxer, int64_t stream_pos)
|
||||
{
|
||||
stream_t *s = demuxer->stream;
|
||||
mpg_demuxer_t *mpg_d = demuxer->priv;
|
||||
@ -210,7 +210,7 @@ static demuxer_t* demux_mpg_open(demuxer_t* demuxer) {
|
||||
//of the stream
|
||||
|
||||
//The position where the stream is now
|
||||
off_t pos = stream_tell(s);
|
||||
int64_t pos = stream_tell(s);
|
||||
float first_pts = read_first_mpeg_pts_at_position(demuxer, demuxer->movi_start);
|
||||
if(first_pts != -1.0)
|
||||
{
|
||||
@ -450,7 +450,7 @@ static int demux_mpg_read_packet(demuxer_t *demux,int id){
|
||||
//============== DVD Audio sub-stream ======================
|
||||
if(id==0x1BD){
|
||||
int aid, rawa52 = 0;
|
||||
off_t tmppos;
|
||||
int64_t tmppos;
|
||||
unsigned int tmp;
|
||||
|
||||
tmppos = stream_tell(demux->stream);
|
||||
@ -674,7 +674,7 @@ static inline void update_stats(int head)
|
||||
static int demux_mpg_probe(demuxer_t *demuxer) {
|
||||
int pes av_unused = 1;
|
||||
int tmp;
|
||||
off_t tmppos;
|
||||
int64_t tmppos;
|
||||
int file_format = DEMUXER_TYPE_UNKNOWN;
|
||||
|
||||
tmppos=stream_tell(demuxer->stream);
|
||||
@ -910,9 +910,9 @@ static void demux_seek_mpg(demuxer_t *demuxer, float rel_seek_secs,
|
||||
mpg_demuxer_t *mpg_d=(mpg_demuxer_t*)demuxer->priv;
|
||||
int precision = 1;
|
||||
float oldpts = 0;
|
||||
off_t oldpos = demuxer->filepos;
|
||||
int64_t oldpos = demuxer->filepos;
|
||||
float newpts = 0;
|
||||
off_t newpos = (flags & SEEK_ABSOLUTE) ? demuxer->movi_start : oldpos;
|
||||
int64_t newpos = (flags & SEEK_ABSOLUTE) ? demuxer->movi_start : oldpos;
|
||||
|
||||
if(mpg_d)
|
||||
oldpts = mpg_d->last_pts;
|
||||
@ -1114,7 +1114,7 @@ static demuxer_t* demux_mpg_ps_open(demuxer_t* demuxer)
|
||||
|
||||
if(!sh_video->format && ps_probe > 0) {
|
||||
int head;
|
||||
off_t pos = stream_tell(demuxer->stream);
|
||||
int64_t pos = stream_tell(demuxer->stream);
|
||||
|
||||
clear_stats();
|
||||
do {
|
||||
|
@ -28,7 +28,7 @@ typedef struct demux_packet {
|
||||
double pts;
|
||||
double duration;
|
||||
double stream_pts;
|
||||
off_t pos; // position in index (AVI) or file (MPG)
|
||||
int64_t pos; // position in index (AVI) or file (MPG)
|
||||
unsigned char *buffer;
|
||||
bool keyframe;
|
||||
int refcount; // counter for the master packet, if 0, buffer can be free()d
|
||||
|
@ -78,7 +78,7 @@ static demuxer_t* demux_rawaudio_open(demuxer_t* demuxer) {
|
||||
static int demux_rawaudio_fill_buffer(demuxer_t* demuxer, demux_stream_t *ds) {
|
||||
sh_audio_t* sh_audio = demuxer->audio->sh;
|
||||
int l = sh_audio->wf->nAvgBytesPerSec;
|
||||
off_t spos = stream_tell(demuxer->stream);
|
||||
int64_t spos = stream_tell(demuxer->stream);
|
||||
demux_packet_t* dp;
|
||||
|
||||
if(demuxer->stream->eof)
|
||||
@ -98,7 +98,7 @@ static int demux_rawaudio_fill_buffer(demuxer_t* demuxer, demux_stream_t *ds) {
|
||||
static void demux_rawaudio_seek(demuxer_t *demuxer,float rel_seek_secs,float audio_delay,int flags){
|
||||
stream_t* s = demuxer->stream;
|
||||
sh_audio_t* sh_audio = demuxer->audio->sh;
|
||||
off_t base,pos;
|
||||
int64_t base,pos;
|
||||
|
||||
base = (flags & SEEK_ABSOLUTE) ? demuxer->movi_start : stream_tell(s);
|
||||
if(flags & SEEK_FACTOR)
|
||||
|
@ -127,7 +127,7 @@ static demuxer_t* demux_rawvideo_open(demuxer_t* demuxer) {
|
||||
|
||||
static int demux_rawvideo_fill_buffer(demuxer_t* demuxer, demux_stream_t *ds) {
|
||||
sh_video_t* sh = demuxer->video->sh;
|
||||
off_t pos;
|
||||
int64_t pos;
|
||||
if(demuxer->stream->eof) return 0;
|
||||
if(ds!=demuxer->video) return 0;
|
||||
pos = stream_tell(demuxer->stream);
|
||||
@ -138,7 +138,7 @@ static int demux_rawvideo_fill_buffer(demuxer_t* demuxer, demux_stream_t *ds) {
|
||||
static void demux_rawvideo_seek(demuxer_t *demuxer,float rel_seek_secs,float audio_delay,int flags){
|
||||
stream_t* s = demuxer->stream;
|
||||
sh_video_t* sh_video = demuxer->video->sh;
|
||||
off_t pos;
|
||||
int64_t pos;
|
||||
|
||||
pos = (flags & SEEK_ABSOLUTE) ? demuxer->movi_start : stream_tell(s);
|
||||
if(flags & SEEK_FACTOR)
|
||||
|
@ -60,7 +60,7 @@
|
||||
|
||||
int ts_prog;
|
||||
int ts_keep_broken=0;
|
||||
off_t ts_probe = 0;
|
||||
int64_t ts_probe = 0;
|
||||
int audio_substream_id = -1;
|
||||
|
||||
typedef enum
|
||||
@ -434,8 +434,8 @@ static int ts_check_file(demuxer_t * demuxer)
|
||||
uint32_t _read, i, count = 0, is_ts;
|
||||
int cc[NB_PID_MAX], last_cc[NB_PID_MAX], pid, cc_ok, c, good, bad;
|
||||
uint8_t size = 0;
|
||||
off_t pos = 0;
|
||||
off_t init_pos;
|
||||
int64_t pos = 0;
|
||||
int64_t init_pos;
|
||||
|
||||
mp_msg(MSGT_DEMUX, MSGL_V, "Checking for MPEG-TS...\n");
|
||||
|
||||
@ -629,7 +629,7 @@ typedef struct {
|
||||
int32_t apid, vpid, spid; //stream ids
|
||||
char alang[4]; //languages
|
||||
uint16_t prog;
|
||||
off_t probe;
|
||||
int64_t probe;
|
||||
} tsdemux_init_t;
|
||||
|
||||
//second stage: returns the count of A52 syncwords found
|
||||
@ -663,12 +663,12 @@ static int a52_check(char *buf, int len)
|
||||
}
|
||||
|
||||
|
||||
static off_t ts_detect_streams(demuxer_t *demuxer, tsdemux_init_t *param)
|
||||
static int64_t ts_detect_streams(demuxer_t *demuxer, tsdemux_init_t *param)
|
||||
{
|
||||
int video_found = 0, audio_found = 0, i, num_packets = 0, req_apid, req_vpid, req_spid;
|
||||
int is_audio, is_video, is_sub, has_tables;
|
||||
int32_t p, chosen_pid = 0;
|
||||
off_t pos=0, ret = 0, init_pos, end_pos;
|
||||
int64_t pos=0, ret = 0, init_pos, end_pos;
|
||||
ES_stream_t es;
|
||||
unsigned char tmp[TS_FEC_PACKET_SIZE];
|
||||
ts_priv_t *priv = (ts_priv_t*) demuxer->priv;
|
||||
@ -979,7 +979,7 @@ static demuxer_t *demux_open_ts(demuxer_t * demuxer)
|
||||
uint8_t packet_size;
|
||||
sh_video_t *sh_video;
|
||||
sh_audio_t *sh_audio;
|
||||
off_t start_pos;
|
||||
int64_t start_pos;
|
||||
tsdemux_init_t params;
|
||||
ts_priv_t * priv = demuxer->priv;
|
||||
|
||||
@ -3253,7 +3253,7 @@ static void demux_seek_ts(demuxer_t *demuxer, float rel_seek_secs, float audio_d
|
||||
sh_video_t *sh_video=d_video->sh;
|
||||
ts_priv_t * priv = (ts_priv_t*) demuxer->priv;
|
||||
int i, video_stats;
|
||||
off_t newpos;
|
||||
int64_t newpos;
|
||||
|
||||
//================= seek in MPEG-TS ==========================
|
||||
|
||||
|
@ -506,7 +506,7 @@ static int asf_mmst_streaming_read( int fd, char *buffer, int size, streaming_ct
|
||||
|
||||
}
|
||||
|
||||
static int asf_mmst_streaming_seek( int fd, off_t pos, streaming_ctrl_t *streaming_ctrl )
|
||||
static int asf_mmst_streaming_seek( int fd, int64_t pos, streaming_ctrl_t *streaming_ctrl )
|
||||
{
|
||||
return -1;
|
||||
// Shut up gcc warning
|
||||
|
@ -454,7 +454,7 @@ static int asf_http_streaming_read( int fd, char *buffer, int size, streaming_ct
|
||||
return read;
|
||||
}
|
||||
|
||||
static int asf_http_streaming_seek( int fd, off_t pos, streaming_ctrl_t *streaming_ctrl ) {
|
||||
static int asf_http_streaming_seek( int fd, int64_t pos, streaming_ctrl_t *streaming_ctrl ) {
|
||||
return -1;
|
||||
// to shut up gcc warning
|
||||
fd++;
|
||||
|
@ -110,7 +110,7 @@ static int parse_line(char **ptr, char *cols[6])
|
||||
}
|
||||
|
||||
/* Loads a file into RAM */
|
||||
static char *load_file(const char *filename, off_t * length)
|
||||
static char *load_file(const char *filename, int64_t * length)
|
||||
{
|
||||
int fd = -1;
|
||||
char *buffer = NULL;
|
||||
@ -163,7 +163,7 @@ static struct cookie_list_type *load_cookies_from(const char *filename,
|
||||
*list)
|
||||
{
|
||||
char *ptr;
|
||||
off_t length;
|
||||
int64_t length;
|
||||
|
||||
ptr = load_file(filename, &length);
|
||||
if (!ptr)
|
||||
|
@ -170,7 +170,7 @@ URL_t *url_new_with_proxy(const char *urlstr)
|
||||
}
|
||||
|
||||
int
|
||||
http_send_request( URL_t *url, off_t pos ) {
|
||||
http_send_request( URL_t *url, int64_t pos ) {
|
||||
HTTP_header_t *http_hdr;
|
||||
URL_t *server_url;
|
||||
char str[256];
|
||||
@ -362,7 +362,7 @@ http_authenticate(HTTP_header_t *http_hdr, URL_t *url, int *auth_retry) {
|
||||
}
|
||||
|
||||
int
|
||||
http_seek( stream_t *stream, off_t pos ) {
|
||||
http_seek( stream_t *stream, int64_t pos ) {
|
||||
HTTP_header_t *http_hdr = NULL;
|
||||
int fd;
|
||||
if( stream==NULL ) return 0;
|
||||
@ -458,7 +458,7 @@ nop_streaming_read( int fd, char *buffer, int size, streaming_ctrl_t *stream_ctr
|
||||
}
|
||||
|
||||
int
|
||||
nop_streaming_seek( int fd, off_t pos, streaming_ctrl_t *stream_ctrl ) {
|
||||
nop_streaming_seek( int fd, int64_t pos, streaming_ctrl_t *stream_ctrl ) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -67,10 +67,10 @@ streaming_ctrl_t *streaming_ctrl_new(void);
|
||||
int streaming_bufferize( streaming_ctrl_t *streaming_ctrl, char *buffer, int size);
|
||||
|
||||
int nop_streaming_read( int fd, char *buffer, int size, streaming_ctrl_t *stream_ctrl );
|
||||
int nop_streaming_seek( int fd, off_t pos, streaming_ctrl_t *stream_ctrl );
|
||||
int nop_streaming_seek( int fd, int64_t pos, streaming_ctrl_t *stream_ctrl );
|
||||
void streaming_ctrl_free( streaming_ctrl_t *streaming_ctrl );
|
||||
|
||||
int http_send_request(URL_t *url, off_t pos);
|
||||
int http_send_request(URL_t *url, int64_t pos);
|
||||
HTTP_header_t *http_read_response(int fd);
|
||||
|
||||
int http_authenticate(HTTP_header_t *http_hdr, URL_t *url, int *auth_retry);
|
||||
@ -78,6 +78,6 @@ URL_t* check4proxies(const URL_t *url);
|
||||
URL_t *url_new_with_proxy(const char *urlstr);
|
||||
|
||||
void fixup_network_stream_cache(stream_t *stream);
|
||||
int http_seek(stream_t *stream, off_t pos);
|
||||
int http_seek(stream_t *stream, int64_t pos);
|
||||
|
||||
#endif /* MPLAYER_NETWORK_H */
|
||||
|
@ -268,7 +268,7 @@ static int stream_reconnect(stream_t *s)
|
||||
#define MAX_RECONNECT_RETRIES 5
|
||||
#define RECONNECT_SLEEP_MS 1000
|
||||
int retry = 0;
|
||||
off_t pos = s->pos;
|
||||
int64_t pos = s->pos;
|
||||
// Seeking is used as a hack to make network streams
|
||||
// reopen the connection, ideally they would implement
|
||||
// e.g. a STREAM_CTRL_RECONNECT to do this
|
||||
@ -356,7 +356,7 @@ int stream_write_buffer(stream_t *s, unsigned char *buf, int len) {
|
||||
return rd;
|
||||
}
|
||||
|
||||
int stream_seek_internal(stream_t *s, off_t newpos)
|
||||
int stream_seek_internal(stream_t *s, int64_t newpos)
|
||||
{
|
||||
if(newpos==0 || newpos!=s->pos){
|
||||
switch(s->type){
|
||||
@ -405,9 +405,9 @@ if(newpos==0 || newpos!=s->pos){
|
||||
return -1;
|
||||
}
|
||||
|
||||
int stream_seek_long(stream_t *s,off_t pos){
|
||||
int stream_seek_long(stream_t *s,int64_t pos){
|
||||
int res;
|
||||
off_t newpos=0;
|
||||
int64_t newpos=0;
|
||||
|
||||
// if( mp_msg_test(MSGT_STREAM,MSGL_DBG3) ) printf("seek_long to 0x%X\n",(unsigned int)pos);
|
||||
|
||||
@ -422,7 +422,7 @@ off_t newpos=0;
|
||||
if(s->sector_size)
|
||||
newpos = (pos/s->sector_size)*s->sector_size;
|
||||
else
|
||||
newpos = pos&(~((off_t)STREAM_BUFFER_SIZE-1));
|
||||
newpos = pos&(~((int64_t)STREAM_BUFFER_SIZE-1));
|
||||
|
||||
if( mp_msg_test(MSGT_STREAM,MSGL_DBG3) ){
|
||||
mp_msg(MSGT_STREAM,MSGL_DBG3, "s->pos=%"PRIX64" newpos=%"PRIX64" new_bufpos=%"PRIX64" buflen=%X \n",
|
||||
|
@ -118,7 +118,7 @@ typedef struct streaming_control {
|
||||
unsigned int buffer_pos;
|
||||
unsigned int bandwidth; // The downstream available
|
||||
int (*streaming_read)( int fd, char *buffer, int buffer_size, struct streaming_control *stream_ctrl );
|
||||
int (*streaming_seek)( int fd, off_t pos, struct streaming_control *stream_ctrl );
|
||||
int (*streaming_seek)( int fd, int64_t pos, struct streaming_control *stream_ctrl );
|
||||
void *data;
|
||||
// hacks for asf
|
||||
int *audio_id_ptr;
|
||||
@ -148,7 +148,7 @@ typedef struct stream {
|
||||
// Write
|
||||
int (*write_buffer)(struct stream *s, char* buffer, int len);
|
||||
// Seek
|
||||
int (*seek)(struct stream *s,off_t pos);
|
||||
int (*seek)(struct stream *s,int64_t pos);
|
||||
// Control
|
||||
// Will be later used to let streams like dvd and cdda report
|
||||
// their structure (ie tracks, chapters, etc)
|
||||
@ -162,7 +162,7 @@ typedef struct stream {
|
||||
int sector_size; // sector size (seek will be aligned on this size if non 0)
|
||||
int read_chunk; // maximum amount of data to read at once to limit latency (0 for default)
|
||||
unsigned int buf_pos,buf_len;
|
||||
off_t pos,start_pos,end_pos;
|
||||
int64_t pos,start_pos,end_pos;
|
||||
int eof;
|
||||
int mode; //STREAM_READ or STREAM_WRITE
|
||||
unsigned int cache_pid;
|
||||
@ -182,7 +182,7 @@ typedef struct stream {
|
||||
#endif
|
||||
|
||||
int stream_fill_buffer(stream_t *s);
|
||||
int stream_seek_long(stream_t *s, off_t pos);
|
||||
int stream_seek_long(stream_t *s, int64_t pos);
|
||||
|
||||
#ifdef CONFIG_STREAM_CACHE
|
||||
int stream_enable_cache_percent(stream_t *stream, int64_t stream_cache_size,
|
||||
@ -294,11 +294,11 @@ inline static int stream_eof(stream_t *s){
|
||||
return s->eof;
|
||||
}
|
||||
|
||||
inline static off_t stream_tell(stream_t *s){
|
||||
inline static int64_t stream_tell(stream_t *s){
|
||||
return s->pos+s->buf_pos-s->buf_len;
|
||||
}
|
||||
|
||||
inline static int stream_seek(stream_t *s,off_t pos){
|
||||
inline static int stream_seek(stream_t *s,int64_t pos){
|
||||
|
||||
mp_dbg(MSGT_DEMUX, MSGL_DBG3, "seek to 0x%llX\n", (long long)pos);
|
||||
|
||||
@ -308,7 +308,7 @@ inline static int stream_seek(stream_t *s,off_t pos){
|
||||
pos = 0;
|
||||
}
|
||||
if(pos<s->pos){
|
||||
off_t x=pos-(s->pos-s->buf_len);
|
||||
int64_t x=pos-(s->pos-s->buf_len);
|
||||
if(x>=0){
|
||||
s->buf_pos=x;
|
||||
s->eof = 0;
|
||||
@ -320,7 +320,7 @@ inline static int stream_seek(stream_t *s,off_t pos){
|
||||
return cache_stream_seek_long(s,pos);
|
||||
}
|
||||
|
||||
inline static int stream_skip(stream_t *s,off_t len){
|
||||
inline static int stream_skip(stream_t *s,int64_t len){
|
||||
if( len<0 || (len>2*STREAM_BUFFER_SIZE && (s->flags & MP_STREAM_SEEK_FW)) ) {
|
||||
// negative or big skip!
|
||||
return stream_seek(s,stream_tell(s)+len);
|
||||
@ -371,7 +371,7 @@ int stream_check_interrupt(int time);
|
||||
/// Internal read function bypassing the stream buffer
|
||||
int stream_read_internal(stream_t *s, void *buf, int len);
|
||||
/// Internal seek function bypassing the stream buffer
|
||||
int stream_seek_internal(stream_t *s, off_t newpos);
|
||||
int stream_seek_internal(stream_t *s, int64_t newpos);
|
||||
|
||||
extern int bluray_angle;
|
||||
extern int bluray_chapter;
|
||||
|
@ -88,10 +88,10 @@ static void bluray_stream_close(stream_t *s)
|
||||
free(b);
|
||||
}
|
||||
|
||||
static int bluray_stream_seek(stream_t *s, off_t pos)
|
||||
static int bluray_stream_seek(stream_t *s, int64_t pos)
|
||||
{
|
||||
struct bluray_priv_s *b = s->priv;
|
||||
off_t p;
|
||||
int64_t p;
|
||||
|
||||
p = bd_seek(b->bd, pos);
|
||||
if (p == -1)
|
||||
|
@ -196,7 +196,7 @@ static int fill_buffer(stream_t *s, char *buffer, int max_len)
|
||||
return CDIO_CD_FRAMESIZE_RAW;
|
||||
}
|
||||
|
||||
static int seek(stream_t *s, off_t newpos)
|
||||
static int seek(stream_t *s, int64_t newpos)
|
||||
{
|
||||
cdda_priv *p = (cdda_priv *)s->priv;
|
||||
int sec;
|
||||
|
@ -372,7 +372,7 @@ static void dvd_close(dvd_priv_t *d)
|
||||
|
||||
static int fill_buffer(stream_t *s, char *buf, int len)
|
||||
{
|
||||
off_t pos;
|
||||
int64_t pos;
|
||||
if (len < 2048)
|
||||
return -1;
|
||||
pos = dvd_read_sector(s->priv, buf);
|
||||
@ -382,7 +382,7 @@ static int fill_buffer(stream_t *s, char *buf, int len)
|
||||
return 2048; // full sector
|
||||
}
|
||||
|
||||
static int seek(stream_t *s, off_t newpos) {
|
||||
static int seek(stream_t *s, int64_t newpos) {
|
||||
s->pos=newpos; // real seek
|
||||
dvd_seek(s->priv,s->pos/2048);
|
||||
return 1;
|
||||
@ -460,7 +460,7 @@ static int seek_to_chapter(stream_t *stream, ifo_handle_t *vts_file, tt_srpt_t *
|
||||
dvd_priv_t *d = stream->priv;
|
||||
ptt_info_t ptt;
|
||||
pgc_t *pgc;
|
||||
off_t pos;
|
||||
int64_t pos;
|
||||
|
||||
if(!vts_file || !tt_srpt)
|
||||
return 0;
|
||||
@ -489,7 +489,7 @@ static int seek_to_chapter(stream_t *stream, ifo_handle_t *vts_file, tt_srpt_t *
|
||||
d->packs_left = -1;
|
||||
d->angle_seek = 0;
|
||||
|
||||
pos = (off_t) d->cur_pack * 2048;
|
||||
pos = (int64_t) d->cur_pack * 2048;
|
||||
mp_msg(MSGT_OPEN,MSGL_V,"\r\nSTREAM_DVD, seeked to chapter: %d, cell: %u, pos: %"PRIu64"\n",
|
||||
chapter, d->cur_pack, pos);
|
||||
|
||||
@ -553,7 +553,7 @@ static int dvd_seek_to_time(stream_t *stream, ifo_handle_t *vts_file, double sec
|
||||
unsigned int i, j, k, timeunit, ac_time, tmap_sector=0, cell_sector=0, vobu_sector=0;
|
||||
int t=0;
|
||||
double tm, duration;
|
||||
off_t pos = -1;
|
||||
int64_t pos = -1;
|
||||
dvd_priv_t *d = stream->priv;
|
||||
vts_tmapt_t *vts_tmapt = vts_file->vts_tmapt;
|
||||
|
||||
@ -580,7 +580,7 @@ static int dvd_seek_to_time(stream_t *stream, ifo_handle_t *vts_file, double sec
|
||||
}
|
||||
}
|
||||
|
||||
pos = ((off_t)cell_sector)<<11;
|
||||
pos = ((int64_t)cell_sector)<<11;
|
||||
stream_seek(stream, pos);
|
||||
do {
|
||||
stream_skip(stream, 2048);
|
||||
@ -588,7 +588,7 @@ static int dvd_seek_to_time(stream_t *stream, ifo_handle_t *vts_file, double sec
|
||||
} while(!t);
|
||||
tm = dvd_get_current_time(stream, -1);
|
||||
|
||||
pos = ((off_t)tmap_sector)<<11;
|
||||
pos = ((int64_t)tmap_sector)<<11;
|
||||
stream_seek(stream, pos);
|
||||
//now get current time in terms of the cell+cell time offset
|
||||
memset(&d->dsi_pack.dsi_gi.c_eltm, 0, sizeof(dvd_time_t));
|
||||
@ -606,7 +606,7 @@ static int dvd_seek_to_time(stream_t *stream, ifo_handle_t *vts_file, double sec
|
||||
break;
|
||||
}
|
||||
vobu_sector = vts_file->vts_vobu_admap->vobu_start_sectors[i-1];
|
||||
pos = ((off_t)vobu_sector) << 11;
|
||||
pos = ((int64_t)vobu_sector) << 11;
|
||||
stream_seek(stream, pos);
|
||||
|
||||
return 1;
|
||||
@ -1013,8 +1013,8 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
|
||||
stream->seek = seek;
|
||||
stream->control = control;
|
||||
stream->close = stream_dvd_close;
|
||||
stream->start_pos = (off_t)d->cur_pack*2048;
|
||||
stream->end_pos = (off_t)(d->cur_pgc->cell_playback[d->last_cell-1].last_sector)*2048;
|
||||
stream->start_pos = (int64_t)d->cur_pack*2048;
|
||||
stream->end_pos = (int64_t)(d->cur_pgc->cell_playback[d->last_cell-1].last_sector)*2048;
|
||||
*file_format = DEMUXER_TYPE_MPEG_PS;
|
||||
mp_msg(MSGT_DVD,MSGL_V,"DVD start=%d end=%d \n",d->cur_pack,d->cur_pgc->cell_playback[d->last_cell-1].last_sector);
|
||||
stream->priv = (void*)d;
|
||||
|
@ -73,7 +73,7 @@ static int write_buffer(stream_t *s, char* buffer, int len) {
|
||||
return len;
|
||||
}
|
||||
|
||||
static int seek(stream_t *s,off_t newpos) {
|
||||
static int seek(stream_t *s,int64_t newpos) {
|
||||
s->pos = newpos;
|
||||
if(lseek(s->fd,s->pos,SEEK_SET)<0) {
|
||||
s->eof=1;
|
||||
@ -82,7 +82,7 @@ static int seek(stream_t *s,off_t newpos) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int seek_forward(stream_t *s,off_t newpos) {
|
||||
static int seek_forward(stream_t *s,int64_t newpos) {
|
||||
if(newpos<s->pos){
|
||||
mp_msg(MSGT_STREAM,MSGL_INFO,"Cannot seek backward in linear streams!\n");
|
||||
return 0;
|
||||
@ -116,7 +116,7 @@ static int control(stream_t *s, int cmd, void *arg) {
|
||||
static int open_f(stream_t *stream,int mode, void* opts, int* file_format) {
|
||||
int f;
|
||||
mode_t m = 0;
|
||||
off_t len;
|
||||
int64_t len;
|
||||
unsigned char *filename;
|
||||
struct stream_priv_s* p = (struct stream_priv_s*)opts;
|
||||
|
||||
|
@ -260,7 +260,7 @@ static int FtpOpenPort(struct stream_priv_s* p) {
|
||||
return fd;
|
||||
}
|
||||
|
||||
static int FtpOpenData(stream_t* s,off_t newpos) {
|
||||
static int FtpOpenData(stream_t* s,int64_t newpos) {
|
||||
struct stream_priv_s* p = s->priv;
|
||||
int resp;
|
||||
char str[256],rsp_txt[256];
|
||||
@ -308,7 +308,7 @@ static int fill_buffer(stream_t *s, char* buffer, int max_len){
|
||||
return (r <= 0) ? -1 : r;
|
||||
}
|
||||
|
||||
static int seek(stream_t *s,off_t newpos) {
|
||||
static int seek(stream_t *s,int64_t newpos) {
|
||||
struct stream_priv_s* p = s->priv;
|
||||
int resp;
|
||||
char rsp_txt[256];
|
||||
|
@ -43,7 +43,7 @@ static int write_buffer(stream_t *s, char *buffer, int len)
|
||||
return len;
|
||||
}
|
||||
|
||||
static int seek(stream_t *s, off_t newpos)
|
||||
static int seek(stream_t *s, int64_t newpos)
|
||||
{
|
||||
AVIOContext *avio = s->priv;
|
||||
s->pos = newpos;
|
||||
|
@ -187,7 +187,7 @@ static int fill_buffer(stream_t *s, char* buffer, int max_len){
|
||||
}
|
||||
|
||||
|
||||
static int seek(stream_t *s,off_t newpos) {
|
||||
static int seek(stream_t *s,int64_t newpos) {
|
||||
uint64_t pos = le2me_64((uint64_t)newpos);
|
||||
mp_net_stream_packet_t* pack;
|
||||
|
||||
|
@ -85,7 +85,7 @@ static int control(stream_t *s, int cmd, void *arg) {
|
||||
return STREAM_UNSUPPORTED;
|
||||
}
|
||||
|
||||
static int seek(stream_t *s,off_t newpos) {
|
||||
static int seek(stream_t *s,int64_t newpos) {
|
||||
s->pos = newpos;
|
||||
if(smbc_lseek(s->fd,s->pos,SEEK_SET)<0) {
|
||||
s->eof=1;
|
||||
@ -119,7 +119,7 @@ static void close_f(stream_t *s){
|
||||
static int open_f (stream_t *stream, int mode, void *opts, int* file_format) {
|
||||
char *filename;
|
||||
mode_t m = 0;
|
||||
off_t len;
|
||||
int64_t len;
|
||||
int fd, err;
|
||||
|
||||
filename = stream->url;
|
||||
|
@ -82,7 +82,7 @@ static int fill_buffer(stream_t *s, char* buffer, int max_len){
|
||||
return vcd_read(s->priv,buffer);
|
||||
}
|
||||
|
||||
static int seek(stream_t *s,off_t newpos) {
|
||||
static int seek(stream_t *s,int64_t newpos) {
|
||||
s->pos = newpos;
|
||||
vcd_set_msf(s->priv,s->pos/VCD_SECTOR_DATA);
|
||||
return 1;
|
||||
|
@ -89,7 +89,7 @@ static int fill_buffer(stream_t *s, char* buffer, int max_len){
|
||||
return len;
|
||||
}
|
||||
|
||||
static int seek(stream_t *s,off_t newpos) {
|
||||
static int seek(stream_t *s,int64_t newpos) {
|
||||
s->pos = newpos;
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user