new mencoder option -info, to store copyright, title, encoder version etc in AVI
based on patch by "Andriy N. Gritsenko" <[email protected]> git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@7146 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
1 parent
978bfc3003
commit
39f2bf39d5
5 files changed
+98
-1
No files matched your search
@@ -93,6 +93,26 @@ struct config oac_conf[]={
|
||||
{NULL, NULL, 0, 0, 0, 0, NULL}
|
||||
};
|
||||
|
||||
struct config info_conf[]={
|
||||
{"name", &info_name, CONF_TYPE_STRING, 0, 0, 0, NULL},
|
||||
{"artist", &info_artist, CONF_TYPE_STRING, 0, 0, 0, NULL},
|
||||
{"genre", &info_genre, CONF_TYPE_STRING, 0, 0, 0, NULL},
|
||||
{"subject", &info_subject, CONF_TYPE_STRING, 0, 0, 0, NULL},
|
||||
{"copyright", &info_copyright, CONF_TYPE_STRING, 0, 0, 0, NULL},
|
||||
{"srcform", &info_sourceform, CONF_TYPE_STRING, 0, 0, 0, NULL},
|
||||
{"comment", &info_comment, CONF_TYPE_STRING, 0, 0, 0, NULL},
|
||||
{"help", "\nAvailable INFO fields:\n"
|
||||
" name - title of the subject of the file\n"
|
||||
" artist - artist or author of the original subject of the file\n"
|
||||
" genre - original work category\n"
|
||||
" subject - contents of the file\n"
|
||||
" copyright - copyright information for the file\n"
|
||||
" srcform - original form of the material that was digitized\n"
|
||||
" comment - general comments about the file or the subject of the file\n"
|
||||
"\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
|
||||
{NULL, NULL, 0, 0, 0, 0, NULL}
|
||||
};
|
||||
|
||||
static config_t mencoder_opts[]={
|
||||
/* name, pointer, type, flags, min, max */
|
||||
{"include", cfg_include, CONF_TYPE_FUNC_PARAM, CONF_NOSAVE, 0, 0, NULL}, /* this must be the first!!! */
|
||||
@@ -130,6 +150,9 @@ static config_t mencoder_opts[]={
|
||||
{"vobsuboutindex", &vobsub_out_index, CONF_TYPE_INT, CONF_RANGE, 0, 31, NULL},
|
||||
{"vobsuboutid", &vobsub_out_id, CONF_TYPE_STRING, 0, 0, 0, NULL},
|
||||
|
||||
// info header strings
|
||||
{"info", info_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
|
||||
|
||||
#ifdef HAVE_DIVX4ENCORE
|
||||
{"divx4opts", divx4opts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -707,7 +707,7 @@ static int config_read_option(m_config_t *config,config_t** conf_list, char *opt
|
||||
/* clear out */
|
||||
subopt[0] = subparam[0] = 0;
|
||||
|
||||
sscanf_ret = sscanf(token, "%[^=]=%s", subopt, subparam);
|
||||
sscanf_ret = sscanf(token, "%[^=]=%[^:]", subopt, subparam);
|
||||
|
||||
mp_msg(MSGT_CFGPARSER, MSGL_DBG3, "token: '%s', i=%d, subopt='%s', subparam='%s' (ret: %d)\n", token, i, subopt, subparam, sscanf_ret);
|
||||
switch(sscanf_ret)
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -25,6 +25,11 @@ typedef struct {
|
||||
BITMAPINFOHEADER *bih; // in format
|
||||
} aviwrite_stream_t;
|
||||
|
||||
typedef struct {
|
||||
unsigned int id;
|
||||
char *text;
|
||||
} aviwrite_info_t;
|
||||
|
||||
typedef struct {
|
||||
// encoding:
|
||||
MainAVIHeader avih;
|
||||
|
||||
@@ -164,6 +164,15 @@ static subtitle* subtitles=NULL;
|
||||
float sub_last_pts = -303;
|
||||
#endif
|
||||
|
||||
// infos are empty by default
|
||||
char *info_name=NULL;
|
||||
char *info_artist=NULL;
|
||||
char *info_genre=NULL;
|
||||
char *info_subject=NULL;
|
||||
char *info_copyright=NULL;
|
||||
char *info_sourceform=NULL;
|
||||
char *info_comment=NULL;
|
||||
|
||||
|
||||
|
||||
//char *out_audio_codec=NULL; // override audio codec
|
||||
|
||||
Reference in new issue
Block a user