Ignore:
Timestamp:
12/14/07 00:22:01 (16 years ago)
Author:
radscorpion
Message:

MPC Demux works. Right now it can only be used with Dump filter, because
it accepts any mediatype.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • dsfilters/demux_mpc/src/mpc_pin.cpp

    r366 r368  
    131131        ev_can_write.Set();
    132132        ev_abort.Reset();
     133
     134        // up to 5 seconds
     135        buffer_time_ms = 5000;
    133136}
    134137
     
    141144{
    142145        CheckPointer(ppv, E_POINTER);
    143         /*
    144146        if (riid == IID_IMediaSeeking) {
    145147                return GetInterface((IMediaSeeking*)this, ppv);
    146148        } else {
    147         */
    148149                return CBaseOutputPin::NonDelegatingQueryInterface(riid, ppv);
    149         //}
     150        }
    150151}
    151152
     
    292293}
    293294
    294 /*
    295295// IMediaSeeking
    296296STDMETHODIMP CMPCOutputPin::GetCapabilities(DWORD* pCapabilities)                                       { return demux->GetCapabilities(pCapabilities); }
     
    315315STDMETHODIMP CMPCOutputPin::SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags)
    316316{
    317         return demux->SetPositionsInternal(stream_index, pCurrent, dwCurrentFlags, pStop, dwStopFlags);
    318 }
    319 */
     317        return demux->SetPositionsInternal(0, pCurrent, dwCurrentFlags, pStop, dwStopFlags);
     318}
    320319
    321320int CMPCOutputPin::GetDataPacket(DataPacket **packet)
     
    342341}
    343342
    344 /*
    345 // dorucenie packetu
    346 HRESULT CMPCOutputPin::DeliverPacket(MP4::Packet &packet)
     343HRESULT CMPCOutputPin::DeliverPacket(CMPCPacket &packet)
    347344{
    348345        // ziskame novy packet na vystup
     
    356353
    357354        // spocitame casy
    358         outp->rtStart = (packet.pts_100mhz / 10) - rtStart;
    359         outp->rtStop  = outp->rtStart + 1;
     355        outp->rtStart = packet.tStart;
     356        outp->rtStop  = packet.tStop;
    360357       
    361         outp->size        = packet.size;
     358        outp->size        = packet.packet_size;
    362359        outp->buf         = (BYTE*)malloc(outp->size);
    363         memcpy(outp->buf, packet.data, packet.size);
    364 
    365         // sync point ?
    366         if (packet.flags & PACKET_FLAG_KEYFRAME) {
    367                 outp->sync_point = TRUE;
    368         } else {
    369                 outp->sync_point = FALSE;
    370         }
     360        memcpy(outp->buf, packet.packet, packet.packet_size);
     361
     362        // each packet is sync point
     363        outp->sync_point = TRUE;
    371364
    372365        // discontinuity ?
     
    379372
    380373        {
    381                 // strcime do queue
    382                 MonoBase::AutoLock              lck(&lock_queue);
     374                // insert into queue
     375                CAutoLock               lck(&lock_queue);
    383376                queue.AddTail(outp);
    384377                ev_can_read.Set();
    385378
    386                 // zakazeme dalsie bufferovanie
    387                 // toto mozeme robit iba pre seekovaci pin
    388                 if (stream_index == demux->buf_index) {
    389                         if (GetBufferTime_MS() >= buffer_time_ms) {
    390                                 ev_can_write.Reset();
    391                         }
     379                // we allow buffering for a few seconds (might be usefull for network playback)
     380                if (GetBufferTime_MS() >= buffer_time_ms) {
     381                        ev_can_write.Reset();
    392382                }
    393383        }
     
    395385        return NOERROR;
    396386}
    397 */
    398387
    399388HRESULT CMPCOutputPin::DoEndOfStream()
     
    441430
    442431        // we should have enough space in there
    443         ASSERT(sample->GetSize() >= packet.size);
     432        long lsize = sample->GetSize();
     433        ASSERT(lsize >= packet.size);
    444434
    445435        BYTE                    *buf;
Note: See TracChangeset for help on using the changeset viewer.