//----------------------------------------------------------------------------------------
// Transcode Optional Scripts
//----------------------------------------------------------------------------------------
// Transcode Optional Scripts with full_java syntax for transcode customizing per renderer.
// Scripts text encoding must be UTF-8.
//----------------------------------------------------------------------------------------
// <Special Tags>
//  <@load> : Begin part of [declare functions] 
//            Functions in this part aren't auto-excuted, but memoried for later use from others. 
//  <@exec [when={1-4},target={0-3}, stat={0-1},mgrp={0-2},mname={menu_name}]> : Begin part of [exec scripts]
//            Scripts in this part will be directly exuted with follwing conditions.
//            when   : =1:list,=2:play,  =3:list|play,  =4:oneshot (default=3)
//            target : =1:file,=2:folder,=3:file|folder,=0:unknown (default=3)  
//            stat   : =0:Btn-ON,=1:Btn-OFF,=2:pushBtn (default=1)(+OR 0x4: call both ON/OFF)
//            mgrp   : =0:no-menu-group,=1:begin new menu-group,=2:inherit menu-group (default=0)
//            mname  : menu_name displayed on renderer script_menues (default=null:not displayed)
// <Comments>
//  line bigins with # is treated as comments
//---------------------------------------------------------------------------------------
// <Input params: inp.xxx> 
//    media/transcode info of target file
//    <Media info>
//      boolean is_folder/is_video/is_audio/is_image
//      String  filename/srtfile/container/vcodec/acodec/dpname 
//      float   framerate/bitrate/samplerate 
//      boolean audio/subtitles
//      int     width/height/duration/channels 
//    <Transcode info>
//      String  player/trans_type/trans_format/trans_proc/remux_format/remux_proc
//      float   timeseek
//    <Other>
//			int     when,stat (real value of @exec params described above)
//
// <Output-able params: out.xxx> 
//    force dlna profile/transcoder and it's parameters etc
//    <Transcode info>
//      String  player/dpname/trans_type
//			String 	trans_format/trans_proc/trans_prog
//			String 	remux_format/remux_proc/remux_prog
//      String  trans_format_web
//      String  player/trans_type/trans_format/remux_format/dpname
//      float   sound_delay
//      String  mencoder_opt/mencoder_opta/ffmpeg_opt/tsmuxer_optv/tsmuxer_opta
//      String  sys_web_opt,sys_aav_opt,sys_iav_opt
//    <DLNA/MimeType>
//      String  dlna_prof/dlna_op/mime_type
//
// <Special opts> allowed in mencoder_opt/ffmpeg_opt
//    -adelay_add/-adelay_rep --- for both, audio_delay(secs) add/replace
//    -noass/-noskip/-dts_remux/dts_embed/-pcm_mod/-pcm_raw/-oac_copy  ---- mencoder only 
//
// <Notes>
//  1) pxm/pxf parameters (customizing per file) will override/modify this script results. 
//     i.e. Priority of designations is {pxm/pxf parameters} > {this scripts}
//  2) trans_type  : ={"direct"/"remux"/"trans"}
//  3) trans_format: ={"mpegps"/"mpegts"/"m2ts"}, remux_format={"mpegts"/"m2ts"}
//  4) sys_trans_format_web: ={"mpegps"/"mpegts"/"m2ts"/"reset"}
//  5) tsmuxer_optv: "%vcodec%, %file%, %fps%, %opts%, %track_v%", replace %-% with real value if you want
//  6) tsmuxer_opta: "%acodec%, %file%, %timeshift%, %track_a%", replace %-% with real value if you want
//
//----------------------------------------------------------------------------------------
// Samples
//----------------------------------------------------------------------------------------
//<@load>
void DVD_mpegps_24fps() {
  if(inp.container.equals("iso")){
    out.trans_format="mpegps";
    if(inp.subtitles) out.mencoder_opt+=" -ofps 24000/1001";  //improve stattering
    if(inp.acodec.equals("ac3")) out.mencoder_opt+=" -oac copy";  //improve small sound
  }
}
void DVD_m2ts_24fps() {
  if(inp.container.equals("iso")){
    out.trans_format="m2ts";
    out.sound_delay=-0.3;
    if(inp.subtitles) out.mencoder_opt+=" -ofps 24";
    if(inp.acodec.equals("ac3")) out.mencoder_opta+=" -oac copy";
  }
}

//<@exec when=1,target=1,stat=0,mgrp=2,mname=DVD/DVD_mpegps_24fps>
DVD_mpegps_24fps();

//<@exec when=1,target=1,stat=0,mgrp=2,mname=DVD/DVD_m2ts_24fps>
DVD_m2ts_24fps();

