Index: libmpcodecs/vf_ass.c
===================================================================
--- libmpcodecs/vf_ass.c	(revision 32161)
+++ libmpcodecs/vf_ass.c	(working copy)
@@ -329,9 +329,25 @@
 
 static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
 {
+	static short int zerar;
+
+	// ARZ	
+	zerar = 0;
+	if(pts == MP_NOPTS_VALUE)
+	{
+		zerar = 1;
+		pts = vf_pts;
+//		if(!vf_quiet) mp_msg(MSGT_STATUSLINE,MSGL_STATUS,"NOPTS vf_pts: %6.3fs Pts: %6.3fs\n", vf_pts, pts);
+		if(!vf_quiet) mp_msg(MSGT_STATUSLINE,MSGL_STATUS,"NOPTS ");
+	}
+	if(!vf_quiet) mp_msg(MSGT_STATUSLINE,MSGL_STATUS,"Pts:%6.1fs ", pts);
+	
 	ASS_Image* images = eosd_render_frame(pts, NULL);
 	prepare_image(vf, mpi);
 	if (images) render_frame(vf, mpi, images);
+	
+	// ARZ
+	if (zerar) pts = MP_NOPTS_VALUE;
 
 	return vf_next_put_image(vf, vf->dmpi, pts);
 }
Index: libmpcodecs/vf.c
===================================================================
--- libmpcodecs/vf.c	(revision 32161)
+++ libmpcodecs/vf.c	(working copy)
@@ -213,6 +213,10 @@
     NULL
 };
 
+// ARZ
+double vf_pts;
+int    vf_quiet;
+
 // For the vf option
 m_obj_settings_t* vf_settings = NULL;
 const m_obj_list_t vf_obj_list = {
Index: libmpcodecs/vf.h
===================================================================
--- libmpcodecs/vf.h	(revision 32161)
+++ libmpcodecs/vf.h	(working copy)
@@ -22,6 +22,10 @@
 #include "m_option.h"
 #include "mp_image.h"
 
+// ARZ
+extern double vf_pts;
+extern int    vf_quiet;
+
 extern m_obj_settings_t* vf_settings;
 extern const m_obj_list_t vf_obj_list;
 
Index: mplayer.c
===================================================================
--- mplayer.c	(revision 32161)
+++ mplayer.c	(working copy)
@@ -287,6 +287,9 @@
 char** video_driver_list=NULL;
 char** audio_driver_list=NULL;
 
+// ARZ
+static short int initial_sync = 0;	
+
 // sub:
 char *font_name=NULL;
 char *sub_font_name=NULL;
@@ -3597,6 +3600,8 @@
 mpctx->sh_audio=mpctx->d_audio->sh;
 mpctx->sh_video=mpctx->d_video->sh;
 
+vf_quiet = quiet;	
+	
 if(mpctx->sh_video){
 
   current_module="video_read_properties";
@@ -3889,6 +3894,15 @@
 /*========================== PLAY VIDEO ============================*/
 
   vo_pts=mpctx->sh_video->timer*90000.0;
+
+  // ARZ
+  if ( ! initial_sync )
+  {
+    seek_to_sec = mpctx->sh_video->pts;
+    initial_sync = 1;
+  }
+  vf_pts = ( mpctx->sh_video->timer + seek_to_sec);
+
   vo_fps=mpctx->sh_video->fps;
 
   if (!mpctx->num_buffered_frames) {
Index: libmpdemux/demux_mkv.c
===================================================================
--- libmpdemux/demux_mkv.c	(revision 32161)
+++ libmpdemux/demux_mkv.c	(working copy)
@@ -366,6 +366,22 @@
             }
             *size = dstlen;
         }
+		
+        // ARZ
+        if (track->encodings[i].comp_algo == 3) 
+        {
+            if (*size >= SIZE_MAX - track->encodings[i].comp_settings_len) 
+            {
+                mp_msg(MSGT_DEMUX, MSGL_ERR, "[mkv] integer overflow in demux_mkv_decode!\n");
+                break;
+            }
+
+            modified = 1;
+            *dest = malloc(*size + track->encodings[i].comp_settings_len);
+            memcpy(*dest, track->encodings[i].comp_settings, track->encodings[i].comp_settings_len);
+            memcpy(*dest + track->encodings[i].comp_settings_len, src, *size);
+            *size += track->encodings[i].comp_settings_len;
+        }
     }
 
     return modified;
@@ -526,7 +542,8 @@
                                track->tnum);
                     }
 
-                    if (e.comp_algo != 0 && e.comp_algo != 2) {
+                    // ARZ					
+                    if (e.comp_algo != 0 && e.comp_algo != 2 && e.comp_algo != 3 ) {
                         mp_msg(MSGT_DEMUX, MSGL_WARN,
                                MSGTR_MPDEMUX_MKV_UnknownCompression,
                                track->tnum, e.comp_algo);
Index: mencoder.c
===================================================================
--- mencoder.c	(revision 32161)
+++ mencoder.c	(working copy)
@@ -175,6 +175,9 @@
 static int play_n_frames=-1;
 static int play_n_frames_mf=-1;
 
+// ARZ
+static short int initial_sync = 0;	
+
 // sub:
 char *font_name=NULL;
 char *sub_font_name=NULL;
@@ -455,6 +458,14 @@
             }
         }
         if (sh_video->pts >= end_pts) done = 1;
+		
+        // ARZ
+        if ( ! initial_sync )
+        {
+            seek_to_sec = sh_video->pts;
+            initial_sync = 1;
+        }
+        vf_pts = ( sh_video->timer + seek_to_sec);
 
         if (vfilter) {
             int softskip = (vfilter->control(vfilter, VFCTRL_SKIP_NEXT_FRAME, 0) == CONTROL_TRUE);
@@ -815,6 +826,9 @@
   mp_msg(MSGT_CPLAYER,MSGL_INFO,"==========================================================================\n");
 }
 
+// ARZ	
+vf_quiet = quiet;	
+
   if (sh_audio) {
     new_srate = sh_audio->samplerate;
     if (playback_speed != 1.0) {
@@ -1523,6 +1537,17 @@
     if(skip_flag<=0) muxer_write_chunk(mux_v,sizeof(int),AVIIF_KEYFRAME, MP_NOPTS_VALUE, MP_NOPTS_VALUE);
     break;
 default:
+
+    // ARZ
+    if ( ! initial_sync )
+    {
+        seek_to_sec = sh_video->pts;
+        initial_sync = 1;
+    }
+	vf_pts = ( sh_video->timer + seek_to_sec);
+    // fprintf( stderr, "seek_to_sec: %6.3f sh_video->timer: %6.10fs sh_video->pts: %6.3fs vf_pts: %6.10fs ", 
+    //	        seek_to_sec, sh_video->timer, sh_video->pts, ( sh_video->timer + seek_to_sec) );
+		
     // decode_video will callback down to ve_*.c encoders, through the video filters
     {
     int drop_frame = skip_flag > 0 &&
