summaryrefslogtreecommitdiffstats
path: root/libmpdemux
diff options
context:
space:
mode:
authorarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-08-29 20:50:49 +0000
committerarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-08-29 20:50:49 +0000
commit39f2bf39d5f924328dc71dd7e2dd9f28c065ea0e (patch)
tree8c40ea9718687a21fc6d9ba5fa978a15febd90ab /libmpdemux
parent978bfc3003d393534a773737e0cde928da3823ca (diff)
downloadmpv-39f2bf39d5f924328dc71dd7e2dd9f28c065ea0e.tar.bz2
mpv-39f2bf39d5f924328dc71dd7e2dd9f28c065ea0e.tar.xz
new mencoder option -info, to store copyright, title, encoder version etc in AVI
based on patch by "Andriy N. Gritsenko" <andrej@lucky.net> git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@7146 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r--libmpdemux/aviwrite.c60
-rw-r--r--libmpdemux/aviwrite.h5
2 files changed, 65 insertions, 0 deletions
diff --git a/libmpdemux/aviwrite.c b/libmpdemux/aviwrite.c
index 7a86b0a9d1..f2ff2f7714 100644
--- a/libmpdemux/aviwrite.c
+++ b/libmpdemux/aviwrite.c
@@ -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 @@ void aviwrite_write_header(aviwrite_t *muxer,FILE *f){
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
@@ -221,6 +231,56 @@ void aviwrite_write_header(aviwrite_t *muxer,FILE *f){
}
}
+// ============= 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);
+ }
+ }
+
// JUNK:
write_avi_chunk(f,ckidAVIPADDING,2048-(ftell(f)&2047)-8,NULL); /* junk */
// 'movi' header:
diff --git a/libmpdemux/aviwrite.h b/libmpdemux/aviwrite.h
index 7973649747..feab55cac0 100644
--- a/libmpdemux/aviwrite.h
+++ b/libmpdemux/aviwrite.h
@@ -26,6 +26,11 @@ typedef struct {
} aviwrite_stream_t;
typedef struct {
+ unsigned int id;
+ char *text;
+} aviwrite_info_t;
+
+typedef struct {
// encoding:
MainAVIHeader avih;
unsigned int movi_start;