changeset 3071:a5f378f982cc

added demux_info
author alex
date Thu, 22 Nov 2001 15:43:24 +0000
parents dee70d05a406
children 8dbc1954e49b
files libmpdemux/aviheader.c libmpdemux/demux_mov.c libmpdemux/demuxer.c libmpdemux/demuxer.h
diffstat 4 files changed, 46 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/aviheader.c	Thu Nov 22 15:30:54 2001 +0000
+++ b/libmpdemux/aviheader.c	Thu Nov 22 15:43:24 2001 +0000
@@ -170,6 +170,7 @@
       chunksize-=len;
       buf[len]=0;
       mp_msg(MSGT_HEADER,MSGL_V,"%-10s: %s\n",hdr,buf);
+      demux_info_add(demuxer, hdr, buf);
   }
   if(chunksize>0) stream_skip(demuxer->stream,chunksize); else
   if(chunksize<0) mp_msg(MSGT_HEADER,MSGL_WARN,"chunksize=%d  (id=%.4s)\n",chunksize,(char *) &id);
--- a/libmpdemux/demux_mov.c	Thu Nov 22 15:30:54 2001 +0000
+++ b/libmpdemux/demux_mov.c	Thu Nov 22 15:43:24 2001 +0000
@@ -143,6 +143,7 @@
 #define MOV_TRAK_AUDIO 2
 #define MOV_TRAK_FLASH 3
 #define MOV_TRAK_GENERIC 4
+#define MOV_TRAK_CODE 5
 
 typedef struct {
     off_t moov_start;
@@ -154,7 +155,11 @@
 } mov_priv_t;
 
 #warning "FIXME - mov support is only working perfectly on Little Endian systems?!"
+//#ifdef WORDS_BIGENDIAN
+//#define MOV_FOURCC(a,b,c,d) ((d)|(c<<8)|(b<<16)|(a<<24))
+//#else
 #define MOV_FOURCC(a,b,c,d) ((a<<24)|(b<<16)|(c<<8)|(d))
+//#endif
 
 int mov_check_file(demuxer_t* demuxer){
     int flags=0;
@@ -227,6 +232,7 @@
 	//
 	if(trak){
 	  switch(id){
+	    case MOV_FOURCC('f','r','e','e'):
 	    case MOV_FOURCC('u','d','t','a'):
 		/* here not supported :p */
 		break;
@@ -441,7 +447,7 @@
 	    }
 	    case MOV_FOURCC('c','o','d','e'):
 	    {
-#warning Implement atom 'code' for FLASH
+#warning "Implement atom 'code' for FLASH support"
 	    }
 	    default:
 		id = bswap_32(id);
@@ -525,7 +531,7 @@
 	    case MOV_TRAK_GENERIC:
 		mp_msg(MSGT_DEMUX, MSGL_INFO, "Generic track - not completly understood! (id: %d)\n",
 		    trak->id);
-#warning Also this contains the FLASH data
+#warning "Also this contains the FLASH data"
 #if 0
 		mp_msg(MSGT_DEMUX, MSGL_INFO, "Extracting samples to files (possibly this is an flash anim)\n");
 	    {
@@ -692,9 +698,11 @@
 			switch(udta_id)
 			{
 			    case MOV_FOURCC(0xa9,'a','u','t'):
+				demux_info_add(demuxer, "author", &text[2]);
 				mp_msg(MSGT_DEMUX, MSGL_INFO, " Author: %s\n", &text[2]);
 				break;
 			    case MOV_FOURCC(0xa9,'c','p','y'):
+				demux_info_add(demuxer, "copyright", &text[2]);
 				mp_msg(MSGT_DEMUX, MSGL_INFO, " Copyright: %s\n", &text[2]);
 				break;
 			    case MOV_FOURCC(0xa9,'i','n','f'):
@@ -702,6 +710,7 @@
 				break;
 			    case MOV_FOURCC('n','a','m','e'):
 			    case MOV_FOURCC(0xa9,'n','a','m'):
+				demux_info_add(demuxer, "name", &text[2]);
 				mp_msg(MSGT_DEMUX, MSGL_INFO, " Name: %s\n", &text[2]);
 				break;
 			    case MOV_FOURCC(0xa9,'A','R','T'):
@@ -711,12 +720,14 @@
 				mp_msg(MSGT_DEMUX, MSGL_INFO, " Director: %s\n", &text[2]);
 				break;
 			    case MOV_FOURCC(0xa9,'c','m','t'):
+				demux_info_add(demuxer, "comments", &text[2]);
 				mp_msg(MSGT_DEMUX, MSGL_INFO, " Comment: %s\n", &text[2]);
 				break;
 			    case MOV_FOURCC(0xa9,'r','e','q'):
 				mp_msg(MSGT_DEMUX, MSGL_INFO, " Requirements: %s\n", &text[2]);
 				break;
 			    case MOV_FOURCC(0xa9,'s','w','r'):
+				demux_info_add(demuxer, "encoder", &text[2]);
 				mp_msg(MSGT_DEMUX, MSGL_INFO, " Software: %s\n", &text[2]);
 				break;
 			    case MOV_FOURCC(0xa9,'d','a','y'):
@@ -799,9 +810,15 @@
     if(trak->pos>=trak->chunks_size) return 0; // EOF
     stream_seek(demuxer->stream,trak->chunks[trak->pos].pos);
     pts=(float)(trak->chunks[trak->pos].sample*trak->duration)/(float)trak->timescale;
-    x=trak->chunks[trak->pos].size;
-//    x=trak->chunks[trak->pos].size*trak->samplesize;
-    if(trak->samplesize!=1) printf("WARNING! Samplesize=%d   \n",trak->samplesize);
+    if(trak->samplesize!=1)
+    {
+	mp_msg(MSGT_DEMUX, MSGL_WARN, "WARNING! Samplesize(%d) != 1\n",
+	    trak->samplesize);
+	x=trak->chunks[trak->pos].size*trak->samplesize;
+    }
+    else
+	x=trak->chunks[trak->pos].size;
+    printf("X = %d\n", x);
     if(trak->stdata_len>=36){
 	// extended stsd header - works for CBR MP3:
 	x/=(trak->stdata[30]<<8)+trak->stdata[31];  // samples/packet
--- a/libmpdemux/demuxer.c	Thu Nov 22 15:30:54 2001 +0000
+++ b/libmpdemux/demuxer.c	Thu Nov 22 15:43:24 2001 +0000
@@ -652,7 +652,7 @@
 	return(1);
     }
 
-    if (!strcasecmp(opt, "encoder"))
+    if (!strcasecmp(opt, "encoder") || !strcasecmp(opt, "software"))
     {
 	if (info->encoder)
 	{
@@ -664,7 +664,7 @@
 	return(1);
     }
 
-    if (!strcasecmp(opt, "comments"))
+    if (!strcasecmp(opt, "comment") || !strcasecmp(opt, "comments"))
     {
 	if (info->comments)
 	{
@@ -676,7 +676,19 @@
 	return(1);
     }
 
-    mp_msg(MSGT_DEMUX, MSGL_WARN, "Unknown demuxer info->%s (=%s)!\n",
+    if (!strcasecmp(opt, "copyright"))
+    {
+	if (info->copyright)
+	{
+	    mp_msg(MSGT_DEMUX, MSGL_WARN, "Demuxer info->copyright already present\n!");
+	    return(0);
+	}
+	info->copyright = malloc(strlen(param));
+	strcpy(info->copyright, param);
+	return(1);
+    }
+
+    mp_msg(MSGT_DEMUX, MSGL_DBG2, "Unknown demuxer info->%s (=%s)!\n",
 	opt, param);
     return(1);
 }
@@ -685,16 +697,18 @@
 {
     demuxer_info_t *info = &demuxer->info;
 
-    if (info->name || info->author || info->encoder || info->comments)
+    if (info->name || info->author || info->encoder || info->comments || info->copyright)
     {
 	mp_msg(MSGT_DEMUX, MSGL_INFO, "Clip info: \n");
 	if (info->name)
 	    mp_msg(MSGT_DEMUX, MSGL_INFO, " Name: %s\n", info->name);
 	if (info->author)
 	    mp_msg(MSGT_DEMUX, MSGL_INFO, " Author: %s\n", info->author);
+	if (info->comments)
+	    mp_msg(MSGT_DEMUX, MSGL_INFO, " Copyright: %s\n", info->comments);
+	if (info->comments)
+	    mp_msg(MSGT_DEMUX, MSGL_INFO, " Comments: %s\n", info->comments);
 	if (info->encoder)
 	    mp_msg(MSGT_DEMUX, MSGL_INFO, " Encoder: %s\n", info->encoder);
-	if (info->comments)
-	    mp_msg(MSGT_DEMUX, MSGL_INFO, " Comments: %s\n", info->comments);
     }
 }
--- a/libmpdemux/demuxer.h	Thu Nov 22 15:30:54 2001 +0000
+++ b/libmpdemux/demuxer.h	Thu Nov 22 15:43:24 2001 +0000
@@ -61,6 +61,7 @@
   char *author;
   char *encoder;
   char *comments;
+  char *copyright;
 } demuxer_info_t;
 
 typedef struct demuxer_st {
@@ -166,6 +167,5 @@
 extern int force_ni;
 extern int pts_from_bps;
 
-
-
-
+int demux_info_add(demuxer_t *demuxer, char *opt, char *param);
+int demux_info_print(demuxer_t *demuxer);