Ticket #1727: mkv_demuxer_header_compression+ass_fix_pts_out_of_order.diff

File mkv_demuxer_header_compression+ass_fix_pts_out_of_order.diff, 5.5 KB (added by alexandrezia@…, 16 years ago)

mkv header decompression + ASS pts ordering

  • libmpcodecs/vf_ass.c

     
    329329
    330330static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
    331331{
     332        static short int zerar;
     333
     334        // ARZ 
     335        zerar = 0;
     336        if(pts == MP_NOPTS_VALUE)
     337        {
     338                zerar = 1;
     339                pts = vf_pts;
     340//              if(!vf_quiet) mp_msg(MSGT_STATUSLINE,MSGL_STATUS,"NOPTS vf_pts: %6.3fs Pts: %6.3fs\n", vf_pts, pts);
     341                if(!vf_quiet) mp_msg(MSGT_STATUSLINE,MSGL_STATUS,"NOPTS ");
     342        }
     343        if(!vf_quiet) mp_msg(MSGT_STATUSLINE,MSGL_STATUS,"Pts:%6.1fs ", pts);
     344       
    332345        ASS_Image* images = eosd_render_frame(pts, NULL);
    333346        prepare_image(vf, mpi);
    334347        if (images) render_frame(vf, mpi, images);
     348       
     349        // ARZ
     350        if (zerar) pts = MP_NOPTS_VALUE;
    335351
    336352        return vf_next_put_image(vf, vf->dmpi, pts);
    337353}
  • libmpcodecs/vf.c

     
    213213    NULL
    214214};
    215215
     216// ARZ
     217double vf_pts;
     218int    vf_quiet;
     219
    216220// For the vf option
    217221m_obj_settings_t* vf_settings = NULL;
    218222const m_obj_list_t vf_obj_list = {
  • libmpcodecs/vf.h

     
    2222#include "m_option.h"
    2323#include "mp_image.h"
    2424
     25// ARZ
     26extern double vf_pts;
     27extern int    vf_quiet;
     28
    2529extern m_obj_settings_t* vf_settings;
    2630extern const m_obj_list_t vf_obj_list;
    2731
  • mplayer.c

     
    287287char** video_driver_list=NULL;
    288288char** audio_driver_list=NULL;
    289289
     290// ARZ
     291static short int initial_sync = 0;     
     292
    290293// sub:
    291294char *font_name=NULL;
    292295char *sub_font_name=NULL;
     
    35973600mpctx->sh_audio=mpctx->d_audio->sh;
    35983601mpctx->sh_video=mpctx->d_video->sh;
    35993602
     3603vf_quiet = quiet;       
     3604       
    36003605if(mpctx->sh_video){
    36013606
    36023607  current_module="video_read_properties";
     
    38893894/*========================== PLAY VIDEO ============================*/
    38903895
    38913896  vo_pts=mpctx->sh_video->timer*90000.0;
     3897
     3898  // ARZ
     3899  if ( ! initial_sync )
     3900  {
     3901    seek_to_sec = mpctx->sh_video->pts;
     3902    initial_sync = 1;
     3903  }
     3904  vf_pts = ( mpctx->sh_video->timer + seek_to_sec);
     3905
    38923906  vo_fps=mpctx->sh_video->fps;
    38933907
    38943908  if (!mpctx->num_buffered_frames) {
  • libmpdemux/demux_mkv.c

     
    366366            }
    367367            *size = dstlen;
    368368        }
     369               
     370        // ARZ
     371        if (track->encodings[i].comp_algo == 3)
     372        {
     373            if (*size >= SIZE_MAX - track->encodings[i].comp_settings_len)
     374            {
     375                mp_msg(MSGT_DEMUX, MSGL_ERR, "[mkv] integer overflow in demux_mkv_decode!\n");
     376                break;
     377            }
     378
     379            modified = 1;
     380            *dest = malloc(*size + track->encodings[i].comp_settings_len);
     381            memcpy(*dest, track->encodings[i].comp_settings, track->encodings[i].comp_settings_len);
     382            memcpy(*dest + track->encodings[i].comp_settings_len, src, *size);
     383            *size += track->encodings[i].comp_settings_len;
     384        }
    369385    }
    370386
    371387    return modified;
     
    526542                               track->tnum);
    527543                    }
    528544
    529                     if (e.comp_algo != 0 && e.comp_algo != 2) {
     545                    // ARZ                                     
     546                    if (e.comp_algo != 0 && e.comp_algo != 2 && e.comp_algo != 3 ) {
    530547                        mp_msg(MSGT_DEMUX, MSGL_WARN,
    531548                               MSGTR_MPDEMUX_MKV_UnknownCompression,
    532549                               track->tnum, e.comp_algo);
  • mencoder.c

     
    175175static int play_n_frames=-1;
    176176static int play_n_frames_mf=-1;
    177177
     178// ARZ
     179static short int initial_sync = 0;     
     180
    178181// sub:
    179182char *font_name=NULL;
    180183char *sub_font_name=NULL;
     
    455458            }
    456459        }
    457460        if (sh_video->pts >= end_pts) done = 1;
     461               
     462        // ARZ
     463        if ( ! initial_sync )
     464        {
     465            seek_to_sec = sh_video->pts;
     466            initial_sync = 1;
     467        }
     468        vf_pts = ( sh_video->timer + seek_to_sec);
    458469
    459470        if (vfilter) {
    460471            int softskip = (vfilter->control(vfilter, VFCTRL_SKIP_NEXT_FRAME, 0) == CONTROL_TRUE);
     
    815826  mp_msg(MSGT_CPLAYER,MSGL_INFO,"==========================================================================\n");
    816827}
    817828
     829// ARZ 
     830vf_quiet = quiet;       
     831
    818832  if (sh_audio) {
    819833    new_srate = sh_audio->samplerate;
    820834    if (playback_speed != 1.0) {
     
    15231537    if(skip_flag<=0) muxer_write_chunk(mux_v,sizeof(int),AVIIF_KEYFRAME, MP_NOPTS_VALUE, MP_NOPTS_VALUE);
    15241538    break;
    15251539default:
     1540
     1541    // ARZ
     1542    if ( ! initial_sync )
     1543    {
     1544        seek_to_sec = sh_video->pts;
     1545        initial_sync = 1;
     1546    }
     1547        vf_pts = ( sh_video->timer + seek_to_sec);
     1548    // fprintf( stderr, "seek_to_sec: %6.3f sh_video->timer: %6.10fs sh_video->pts: %6.3fs vf_pts: %6.10fs ",
     1549    //          seek_to_sec, sh_video->timer, sh_video->pts, ( sh_video->timer + seek_to_sec) );
     1550               
    15261551    // decode_video will callback down to ve_*.c encoders, through the video filters
    15271552    {
    15281553    int drop_frame = skip_flag > 0 &&