[Mplayer-cvslog] CVS: main/libmpdemux demux_mf.c,1.2,1.3 demuxer.c,1.70,1.71 mf.c,1.1,1.2

Zoltan Ponekker pontscho at mplayer.dev.hu
Thu Feb 7 13:07:55 CET 2002


Update of /cvsroot/mplayer/main/libmpdemux
In directory mplayer:/var/tmp.root/cvs-serv29849/libmpdemux

Modified Files:
	demux_mf.c demuxer.c mf.c 
Log Message:
finalize mfi support.

Index: demux_mf.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_mf.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- demux_mf.c	6 Feb 2002 22:03:19 -0000	1.2
+++ demux_mf.c	7 Feb 2002 12:07:47 -0000	1.3
@@ -22,6 +22,15 @@
 } 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;
+  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;
+   else newpos+=rel_seek_secs * sh_video->fps;
+  if ( newpos < 0 ) newpos=0;
+  if( newpos > mf->nr_of_frames) newpos=mf->nr_of_frames;
+  mf->curr_frame=newpos;
 }
 
 // return value:
@@ -38,14 +47,13 @@
   mf=(mf_t*)demuxer->stream->priv;
 
   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 );
+//  printf( "[demux_mf] frame: %d (%s,%d)\n",dmf->curr_frame,mf->names[dmf->curr_frame],fs.st_size );
 
   if ( !( f=fopen( mf->names[dmf->curr_frame],"r" ) ) ) return 0;
   {
    sh_video_t     * sh_video = demuxer->video->sh;
    demux_packet_t * dp = new_demux_packet( fs.st_size );
-//    stream_read(stream,dp->buffer,len);
-   if ( !fread( dp->buffer,1,fs.st_size,f ) ) return 0;
+   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->flags=0;
@@ -63,7 +71,6 @@
   mf_t         *mf = NULL;
   demuxer_mf_t *dmf = NULL;
 
-  mp_msg( MSGT_DEMUX,MSGL_V,"[demux_mf] mf demuxer opened.\n" );
   mf=(mf_t*)demuxer->stream->priv;
   dmf=calloc( 1,sizeof( demuxer_mf_t ) );
 
@@ -106,7 +113,7 @@
   sh_video->bih->biSizeImage=sh_video->bih->biWidth*sh_video->bih->biHeight*3;
 
   /* disable seeking */
-  demuxer->seekable = 0;
+//  demuxer->seekable = 0;
 
   demuxer->priv=(void*)dmf;
 

Index: demuxer.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demuxer.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -r1.70 -r1.71
--- demuxer.c	6 Feb 2002 20:16:35 -0000	1.70
+++ demuxer.c	7 Feb 2002 12:07:47 -0000	1.71
@@ -776,6 +776,9 @@
   case DEMUXER_TYPE_Y4M:
       demux_seek_y4m(demuxer,rel_seek_secs,flags);  break;
 
+  case DEMUXER_TYPE_MF:
+      demux_seek_mf(demuxer,rel_seek_secs,flags);  break;
+      
   case DEMUXER_TYPE_FLI:
       demux_seek_fli(demuxer,rel_seek_secs,flags);  break;
   case DEMUXER_TYPE_NUV:

Index: mf.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/mf.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- mf.c	6 Feb 2002 19:23:49 -0000	1.1
+++ mf.c	7 Feb 2002 12:07:47 -0000	1.2
@@ -31,44 +31,62 @@
  int           i;
  char        * fname;
  mf_t        * mf;
+ int           error_count = 0;
+ int	       count = 0;
 
- fname=malloc( strlen( filename ) + 2 );
- strcpy( fname,filename ); strcat( fname,"*" );
-
- if ( glob( fname,0,NULL,&gg ) )
-  { free( fname ); return 0; }
+ fname=malloc( strlen( filename ) + 32 );
+ mf=calloc( 1,sizeof( mf_t ) );
+ 
+ if ( !strchr( filename,'%' ) )
+  {
+   strcpy( fname,filename ); 
+   if ( !strchr( filename,'*' ) ) strcat( fname,"*" );
 
- printf( "[mf] search expr: %s\n",fname );
+   mp_msg( MSGT_STREAM,MSGL_INFO,"[mf] search expr: %s\n",fname );
 
- mf=malloc( sizeof( mf_t ) );
- mf->nr_of_files=gg.gl_pathc;
- mf->names=malloc( gg.gl_pathc * sizeof( char* ) );
+   if ( glob( fname,0,NULL,&gg ) )
+    { free( mf ); free( fname ); return 0; }
 
- printf( "[mf] number of files: %d (%d)\n",mf->nr_of_files, gg.gl_pathc * sizeof( char* ) );
+   mf->nr_of_files=gg.gl_pathc;
+   mf->names=malloc( gg.gl_pathc * sizeof( char* ) );
+
+   mp_msg( MSGT_STREAM,MSGL_INFO,"[mf] number of files: %d (%d)\n",mf->nr_of_files, gg.gl_pathc * sizeof( char* ) );
+
+   for( i=0;i < gg.gl_pathc;i++ )
+    {
+     stat( gg.gl_pathv[i],&fs );
+     if( S_ISDIR( fs.st_mode ) ) continue;
+     mf->names[i]=strdup( gg.gl_pathv[i] );
+//     mp_msg( MSGT_STREAM,MSGL_DBG2,"[mf] added file %d.: %s\n",i,mf->names[i] );
+    }
+   globfree( &gg );
+   goto exit_mf;
+  }
 
- for( i=0;i < gg.gl_pathc;i++ )
+ mp_msg( MSGT_STREAM,MSGL_INFO,"[mf] search expr: %s\n",filename );
+ 
+ while ( error_count < 5 )
   {
-   stat( gg.gl_pathv[i],&fs );
-   if( S_ISDIR( fs.st_mode ) ) continue;
-   mf->names[i]=strdup( gg.gl_pathv[i] );
-//   printf( "[mf] added file %d.: %s\n",i,mf->names[i] );
+   sprintf( fname,filename,count++ );
+   if ( stat( fname,&fs ) ) 
+    {
+     error_count++;
+     mp_msg( MSGT_STREAM,MSGL_V,"[mf] file not found: '%s'\n",fname );
+    }
+    else
+    {
+     mf->names=realloc( mf->names,( mf->nr_of_files + 1 ) * sizeof( char* ) );
+     mf->names[mf->nr_of_files]=strdup( fname );
+//     mp_msg( MSGT_STREAM,MSGL_V,"[mf] added file %d.: %s\n",mf->nr_of_files,mf->names[mf->nr_of_files] );
+     mf->nr_of_files++;
+    }
   }
- globfree( &gg );
 
+ mp_msg( MSGT_STREAM,MSGL_INFO,"[mf] number of files: %d\n",mf->nr_of_files );
+
+exit_mf:
  free( fname );
  stream->priv=(void*)mf;
-
  return 1;
 }
 
-#if 0
-
-stream_t stream;
-
-int main( void )
-{
- stream_open_mf( "tmp/a",&stream );
- return 0;
-}
-
-#endif




More information about the MPlayer-cvslog mailing list