changeset 22881:2d01760be338

removed init_apts and init_vpts; added :adelay in addition to :vdelay
author nicodvb
date Sun, 01 Apr 2007 21:27:47 +0000
parents 8b0cfdc71759
children 1c366c351ced
files libmpdemux/muxer_mpeg.c
diffstat 1 files changed, 14 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/muxer_mpeg.c	Sun Apr 01 20:48:34 2007 +0000
+++ b/libmpdemux/muxer_mpeg.c	Sun Apr 01 21:27:47 2007 +0000
@@ -78,7 +78,7 @@
 static uint32_t conf_vbitrate = 0;
 static int conf_init_vpts = 200, conf_init_apts = 200;
 static int conf_ts_allframes = 0;
-static int conf_init_adelay = 0;
+static int conf_init_adelay = 0, conf_init_vdelay = 0;
 static int conf_abuf_size = 0;
 static int conf_vbuf_size = 0;
 static int conf_drop = 0;
@@ -197,9 +197,8 @@
 	{"vpswidth", &(conf_panscan_width), CONF_TYPE_INT, M_OPT_GLOBAL|M_OPT_RANGE, 1, 16383, NULL},
 	{"vpsheight", &(conf_panscan_height), CONF_TYPE_INT, M_OPT_GLOBAL|M_OPT_RANGE, 1, 16383, NULL},
 	{"vbitrate", &(conf_vbitrate), CONF_TYPE_INT, M_OPT_GLOBAL|M_OPT_RANGE, 1, 104857599, NULL},
-	{"init_vpts", &(conf_init_vpts), CONF_TYPE_INT, M_OPT_GLOBAL|M_OPT_RANGE, 100, 700, NULL},	//2*frametime at 60fps
-	{"init_apts", &(conf_init_apts), CONF_TYPE_INT, M_OPT_GLOBAL|M_OPT_RANGE, 100, 700, NULL},
-	{"vdelay", &conf_init_adelay, CONF_TYPE_INT, M_OPT_GLOBAL|M_OPT_RANGE, 1, 32760, NULL},
+	{"vdelay", &conf_init_vdelay, CONF_TYPE_INT, M_OPT_GLOBAL|M_OPT_RANGE, 0, 32760, NULL},
+	{"adelay", &conf_init_adelay, CONF_TYPE_INT, M_OPT_GLOBAL|M_OPT_RANGE, 0, 32760, NULL},
 	{"vbuf_size", &conf_vbuf_size, CONF_TYPE_INT, M_OPT_GLOBAL|M_OPT_RANGE, 40, 1194, NULL},
 	{"abuf_size", &conf_abuf_size, CONF_TYPE_INT, M_OPT_GLOBAL|M_OPT_RANGE, 4, 64, NULL},
 	{"drop", &conf_drop, CONF_TYPE_FLAG, M_OPT_GLOBAL, 0, 1, NULL},
@@ -394,6 +393,10 @@
   if (type == MUXER_TYPE_VIDEO) {
     spriv->type = 1;
     spriv->last_pts = conf_init_vpts * 90 * 300;
+    if(conf_init_vdelay) {
+      spriv->last_dts += conf_init_vdelay * 90 * 300;
+      spriv->last_pts += conf_init_vdelay * 90 * 300;
+    }
     spriv->id = 0xe0 + muxer->num_videos;
     s->ckid = be2me_32 (0x100 + spriv->id);
     if(priv->is_genmpeg1 || priv->is_genmpeg2) {
@@ -428,8 +431,8 @@
     spriv->type = 0;
     spriv->drop_delayed_frames = conf_drop;
     spriv->last_pts = conf_init_apts * 90 * 300;
-    if(conf_init_adelay < 0 && ! spriv->drop_delayed_frames)
-      spriv->last_pts += (-conf_init_adelay) * 90 * 300;
+    if(conf_init_adelay && ! spriv->drop_delayed_frames)
+      spriv->last_pts += conf_init_adelay * 90 * 300;
     spriv->pts = spriv->last_pts;
     spriv->id = 0xc0 + muxer->num_audios;
     s->ckid = be2me_32 (0x100 + spriv->id);
@@ -2645,6 +2648,11 @@
   muxer->sysrate = priv->muxrate; 		// initial muxrate = constrained stream parameter
   priv->scr = muxer->file_end = 0;
 
+  if(conf_init_vdelay && conf_drop)
+  {
+	mp_msg(MSGT_MUXER, MSGL_ERR, "\nmuxer_mpg, :drop and :vdelay used together are not supported, exiting\n");
+	return 0;
+  }
   if(conf_init_adelay)
   	priv->init_adelay = - (double) conf_init_adelay / (double) 1000.0;