changeset 8937:afca652cb0e5

patch adds support for MOV-Reference-Files. it uses d_video queue to store playlist entries as strz. It also makes sure, that unnecessary items like qt5gateQT are removed and that the url/basepath is added to "local files" by Fabian Franz <FabianFranz@gmx.de>
author arpi
date Mon, 13 Jan 2003 02:42:06 +0000
parents 7c28736ebf2c
children fc21a94f98c6
files libmpdemux/demux_mov.c libmpdemux/demuxer.c mplayer.c
diffstat 3 files changed, 77 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_mov.c	Mon Jan 13 01:50:20 2003 +0000
+++ b/libmpdemux/demux_mov.c	Mon Jan 13 02:42:06 2003 +0000
@@ -356,6 +356,8 @@
 	      int ref=0;
 	      skipped+=i;
 	      mp_msg(MSGT_DEMUX,MSGL_INFO,"MOV: Reference Media file!!!\n");
+	      //set demuxer type to playlist ...
+	      demuxer->type=DEMUXER_TYPE_PLAYLIST;
 	      while(i>0){
 	          int len=stream_read_dword(demuxer->stream)-8;
 		  int fcc=stream_read_dword(demuxer->stream);
@@ -369,10 +371,21 @@
 		      int tmp=stream_read_dword(demuxer->stream);
 		      int type=stream_read_dword_le(demuxer->stream);
 	              int slen=stream_read_dword(demuxer->stream);
-		      char* s=malloc(slen+1);
-		      stream_read(demuxer->stream,s,slen);
-		      s[slen]=0;
-		      mp_msg(MSGT_DEMUX,MSGL_INFO,"REF: [%.4s] %s\n",&type,s);
+		      //char* s=malloc(slen+1);
+		      //stream_read(demuxer->stream,s,slen);
+		      
+		      //FIXME: also store type & data_rate ?
+		      ds_read_packet(demuxer->video, 
+			demuxer->stream,
+			slen,
+			0,
+			stream_tell(demuxer->stream),
+			0 // no flags 
+		      );
+		      flags|=4;
+		      mp_msg(MSGT_DEMUX,MSGL_V,"Added reference to playlist\n");
+		      //s[slen]=0;
+		      //mp_msg(MSGT_DEMUX,MSGL_INFO,"REF: [%.4s] %s\n",&type,s);
 		      len-=12+slen;i-=12+slen; break;
 		    }
 		  case MOV_FOURCC('r','m','d','r'): {
@@ -434,6 +447,9 @@
     }
     free(priv);
 
+    if (flags==5) // reference & header sent
+        return 1;
+
     if(flags==1)
 	mp_msg(MSGT_DEMUX,MSGL_WARN,"MOV: missing data (mdat) chunk! Maybe broken file...\n");
     else if(flags==2)
--- a/libmpdemux/demuxer.c	Mon Jan 13 01:50:20 2003 +0000
+++ b/libmpdemux/demuxer.c	Mon Jan 13 02:42:06 2003 +0000
@@ -650,7 +650,7 @@
   demuxer=new_demuxer(stream,DEMUXER_TYPE_MOV,audio_id,video_id,dvdsub_id);
   if(mov_check_file(demuxer)){
       mp_msg(MSGT_DEMUXER,MSGL_INFO,MSGTR_Detected_XXX_FileFormat,"QuickTime/MOV");
-      file_format=DEMUXER_TYPE_MOV;
+      file_format=demuxer->type;
   } else {
       free_demuxer(demuxer);
       demuxer = NULL;
--- a/mplayer.c	Mon Jan 13 01:50:20 2003 +0000
+++ b/mplayer.c	Mon Jan 13 02:42:06 2003 +0000
@@ -585,6 +585,8 @@
   return eof;
 }
 
+#define mp_basename(s) (strrchr(s,'/')==NULL?(char*)s:(strrchr(s,'/')+1))
+
 int playtree_add_playlist(play_tree_t* entry)
 {
   if(!entry) {      
@@ -1226,6 +1228,60 @@
 current_module="demux_open";
 
 demuxer=demux_open(stream,file_format,audio_id,video_id,dvdsub_id);
+
+// HACK to get MOV Reference Files working
+
+if (demuxer && demuxer->type==DEMUXER_TYPE_PLAYLIST)
+{ 
+  unsigned char* playlist_entry;
+  play_tree_t *list = NULL, *entry = NULL;
+
+  current_module="handle_demux_playlist";
+  while (ds_get_packet(demuxer->video,&playlist_entry)>0)
+  {	 
+    char *temp, *bname;
+    
+    mp_msg(MSGT_CPLAYER,MSGL_V,"Adding file %s to element entry\n",playlist_entry);
+
+    bname=mp_basename(playlist_entry);
+    if ((strlen(bname)>10) && !strncmp(bname,"qt",2) && !strncmp(bname+3,"gateQT",6))
+        continue;
+
+    entry = play_tree_new();
+    
+    if (filename && !strcmp(mp_basename(playlist_entry),playlist_entry)) // add reference path of current file
+    {
+      temp=malloc((strlen(filename)-strlen(mp_basename(filename))+strlen(playlist_entry)+1)*sizeof(char));
+      if (temp)
+      {
+	strncpy(temp, filename, strlen(filename)-strlen(mp_basename(filename)));
+	temp[strlen(filename)-strlen(mp_basename(filename))]='\0';
+	strcat(temp, playlist_entry);
+	play_tree_add_file(entry,temp);
+	mp_msg(MSGT_CPLAYER,MSGL_V,"Resolving reference to %s\n",temp);
+	free(temp);
+      }
+    }
+    else
+      play_tree_add_file(entry,playlist_entry);
+    
+    if(!list)
+      list = entry;
+    else
+      play_tree_append_entry(list,entry);
+  }
+  free_demuxer(demuxer);
+  demuxer = NULL;
+
+  if (list)
+  {
+    entry = play_tree_new();
+    play_tree_set_child(entry,list);
+    eof=playtree_add_playlist(entry);
+    goto goto_next_file;
+  }
+}
+
 if(!demuxer) 
 {
   play_tree_t* entry;