[Mplayer-cvslog] CVS: main/libmpdemux demux_mf.c,1.8,1.9 mf.c,1.4,1.5 mf.h,1.2,1.3 open.c,1.55,1.56 stream.c,1.42,1.43 stream.h,1.48,1.49
Arpi of Ize
arpi at mplayerhq.hu
Sun Sep 15 21:48:08 CEST 2002
- Previous message: [Mplayer-cvslog] CVS: main/libmpdemux open.c,1.54,1.55 stream.c,1.41,1.42 stream.h,1.47,1.48 vcd_read.h,1.11,1.12 vcd_read_fbsd.h,1.4,1.5 vcd_read_nbsd.h,1.1,1.2
- Next message: [Mplayer-cvslog] CVS: main/libmpdemux open.c,1.56,1.57 stream.c,1.43,1.44 stream.h,1.49,1.50 tv.c,1.32,1.33
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var/tmp.root/cvs-serv32628
Modified Files:
demux_mf.c mf.c mf.h open.c stream.c stream.h
Log Message:
stream layer cleanup - part 1
STREAMTYPE_MF removed, using STREAMTYPE_DUMMY instead
mf.c/demux_mf updated to do the opening in demux_open instead of stream_open
Index: demux_mf.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_mf.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- demux_mf.c 10 Sep 2002 20:59:52 -0000 1.8
+++ demux_mf.c 15 Sep 2002 19:47:49 -0000 1.9
@@ -15,21 +15,15 @@
#include "stheader.h"
#include "mf.h"
-typedef struct
-{
- int nr_of_frames;
- int curr_frame;
-} demuxer_mf_t;
-
void demux_seek_mf(demuxer_t *demuxer,float rel_seek_secs,int flags){
- demuxer_mf_t * mf = (demuxer_mf_t *)demuxer->priv;
+ mf_t * mf = (mf_t *)demuxer->priv;
sh_video_t * sh_video = demuxer->video->sh;
int newpos = (flags & 1)?0:mf->curr_frame;
- if ( flags & 2 ) newpos+=rel_seek_secs*mf->nr_of_frames;
+ if ( flags & 2 ) newpos+=rel_seek_secs*mf->nr_of_files;
else newpos+=rel_seek_secs * sh_video->fps;
if ( newpos < 0 ) newpos=0;
- if( newpos > mf->nr_of_frames) newpos=mf->nr_of_frames;
+ if( newpos > mf->nr_of_files) newpos=mf->nr_of_files;
mf->curr_frame=newpos;
}
@@ -38,49 +32,43 @@
// 1 = successfully read a packet
int demux_mf_fill_buffer(demuxer_t *demuxer){
mf_t * mf;
- demuxer_mf_t * dmf;
struct stat fs;
FILE * f;
- dmf=(demuxer_mf_t*)demuxer->priv;
- if ( dmf->curr_frame >= dmf->nr_of_frames ) return 0;
- mf=(mf_t*)demuxer->stream->priv;
+ mf=(mf_t*)demuxer->priv;
+ if ( mf->curr_frame >= mf->nr_of_files ) return 0;
- stat( mf->names[dmf->curr_frame],&fs );
-// printf( "[demux_mf] frame: %d (%s,%d)\n",dmf->curr_frame,mf->names[dmf->curr_frame],fs.st_size );
+ stat( mf->names[mf->curr_frame],&fs );
+// printf( "[demux_mf] frame: %d (%s,%d)\n",mf->curr_frame,mf->names[mf->curr_frame],fs.st_size );
- if ( !( f=fopen( mf->names[dmf->curr_frame],"r" ) ) ) return 0;
+ if ( !( f=fopen( mf->names[mf->curr_frame],"r" ) ) ) return 0;
{
sh_video_t * sh_video = demuxer->video->sh;
demux_packet_t * dp = new_demux_packet( fs.st_size );
if ( !fread( dp->buffer,fs.st_size,1,f ) ) return 0;
- dp->pts=dmf->curr_frame / sh_video->fps;
- dp->pos=dmf->curr_frame;
+ dp->pts=mf->curr_frame / sh_video->fps;
+ dp->pos=mf->curr_frame;
dp->flags=0;
// append packet to DS stream:
ds_add_packet( demuxer->video,dp );
}
fclose( f );
- dmf->curr_frame++;
+ mf->curr_frame++;
return 1;
}
demuxer_t* demux_open_mf(demuxer_t* demuxer){
sh_video_t *sh_video = NULL;
mf_t *mf = NULL;
- demuxer_mf_t *dmf = NULL;
-
- mf=(mf_t*)demuxer->stream->priv;
- dmf=calloc( 1,sizeof( demuxer_mf_t ) );
+
+ if(!demuxer->stream->url) return NULL;
+ mf=open_mf(demuxer->stream->url);
+ if(!mf) return NULL;
+ mf->curr_frame=0;
- // go back to the beginning
- stream_reset(demuxer->stream);
-// stream_seek(demuxer->stream, 0);
demuxer->movi_start = 0;
demuxer->movi_end = mf->nr_of_files - 1;
- dmf->nr_of_frames= mf->nr_of_files;
- dmf->curr_frame=0;
// create a new video stream header
sh_video = new_sh_video(demuxer, 0);
@@ -99,7 +87,7 @@
if ( !strcasecmp( mf_type,"png" )) sh_video->format = mmioFOURCC('M', 'P', 'N', 'G' );
else
if ( !strcasecmp( mf_type,"tga" )) sh_video->format = mmioFOURCC('M', 'T', 'G', 'A' );
- else { mp_msg(MSGT_DEMUX, MSGL_INFO, "[demux_mf] unknow input file type.\n" ); free( dmf ); return NULL; }
+ else { mp_msg(MSGT_DEMUX, MSGL_INFO, "[demux_mf] unknow input file type.\n" ); free( mf ); return NULL; }
sh_video->disp_w = mf_w;
sh_video->disp_h = mf_h;
@@ -120,15 +108,15 @@
/* disable seeking */
// demuxer->seekable = 0;
- demuxer->priv=(void*)dmf;
+ demuxer->priv=(void*)mf;
return demuxer;
}
void demux_close_mf(demuxer_t* demuxer) {
- demuxer_mf_t *dmf = demuxer->priv;
+ mf_t *mf = demuxer->priv;
- if(!dmf)
+ if(!mf)
return;
- free(dmf);
+ free(mf);
}
Index: mf.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/mf.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- mf.c 26 Mar 2002 05:47:04 -0000 1.4
+++ mf.c 15 Sep 2002 19:47:49 -0000 1.5
@@ -24,8 +24,7 @@
float mf_fps = 25.0;
char * mf_type = "jpg";
-int stream_open_mf(char * filename,stream_t * stream)
-{
+mf_t* open_mf(char * filename){
glob_t gg;
struct stat fs;
int i;
@@ -70,7 +69,7 @@
mp_msg( MSGT_STREAM,MSGL_INFO,"[mf] search expr: %s\n",fname );
if ( glob( fname,0,NULL,&gg ) )
- { free( mf ); free( fname ); return 0; }
+ { free( mf ); free( fname ); return NULL; }
mf->nr_of_files=gg.gl_pathc;
mf->names=malloc( gg.gl_pathc * sizeof( char* ) );
@@ -111,7 +110,6 @@
exit_mf:
free( fname );
- stream->priv=(void*)mf;
- return 1;
+ return mf;
}
Index: mf.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/mf.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- mf.h 26 Mar 2002 05:25:15 -0000 1.2
+++ mf.h 15 Sep 2002 19:47:49 -0000 1.3
@@ -10,8 +10,11 @@
typedef struct
{
- int nr_of_files;
+ int curr_frame;
+ int nr_of_files;
char ** names;
} mf_t;
+
+mf_t* open_mf(char * filename);
#endif
Index: open.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/open.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -r1.55 -r1.56
--- open.c 15 Sep 2002 18:48:16 -0000 1.55
+++ open.c 15 Sep 2002 19:47:49 -0000 1.56
@@ -428,13 +428,9 @@
if (mf_support == 1)
{
/* create stream */
- stream = new_stream(-1, STREAMTYPE_MF);
- if (!stream)
- return(NULL);
-
- if (!stream_open_mf(filename, stream))
- return(NULL);
-
+ stream = new_stream(-1, STREAMTYPE_DUMMY);
+ if (!stream) return(NULL);
+ stream->url=strdup(filename);
return(stream);
}
Index: stream.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/stream.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- stream.c 15 Sep 2002 18:48:16 -0000 1.42
+++ stream.c 15 Sep 2002 19:47:49 -0000 1.43
@@ -254,6 +254,7 @@
s->buf_pos=s->buf_len=0;
s->start_pos=s->end_pos=0;
s->priv=NULL;
+ s->url=NULL;
s->cache_pid=0;
stream_reset(s);
return s;
Index: stream.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/stream.h,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- stream.h 15 Sep 2002 18:48:16 -0000 1.48
+++ stream.h 15 Sep 2002 19:47:49 -0000 1.49
@@ -7,17 +7,17 @@
#define STREAM_BUFFER_SIZE 2048
-#define STREAMTYPE_FILE 0
-#define STREAMTYPE_VCD 1
-#define STREAMTYPE_STREAM 2 // same as FILE but no seeking (for stdin)
-#define STREAMTYPE_DVD 3
-#define STREAMTYPE_MEMORY 4
-#define STREAMTYPE_TV 5
-#define STREAMTYPE_PLAYLIST 6
-#define STREAMTYPE_MF 7
-#define STREAMTYPE_DS 8
-#define STREAMTYPE_DVDNAV 9 // we cannot safely "seek" in this...
-#define STREAMTYPE_CDDA 10
+#define STREAMTYPE_DUMMY -1 // for placeholders, when the actual reading is handled in the demuxer
+#define STREAMTYPE_FILE 0 // read from seekable file
+#define STREAMTYPE_VCD 1 // raw mode-2 CDROM reading, 2324 bytes/sector
+#define STREAMTYPE_STREAM 2 // same as FILE but no seeking (for net/stdin)
+#define STREAMTYPE_DVD 3 // libdvdread
+#define STREAMTYPE_MEMORY 4 // read data from memory area
+#define STREAMTYPE_TV 5 // FIXME!!! dummy
+#define STREAMTYPE_PLAYLIST 6 // FIXME!!! same as STREAMTYPE_FILE now
+#define STREAMTYPE_DS 8 // read from a demuxer stream
+#define STREAMTYPE_DVDNAV 9 // we cannot safely "seek" in this...
+#define STREAMTYPE_CDDA 10 // raw audio CD reader
#define VCD_SECTOR_SIZE 2352
#define VCD_SECTOR_OFFS 24
@@ -31,18 +31,19 @@
void vcd_read_toc(int fd);
typedef struct {
- int fd;
- int type; // 0=file 1=VCD
+ int fd; // file descriptor, see man open(2)
+ int type; // see STREAMTYPE_*
unsigned int buf_pos,buf_len;
off_t pos,start_pos,end_pos;
int eof;
unsigned int cache_pid;
void* cache_data;
void* priv; // used for DVD, TV, RTSP etc
- unsigned char buffer[STREAM_BUFFER_SIZE>VCD_SECTOR_SIZE?STREAM_BUFFER_SIZE:VCD_SECTOR_SIZE];
+ char* url; // strdup() of filename/url
#ifdef STREAMING
streaming_ctrl_t *streaming_ctrl;
#endif
+ unsigned char buffer[STREAM_BUFFER_SIZE>VCD_SECTOR_SIZE?STREAM_BUFFER_SIZE:VCD_SECTOR_SIZE];
} stream_t;
#ifdef USE_STREAM_CACHE
- Previous message: [Mplayer-cvslog] CVS: main/libmpdemux open.c,1.54,1.55 stream.c,1.41,1.42 stream.h,1.47,1.48 vcd_read.h,1.11,1.12 vcd_read_fbsd.h,1.4,1.5 vcd_read_nbsd.h,1.1,1.2
- Next message: [Mplayer-cvslog] CVS: main/libmpdemux open.c,1.56,1.57 stream.c,1.43,1.44 stream.h,1.49,1.50 tv.c,1.32,1.33
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the MPlayer-cvslog
mailing list