From feaead439363146b868b2df2981a6e9b8fbcfcc4 Mon Sep 17 00:00:00 2001 From: ranma Date: Fri, 30 Apr 2004 21:33:53 +0000 Subject: [PATCH] Allow user to disable writing of ODML index git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@12364 b3059339-0415-0410-9bf9-f77b7e298cf2 --- DOCS/man/en/mplayer.1 | 4 ++++ cfg-mencoder.h | 4 ++++ libmpdemux/muxer_avi.c | 25 +++++++++++++++---------- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1 index 06d7723841..6ab5d754b8 100644 --- a/DOCS/man/en/mplayer.1 +++ b/DOCS/man/en/mplayer.1 @@ -3974,6 +3974,10 @@ Do not automatically insert the expand filter into the MEncoder filter chain. Useful to control at which point of the filter chain subtitles are rendered when hardcoding subtitles onto a movie. .TP +.B \-noodml +Do not write OpenDML index for files >1GB. +Applies to \-of avi only. +.TP .B \-noskip Do not skip frames. .TP diff --git a/cfg-mencoder.h b/cfg-mencoder.h index b6209e8237..0e8f8a3ceb 100644 --- a/cfg-mencoder.h +++ b/cfg-mencoder.h @@ -161,6 +161,7 @@ m_option_t of_conf[]={ }; extern float avi_aspect_override; /* defined in libmpdemux/muxer_avi.c */ +extern int write_odml; /* defined in libmpdemux/muxer_avi.c */ m_option_t mencoder_opts[]={ /* name, pointer, type, flags, min, max */ @@ -210,6 +211,9 @@ m_option_t mencoder_opts[]={ {"encodedups", &encode_duplicates, CONF_TYPE_FLAG, 0, 0, 1, NULL}, {"noencodedups", &encode_duplicates, CONF_TYPE_FLAG, 0, 1, 0, NULL}, + {"odml", &write_odml, CONF_TYPE_FLAG, 0, 0, 1, NULL}, + {"noodml", &write_odml, CONF_TYPE_FLAG, 0, 1, 0, NULL}, + // info header strings {"info", info_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL}, diff --git a/libmpdemux/muxer_avi.c b/libmpdemux/muxer_avi.c index bf837c75da..2970405dcc 100644 --- a/libmpdemux/muxer_avi.c +++ b/libmpdemux/muxer_avi.c @@ -33,6 +33,7 @@ extern char *info_comment; #define MOVIALIGN 0x00001000 float avi_aspect_override = -1.0; +int write_odml = 1; struct avi_odmlidx_entry { uint64_t ofs; @@ -159,7 +160,7 @@ if(len>0){ } static void write_avi_list(FILE *f,unsigned int id,int len); -static void avifile_write_index(muxer_t *muxer); +static void avifile_write_standard_index(muxer_t *muxer); static void avifile_odml_new_riff(muxer_t *muxer) { @@ -198,9 +199,9 @@ static void avifile_write_chunk(muxer_stream_t *s,size_t len,unsigned int flags) if (vsi->riffofspos == 0) { rifflen += 8+muxer->idx_pos*sizeof(AVIINDEXENTRY); } - if (rifflen + paddedlen > ODML_CHUNKLEN) { + if (rifflen + paddedlen > ODML_CHUNKLEN && write_odml == 1) { if (vsi->riffofspos == 0) { - avifile_write_index(muxer); + avifile_write_standard_index(muxer); } avifile_odml_new_riff(muxer); } @@ -624,13 +625,7 @@ static void avifile_odml_write_index(muxer_t *muxer){ muxer->file_end=ftello(muxer->file); } -static void avifile_write_index(muxer_t *muxer){ - - if(muxer->file_end > ODML_CHUNKLEN && - muxer->idx && muxer->idx_pos>0) { - avifile_odml_write_index(muxer); - return; - } +static void avifile_write_standard_index(muxer_t *muxer){ muxer->movi_end=ftello(muxer->file); if(muxer->idx && muxer->idx_pos>0){ @@ -646,6 +641,16 @@ static void avifile_write_index(muxer_t *muxer){ muxer->file_end=ftello(muxer->file); } +static void avifile_write_index(muxer_t *muxer){ + struct avi_stream_info *vsi = muxer->def_v->priv; + + if (vsi->riffofspos > 0){ + avifile_odml_write_index(muxer); + } else { + avifile_write_standard_index(muxer); + } +} + void muxer_init_muxer_avi(muxer_t *muxer){ muxer->cont_new_stream = &avifile_new_stream; muxer->cont_write_chunk = &avifile_write_chunk;