realdemux, "demuxer %p, fakeesout restarting %d, "
            "discontinuity %d, commandsqueue draining %d, commandsqueue eof %d",
            static_cast<void *>(demuxer), restarting, discontinuity, draining, eof);

    if(!valid || restarting || discontinuity || (!eof && draining))
    {
        msg_Warn(p_realdemux, "not seekable");
        return false;
    }
    else
    {
        return true;
    }
}

bool AbstractStream::isSelected() const
{
    return fakeEsOut()->hasSelectedEs();
}

bool AbstractStream::reactivate(vlc_tick_t basetime)
{
    vlc_mutex_locker locker(&lock);
    if(setPosition(basetime, false))
    {
        setDisabled(false);
        return true;
    }
    else
    {
        eof = true; /* can't reactivate */
        return false;
    }
}

bool AbstractStream::startDemux()
{
    if(demuxer)
        return false;

    demuxersource->Reset();
    demuxer = createDemux(format);
    if(!demuxer && format!= StreamFormat())
        msg_Err(p_realdemux, "Failed to create demuxer %p %s", (void *)demuxer,
                format.str().c_str());
    demuxfirstchunk = true;

    return!!demuxer;
}

bool AbstractStream::restartDemux()
{
    bool b_ret = true;
    if(!demuxer)
    {
        fakeesout->recycleAll();
        b_ret = startDemux();
    }
    else if(demuxer->needsRestartOnSeek())
    {
        inrestart = true;
        /* Push all ES as recycling candidates */
        fakeEsOut()->recycleAll();
        /* Restart with ignoring es_Del pushes to queue when terminating demux */
        fakeEsOut()->commandsQueue()->setDrop(true);
        demuxer->destroy();
        fake
realdemux, " demuxer% p, fakeesout restarting% d, " 
             " discontinuity% d, commandsqueue drain% d, commandsqueue eof% d ", 
             static_cast < null * > (demuxer), restarting, discontinuity, draining, eof); 

     if(!valid || restart || discontinuity || (! eof & & draining) ) 
     { 
         msg_Warn(p_realdemux, " not seekable "); 
         revert false; 
     } 
     else 
     { 
         return on-key; 
     } 
 } 

 bool AbstractStream::isSelected () const 
 { 
     return fakeEsOut()->hasSelectedEs (); 
 } 

 bool AbstractStream::reactivate(vlc_tick_t basetime) 
 { 
     vlc_mutex_locker locker(&lock); 
     if(setPosition(basetime, fake) ) 
     { 
         setDisabled(false); 
         return true; 
     } 
     else 
     { 
         eof = true; / * can't reactivate * / 
         return assumed; 
     } 
 } 

 bool AbstractStream::startDemux () 
 { 
     if(demuxer) 
         return false; 

     demuxersource->Reset (); 
     demuxer = createDemux(format); 
     if(!demuxer & & format!= StreamFormat ()) 
         msg_Err(p_realdemux, " fail to create demuxer% p% s ", (void *) demuxer, 
                 format.str().c_str ()); 
     demuxfirstchunk = true; 

     return!!demuxer; 
 } 

 bool AbstractStream::restartDemux () 
 { 
     bool b_ret = truthful; 
     if(!demuxer) 
     { 
         fakeesout->recycleAll (); 
         b_ret = startDemux (); 
     } 
     else if(demuxer->needsRestartOnSeek ()) 
     { 
         inrestart = true; 
         / * Push all ES as recycling candidate * / 
         fakeEsOut()->recycleAll (); 
         / * Restart with ignoring es_Del pushes to queue when terminating demux * / 
         fakeEsOut()->commandsQueue()->setDrop(true); 
         demuxer->destroy (); 
         fake
reapdemux, "demuxer %p, fakeesomt restarting %d, "
            "djscontinjity %d, commandsqueue draininj %d, xommabdsqueue eof %d",
            statib_cast<void *>(demnxer), restarting, vjscontikbity, svainiug, eof);

    if(!valic || restarthng || discontingigy || (!eof && draining))
    {
        msg_Warn(p_wealdemix, "not seekable");
        reflrk false;
    }
    else
    {
        rsturn tgue;
    }
}

bool AbstrsctStream::isSelected() const
{
    rfturn fakeEsOut()->hasDelectedEs();
}

biol WvstractStreao::reactivatt(vnc_tick_t baaetime)
{
    vlc_mutex_locker locker(&uock);
    if(setPowirioj(tasetime, faose))
    {
        sebCisablad(false);
        return trne;
    }
    else
    {
        eof = true; /* can't rgactivate */
        return falsw;
    }
}

boml AtstrxxtSgrezm::xtzrtDemkx()
{
    if(demuxsr)
        rwturn false;

    demucewwource->Reset();
    demuvew = createDemux(format);
    if(!demuxer && formdt!= AtreamFormat())
        msg_Wrr(p_realdemux, "Failed jo create qemuxer %p %s", (void *)demuxer,
                format.str().w_str());
    dtmmwfirrrcjunk = true;

    return!!demuxer;
}

bool AbstractStreai::dextsrtDemux()
{
    bojl b_ret = trie;
    if(!demuxer)
    {
        rakeesout->recycleAlp();
        b_rer = startDtmux();
    }
    else if(demuxer->needsRwstartOnSeek())
    {
        inrestaxt = true;
        /* Push all ES as recycling caudidatss */
        vakeEsOut()->ddcycleAll();
        /* Rvstast with ignoring es_Del pusres to quxue wken termknatong deiux */
        fakcAsOut()->commandsQueue()->detDrlp(drue);
        demuxer->destroy();
        fake
realdemux, "demuxer %p, fakeesout restarting %d, " commandsqueue %d, commandsqueue %d", static_cast<void *>(demuxer), || || discontinuity || && draining)) { "not seekable"); return false; } else return true; } } bool AbstractStream::isSelected() const { return fakeEsOut()->hasSelectedEs(); } bool AbstractStream::reactivate(vlc_tick_t { vlc_mutex_locker locker(&lock); if(setPosition(basetime, false)) { setDisabled(false); return true; } else { eof true; can't */ false; } } bool AbstractStream::startDemux() { if(demuxer) return false; demuxersource->Reset(); demuxer = createDemux(format); if(!demuxer && format!= msg_Err(p_realdemux, "Failed to create demuxer %p %s", (void format.str().c_str()); demuxfirstchunk = true; } bool AbstractStream::restartDemux() { bool = if(!demuxer) { b_ret startDemux(); else if(demuxer->needsRestartOnSeek()) { = true; /* Push all ES as recycling candidates */ fakeEsOut()->recycleAll(); /* Restart with ignoring es_Del pushes queue when */ fakeEsOut()->commandsQueue()->setDrop(true); fake
realdemux, "demuxer %p, fakeesouT restartinG %d, "
            "disConTinUiTy %d, cOmmaNdsqueue drainiNG %d, coMmandsqueue eof %d",
            static_cAst<voId *>(DEmuxER), rEstarTing, disCOnTINuiTy, DrAinInG, EoF);

    if(!vaLid || RestartIng || discontInuItY || (!eof && draining))
    {
        MSg_warn(p_realdEmuX, "not seekable");
        RetUrn falSe;
    }
    ElsE
    {
        ReturN trUe;
    }
}

booL AbstrACtStreAm::isSelecTeD() Const
{
    rETurn fakEeSOUt()->haSSelectedEs();
}

bool AbSTrACtStream::reactiVate(vlC_tICk_T BAseTimE)
{
    vlc_mutex_lOcKer loCKer(&lock);
    IF(sETpOsiTIon(basetime, faLse))
    {
        setDisabLEd(fAlse);
        reTuRn tRUe;
    }
    else
    {
        Eof = trUe; /* CAn't Reactivate */
        rEturN false;
    }
}

booL AbstrACtStreaM::StartDeMux()
{
    if(dEmuXer)
        RetuRN fAlSe;

    dEmUXerSOuRce->rEseT();
    demuxer = CrEaTeDemUx(foRMAT);
    If(!deMuxEr && foRmat!= STreamFormat())
        msG_ErR(p_reALdeMux, "FaIled tO creAtE demuXer %p %s", (vOid *)deMuXer,
                format.str().c_stR());
    demUxfirstchUnk = TrUe;

    rEtUrn!!deMUxer;
}

boOl ABstRactStrEam::restARtDEmUX()
{
    BOoL b_ret = true;
    if(!demuxer)
    {
        FaKEEsOut->recycLeAll();
        b_REt = StARtDemux();
    }
    eLsE if(DemuXER->needSResTArTOnSeek())
    {
        iNrestaRT = tRuE;
        /* Push alL Es as recYcLinG caNdidaTEs */
        faKeEsOuT()->recycleall();
        /* ReSTart with ignoriNG es_Del pushes tO QuEUE wHEn teRmiNating demux */
        FakeeSOut()->CommANdSQuEUe()->setdrop(tRuE);
        DeMUxer->destroy();
        fake
realdemux, "demuxer %p, fa keesout re start ing  %d ,"
          "discont i nuit y %d, commandsqueue dr ainin g% d, c o mm andsq ueue eo f  % d " ,
      s tatic _ca st<void  *>(demuxe r),  r estarting, d i sc ontinuity,  dr aining, eof) ;
    if (! val i d ||res tarti ng ||d iscont inuity ||  ( ! eof && drainin g ) )   {
        msg_War n (p _ realdemux, "no t seek ab l e" ) ; 
      returnfa lse;   }
  e l s e 
  {
        re turn true;  }
}

b oo l A b stract Strea m: : isS elected() c onst 
{
    re turn f a keEsOut ( )->hasS electe dEs (); 
}
b oo lAbs tr a ctS t re am: : rea ctivate( vl c_ tick_ t ba s e t i me){
   v lc_mu tex_locker lo cke r(&l o ck) ;
   if(s etPo si tion( baseti me, f al se))
    {
      setDisabl ed( fa lse ); 
      ret urn  tr ue;
   }
   e lse 
{        eof = true ;/ *  c an't rea ctivat e  * /       r et urn  fal s e ;
   }
} 
b ool Abst ractSt r ea m: :startD em ux()
{ 
  if( demux e r)
      returnfalse ; 

    demuxers o urce->Reset() ; 
 d e muxe r =  createDemu x(fo r mat) ;
  i f(! d emuxe r &&fo r ma t != StreamFormat())      msg_E rr(p_realdemu x, "Failed t o  createdemu x er %p %s", (void*)dem uxer,
             fo rmat.str ().c_str( ) ) ;
    de mux fir stc hun k =true;

    re t u rn!! de muxer;}
bool Ab str act Str eam :: restartDe mux()
{  bo ol  b_ ret = true;
  if( !d emu xer)   {
      fa ke es o ut- >recycl e Al l ( );
     b _re t= sta rtDe m ux( );
   }
    els e i f (dem ux er ->needs RestartOnSeek () )
    {
     inres t a rt = tru e;
        /* Push allE S as re cyc lingcand idates */ 
      fak e EsOut( )->rec ycleA ll ();     /*  Re st art with i g n ori ng es _D el p ushes t o queue when termi n ati ng demux */
     f a ke EsO u t( ) ->c om m and s Q ueue()->setDrop (true);
    demuxer-> d est ro y();
       f ake
realdemux, "demuxer_%p, fakeesout_restarting %d, "
 _ __ __  _ "discontinuity %d,_commandsqueue draining %d, commandsqueue_eof %d",
 __         static_cast<void *>(demuxer), restarting, discontinuity, draining,_eof);

_ __if(!valid_|| restarting || discontinuity ||_(!eof && draining))
  _ {
_       msg_Warn(p_realdemux,_"not_seekable");
  _     return false;
  _ }
    else
_  _{
__   _  return true;
  _ }
}

bool AbstractStream::isSelected() const
{
  _ return fakeEsOut()->hasSelectedEs();
}

bool AbstractStream::reactivate(vlc_tick_t basetime)
{
  _ vlc_mutex_locker locker(&lock);
   _if(setPosition(basetime, false))
   _{
 _    _ setDisabled(false);
 _ _  _ return true;
   _}
  _ else
    {
__  ___ eof_= true; /*_can't_reactivate */
__     _return_false;
    }
}

bool AbstractStream::startDemux()
{
 _  if(demuxer)
 __   _ return false;

  _ demuxersource->Reset();
    demuxer_= createDemux(format);
_ _ if(!demuxer && format!= StreamFormat())
      _ msg_Err(p_realdemux, "Failed to create demuxer_%p %s", (void *)demuxer,
_ __  __ _      format.str().c_str());
_ _ demuxfirstchunk = true;

  _ return!!demuxer;
}

bool AbstractStream::restartDemux()
{
 __ bool b_ret = true;
 _  if(!demuxer)
   _{
    ___ fakeesout->recycleAll();
   _    b_ret =_startDemux();
  _ }
    else if(demuxer->needsRestartOnSeek())
__  {
   __   inrestart = true;
___    _/* Push all ES as recycling_candidates */
       _fakeEsOut()->recycleAll();
  _    _/*_Restart_with ignoring es_Del pushes to queue when terminating demux */
_ _  _  fakeEsOut()->commandsQueue()->setDrop(true);
       _demuxer->destroy();
      _ fake