Changeset 372 for dsfilters/demux_mpc/src/mpc_pin.cpp
- Timestamp:
- 12/15/07 17:04:51 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
dsfilters/demux_mpc/src/mpc_pin.cpp
r368 r372 248 248 ev_abort.Reset(); 249 249 250 HRESULT hr = CBaseOutputPin::Active(); 251 if (FAILED(hr)) { 252 active = FALSE; 253 return hr; 254 } 255 256 // new segment 257 DoNewSegment(rtStart, rtStop, rate); 258 250 259 // vytvorime novu queue 251 260 if (!ThreadExists()) { … … 254 263 } 255 264 256 HRESULT hr = CBaseOutputPin::Active();257 if (FAILED(hr)) {258 active = FALSE;259 return hr;260 }261 262 // new segment263 DoNewSegment(rtStart, rtStop, rate);264 265 active = TRUE; 265 266 return hr; … … 343 344 HRESULT CMPCOutputPin::DeliverPacket(CMPCPacket &packet) 344 345 { 346 // we don't accept packets while aborting... 347 if (ev_abort.Check()) return E_FAIL; 348 345 349 // ziskame novy packet na vystup 346 350 DataPacket *outp = NULL; … … 388 392 HRESULT CMPCOutputPin::DoEndOfStream() 389 393 { 390 DataPacket *packet; 391 int ret = GetDataPacket(&packet); 392 if (ret < 0 || !packet) return E_FAIL; 394 DataPacket *packet = new DataPacket(); 393 395 394 396 // naqueueujeme EOS … … 413 415 ev_can_read.Reset(); 414 416 ev_can_write.Set(); 415 416 // we return buffer level only for the first pin417 /*418 if (stream_index == demux->buf_index) {419 //MonoBase::AutoLock lck2(&demux->lock_info);420 demux->buf_size_ms = GetBufferTime_MS();421 }422 */423 417 } 424 418 … … 538 532 if (packet->type == DataPacket::PACKET_TYPE_DATA) { 539 533 hr = DeliverDataPacket(*packet); 540 if (SUCCEEDED(hr)) {541 542 /*543 if (stream_index == demux->buf_index) {544 int size = GetBufferTime_MS();545 {546 MonoBase::AutoLock lck2(&demux->lock_info);547 demux->buf_size_ms = size;548 demux->NotifyEvent(EC_BUFFER_STATE, size, demux->internal_buffer_size); // v milisekundach549 }550 demux->UpdatePage(1);551 552 // posleme notifikaciu, ze data boli dorucene553 if (is_first) {554 is_first = false;555 demux->NotifyEvent(EC_FRAME_READY, 0, 0);556 }557 558 // starvation559 if (size < 0.05*demux->internal_buffer_size && !eos_delivered &&560 demux->ev_ready.Check() == TRUE561 ) {562 demux->NotifyStarvation();563 }564 }565 */566 }567 534 } 568 535 … … 596 563 reader = rd; 597 564 reader->AddRef(); 598 pos = 0;565 position = 0; 599 566 } 600 567 … … 623 590 624 591 // aktualna pozicia 625 if (pos) *pos = this->pos;592 if (pos) *pos = position; 626 593 return 0; 627 594 } … … 634 601 635 602 // seekneme 636 this->pos= pos;603 position = pos; 637 604 return 0; 638 605 } … … 642 609 __int64 avail, total; 643 610 GetSize(&avail, &total); 644 if (pos + size > avail) return -1; 611 if (position + size > avail) { 612 return -1; 613 } 645 614 646 615 // TODO: Caching here !!!! 647 616 648 HRESULT hr = reader->SyncRead(pos, size, (BYTE*)buf); 649 if (FAILED(hr)) return -2; 617 HRESULT hr = reader->SyncRead(position, size, (BYTE*)buf); 618 if (FAILED(hr)) { 619 return -1; 620 } 650 621 651 622 // update position 652 pos += size;623 position += size; 653 624 return 0; 654 625 }
Note: See TracChangeset
for help on using the changeset viewer.