[Ffmpeg-cvslog] CVS: ffmpeg/libavformat avidec.c, 1.70, 1.71 avio.h, 1.18, 1.19 aviobuf.c, 1.25, 1.26 dv.c, 1.42, 1.43 ffm.c, 1.40, 1.41 img2.c, 1.15, 1.16 mov.c, 1.79, 1.80 mp3.c, 1.6, 1.7 ogg2.c, 1.6, 1.7 utils.c, 1.146, 1.147 yuv.c, 1.3, 1.4

Aurelien Jacobs CVS aurel
Thu May 19 02:06:30 CEST 2005


Update of /cvsroot/ffmpeg/ffmpeg/libavformat
In directory mail:/var2/tmp/cvs-serv12470/libavformat

Modified Files:
	avidec.c avio.h aviobuf.c dv.c ffm.c img2.c mov.c mp3.c ogg2.c 
	utils.c yuv.c 
Log Message:
drop most url_fileno() calls (allows to use ByteIOContext directly in caller apps instead of URLProtocol)

Index: avidec.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/avidec.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -d -r1.70 -r1.71
--- avidec.c	30 Apr 2005 21:43:58 -0000	1.70
+++ avidec.c	19 May 2005 00:06:26 -0000	1.71
@@ -125,7 +125,7 @@
             if (tag1 == MKTAG('m', 'o', 'v', 'i')) {
                 avi->movi_list = url_ftell(pb) - 4;
                 if(size) avi->movi_end = avi->movi_list + size;
-                else     avi->movi_end = url_filesize(url_fileno(pb));
+                else     avi->movi_end = url_fsize(pb);
 #ifdef DEBUG
                 printf("movi end=%Lx\n", avi->movi_end);
 #endif
@@ -486,7 +486,7 @@
 	if (i >= avi->movi_end) {
 	    if (avi->is_odml) {
 		url_fskip(pb, avi->riff_end - i);
-	        avi->riff_end = avi->movi_end = url_filesize(url_fileno(pb));
+	        avi->riff_end = avi->movi_end = url_fsize(pb);
 	    } else
 	        break;
 	}

Index: avio.h
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/avio.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- avio.h	8 Oct 2004 20:09:52 -0000	1.18
+++ avio.h	19 May 2005 00:06:26 -0000	1.19
@@ -109,6 +109,7 @@
 offset_t url_fseek(ByteIOContext *s, offset_t offset, int whence);
 void url_fskip(ByteIOContext *s, offset_t offset);
 offset_t url_ftell(ByteIOContext *s);
+offset_t url_fsize(ByteIOContext *s);
 int url_feof(ByteIOContext *s);
 int url_ferror(ByteIOContext *s);
 

Index: aviobuf.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/aviobuf.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- aviobuf.c	24 Mar 2005 22:07:54 -0000	1.25
+++ aviobuf.c	19 May 2005 00:06:26 -0000	1.26
@@ -172,6 +172,17 @@
     return url_fseek(s, 0, SEEK_CUR);
 }
 
+offset_t url_fsize(ByteIOContext *s)
+{
+    offset_t size;
+    
+    if (!s->seek)
+        return -EPIPE;
+    size = s->seek(s->opaque, -1, SEEK_END) + 1;
+    s->seek(s->opaque, s->pos, SEEK_SET);
+    return size;
+}
+
 int url_feof(ByteIOContext *s)
 {
     return s->eof_reached;

Index: dv.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/dv.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- dv.c	30 Apr 2005 21:43:58 -0000	1.42
+++ dv.c	19 May 2005 00:06:26 -0000	1.43
@@ -815,7 +815,7 @@
     // FIXME: sys may be wrong if last dv_read_packet() failed (buffer is junk)
     const DVprofile* sys = dv_codec_profile(&c->vst->codec);
     int64_t offset;
-    int64_t size = url_filesize(url_fileno(&s->pb));
+    int64_t size = url_fsize(&s->pb);
     int64_t max_offset = ((size-1) / sys->frame_size) * sys->frame_size;
 
     offset = sys->frame_size * timestamp;

Index: ffm.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/ffm.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- ffm.c	7 May 2005 00:58:28 -0000	1.40
+++ ffm.c	19 May 2005 00:06:26 -0000	1.41
@@ -462,7 +462,7 @@
     ffm->write_index = get_be64(pb);
     /* get also filesize */
     if (!url_is_streamed(pb)) {
-        ffm->file_size = url_filesize(url_fileno(pb));
+        ffm->file_size = url_fsize(pb);
         adjust_write_index(s);
     } else {
         ffm->file_size = (uint64_t_C(1) << 63) - 1;

Index: img2.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/img2.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- img2.c	30 Apr 2005 21:43:58 -0000	1.15
+++ img2.c	19 May 2005 00:06:26 -0000	1.16
@@ -244,7 +244,7 @@
         for(i=0; i<3; i++){
             if (url_fopen(f[i], filename, URL_RDONLY) < 0)
                 return AVERROR_IO;
-            size[i]= url_filesize(url_fileno(f[i]));
+            size[i]= url_fsize(f[i]);
             
             if(codec->codec_id != CODEC_ID_RAWVIDEO)
                 break;

Index: mov.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/mov.c,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -d -r1.79 -r1.80
--- mov.c	30 Apr 2005 21:43:58 -0000	1.79
+++ mov.c	19 May 2005 00:06:26 -0000	1.80
@@ -1740,7 +1740,7 @@
         mov->mp4 = 1;
 #endif
     if(!url_is_streamed(pb)) /* .mov and .mp4 aren't streamable anyway (only progressive download if moov is before mdat) */
-	atom.size = url_filesize(url_fileno(pb));
+	atom.size = url_fsize(pb);
     else
 	atom.size = 0x7FFFFFFFFFFFFFFFLL;
 

Index: mp3.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/mp3.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- mp3.c	19 Jun 2004 03:59:34 -0000	1.6
+++ mp3.c	19 May 2005 00:06:27 -0000	1.7
@@ -258,7 +258,7 @@
     /* try to get the TAG */
     if (!url_is_streamed(&s->pb)) {
         /* XXX: change that */
-        filesize = url_filesize(url_fileno(&s->pb));
+        filesize = url_fsize(&s->pb);
         if (filesize > 128) {
             url_fseek(&s->pb, filesize - 128, SEEK_SET);
             ret = get_buffer(&s->pb, buf, ID3_TAG_SIZE);

Index: ogg2.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/ogg2.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- ogg2.c	11 May 2005 22:47:26 -0000	1.6
+++ ogg2.c	19 May 2005 00:06:27 -0000	1.7
@@ -449,7 +449,6 @@
 ogg_get_length (AVFormatContext * s)
 {
     ogg_t *ogg = s->priv_data;
-    URLContext *h = url_fileno (&s->pb);
     int idx = -1, i;
 //FIXME: get the right ctx flag to know if is seekable or not
 //    if(ogg->f->flags & URL_FLAG_STREAMED)
@@ -460,7 +459,7 @@
         return 0;
 
     ogg_save (s);
-    url_seek (h, -MAX_PAGE_SIZE, SEEK_END);
+    url_fseek (&s->pb, -MAX_PAGE_SIZE, SEEK_END);
 
     while (!ogg_read_page (s, &i)){
         if (ogg->streams[i].granule != -1 && ogg->streams[i].granule != 0)
@@ -472,7 +471,7 @@
             ogg_gptopts (s, idx, ogg->streams[idx].granule);
     }
 
-    ogg->size = url_filesize(h);
+    ogg->size = url_fsize(&s->pb);
     ogg_restore (s, 0);
 
     return 0;

Index: utils.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/utils.c,v
retrieving revision 1.146
retrieving revision 1.147
diff -u -d -r1.146 -r1.147
--- utils.c	12 May 2005 16:27:05 -0000	1.146
+++ utils.c	19 May 2005 00:06:27 -0000	1.147
@@ -1192,7 +1192,7 @@
 
     if(ts_max == AV_NOPTS_VALUE){
         int step= 1024;
-        pos_max = url_filesize(url_fileno(&s->pb)) - 1;
+        pos_max = url_fsize(&s->pb) - 1;
         do{
             pos_max -= step;
             ts_max = avif->read_timestamp(s, stream_index, &pos_max, pos_max + step);
@@ -1289,7 +1289,7 @@
 #endif
 
     pos_min = s->data_offset;
-    pos_max = url_filesize(url_fileno(&s->pb)) - 1;
+    pos_max = url_fsize(&s->pb) - 1;
 
     if     (pos < pos_min) pos= pos_min;
     else if(pos > pos_max) pos= pos_max;
@@ -1586,15 +1586,13 @@
 
 static void av_estimate_timings(AVFormatContext *ic)
 {
-    URLContext *h;
     int64_t file_size;
 
     /* get the file size, if possible */
     if (ic->iformat->flags & AVFMT_NOFILE) {
         file_size = 0;
     } else {
-        h = url_fileno(&ic->pb);
-        file_size = url_filesize(h);
+        file_size = url_fsize(&ic->pb);
         if (file_size < 0)
             file_size = 0;
     }

Index: yuv.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/yuv.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- yuv.c	19 Jun 2004 03:59:34 -0000	1.3
+++ yuv.c	19 May 2005 00:06:27 -0000	1.4
@@ -54,9 +54,10 @@
     URLContext *h;
     AVImageInfo info1, *info = &info1;
     
+    img_size = url_fsize(f);
+
     /* XXX: hack hack */
     h = url_fileno(f);
-    img_size = url_seek(h, 0, SEEK_END);
     url_get_filename(h, fname, sizeof(fname));
 
     if (infer_size(&info->width, &info->height, img_size) < 0) {





More information about the ffmpeg-cvslog mailing list