[Mplayer-cvslog] CVS: main/libmpdemux aviwrite.c,1.9,1.10 aviwrite.h,1.4,1.5
Arpi of Ize
arpi at mplayerhq.hu
Thu Aug 29 22:50:52 CEST 2002
Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var/tmp.root/cvs-serv31069/libmpdemux
Modified Files:
aviwrite.c aviwrite.h
Log Message:
new mencoder option -info, to store copyright, title, encoder version etc in AVI
based on patch by "Andriy N. Gritsenko" <andrej at lucky.net>
Index: aviwrite.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/aviwrite.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- aviwrite.c 29 Aug 2002 20:21:59 -0000 1.9
+++ aviwrite.c 29 Aug 2002 20:50:49 -0000 1.10
@@ -18,6 +18,14 @@
#include "aviwrite.h"
#include "aviheader.h"
+extern char *info_name;
+extern char *info_artist;
+extern char *info_genre;
+extern char *info_subject;
+extern char *info_copyright;
+extern char *info_sourceform;
+extern char *info_comment;
+
aviwrite_stream_t* aviwrite_new_stream(aviwrite_t *muxer,int type){
aviwrite_stream_t* s;
if(muxer->avih.dwStreams>=AVIWRITE_MAX_STREAMS){
@@ -135,6 +143,8 @@
unsigned int riff[3];
int i;
unsigned int hdrsize;
+ aviwrite_info_t info[16];
+
// RIFF header:
#ifdef WORDS_BIGENDIAN
/* FIXME: updating the header on big-endian causes the video
@@ -218,6 +228,56 @@
le2me_WAVEFORMATEX(muxer->streams[i]->wf);
}
break;
+ }
+ }
+
+// ============= INFO ===============
+// always include software info
+info[0].id=mmioFOURCC('I','S','F','T'); // Software:
+info[0].text="MEncoder " VERSION;
+// include any optional strings
+i=1;
+if(info_name!=NULL){
+ info[i].id=mmioFOURCC('I','N','A','M'); // Name:
+ info[i++].text=info_name;
+}
+if(info_artist!=NULL){
+ info[i].id=mmioFOURCC('I','A','R','T'); // Artist:
+ info[i++].text=info_artist;
+}
+if(info_genre!=NULL){
+ info[i].id=mmioFOURCC('I','G','N','R'); // Genre:
+ info[i++].text=info_genre;
+}
+if(info_subject!=NULL){
+ info[i].id=mmioFOURCC('I','S','B','J'); // Subject:
+ info[i++].text=info_subject;
+}
+if(info_copyright!=NULL){
+ info[i].id=mmioFOURCC('I','C','O','P'); // Copyright:
+ info[i++].text=info_copyright;
+}
+if(info_sourceform!=NULL){
+ info[i].id=mmioFOURCC('I','S','R','F'); // Source Form:
+ info[i++].text=info_sourceform;
+}
+if(info_comment!=NULL){
+ info[i].id=mmioFOURCC('I','C','M','T'); // Comment:
+ info[i++].text=info_comment;
+}
+info[i].id=0;
+
+ hdrsize=0;
+ // calc info size:
+ for(i=0;info[i].id!=0;i++) if(info[i].text){
+ size_t sz=strlen(info[i].text)+1;
+ hdrsize+=sz+8+sz%2;
+ }
+ // write infos:
+ if (hdrsize!=0){
+ write_avi_list(f,mmioFOURCC('I','N','F','O'),hdrsize);
+ for(i=0;info[i].id!=0;i++) if(info[i].text){
+ write_avi_chunk(f,info[i].id,strlen(info[i].text)+1,info[i].text);
}
}
Index: aviwrite.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/aviwrite.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- aviwrite.h 12 Apr 2002 10:40:38 -0000 1.4
+++ aviwrite.h 29 Aug 2002 20:50:49 -0000 1.5
@@ -26,6 +26,11 @@
} aviwrite_stream_t;
typedef struct {
+ unsigned int id;
+ char *text;
+} aviwrite_info_t;
+
+typedef struct {
// encoding:
MainAVIHeader avih;
unsigned int movi_start;
More information about the MPlayer-cvslog
mailing list