From ddffcce67810fbde5508a353f85760da7a1b4a95 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 18 Nov 2012 20:46:12 +0100 Subject: 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. --- stream/asf_mmst_streaming.c | 2 +- stream/asf_streaming.c | 2 +- stream/cookies.c | 4 ++-- stream/network.c | 6 +++--- stream/network.h | 6 +++--- stream/stream.c | 10 +++++----- stream/stream.h | 18 +++++++++--------- stream/stream_bluray.c | 4 ++-- stream/stream_cdda.c | 2 +- stream/stream_dvd.c | 20 ++++++++++---------- stream/stream_file.c | 6 +++--- stream/stream_ftp.c | 4 ++-- stream/stream_lavf.c | 2 +- stream/stream_netstream.c | 2 +- stream/stream_smb.c | 4 ++-- stream/stream_vcd.c | 2 +- stream/stream_vstream.c | 2 +- 17 files changed, 48 insertions(+), 48 deletions(-) (limited to 'stream') diff --git a/stream/asf_mmst_streaming.c b/stream/asf_mmst_streaming.c index 26dd8aeddf..371e256da5 100644 --- a/stream/asf_mmst_streaming.c +++ b/stream/asf_mmst_streaming.c @@ -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 diff --git a/stream/asf_streaming.c b/stream/asf_streaming.c index 5e34f53d4c..e3bfbe9019 100644 --- a/stream/asf_streaming.c +++ b/stream/asf_streaming.c @@ -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++; diff --git a/stream/cookies.c b/stream/cookies.c index 62025b157b..78a18284af 100644 --- a/stream/cookies.c +++ b/stream/cookies.c @@ -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) diff --git a/stream/network.c b/stream/network.c index b23ed8ef02..fb432d47c0 100644 --- a/stream/network.c +++ b/stream/network.c @@ -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; } diff --git a/stream/network.h b/stream/network.h index 96d486e910..ee6a940c99 100644 --- a/stream/network.h +++ b/stream/network.h @@ -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 */ diff --git a/stream/stream.c b/stream/stream.c index d1dcc11dc0..a94939ffda 100644 --- a/stream/stream.c +++ b/stream/stream.c @@ -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", diff --git a/stream/stream.h b/stream/stream.h index ace35abd9a..9023c95933 100644 --- a/stream/stream.h +++ b/stream/stream.h @@ -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(pospos){ - 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; diff --git a/stream/stream_bluray.c b/stream/stream_bluray.c index 432216e20e..5f380458c7 100644 --- a/stream/stream_bluray.c +++ b/stream/stream_bluray.c @@ -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) diff --git a/stream/stream_cdda.c b/stream/stream_cdda.c index 31e29a343f..c8a624c86a 100644 --- a/stream/stream_cdda.c +++ b/stream/stream_cdda.c @@ -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; diff --git a/stream/stream_dvd.c b/stream/stream_dvd.c index a45fa4e432..4554b2c2cc 100644 --- a/stream/stream_dvd.c +++ b/stream/stream_dvd.c @@ -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; diff --git a/stream/stream_file.c b/stream/stream_file.c index fe893af0b4..8b587e6048 100644 --- a/stream/stream_file.c +++ b/stream/stream_file.c @@ -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(newpospos){ 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; diff --git a/stream/stream_ftp.c b/stream/stream_ftp.c index 90ccc7b13a..8485e0e969 100644 --- a/stream/stream_ftp.c +++ b/stream/stream_ftp.c @@ -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]; diff --git a/stream/stream_lavf.c b/stream/stream_lavf.c index 9619a06b1a..6e5f70ae83 100644 --- a/stream/stream_lavf.c +++ b/stream/stream_lavf.c @@ -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; diff --git a/stream/stream_netstream.c b/stream/stream_netstream.c index bbc8c85cbf..2abc0e48f9 100644 --- a/stream/stream_netstream.c +++ b/stream/stream_netstream.c @@ -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; diff --git a/stream/stream_smb.c b/stream/stream_smb.c index ecd2a6260a..3b67d6c88d 100644 --- a/stream/stream_smb.c +++ b/stream/stream_smb.c @@ -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; diff --git a/stream/stream_vcd.c b/stream/stream_vcd.c index 8093088456..1ef9a337de 100644 --- a/stream/stream_vcd.c +++ b/stream/stream_vcd.c @@ -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; diff --git a/stream/stream_vstream.c b/stream/stream_vstream.c index 790ba1b83f..7b25ca3103 100644 --- a/stream/stream_vstream.c +++ b/stream/stream_vstream.c @@ -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; } -- cgit v1.2.3