mediastream.c (c2c66aff) | mediastream.c (7401c74a) |
---|---|
1/* 2 * Implementation of IMediaStream Interfaces 3 * 4 * Copyright 2005, 2008, 2012 Christian Costa 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either --- 4 unchanged lines hidden (view full) --- 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with this library; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 19 */ 20 | 1/* 2 * Implementation of IMediaStream Interfaces 3 * 4 * Copyright 2005, 2008, 2012 Christian Costa 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either --- 4 unchanged lines hidden (view full) --- 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with this library; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 19 */ 20 |
21#ifndef __REACTOS__ 22#define NONAMELESSUNION 23#define NONAMELESSSTRUCT 24#endif 25#define COBJMACROS 26 27#include <stdarg.h> 28#include "windef.h" 29#include "winbase.h" 30#include "wingdi.h" 31#include "dshow.h" 32 33#include "wine/strmbase.h" 34 |
|
21#include "amstream_private.h" 22 | 35#include "amstream_private.h" 36 |
37#include "ddstream.h" 38#include "wine/debug.h" 39 40WINE_DEFAULT_DEBUG_CHANNEL(amstream); 41 |
|
23#include <initguid.h> 24DEFINE_GUID(IID_IDirectDraw7, 0x15e65ec0,0x3b9c,0x11d2,0xb9,0x2f,0x00,0x60,0x97,0x97,0xea,0x5b); 25 26static HRESULT ddrawstreamsample_create(IDirectDrawMediaStream *parent, IDirectDrawSurface *surface, 27 const RECT *rect, IDirectDrawStreamSample **ddraw_stream_sample); 28static HRESULT audiostreamsample_create(IAudioMediaStream *parent, IAudioData *audio_data, IAudioStreamSample **audio_stream_sample); 29 | 42#include <initguid.h> 43DEFINE_GUID(IID_IDirectDraw7, 0x15e65ec0,0x3b9c,0x11d2,0xb9,0x2f,0x00,0x60,0x97,0x97,0xea,0x5b); 44 45static HRESULT ddrawstreamsample_create(IDirectDrawMediaStream *parent, IDirectDrawSurface *surface, 46 const RECT *rect, IDirectDrawStreamSample **ddraw_stream_sample); 47static HRESULT audiostreamsample_create(IAudioMediaStream *parent, IAudioData *audio_data, IAudioStreamSample **audio_stream_sample); 48 |
49struct DirectDrawMediaStreamImpl; 50 |
|
30typedef struct { | 51typedef struct { |
52 BaseInputPin pin; 53 struct DirectDrawMediaStreamImpl *parent; 54} DirectDrawMediaStreamInputPin; 55 56typedef struct DirectDrawMediaStreamImpl { |
|
31 IAMMediaStream IAMMediaStream_iface; 32 IDirectDrawMediaStream IDirectDrawMediaStream_iface; 33 LONG ref; 34 IMultiMediaStream* parent; 35 MSPID purpose_id; 36 STREAM_TYPE stream_type; 37 IDirectDraw7 *ddraw; | 57 IAMMediaStream IAMMediaStream_iface; 58 IDirectDrawMediaStream IDirectDrawMediaStream_iface; 59 LONG ref; 60 IMultiMediaStream* parent; 61 MSPID purpose_id; 62 STREAM_TYPE stream_type; 63 IDirectDraw7 *ddraw; |
64 DirectDrawMediaStreamInputPin *input_pin; 65 CRITICAL_SECTION critical_section; |
|
38} DirectDrawMediaStreamImpl; 39 40static inline DirectDrawMediaStreamImpl *impl_from_DirectDrawMediaStream_IAMMediaStream(IAMMediaStream *iface) 41{ 42 return CONTAINING_RECORD(iface, DirectDrawMediaStreamImpl, IAMMediaStream_iface); 43} 44 45/*** IUnknown methods ***/ --- 13 unchanged lines hidden (view full) --- 59 return S_OK; 60 } 61 else if (IsEqualGUID(riid, &IID_IDirectDrawMediaStream)) 62 { 63 IAMMediaStream_AddRef(iface); 64 *ret_iface = &This->IDirectDrawMediaStream_iface; 65 return S_OK; 66 } | 66} DirectDrawMediaStreamImpl; 67 68static inline DirectDrawMediaStreamImpl *impl_from_DirectDrawMediaStream_IAMMediaStream(IAMMediaStream *iface) 69{ 70 return CONTAINING_RECORD(iface, DirectDrawMediaStreamImpl, IAMMediaStream_iface); 71} 72 73/*** IUnknown methods ***/ --- 13 unchanged lines hidden (view full) --- 87 return S_OK; 88 } 89 else if (IsEqualGUID(riid, &IID_IDirectDrawMediaStream)) 90 { 91 IAMMediaStream_AddRef(iface); 92 *ret_iface = &This->IDirectDrawMediaStream_iface; 93 return S_OK; 94 } |
95 else if (IsEqualGUID(riid, &IID_IPin)) 96 { 97 IAMMediaStream_AddRef(iface); 98 *ret_iface = &This->input_pin->pin.pin.IPin_iface; 99 return S_OK; 100 } 101 else if (IsEqualGUID(riid, &IID_IMemInputPin)) 102 { 103 IAMMediaStream_AddRef(iface); 104 *ret_iface = &This->input_pin->pin.IMemInputPin_iface; 105 return S_OK; 106 } |
|
67 68 ERR("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ret_iface); 69 return E_NOINTERFACE; 70} 71 72static ULONG WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_AddRef(IAMMediaStream *iface) 73{ 74 DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface); --- 8 unchanged lines hidden (view full) --- 83{ 84 DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface); 85 ULONG ref = InterlockedDecrement(&This->ref); 86 87 TRACE("(%p/%p)->(): new ref = %u\n", iface, This, ref); 88 89 if (!ref) 90 { | 107 108 ERR("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ret_iface); 109 return E_NOINTERFACE; 110} 111 112static ULONG WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_AddRef(IAMMediaStream *iface) 113{ 114 DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface); --- 8 unchanged lines hidden (view full) --- 123{ 124 DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface); 125 ULONG ref = InterlockedDecrement(&This->ref); 126 127 TRACE("(%p/%p)->(): new ref = %u\n", iface, This, ref); 128 129 if (!ref) 130 { |
131 BaseInputPin_Destroy((BaseInputPin *)This->input_pin); 132 DeleteCriticalSection(&This->critical_section); |
|
91 if (This->ddraw) 92 IDirectDraw7_Release(This->ddraw); 93 HeapFree(GetProcessHeap(), 0, This); 94 } 95 96 return ref; 97} 98 --- 96 unchanged lines hidden (view full) --- 195 196 return S_FALSE; 197} 198 199static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_JoinFilter(IAMMediaStream *iface, IMediaStreamFilter *media_stream_filter) 200{ 201 DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface); 202 | 133 if (This->ddraw) 134 IDirectDraw7_Release(This->ddraw); 135 HeapFree(GetProcessHeap(), 0, This); 136 } 137 138 return ref; 139} 140 --- 96 unchanged lines hidden (view full) --- 237 238 return S_FALSE; 239} 240 241static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_JoinFilter(IAMMediaStream *iface, IMediaStreamFilter *media_stream_filter) 242{ 243 DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface); 244 |
203 FIXME("(%p/%p)->(%p) stub!\n", This, iface, media_stream_filter); | 245 TRACE("(%p/%p)->(%p)\n", This, iface, media_stream_filter); |
204 | 246 |
205 return S_FALSE; | 247 This->input_pin->pin.pin.pinInfo.pFilter = (IBaseFilter *)media_stream_filter; 248 249 return S_OK; |
206} 207 208static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_JoinFilterGraph(IAMMediaStream *iface, IFilterGraph *filtergraph) 209{ 210 DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface); 211 212 FIXME("(%p/%p)->(%p) stub!\n", This, iface, filtergraph); 213 --- 202 unchanged lines hidden (view full) --- 416 DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetFormat, 417 DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SetFormat, 418 DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetDirectDraw, 419 DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SetDirectDraw, 420 DirectDrawMediaStreamImpl_IDirectDrawMediaStream_CreateSample, 421 DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetTimePerFrame 422}; 423 | 250} 251 252static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_JoinFilterGraph(IAMMediaStream *iface, IFilterGraph *filtergraph) 253{ 254 DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface); 255 256 FIXME("(%p/%p)->(%p) stub!\n", This, iface, filtergraph); 257 --- 202 unchanged lines hidden (view full) --- 460 DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetFormat, 461 DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SetFormat, 462 DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetDirectDraw, 463 DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SetDirectDraw, 464 DirectDrawMediaStreamImpl_IDirectDrawMediaStream_CreateSample, 465 DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetTimePerFrame 466}; 467 |
468static inline DirectDrawMediaStreamInputPin *impl_from_DirectDrawMediaStreamInputPin_IPin(IPin *iface) 469{ 470 return CONTAINING_RECORD(iface, DirectDrawMediaStreamInputPin, pin.pin.IPin_iface); 471} 472 473/*** IUnknown methods ***/ 474static HRESULT WINAPI DirectDrawMediaStreamInputPin_IPin_QueryInterface(IPin *iface, REFIID riid, void **ret_iface) 475{ 476 DirectDrawMediaStreamInputPin *This = impl_from_DirectDrawMediaStreamInputPin_IPin(iface); 477 478 return IAMMediaStream_QueryInterface(&This->parent->IAMMediaStream_iface, riid, ret_iface); 479} 480 481static ULONG WINAPI DirectDrawMediaStreamInputPin_IPin_AddRef(IPin *iface) 482{ 483 DirectDrawMediaStreamInputPin *This = impl_from_DirectDrawMediaStreamInputPin_IPin(iface); 484 485 return IAMMediaStream_AddRef(&This->parent->IAMMediaStream_iface); 486} 487 488static ULONG WINAPI DirectDrawMediaStreamInputPin_IPin_Release(IPin *iface) 489{ 490 DirectDrawMediaStreamInputPin *This = impl_from_DirectDrawMediaStreamInputPin_IPin(iface); 491 492 return IAMMediaStream_Release(&This->parent->IAMMediaStream_iface); 493} 494 495static const IPinVtbl DirectDrawMediaStreamInputPin_IPin_Vtbl = 496{ 497 DirectDrawMediaStreamInputPin_IPin_QueryInterface, 498 DirectDrawMediaStreamInputPin_IPin_AddRef, 499 DirectDrawMediaStreamInputPin_IPin_Release, 500 BaseInputPinImpl_Connect, 501 BaseInputPinImpl_ReceiveConnection, 502 BasePinImpl_Disconnect, 503 BasePinImpl_ConnectedTo, 504 BasePinImpl_ConnectionMediaType, 505 BasePinImpl_QueryPinInfo, 506 BasePinImpl_QueryDirection, 507 BasePinImpl_QueryId, 508 BaseInputPinImpl_QueryAccept, 509 BasePinImpl_EnumMediaTypes, 510 BasePinImpl_QueryInternalConnections, 511 BaseInputPinImpl_EndOfStream, 512 BaseInputPinImpl_BeginFlush, 513 BaseInputPinImpl_EndFlush, 514 BaseInputPinImpl_NewSegment, 515}; 516 517static HRESULT WINAPI DirectDrawMediaStreamInputPin_CheckMediaType(BasePin *base, const AM_MEDIA_TYPE *media_type) 518{ 519 DirectDrawMediaStreamInputPin *This = impl_from_DirectDrawMediaStreamInputPin_IPin(&base->IPin_iface); 520 521 TRACE("(%p)->(%p)\n", This, media_type); 522 523 if (IsEqualGUID(&media_type->majortype, &MEDIATYPE_Video)) 524 { 525 if (IsEqualGUID(&media_type->subtype, &MEDIASUBTYPE_RGB1) || 526 IsEqualGUID(&media_type->subtype, &MEDIASUBTYPE_RGB4) || 527 IsEqualGUID(&media_type->subtype, &MEDIASUBTYPE_RGB8) || 528 IsEqualGUID(&media_type->subtype, &MEDIASUBTYPE_RGB565) || 529 IsEqualGUID(&media_type->subtype, &MEDIASUBTYPE_RGB555) || 530 IsEqualGUID(&media_type->subtype, &MEDIASUBTYPE_RGB24) || 531 IsEqualGUID(&media_type->subtype, &MEDIASUBTYPE_RGB32)) 532 { 533 TRACE("Video sub-type %s matches\n", debugstr_guid(&media_type->subtype)); 534 return S_OK; 535 } 536 } 537 538 return S_FALSE; 539} 540 541static LONG WINAPI DirectDrawMediaStreamInputPin_GetMediaTypeVersion(BasePin *base) 542{ 543 return 0; 544} 545 546static HRESULT WINAPI DirectDrawMediaStreamInputPin_GetMediaType(BasePin *base, int index, AM_MEDIA_TYPE *media_type) 547{ 548 DirectDrawMediaStreamInputPin *This = impl_from_DirectDrawMediaStreamInputPin_IPin(&base->IPin_iface); 549 550 TRACE("(%p)->(%d,%p)\n", This, index, media_type); 551 552 /* FIXME: Reset structure as we only fill majortype and minortype for now */ 553 ZeroMemory(media_type, sizeof(*media_type)); 554 555 media_type->majortype = MEDIATYPE_Video; 556 557 switch (index) 558 { 559 case 0: 560 media_type->subtype = MEDIASUBTYPE_RGB1; 561 break; 562 case 1: 563 media_type->subtype = MEDIASUBTYPE_RGB4; 564 break; 565 case 2: 566 media_type->subtype = MEDIASUBTYPE_RGB8; 567 break; 568 case 3: 569 media_type->subtype = MEDIASUBTYPE_RGB565; 570 break; 571 case 4: 572 media_type->subtype = MEDIASUBTYPE_RGB555; 573 break; 574 case 5: 575 media_type->subtype = MEDIASUBTYPE_RGB24; 576 break; 577 case 6: 578 media_type->subtype = MEDIASUBTYPE_RGB32; 579 break; 580 default: 581 return S_FALSE; 582 } 583 584 return S_OK; 585} 586 587static HRESULT WINAPI DirectDrawMediaStreamInputPin_Receive(BaseInputPin *base, IMediaSample *sample) 588{ 589 DirectDrawMediaStreamInputPin *This = impl_from_DirectDrawMediaStreamInputPin_IPin(&base->pin.IPin_iface); 590 591 FIXME("(%p)->(%p) stub!\n", This, sample); 592 593 return E_NOTIMPL; 594} 595 596static const BaseInputPinFuncTable DirectDrawMediaStreamInputPin_FuncTable = 597{ 598 { 599 DirectDrawMediaStreamInputPin_CheckMediaType, 600 NULL, 601 DirectDrawMediaStreamInputPin_GetMediaTypeVersion, 602 DirectDrawMediaStreamInputPin_GetMediaType, 603 }, 604 DirectDrawMediaStreamInputPin_Receive, 605}; 606 |
|
424HRESULT ddrawmediastream_create(IMultiMediaStream *parent, const MSPID *purpose_id, 425 STREAM_TYPE stream_type, IAMMediaStream **media_stream) 426{ 427 DirectDrawMediaStreamImpl *object; | 607HRESULT ddrawmediastream_create(IMultiMediaStream *parent, const MSPID *purpose_id, 608 STREAM_TYPE stream_type, IAMMediaStream **media_stream) 609{ 610 DirectDrawMediaStreamImpl *object; |
611 PIN_INFO pin_info; 612 HRESULT hr; |
|
428 429 TRACE("(%p,%s,%p)\n", parent, debugstr_guid(purpose_id), media_stream); 430 431 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DirectDrawMediaStreamImpl)); 432 if (!object) 433 return E_OUTOFMEMORY; 434 435 object->IAMMediaStream_iface.lpVtbl = &DirectDrawMediaStreamImpl_IAMMediaStream_Vtbl; 436 object->IDirectDrawMediaStream_iface.lpVtbl = &DirectDrawMediaStreamImpl_IDirectDrawMediaStream_Vtbl; 437 object->ref = 1; 438 | 613 614 TRACE("(%p,%s,%p)\n", parent, debugstr_guid(purpose_id), media_stream); 615 616 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DirectDrawMediaStreamImpl)); 617 if (!object) 618 return E_OUTOFMEMORY; 619 620 object->IAMMediaStream_iface.lpVtbl = &DirectDrawMediaStreamImpl_IAMMediaStream_Vtbl; 621 object->IDirectDrawMediaStream_iface.lpVtbl = &DirectDrawMediaStreamImpl_IDirectDrawMediaStream_Vtbl; 622 object->ref = 1; 623 |
624 InitializeCriticalSection(&object->critical_section); 625 626 pin_info.pFilter = NULL; 627 pin_info.dir = PINDIR_INPUT; 628 pin_info.achName[0] = 'I'; 629 StringFromGUID2(purpose_id, pin_info.achName + 1, MAX_PIN_NAME - 1); 630 hr = BaseInputPin_Construct(&DirectDrawMediaStreamInputPin_IPin_Vtbl, 631 sizeof(DirectDrawMediaStreamInputPin), &pin_info, &DirectDrawMediaStreamInputPin_FuncTable, 632 &object->critical_section, NULL, (IPin **)&object->input_pin); 633 if (FAILED(hr)) 634 goto out_object; 635 636 object->input_pin->parent = object; 637 |
|
439 object->parent = parent; 440 object->purpose_id = *purpose_id; 441 object->stream_type = stream_type; 442 443 *media_stream = &object->IAMMediaStream_iface; 444 445 return S_OK; | 638 object->parent = parent; 639 object->purpose_id = *purpose_id; 640 object->stream_type = stream_type; 641 642 *media_stream = &object->IAMMediaStream_iface; 643 644 return S_OK; |
645 646out_object: 647 HeapFree(GetProcessHeap(), 0, object); 648 649 return hr; |
|
446} 447 | 650} 651 |
652struct AudioMediaStreamImpl; 653 |
|
448typedef struct { | 654typedef struct { |
655 BaseInputPin pin; 656 struct AudioMediaStreamImpl *parent; 657} AudioMediaStreamInputPin; 658 659typedef struct AudioMediaStreamImpl { |
|
449 IAMMediaStream IAMMediaStream_iface; 450 IAudioMediaStream IAudioMediaStream_iface; 451 LONG ref; 452 IMultiMediaStream* parent; 453 MSPID purpose_id; 454 STREAM_TYPE stream_type; | 660 IAMMediaStream IAMMediaStream_iface; 661 IAudioMediaStream IAudioMediaStream_iface; 662 LONG ref; 663 IMultiMediaStream* parent; 664 MSPID purpose_id; 665 STREAM_TYPE stream_type; |
666 AudioMediaStreamInputPin *input_pin; 667 CRITICAL_SECTION critical_section; |
|
455} AudioMediaStreamImpl; 456 457static inline AudioMediaStreamImpl *impl_from_AudioMediaStream_IAMMediaStream(IAMMediaStream *iface) 458{ 459 return CONTAINING_RECORD(iface, AudioMediaStreamImpl, IAMMediaStream_iface); 460} 461 462/*** IUnknown methods ***/ --- 13 unchanged lines hidden (view full) --- 476 return S_OK; 477 } 478 else if (IsEqualGUID(riid, &IID_IAudioMediaStream)) 479 { 480 IAMMediaStream_AddRef(iface); 481 *ret_iface = &This->IAudioMediaStream_iface; 482 return S_OK; 483 } | 668} AudioMediaStreamImpl; 669 670static inline AudioMediaStreamImpl *impl_from_AudioMediaStream_IAMMediaStream(IAMMediaStream *iface) 671{ 672 return CONTAINING_RECORD(iface, AudioMediaStreamImpl, IAMMediaStream_iface); 673} 674 675/*** IUnknown methods ***/ --- 13 unchanged lines hidden (view full) --- 689 return S_OK; 690 } 691 else if (IsEqualGUID(riid, &IID_IAudioMediaStream)) 692 { 693 IAMMediaStream_AddRef(iface); 694 *ret_iface = &This->IAudioMediaStream_iface; 695 return S_OK; 696 } |
697 else if (IsEqualGUID(riid, &IID_IPin)) 698 { 699 IAMMediaStream_AddRef(iface); 700 *ret_iface = &This->input_pin->pin.pin.IPin_iface; 701 return S_OK; 702 } 703 else if (IsEqualGUID(riid, &IID_IMemInputPin)) 704 { 705 IAMMediaStream_AddRef(iface); 706 *ret_iface = &This->input_pin->pin.IMemInputPin_iface; 707 return S_OK; 708 } |
|
484 485 ERR("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ret_iface); 486 return E_NOINTERFACE; 487} 488 489static ULONG WINAPI AudioMediaStreamImpl_IAMMediaStream_AddRef(IAMMediaStream *iface) 490{ 491 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface); --- 7 unchanged lines hidden (view full) --- 499static ULONG WINAPI AudioMediaStreamImpl_IAMMediaStream_Release(IAMMediaStream *iface) 500{ 501 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface); 502 ULONG ref = InterlockedDecrement(&This->ref); 503 504 TRACE("(%p/%p)->(): new ref = %u\n", iface, This, ref); 505 506 if (!ref) | 709 710 ERR("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ret_iface); 711 return E_NOINTERFACE; 712} 713 714static ULONG WINAPI AudioMediaStreamImpl_IAMMediaStream_AddRef(IAMMediaStream *iface) 715{ 716 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface); --- 7 unchanged lines hidden (view full) --- 724static ULONG WINAPI AudioMediaStreamImpl_IAMMediaStream_Release(IAMMediaStream *iface) 725{ 726 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface); 727 ULONG ref = InterlockedDecrement(&This->ref); 728 729 TRACE("(%p/%p)->(): new ref = %u\n", iface, This, ref); 730 731 if (!ref) |
732 { 733 BaseInputPin_Destroy((BaseInputPin *)This->input_pin); 734 DeleteCriticalSection(&This->critical_section); |
|
507 HeapFree(GetProcessHeap(), 0, This); | 735 HeapFree(GetProcessHeap(), 0, This); |
736 } |
|
508 509 return ref; 510} 511 512/*** IMediaStream methods ***/ 513static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_GetMultiMediaStream(IAMMediaStream *iface, 514 IMultiMediaStream** multi_media_stream) 515{ --- 92 unchanged lines hidden (view full) --- 608 609 return S_FALSE; 610} 611 612static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_JoinFilter(IAMMediaStream *iface, IMediaStreamFilter *media_stream_filter) 613{ 614 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface); 615 | 737 738 return ref; 739} 740 741/*** IMediaStream methods ***/ 742static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_GetMultiMediaStream(IAMMediaStream *iface, 743 IMultiMediaStream** multi_media_stream) 744{ --- 92 unchanged lines hidden (view full) --- 837 838 return S_FALSE; 839} 840 841static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_JoinFilter(IAMMediaStream *iface, IMediaStreamFilter *media_stream_filter) 842{ 843 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface); 844 |
616 FIXME("(%p/%p)->(%p) stub!\n", This, iface, media_stream_filter); | 845 TRACE("(%p/%p)->(%p)\n", This, iface, media_stream_filter); |
617 | 846 |
618 return S_FALSE; | 847 This->input_pin->pin.pin.pinInfo.pFilter = (IBaseFilter *)media_stream_filter; 848 849 return S_OK; |
619} 620 621static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_JoinFilterGraph(IAMMediaStream *iface, IFilterGraph *filtergraph) 622{ 623 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface); 624 625 FIXME("(%p/%p)->(%p) stub!\n", This, iface, filtergraph); 626 --- 171 unchanged lines hidden (view full) --- 798 AudioMediaStreamImpl_IAudioMediaStream_CreateSharedSample, 799 AudioMediaStreamImpl_IAudioMediaStream_SendEndOfStream, 800 /*** IAudioMediaStream methods ***/ 801 AudioMediaStreamImpl_IAudioMediaStream_GetFormat, 802 AudioMediaStreamImpl_IAudioMediaStream_SetFormat, 803 AudioMediaStreamImpl_IAudioMediaStream_CreateSample 804}; 805 | 850} 851 852static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_JoinFilterGraph(IAMMediaStream *iface, IFilterGraph *filtergraph) 853{ 854 AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface); 855 856 FIXME("(%p/%p)->(%p) stub!\n", This, iface, filtergraph); 857 --- 171 unchanged lines hidden (view full) --- 1029 AudioMediaStreamImpl_IAudioMediaStream_CreateSharedSample, 1030 AudioMediaStreamImpl_IAudioMediaStream_SendEndOfStream, 1031 /*** IAudioMediaStream methods ***/ 1032 AudioMediaStreamImpl_IAudioMediaStream_GetFormat, 1033 AudioMediaStreamImpl_IAudioMediaStream_SetFormat, 1034 AudioMediaStreamImpl_IAudioMediaStream_CreateSample 1035}; 1036 |
1037static inline AudioMediaStreamInputPin *impl_from_AudioMediaStreamInputPin_IPin(IPin *iface) 1038{ 1039 return CONTAINING_RECORD(iface, AudioMediaStreamInputPin, pin.pin.IPin_iface); 1040} 1041 1042/*** IUnknown methods ***/ 1043static HRESULT WINAPI AudioMediaStreamInputPin_IPin_QueryInterface(IPin *iface, REFIID riid, void **ret_iface) 1044{ 1045 AudioMediaStreamInputPin *This = impl_from_AudioMediaStreamInputPin_IPin(iface); 1046 1047 return IAMMediaStream_QueryInterface(&This->parent->IAMMediaStream_iface, riid, ret_iface); 1048} 1049 1050static ULONG WINAPI AudioMediaStreamInputPin_IPin_AddRef(IPin *iface) 1051{ 1052 AudioMediaStreamInputPin *This = impl_from_AudioMediaStreamInputPin_IPin(iface); 1053 1054 return IAMMediaStream_AddRef(&This->parent->IAMMediaStream_iface); 1055} 1056 1057static ULONG WINAPI AudioMediaStreamInputPin_IPin_Release(IPin *iface) 1058{ 1059 AudioMediaStreamInputPin *This = impl_from_AudioMediaStreamInputPin_IPin(iface); 1060 1061 return IAMMediaStream_Release(&This->parent->IAMMediaStream_iface); 1062} 1063 1064static const IPinVtbl AudioMediaStreamInputPin_IPin_Vtbl = 1065{ 1066 AudioMediaStreamInputPin_IPin_QueryInterface, 1067 AudioMediaStreamInputPin_IPin_AddRef, 1068 AudioMediaStreamInputPin_IPin_Release, 1069 BaseInputPinImpl_Connect, 1070 BaseInputPinImpl_ReceiveConnection, 1071 BasePinImpl_Disconnect, 1072 BasePinImpl_ConnectedTo, 1073 BasePinImpl_ConnectionMediaType, 1074 BasePinImpl_QueryPinInfo, 1075 BasePinImpl_QueryDirection, 1076 BasePinImpl_QueryId, 1077 BaseInputPinImpl_QueryAccept, 1078 BasePinImpl_EnumMediaTypes, 1079 BasePinImpl_QueryInternalConnections, 1080 BaseInputPinImpl_EndOfStream, 1081 BaseInputPinImpl_BeginFlush, 1082 BaseInputPinImpl_EndFlush, 1083 BaseInputPinImpl_NewSegment, 1084}; 1085 1086static HRESULT WINAPI AudioMediaStreamInputPin_CheckMediaType(BasePin *base, const AM_MEDIA_TYPE *media_type) 1087{ 1088 AudioMediaStreamInputPin *This = impl_from_AudioMediaStreamInputPin_IPin(&base->IPin_iface); 1089 1090 TRACE("(%p)->(%p)\n", This, media_type); 1091 1092 if (IsEqualGUID(&media_type->majortype, &MEDIATYPE_Audio)) 1093 { 1094 if (IsEqualGUID(&media_type->subtype, &MEDIASUBTYPE_PCM)) 1095 { 1096 TRACE("Audio sub-type %s matches\n", debugstr_guid(&media_type->subtype)); 1097 return S_OK; 1098 } 1099 } 1100 1101 return S_OK; 1102} 1103 1104static LONG WINAPI AudioMediaStreamInputPin_GetMediaTypeVersion(BasePin *base) 1105{ 1106 return 0; 1107} 1108 1109static HRESULT WINAPI AudioMediaStreamInputPin_GetMediaType(BasePin *base, int index, AM_MEDIA_TYPE *media_type) 1110{ 1111 AudioMediaStreamInputPin *This = impl_from_AudioMediaStreamInputPin_IPin(&base->IPin_iface); 1112 1113 TRACE("(%p)->(%d,%p)\n", This, index, media_type); 1114 1115 /* FIXME: Reset structure as we only fill majortype and minortype for now */ 1116 ZeroMemory(media_type, sizeof(*media_type)); 1117 1118 if (index) 1119 return S_FALSE; 1120 1121 media_type->majortype = MEDIATYPE_Audio; 1122 media_type->subtype = MEDIASUBTYPE_PCM; 1123 1124 return S_OK; 1125} 1126 1127static HRESULT WINAPI AudioMediaStreamInputPin_Receive(BaseInputPin *base, IMediaSample *sample) 1128{ 1129 AudioMediaStreamInputPin *This = impl_from_AudioMediaStreamInputPin_IPin(&base->pin.IPin_iface); 1130 1131 FIXME("(%p)->(%p) stub!\n", This, sample); 1132 1133 return E_NOTIMPL; 1134} 1135 1136static const BaseInputPinFuncTable AudioMediaStreamInputPin_FuncTable = 1137{ 1138 { 1139 AudioMediaStreamInputPin_CheckMediaType, 1140 NULL, 1141 AudioMediaStreamInputPin_GetMediaTypeVersion, 1142 AudioMediaStreamInputPin_GetMediaType, 1143 }, 1144 AudioMediaStreamInputPin_Receive, 1145}; 1146 |
|
806HRESULT audiomediastream_create(IMultiMediaStream *parent, const MSPID *purpose_id, 807 STREAM_TYPE stream_type, IAMMediaStream **media_stream) 808{ 809 AudioMediaStreamImpl *object; | 1147HRESULT audiomediastream_create(IMultiMediaStream *parent, const MSPID *purpose_id, 1148 STREAM_TYPE stream_type, IAMMediaStream **media_stream) 1149{ 1150 AudioMediaStreamImpl *object; |
1151 PIN_INFO pin_info; 1152 HRESULT hr; |
|
810 811 TRACE("(%p,%s,%p)\n", parent, debugstr_guid(purpose_id), media_stream); 812 813 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(AudioMediaStreamImpl)); 814 if (!object) 815 return E_OUTOFMEMORY; 816 817 object->IAMMediaStream_iface.lpVtbl = &AudioMediaStreamImpl_IAMMediaStream_Vtbl; 818 object->IAudioMediaStream_iface.lpVtbl = &AudioMediaStreamImpl_IAudioMediaStream_Vtbl; 819 object->ref = 1; 820 | 1153 1154 TRACE("(%p,%s,%p)\n", parent, debugstr_guid(purpose_id), media_stream); 1155 1156 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(AudioMediaStreamImpl)); 1157 if (!object) 1158 return E_OUTOFMEMORY; 1159 1160 object->IAMMediaStream_iface.lpVtbl = &AudioMediaStreamImpl_IAMMediaStream_Vtbl; 1161 object->IAudioMediaStream_iface.lpVtbl = &AudioMediaStreamImpl_IAudioMediaStream_Vtbl; 1162 object->ref = 1; 1163 |
1164 InitializeCriticalSection(&object->critical_section); 1165 1166 pin_info.pFilter = NULL; 1167 pin_info.dir = PINDIR_INPUT; 1168 pin_info.achName[0] = 'I'; 1169 StringFromGUID2(purpose_id, pin_info.achName + 1, MAX_PIN_NAME - 1); 1170 hr = BaseInputPin_Construct(&AudioMediaStreamInputPin_IPin_Vtbl, 1171 sizeof(AudioMediaStreamInputPin), &pin_info, &AudioMediaStreamInputPin_FuncTable, 1172 &object->critical_section, NULL, (IPin **)&object->input_pin); 1173 if (FAILED(hr)) 1174 goto out_object; 1175 1176 object->input_pin->parent = object; 1177 |
|
821 object->parent = parent; 822 object->purpose_id = *purpose_id; 823 object->stream_type = stream_type; 824 825 *media_stream = &object->IAMMediaStream_iface; 826 827 return S_OK; | 1178 object->parent = parent; 1179 object->purpose_id = *purpose_id; 1180 object->stream_type = stream_type; 1181 1182 *media_stream = &object->IAMMediaStream_iface; 1183 1184 return S_OK; |
1185 1186out_object: 1187 HeapFree(GetProcessHeap(), 0, object); 1188 1189 return hr; |
|
828} 829 830typedef struct { 831 IDirectDrawStreamSample IDirectDrawStreamSample_iface; 832 LONG ref; 833 IMediaStream *parent; 834 IDirectDrawSurface *surface; 835 RECT rect; --- 77 unchanged lines hidden (view full) --- 913 return E_NOTIMPL; 914} 915 916static HRESULT WINAPI IDirectDrawStreamSampleImpl_Update(IDirectDrawStreamSample *iface, DWORD flags, HANDLE event, 917 PAPCFUNC func_APC, DWORD APC_data) 918{ 919 FIXME("(%p)->(%x,%p,%p,%u): stub\n", iface, flags, event, func_APC, APC_data); 920 | 1190} 1191 1192typedef struct { 1193 IDirectDrawStreamSample IDirectDrawStreamSample_iface; 1194 LONG ref; 1195 IMediaStream *parent; 1196 IDirectDrawSurface *surface; 1197 RECT rect; --- 77 unchanged lines hidden (view full) --- 1275 return E_NOTIMPL; 1276} 1277 1278static HRESULT WINAPI IDirectDrawStreamSampleImpl_Update(IDirectDrawStreamSample *iface, DWORD flags, HANDLE event, 1279 PAPCFUNC func_APC, DWORD APC_data) 1280{ 1281 FIXME("(%p)->(%x,%p,%p,%u): stub\n", iface, flags, event, func_APC, APC_data); 1282 |
921 return E_NOTIMPL; | 1283 return S_OK; |
922} 923 924static HRESULT WINAPI IDirectDrawStreamSampleImpl_CompletionStatus(IDirectDrawStreamSample *iface, DWORD flags, DWORD milliseconds) 925{ 926 FIXME("(%p)->(%x,%u): stub\n", iface, flags, milliseconds); 927 928 return E_NOTIMPL; 929} --- 257 unchanged lines hidden --- | 1284} 1285 1286static HRESULT WINAPI IDirectDrawStreamSampleImpl_CompletionStatus(IDirectDrawStreamSample *iface, DWORD flags, DWORD milliseconds) 1287{ 1288 FIXME("(%p)->(%x,%u): stub\n", iface, flags, milliseconds); 1289 1290 return E_NOTIMPL; 1291} --- 257 unchanged lines hidden --- |