summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-11-18 20:46:12 +0100
committerwm4 <wm4@nowhere>2012-11-20 18:00:15 +0100
commitddffcce67810fbde5508a353f85760da7a1b4a95 (patch)
tree74d9b416568c12759a0c198651bce0e78a0c2284
parent51dac4e0702e361b88e5a373fbb0165f5ad47420 (diff)
downloadmpv-ddffcce67810fbde5508a353f85760da7a1b4a95.tar.bz2
mpv-ddffcce67810fbde5508a353f85760da7a1b4a95.tar.xz
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.
-rw-r--r--core/mplayer.c4
-rw-r--r--demux/aviheader.c16
-rw-r--r--demux/aviheader.h10
-rw-r--r--demux/demux.c4
-rw-r--r--demux/demux.h16
-rw-r--r--demux/demux_asf.c6
-rw-r--r--demux/demux_avi.c14
-rw-r--r--demux/demux_mkv.c20
-rw-r--r--demux/demux_mpg.c16
-rw-r--r--demux/demux_packet.h2
-rw-r--r--demux/demux_rawaudio.c4
-rw-r--r--demux/demux_rawvideo.c4
-rw-r--r--demux/demux_ts.c16
-rw-r--r--stream/asf_mmst_streaming.c2
-rw-r--r--stream/asf_streaming.c2
-rw-r--r--stream/cookies.c4
-rw-r--r--stream/network.c6
-rw-r--r--stream/network.h6
-rw-r--r--stream/stream.c10
-rw-r--r--stream/stream.h18
-rw-r--r--stream/stream_bluray.c4
-rw-r--r--stream/stream_cdda.c2
-rw-r--r--stream/stream_dvd.c20
-rw-r--r--stream/stream_file.c6
-rw-r--r--stream/stream_ftp.c4
-rw-r--r--stream/stream_lavf.c2
-rw-r--r--stream/stream_netstream.c2
-rw-r--r--stream/stream_smb.c4
-rw-r--r--stream/stream_vcd.c2
-rw-r--r--stream/stream_vstream.c2
30 files changed, 114 insertions, 114 deletions
diff --git a/core/mplayer.c b/core/mplayer.c
index 8f974c5bc2..cf475b2e01 100644
--- a/core/mplayer.c
+++ b/core/mplayer.c
@@ -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
diff --git a/demux/aviheader.c b/demux/aviheader.c
index a83ce1e0fb..7bf1803799 100644
--- a/demux/aviheader.c
+++ b/demux/aviheader.c
@@ -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 {
diff --git a/demux/aviheader.h b/demux/aviheader.h
index f1ec64a577..0d721908d3 100644
--- a/demux/aviheader.h
+++ b/demux/aviheader.h
@@ -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;
diff --git a/demux/demux.c b/demux/demux.c
index e45335f2f8..9447fc04cf 100644
--- a/demux/demux.c
+++ b/demux/demux.c
@@ -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);
diff --git a/demux/demux.h b/demux/demux.h
index 4ab4581b2a..470b8ed880 100644
--- a/demux/demux.h
+++ b/demux/demux.h
@@ -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)
diff --git a/demux/demux_asf.c b/demux/demux_asf.c
index 010aad4677..ff44954964 100644
--- a/demux/demux_asf.c
+++ b/demux/demux_asf.c
@@ -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);
diff --git a/demux/demux_avi.c b/demux/demux_avi.c
index 9842c1c10c..19f8148e47 100644
--- a/demux/demux_avi.c
+++ b/demux/demux_avi.c
@@ -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;
diff --git a/demux/demux_mkv.c b/demux/demux_mkv.c
index 528d086e81..0ff3cd79e1 100644
--- a/demux/demux_mkv.c
+++ b/demux/demux_mkv.c
@@ -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);
diff --git a/demux/demux_mpg.c b/demux/demux_mpg.c
index 7c943a87b1..92d6290ab0 100644
--- a/demux/demux_mpg.c
+++ b/demux/demux_mpg.c
@@ -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 {
diff --git a/demux/demux_packet.h b/demux/demux_packet.h
index d64291f4e0..db5d41402c 100644
--- a/demux/demux_packet.h
+++ b/demux/demux_packet.h
@@ -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
diff --git a/demux/demux_rawaudio.c b/demux/demux_rawaudio.c
index 2551e2794a..6afcfce470 100644
--- a/demux/demux_rawaudio.c
+++ b/demux/demux_rawaudio.c
@@ -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)
diff --git a/demux/demux_rawvideo.c b/demux/demux_rawvideo.c
index 197c48a454..68dc270e44 100644
--- a/demux/demux_rawvideo.c
+++ b/demux/demux_rawvideo.c
@@ -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)
diff --git a/demux/demux_ts.c b/demux/demux_ts.c
index ef6186f79a..59af903d7b 100644
--- a/demux/demux_ts.c
+++ b/demux/demux_ts.c
@@ -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 ==========================
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(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;
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(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;
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;
}