[Mplayer-cvslog] CVS: main/libmpdemux mf.c,1.6,1.7 mf.h,1.3,1.4 open.c,1.71,1.72 stream.h,1.57,1.58

Alban Bedel CVS albeu at mplayerhq.hu
Sun Mar 30 19:07:35 CEST 2003


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

Modified Files:
	mf.c mf.h open.c stream.h 
Log Message:
Stream cleanup, don't use blah_on options anymore.


Index: mf.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/mf.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- mf.c	28 Jan 2003 22:04:07 -0000	1.6
+++ mf.c	30 Mar 2003 17:07:31 -0000	1.7
@@ -18,7 +18,6 @@
 
 #include "mf.h"
 
-int    mf_support = 0;
 int    mf_w = 0; //352; // let codecs to detect it
 int    mf_h = 0; //288;
 float  mf_fps = 25.0;

Index: mf.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/mf.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- mf.h	15 Sep 2002 19:47:49 -0000	1.3
+++ mf.h	30 Mar 2003 17:07:31 -0000	1.4
@@ -2,7 +2,6 @@
 #ifndef _MF_H
 #define _MF_H
 
-extern int    mf_support;
 extern int    mf_w;
 extern int    mf_h;
 extern float  mf_fps;

Index: open.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/open.c,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -r1.71 -r1.72
--- open.c	27 Mar 2003 20:45:54 -0000	1.71
+++ open.c	30 Mar 2003 17:07:31 -0000	1.72
@@ -5,6 +5,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <fcntl.h>
+#include <string.h>
 
 #include "config.h"
 #include "mp_msg.h"
@@ -32,14 +33,15 @@
 
 int dvbin_param_on=0;
 
+/// We keep these 2 for the gui atm, but they will be removed.
 int dvd_title=0;
+int vcd_track=0;
+
 int dvd_chapter=1;
 int dvd_last_chapter=0;
 int dvd_angle=1;
 char* dvd_device=NULL;
 char* cdrom_device=NULL;
-char* cue_file_name=NULL;
-int dvd_nav=0;                  /* use libdvdnav? */
 
 #ifdef USE_DVDNAV
 #include "dvdnav_stream.h"
@@ -131,30 +133,44 @@
 
 // Open a new stream  (stdin/file/vcd/url)
 
-stream_t* open_stream(char* filename,int vcd_track,int* file_format){
+stream_t* open_stream(char* filename,int _remove_me_,int* file_format){
 stream_t* stream=NULL;
 int f=-1;
 off_t len;
 #ifdef __FreeBSD__
 int bsize = VCD_SECTOR_SIZE;
 #endif
+*file_format = DEMUXER_TYPE_UNKNOWN;
+if(!filename) {
+   mp_msg(MSGT_OPEN,MSGL_ERR,"NULL filename, report this bug\n");
+   return NULL;
+}
 
 #ifdef HAVE_CDDA
-if(filename && strncmp("cdda://",filename,7) == 0)
+if(filename && strncmp("cdda://",filename,7) == 0) {
+  *file_format = DEMUXER_TYPE_RAWAUDIO;
   return open_cdda(cdrom_device ? cdrom_device : DEFAULT_CDROM_DEVICE,filename+7);
+}
 #ifdef STREAMING
-if(filename && strncmp("cddb://",filename,7) == 0)
+if(filename && strncmp("cddb://",filename,7) == 0) {
+  *file_format = DEMUXER_TYPE_RAWAUDIO;
   return cddb_open(cdrom_device ? cdrom_device : DEFAULT_CDROM_DEVICE,filename+7);
+}
 #endif
 #endif
 
 //============ Open VideoCD track ==============
 #ifdef HAVE_VCD
-if(vcd_track && !cue_file_name){
+if(strncmp("vcd://",filename,6) == 0){
   int ret,ret2;
   if(!cdrom_device) cdrom_device=strdup(DEFAULT_CDROM_DEVICE);
   f=open(cdrom_device,O_RDONLY);
   if(f<0){ mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_CdDevNotfound,cdrom_device);return NULL; }
+  vcd_track = filename[6] == '\0' ? 1 : strtol(filename+6,NULL,0);
+  if(vcd_track < 1){ 
+    mp_msg(MSGT_OPEN,MSGL_ERR,"Invalid vcd track %s\n",filename+6);
+    return NULL;
+  }
   vcd_read_toc(f);
   ret2=vcd_get_track_end(f,vcd_track);
   if(ret2<0){ mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_ErrTrackSelect " (get)\n");return NULL;}
@@ -175,10 +191,22 @@
 
 
 // for opening of vcds in bincue files
-if(vcd_track && cue_file_name){
+if(strncmp("cue://",filename,6) == 0){
   int ret,ret2;
-  if ((f = cue_read_cue (cue_file_name)) == -1) return NULL;
-
+  char* p = filename + 6;
+  vcd_track = 1;
+  p = strchr(p,':');
+  if(p && p[1] != '\0') {
+    vcd_track = strtol(p+1,NULL,0);
+    if(vcd_track < 1){ 
+      mp_msg(MSGT_OPEN,MSGL_ERR,"Invalid cue track %s\n",p+1);
+      return NULL;
+    }
+    p[0] = '\0';
+  }
+  f = cue_read_cue (filename + 6);
+  if(p && p[1] != '\0') p[0] = ':';
+  if (f == -1) return NULL;
   cue_vcd_read_toc();
   ret2=cue_vcd_get_track_end(vcd_track);
   ret=cue_vcd_seek_to_track(vcd_track);
@@ -195,19 +223,20 @@
 
 //============ Open DVD title ==============
 #ifdef USE_DVDNAV
-if(dvd_nav){
+if(strncmp("dvdnav://",filename,9) == 0){
     dvdnav_priv_t *dvdnav_priv;
     int event,len,tmplen=0;
-
+    char* name = (filename[9] == '\0') ? NULL : filename + 9;
+    
     stream=new_stream(-1,STREAMTYPE_DVDNAV);
     if (!stream) {
         mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_Exit_error);
         return NULL;
     }
 
-    if(!filename) filename=DEFAULT_DVD_DEVICE;
-    if (!(dvdnav_priv=new_dvdnav_stream(filename))) {
-	mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_CantOpenDVD,filename);
+    if(!name) name=DEFAULT_DVD_DEVICE;
+    if (!(dvdnav_priv=new_dvdnav_stream(name))) {
+	mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_CantOpenDVD,name);
         return NULL;
     }
 
@@ -216,7 +245,7 @@
 }
 #endif
 #ifdef USE_DVDREAD
-if(dvd_title){
+if(strncmp("dvd://",filename,6) == 0){
 //  int ret,ret2;
     dvd_priv_t *d;
     int ttn,pgc_id,pgn;
@@ -225,6 +254,7 @@
     ifo_handle_t *vmg_file;
     tt_srpt_t *tt_srpt;
     ifo_handle_t *vts_file;
+    dvd_title = filename[6] == '\0' ? 1 : strtol(filename + 6,NULL,0);
     /**
      * Open the disc.
      */
@@ -487,7 +517,7 @@
 #endif
 
 #ifdef HAS_DVBIN_SUPPORT
-if(dvbin_param_on == 1)
+if(strncmp("dvbin://",filename,8) == 0)
 {
 	stream = new_stream(-1, STREAMTYPE_DVB);
 	if (!stream)
@@ -503,15 +533,22 @@
 
 
 //============ Check for TV-input or multi-file input ====
-  if( (mf_support == 1)
+  if( (strncmp("mf://",filename,5) == 0)
 #ifdef USE_TV
-   || (tv_param_on == 1)
+   || (strncmp("tv://",filename,5) == 0)
 #endif
   ){
     /* create stream */
     stream = new_stream(-1, STREAMTYPE_DUMMY);
     if (!stream) return(NULL);
-    stream->url=filename?strdup(filename):NULL;
+    if(strncmp("mf://",filename,5) == 0) {
+      *file_format =  DEMUXER_TYPE_MF;
+     } else {
+      *file_format =  DEMUXER_TYPE_TV;
+      if(filename[5] != '\0')
+	tv_param_channel = strdup(filename + 5);
+    }
+    stream->url= filename[5] != '\0' ? strdup(filename + 5) : NULL;
     return(stream);
   }
   

Index: stream.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/stream.h,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -r1.57 -r1.58
--- stream.h	16 Mar 2003 22:59:16 -0000	1.57
+++ stream.h	30 Mar 2003 17:07:31 -0000	1.58
@@ -195,7 +195,6 @@
 extern int dvd_chapter;
 extern int dvd_last_chapter;
 extern int dvd_angle;
-extern int dvd_nav;
 int dvd_parse_chapter_range(struct config*, const char*);
 //#endif
 



More information about the MPlayer-cvslog mailing list