[MPlayer-cvslog] r35979 - in trunk/stream: asf_mmst_streaming.c asf_streaming.c network.c network.h stream.c stream.h stream_bd.c stream_bluray.c stream_cdda.c stream_cue.c stream_dvd.c stream_dvdnav.c stream_ffmpe...

reimar subversion at mplayerhq.hu
Sat Mar 16 14:38:34 CET 2013


Author: reimar
Date: Sat Mar 16 14:38:34 2013
New Revision: 35979

Log:
Fix previous commit, off_t must be replaced by int64_t

The commit replacing off_t by uint64_t was by accident,
I meant to commit this variant.
off_t must be replaced by a signed type to avoid breaking
things like seeking backwards and also detecting errors
from e.g. lseek without too complex hacks.

Modified:
   trunk/stream/asf_mmst_streaming.c
   trunk/stream/asf_streaming.c
   trunk/stream/network.c
   trunk/stream/network.h
   trunk/stream/stream.c
   trunk/stream/stream.h
   trunk/stream/stream_bd.c
   trunk/stream/stream_bluray.c
   trunk/stream/stream_cdda.c
   trunk/stream/stream_cue.c
   trunk/stream/stream_dvd.c
   trunk/stream/stream_dvdnav.c
   trunk/stream/stream_ffmpeg.c
   trunk/stream/stream_file.c
   trunk/stream/stream_ftp.c
   trunk/stream/stream_live555.c
   trunk/stream/stream_nemesi.c
   trunk/stream/stream_netstream.c
   trunk/stream/stream_smb.c
   trunk/stream/stream_vcd.c
   trunk/stream/stream_vstream.c

Modified: trunk/stream/asf_mmst_streaming.c
==============================================================================
--- trunk/stream/asf_mmst_streaming.c	Sat Mar 16 14:38:30 2013	(r35978)
+++ trunk/stream/asf_mmst_streaming.c	Sat Mar 16 14:38:34 2013	(r35979)
@@ -505,7 +505,7 @@ static int asf_mmst_streaming_read( int 
 
 }
 
-static int asf_mmst_streaming_seek( int fd, uint64_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

Modified: trunk/stream/asf_streaming.c
==============================================================================
--- trunk/stream/asf_streaming.c	Sat Mar 16 14:38:30 2013	(r35978)
+++ trunk/stream/asf_streaming.c	Sat Mar 16 14:38:34 2013	(r35979)
@@ -453,7 +453,7 @@ static int asf_http_streaming_read( int 
   return read;
 }
 
-static int asf_http_streaming_seek( int fd, uint64_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++;

Modified: trunk/stream/network.c
==============================================================================
--- trunk/stream/network.c	Sat Mar 16 14:38:30 2013	(r35978)
+++ trunk/stream/network.c	Sat Mar 16 14:38:34 2013	(r35979)
@@ -197,7 +197,7 @@ URL_t *url_new_with_proxy(const char *ur
 }
 
 int
-http_send_request( URL_t *url, uint64_t pos ) {
+http_send_request( URL_t *url, int64_t pos ) {
 	HTTP_header_t *http_hdr;
 	URL_t *server_url;
 	char str[256];
@@ -383,7 +383,7 @@ http_authenticate(HTTP_header_t *http_hd
 }
 
 int
-http_seek( stream_t *stream, uint64_t pos ) {
+http_seek( stream_t *stream, int64_t pos ) {
 	HTTP_header_t *http_hdr = NULL;
 	int fd;
 	if( stream==NULL ) return 0;
@@ -479,7 +479,7 @@ nop_streaming_read( int fd, char *buffer
 }
 
 int
-nop_streaming_seek( int fd, uint64_t pos, streaming_ctrl_t *stream_ctrl ) {
+nop_streaming_seek( int fd, int64_t pos, streaming_ctrl_t *stream_ctrl ) {
 	return -1;
 }
 

Modified: trunk/stream/network.h
==============================================================================
--- trunk/stream/network.h	Sat Mar 16 14:38:30 2013	(r35978)
+++ trunk/stream/network.h	Sat Mar 16 14:38:34 2013	(r35979)
@@ -76,10 +76,10 @@ streaming_ctrl_t *streaming_ctrl_new(voi
 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, uint64_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, uint64_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);
@@ -87,6 +87,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, uint64_t pos);
+int http_seek(stream_t *stream, int64_t pos);
 
 #endif /* MPLAYER_NETWORK_H */

Modified: trunk/stream/stream.c
==============================================================================
--- trunk/stream/stream.c	Sat Mar 16 14:38:30 2013	(r35978)
+++ trunk/stream/stream.c	Sat Mar 16 14:38:34 2013	(r35979)
@@ -286,7 +286,7 @@ static int stream_reconnect(stream_t *s)
 #define MAX_RECONNECT_RETRIES 5
 #define RECONNECT_SLEEP_MS 1000
     int retry = 0;
-    uint64_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
@@ -380,7 +380,7 @@ int stream_write_buffer(stream_t *s, uns
   return rd;
 }
 
-int stream_seek_internal(stream_t *s, uint64_t newpos)
+int stream_seek_internal(stream_t *s, int64_t newpos)
 {
 if(newpos==0 || newpos!=s->pos){
   switch(s->type){
@@ -428,9 +428,9 @@ if(newpos==0 || newpos!=s->pos){
   return -1;
 }
 
-int stream_seek_long(stream_t *s, uint64_t pos){
+int stream_seek_long(stream_t *s, int64_t pos){
   int res;
-  uint64_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);
 
@@ -445,7 +445,7 @@ int stream_seek_long(stream_t *s, uint64
   if(s->sector_size)
       newpos = (pos/s->sector_size)*s->sector_size;
   else
-      newpos = pos&(~((uint64_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",

Modified: trunk/stream/stream.h
==============================================================================
--- trunk/stream/stream.h	Sat Mar 16 14:38:30 2013	(r35978)
+++ trunk/stream/stream.h	Sat Mar 16 14:38:34 2013	(r35979)
@@ -128,7 +128,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, uint64_t pos, struct streaming_control *stream_ctrl );
+	int (*streaming_seek)( int fd, int64_t pos, struct streaming_control *stream_ctrl );
 	void *data;
 } streaming_ctrl_t;
 
@@ -155,7 +155,7 @@ typedef struct stream {
   // Write
   int (*write_buffer)(struct stream *s, char* buffer, int len);
   // Seek
-  int (*seek)(struct stream *s, uint64_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)
@@ -169,7 +169,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;
-  uint64_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;
@@ -188,7 +188,7 @@ typedef struct stream {
 #endif
 
 int stream_fill_buffer(stream_t *s);
-int stream_seek_long(stream_t *s, uint64_t pos);
+int stream_seek_long(stream_t *s, int64_t pos);
 void stream_capture_do(stream_t *s);
 
 #ifdef CONFIG_STREAM_CACHE
@@ -312,12 +312,12 @@ static inline int stream_eof(stream_t *s
   return s->eof;
 }
 
-static inline uint64_t stream_tell(stream_t *s)
+static inline int64_t stream_tell(stream_t *s)
 {
   return s->pos+s->buf_pos-s->buf_len;
 }
 
-static inline int stream_seek(stream_t *s, uint64_t pos)
+static inline int stream_seek(stream_t *s, int64_t pos)
 {
 
   mp_dbg(MSGT_DEMUX, MSGL_DBG3, "seek to 0x%"PRIX64"\n", pos);
@@ -328,7 +328,7 @@ static inline int stream_seek(stream_t *
     pos = 0;
   }
   if(pos<s->pos){
-    uint64_t x=pos-(s->pos-s->buf_len);
+    int64_t x=pos-(s->pos-s->buf_len);
     if(x>=0){
       s->buf_pos=x;
 //      putchar('*');fflush(stdout);
@@ -339,7 +339,7 @@ static inline int stream_seek(stream_t *
   return cache_stream_seek_long(s,pos);
 }
 
-static inline int stream_skip(stream_t *s, uint64_t len)
+static inline 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!
@@ -375,7 +375,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, uint64_t newpos);
+int stream_seek_internal(stream_t *s, int64_t newpos);
 
 extern int bluray_angle;
 extern int bluray_chapter;

Modified: trunk/stream/stream_bd.c
==============================================================================
--- trunk/stream/stream_bd.c	Sat Mar 16 14:38:30 2013	(r35978)
+++ trunk/stream/stream_bd.c	Sat Mar 16 14:38:34 2013	(r35979)
@@ -101,7 +101,7 @@ struct bd_priv {
     stream_t     *title_file;
     struct AVAES *aescbc;
     struct AVAES *aeseed;
-    uint64_t      pos;
+    int64_t       pos;
     struct uks    uks;
     int           nr_lang_maps;
     struct lang_map *lang_maps;
@@ -117,7 +117,7 @@ static void bd_stream_close(stream_t *s)
     free(bd);
 }
 
-static int bd_stream_seek(stream_t *s, uint64_t pos)
+static int bd_stream_seek(stream_t *s, int64_t pos)
 {
     struct bd_priv *bd = s->priv;
 
@@ -275,7 +275,7 @@ static int bd_get_uks(struct bd_priv *bd
 }
 
 // NOTE: we assume buf is sufficiently aligned to 64 bit read/writes
-static uint64_t bd_read(struct bd_priv *bd, uint8_t *buf, int len)
+static int64_t bd_read(struct bd_priv *bd, uint8_t *buf, int len)
 {
     int read_len;
     int unit_offset = bd->pos % BD_UNIT_SIZE;

Modified: trunk/stream/stream_bluray.c
==============================================================================
--- trunk/stream/stream_bluray.c	Sat Mar 16 14:38:30 2013	(r35978)
+++ trunk/stream/stream_bluray.c	Sat Mar 16 14:38:34 2013	(r35979)
@@ -87,10 +87,10 @@ static void bluray_stream_close(stream_t
     free(b);
 }
 
-static int bluray_stream_seek(stream_t *s, uint64_t pos)
+static int bluray_stream_seek(stream_t *s, int64_t pos)
 {
     struct bluray_priv_s *b = s->priv;
-    uint64_t p;
+    int64_t p;
 
     p = bd_seek(b->bd, pos);
     if (p == -1)

Modified: trunk/stream/stream_cdda.c
==============================================================================
--- trunk/stream/stream_cdda.c	Sat Mar 16 14:38:30 2013	(r35978)
+++ trunk/stream/stream_cdda.c	Sat Mar 16 14:38:34 2013	(r35979)
@@ -170,7 +170,7 @@ static int fill_buffer(stream_t* s, char
   return CD_FRAMESIZE_RAW;
 }
 
-static int seek(stream_t* s, uint64_t newpos) {
+static int seek(stream_t* s, int64_t newpos) {
   cdda_priv* p = (cdda_priv*)s->priv;
   cd_track_t *cd_track;
   int sec;

Modified: trunk/stream/stream_cue.c
==============================================================================
--- trunk/stream/stream_cue.c	Sat Mar 16 14:38:30 2013	(r35978)
+++ trunk/stream/stream_cue.c	Sat Mar 16 14:38:34 2013	(r35979)
@@ -480,7 +480,7 @@ static int cue_vcd_get_track_end (int tr
   return VCD_SECTOR_DATA * sector;
 }
 
-static int seek(stream_t *s, uint64_t newpos) {
+static int seek(stream_t *s, int64_t newpos) {
   s->pos=newpos;
   cue_set_msf(s->pos/VCD_SECTOR_DATA);
   return 1;

Modified: trunk/stream/stream_dvd.c
==============================================================================
--- trunk/stream/stream_dvd.c	Sat Mar 16 14:38:30 2013	(r35978)
+++ trunk/stream/stream_dvd.c	Sat Mar 16 14:38:34 2013	(r35979)
@@ -416,7 +416,7 @@ static void dvd_close(dvd_priv_t *d)
 
 static int fill_buffer(stream_t *s, char *buf, int len)
 {
-  uint64_t pos;
+  int64_t pos;
   if (len < 2048)
     return -1;
   pos = dvd_read_sector(s->priv, buf);
@@ -426,7 +426,7 @@ static int fill_buffer(stream_t *s, char
   return 2048; // full sector
 }
 
-static int seek(stream_t *s, uint64_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;
@@ -504,7 +504,7 @@ static int seek_to_chapter(stream_t *str
     dvd_priv_t *d = stream->priv;
     ptt_info_t ptt;
     pgc_t *pgc;
-    uint64_t pos;
+    int64_t pos;
 
     if(!vts_file || !tt_srpt)
        return 0;
@@ -597,7 +597,7 @@ static int dvd_seek_to_time(stream_t *st
     unsigned int i, j, k, timeunit, ac_time, tmap_sector=0, cell_sector=0, vobu_sector=0;
     int t=0;
     double tm, duration;
-    uint64_t pos = -1;
+    int64_t pos = -1;
     dvd_priv_t *d = stream->priv;
     vts_tmapt_t *vts_tmapt = vts_file->vts_tmapt;
 

Modified: trunk/stream/stream_dvdnav.c
==============================================================================
--- trunk/stream/stream_dvdnav.c	Sat Mar 16 14:38:30 2013	(r35978)
+++ trunk/stream/stream_dvdnav.c	Sat Mar 16 14:38:34 2013	(r35979)
@@ -87,7 +87,7 @@ static const struct m_struct_st stream_o
   stream_opts_fields
 };
 
-static int seek(stream_t *s, uint64_t newpos);
+static int seek(stream_t *s, int64_t newpos);
 static void show_audio_subs_languages(dvdnav_t *nav);
 
 static dvdnav_priv_t * new_dvdnav_stream(char * filename) {
@@ -285,7 +285,7 @@ static void update_title_len(stream_t *s
 }
 
 
-static int seek(stream_t *s, uint64_t newpos) {
+static int seek(stream_t *s, int64_t newpos) {
   uint32_t sector = 0;
   dvdnav_priv_t *priv = s->priv;
 

Modified: trunk/stream/stream_ffmpeg.c
==============================================================================
--- trunk/stream/stream_ffmpeg.c	Sat Mar 16 14:38:30 2013	(r35978)
+++ trunk/stream/stream_ffmpeg.c	Sat Mar 16 14:38:34 2013	(r35979)
@@ -42,7 +42,7 @@ static int write_buffer(stream_t *s, cha
     return len;
 }
 
-static int seek(stream_t *s, uint64_t newpos)
+static int seek(stream_t *s, int64_t newpos)
 {
     s->pos = newpos;
     if (avio_seek(s->priv, s->pos, SEEK_SET) < 0) {

Modified: trunk/stream/stream_file.c
==============================================================================
--- trunk/stream/stream_file.c	Sat Mar 16 14:38:30 2013	(r35978)
+++ trunk/stream/stream_file.c	Sat Mar 16 14:38:34 2013	(r35979)
@@ -78,7 +78,7 @@ static int write_buffer(stream_t *s, cha
   return len;
 }
 
-static int seek(stream_t *s, uint64_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;
@@ -87,7 +87,7 @@ static int seek(stream_t *s, uint64_t ne
   return 1;
 }
 
-static int seek_forward(stream_t *s, uint64_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;
@@ -143,7 +143,7 @@ fallback:
 static int open_f(stream_t *stream,int mode, void* opts, int* file_format) {
   int f;
   mode_t m = 0;
-  uint64_t len;
+  int64_t len;
   unsigned char *filename;
   struct stream_priv_s* p = (struct stream_priv_s*)opts;
 

Modified: trunk/stream/stream_ftp.c
==============================================================================
--- trunk/stream/stream_ftp.c	Sat Mar 16 14:38:30 2013	(r35978)
+++ trunk/stream/stream_ftp.c	Sat Mar 16 14:38:34 2013	(r35979)
@@ -284,7 +284,7 @@ static int FtpOpenPort(struct stream_pri
   return fd;
 }
 
-static int FtpOpenData(stream_t* s, uint64_t newpos) {
+static int FtpOpenData(stream_t* s, int64_t newpos) {
   struct stream_priv_s* p = s->priv;
   int resp;
   char rsp_txt[256];
@@ -332,7 +332,7 @@ static int fill_buffer(stream_t *s, char
   return (r <= 0) ? -1 : r;
 }
 
-static int seek(stream_t *s, uint64_t newpos) {
+static int seek(stream_t *s, int64_t newpos) {
   struct stream_priv_s* p = s->priv;
   int resp;
   char rsp_txt[256];

Modified: trunk/stream/stream_live555.c
==============================================================================
--- trunk/stream/stream_live555.c	Sat Mar 16 14:38:30 2013	(r35978)
+++ trunk/stream/stream_live555.c	Sat Mar 16 14:38:34 2013	(r35979)
@@ -29,7 +29,7 @@
 #include "libmpdemux/demuxer.h"
 #include "help_mp.h"
 
-static int _rtsp_streaming_seek(int fd, uint64_t pos, streaming_ctrl_t* streaming_ctrl) {
+static int _rtsp_streaming_seek(int fd, int64_t pos, streaming_ctrl_t* streaming_ctrl) {
   return -1; // For now, we don't handle RTSP stream seeking
 }
 

Modified: trunk/stream/stream_nemesi.c
==============================================================================
--- trunk/stream/stream_nemesi.c	Sat Mar 16 14:38:30 2013	(r35978)
+++ trunk/stream/stream_nemesi.c	Sat Mar 16 14:38:34 2013	(r35979)
@@ -39,7 +39,7 @@
 
 char *rtsp_destination = NULL;
 
-static int rtsp_streaming_seek(int fd, uint64_t pos,
+static int rtsp_streaming_seek(int fd, int64_t pos,
                                streaming_ctrl_t* streaming_ctrl) {
     return -1;
 }

Modified: trunk/stream/stream_netstream.c
==============================================================================
--- trunk/stream/stream_netstream.c	Sat Mar 16 14:38:30 2013	(r35978)
+++ trunk/stream/stream_netstream.c	Sat Mar 16 14:38:34 2013	(r35979)
@@ -188,7 +188,7 @@ static int fill_buffer(stream_t *s, char
 }
 
 
-static int seek(stream_t *s, uint64_t newpos) {
+static int seek(stream_t *s, int64_t newpos) {
   uint64_t pos = le2me_64(newpos);
   mp_net_stream_packet_t* pack;
 

Modified: trunk/stream/stream_smb.c
==============================================================================
--- trunk/stream/stream_smb.c	Sat Mar 16 14:38:30 2013	(r35978)
+++ trunk/stream/stream_smb.c	Sat Mar 16 14:38:34 2013	(r35979)
@@ -86,7 +86,7 @@ static int control(stream_t *s, int cmd,
   return STREAM_UNSUPPORTED;
 }
 
-static int seek(stream_t *s, uint64_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;

Modified: trunk/stream/stream_vcd.c
==============================================================================
--- trunk/stream/stream_vcd.c	Sat Mar 16 14:38:30 2013	(r35978)
+++ trunk/stream/stream_vcd.c	Sat Mar 16 14:38:34 2013	(r35979)
@@ -83,7 +83,7 @@ static int fill_buffer(stream_t *s, char
   return vcd_read(s->priv,buffer);
 }
 
-static int seek(stream_t *s, uint64_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;

Modified: trunk/stream/stream_vstream.c
==============================================================================
--- trunk/stream/stream_vstream.c	Sat Mar 16 14:38:30 2013	(r35978)
+++ trunk/stream/stream_vstream.c	Sat Mar 16 14:38:34 2013	(r35979)
@@ -90,7 +90,7 @@ static int fill_buffer(stream_t *s, char
   return len;
 }
 
-static int seek(stream_t *s, uint64_t newpos) {
+static int seek(stream_t *s, int64_t newpos) {
   s->pos = newpos;
   return 1;
 }


More information about the MPlayer-cvslog mailing list