4 * Copyright 2003 Robert Shearman
5 * Copyright 2004-2005 Christian Costa
6 * Copyright 2007 Chris Robinson
7 * Copyright 2008 Maarten Lankhorst
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
27 #include "quartz_private.h"
36 #include "wine/unicode.h"
37 #include "wine/debug.h"
41 WINE_DEFAULT_DEBUG_CHANNEL(quartz);
43 #define SEQUENCE_HEADER_CODE 0xB3
44 #define PACK_START_CODE 0xBA
46 #define SYSTEM_START_CODE 0xBB
47 #define AUDIO_ELEMENTARY_STREAM 0xC0
48 #define VIDEO_ELEMENTARY_STREAM 0xE0
50 #define MPEG_SYSTEM_HEADER 3
51 #define MPEG_VIDEO_HEADER 2
52 #define MPEG_AUDIO_HEADER 1
53 #define MPEG_NO_HEADER 0
55 typedef struct MPEGSplitterImpl
63 /* Whether we just seeked (or started playing) */
67 static inline MPEGSplitterImpl *impl_from_IMediaSeeking( IMediaSeeking *iface )
69 return CONTAINING_RECORD(iface, MPEGSplitterImpl, Parser.sourceSeeking.IMediaSeeking_iface);
72 static int MPEGSplitter_head_check(const BYTE *header)
74 /* If this is a possible start code, check for a system or video header */
75 if (header[0] == 0 && header[1] == 0 && header[2] == 1)
77 /* Check if we got a system or elementary stream start code */
78 if (header[3] == PACK_START_CODE ||
79 header[3] == VIDEO_ELEMENTARY_STREAM ||
80 header[3] == AUDIO_ELEMENTARY_STREAM)
81 return MPEG_SYSTEM_HEADER;
83 /* Check for a MPEG video sequence start code */
84 if (header[3] == SEQUENCE_HEADER_CODE)
85 return MPEG_VIDEO_HEADER;
88 /* This should give a good guess if we have an MPEG audio header */
89 if(header[0] == 0xff && ((header[1]>>5)&0x7) == 0x7 &&
90 ((header[1]>>1)&0x3) != 0 && ((header[2]>>4)&0xf) != 0xf &&
91 ((header[2]>>2)&0x3) != 0x3)
92 return MPEG_AUDIO_HEADER;
95 return MPEG_NO_HEADER;
98 static const WCHAR wszAudioStream[] = {'A','u','d','i','o',0};
99 static const WCHAR wszVideoStream[] = {'V','i','d','e','o',0};
101 static const DWORD freqs[10] = { 44100, 48000, 32000, 22050, 24000, 16000, 11025, 12000, 8000, 0 };
103 static const DWORD tabsel_123[2][3][16] = {
104 { {0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,},
105 {0,32,48,56, 64, 80, 96,112,128,160,192,224,256,320,384,},
106 {0,32,40,48, 56, 64, 80, 96,112,128,160,192,224,256,320,} },
108 { {0,32,48,56,64,80,96,112,128,144,160,176,192,224,256,},
109 {0,8,16,24,32,40,48,56,64,80,96,112,128,144,160,},
110 {0,8,16,24,32,40,48,56,64,80,96,112,128,144,160,} }
113 static HRESULT parse_header(BYTE *header, LONGLONG *plen, LONGLONG *pduration)
115 int bitrate_index, freq_index, lsf = 1, mpeg1, layer, padding, bitrate, length;
118 if (!(header[0] == 0xff && ((header[1]>>5)&0x7) == 0x7 &&
119 ((header[1]>>1)&0x3) != 0 && ((header[2]>>4)&0xf) != 0xf &&
120 ((header[2]>>2)&0x3) != 0x3))
122 FIXME("Not a valid header: %02x:%02x:%02x:%02x\n", header[0], header[1], header[2], header[3]);
126 mpeg1 = (header[1]>>4)&0x1;
128 lsf = ((header[1]>>3)&0x1)^1;
130 layer = 4-((header[1]>>1)&0x3);
131 bitrate_index = ((header[2]>>4)&0xf);
132 freq_index = ((header[2]>>2)&0x3) + (mpeg1?(lsf*3):6);
133 padding = ((header[2]>>1)&0x1);
135 bitrate = tabsel_123[lsf][layer-1][bitrate_index] * 1000;
138 FIXME("Not a valid header: %02x:%02x:%02x:%02x\n", header[0], header[1], header[2], header[3]);
143 length = 4 * (12 * bitrate / freqs[freq_index] + padding);
145 length = 144 * bitrate / freqs[freq_index] + padding;
147 length = 144 * bitrate / (freqs[freq_index]<<lsf) + padding;
150 ERR("Impossible layer %d\n", layer);
154 duration = (ULONGLONG)10000000 * (ULONGLONG)(length) / (ULONGLONG)(bitrate/8);
157 *pduration += duration;
161 static HRESULT FillBuffer(MPEGSplitterImpl *This, IMediaSample *pCurrentSample)
163 Parser_OutputPin * pOutputPin = unsafe_impl_Parser_OutputPin_from_IPin(This->Parser.ppPins[1]);
165 LONGLONG pos = BYTES_FROM_MEDIATIME(This->Parser.pInputPin->rtNext);
166 LONGLONG time = This->position, rtstop, rtstart;
169 DWORD len = IMediaSample_GetActualDataLength(pCurrentSample);
171 TRACE("Source length: %u\n", len);
172 IMediaSample_GetPointer(pCurrentSample, &fbuf);
174 /* Find the next valid header.. it <SHOULD> be right here */
175 hr = parse_header(fbuf, &length, &This->position);
177 IMediaSample_SetActualDataLength(pCurrentSample, length);
179 /* Queue the next sample */
180 if (length + 4 == len)
182 PullPin *pin = This->Parser.pInputPin;
183 LONGLONG stop = BYTES_FROM_MEDIATIME(pin->rtStop);
186 memcpy(This->header, fbuf + length, 4);
187 while (FAILED(hr = parse_header(This->header, &length, NULL)))
189 memmove(This->header, This->header+1, 3);
192 IAsyncReader_SyncRead(pin->pReader, ++pos, 1, This->header + 3);
194 pin->rtNext = MEDIATIME_FROM_BYTES(pos);
198 /* Remove 4 for the last header, which should hopefully work */
199 IMediaSample *sample = NULL;
200 LONGLONG rtSampleStart = pin->rtNext - MEDIATIME_FROM_BYTES(4);
201 LONGLONG rtSampleStop = rtSampleStart + MEDIATIME_FROM_BYTES(length + 4);
203 if (rtSampleStop > pin->rtStop)
204 rtSampleStop = MEDIATIME_FROM_BYTES(ALIGNUP(BYTES_FROM_MEDIATIME(pin->rtStop), pin->cbAlign));
206 hr = IMemAllocator_GetBuffer(pin->pAlloc, &sample, NULL, NULL, 0);
209 IMediaSample_SetTime(sample, &rtSampleStart, &rtSampleStop);
210 IMediaSample_SetPreroll(sample, 0);
211 IMediaSample_SetDiscontinuity(sample, 0);
212 IMediaSample_SetSyncPoint(sample, 1);
213 hr = IAsyncReader_Request(pin->pReader, sample, 0);
216 pin->rtCurrent = rtSampleStart;
217 pin->rtNext = rtSampleStop;
220 IMediaSample_Release(sample);
223 FIXME("o_Ox%08x\n", hr);
226 /* If not, we're presumably at the end of file */
228 TRACE("Media time : %u.%03u\n", (DWORD)(This->position/10000000), (DWORD)((This->position/10000)%1000));
230 if (IMediaSample_IsDiscontinuity(pCurrentSample) == S_OK) {
232 EnterCriticalSection(&This->Parser.filter.csFilter);
233 pOutputPin->pin.pin.tStart = time;
234 pOutputPin->pin.pin.dRate = This->Parser.sourceSeeking.dRate;
235 hr = IPin_ConnectedTo(&pOutputPin->pin.pin.IPin_iface, &victim);
238 hr = IPin_NewSegment(victim, time, This->Parser.sourceSeeking.llStop,
239 This->Parser.sourceSeeking.dRate);
241 FIXME("NewSegment returns %08x\n", hr);
242 IPin_Release(victim);
244 LeaveCriticalSection(&This->Parser.filter.csFilter);
248 rtstart = (double)(time - pOutputPin->pin.pin.tStart) / pOutputPin->pin.pin.dRate;
249 rtstop = (double)(This->position - pOutputPin->pin.pin.tStart) / pOutputPin->pin.pin.dRate;
250 IMediaSample_SetTime(pCurrentSample, &rtstart, &rtstop);
251 IMediaSample_SetMediaTime(pCurrentSample, &time, &This->position);
253 hr = BaseOutputPinImpl_Deliver(&pOutputPin->pin, pCurrentSample);
258 TRACE("Error sending sample (%x)\n", hr);
260 TRACE("S_FALSE (%d), holding\n", IMediaSample_GetActualDataLength(pCurrentSample));
267 static HRESULT MPEGSplitter_process_sample(LPVOID iface, IMediaSample * pSample, DWORD_PTR cookie)
269 MPEGSplitterImpl *This = iface;
271 DWORD cbSrcStream = 0;
272 REFERENCE_TIME tStart, tStop, tAviStart = This->position;
275 hr = IMediaSample_GetTime(pSample, &tStart, &tStop);
278 cbSrcStream = IMediaSample_GetActualDataLength(pSample);
279 hr = IMediaSample_GetPointer(pSample, &pbSrcStream);
282 /* Flush occurring */
283 if (cbSrcStream == 0)
285 FIXME(".. Why do I need you?\n");
289 /* trace removed for performance reasons */
290 /* TRACE("(%p), %llu -> %llu\n", pSample, tStart, tStop); */
292 /* Now, try to find a new header */
293 hr = FillBuffer(This, pSample);
296 WARN("Failed with hres: %08x!\n", hr);
298 /* Unset progression if denied! */
299 if (hr == VFW_E_WRONG_STATE || hr == S_FALSE)
301 memcpy(This->header, pbSrcStream, 4);
302 This->Parser.pInputPin->rtCurrent = tStart;
303 This->position = tAviStart;
307 if (BYTES_FROM_MEDIATIME(tStop) >= This->EndOfFile || This->position >= This->Parser.sourceSeeking.llStop)
311 TRACE("End of file reached\n");
313 for (i = 0; i < This->Parser.cStreams; i++)
317 hr = IPin_ConnectedTo(This->Parser.ppPins[i+1], &ppin);
320 hr = IPin_EndOfStream(ppin);
324 WARN("Error sending EndOfStream to pin %u (%x)\n", i, hr);
327 /* Force the pullpin thread to stop */
335 static HRESULT MPEGSplitter_query_accept(LPVOID iface, const AM_MEDIA_TYPE *pmt)
337 if (!IsEqualIID(&pmt->majortype, &MEDIATYPE_Stream))
340 if (IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_MPEG1Audio))
343 if (IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_MPEG1Video))
344 FIXME("MPEG-1 video streams not yet supported.\n");
345 else if (IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_MPEG1System))
346 FIXME("MPEG-1 system streams not yet supported.\n");
347 else if (IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_MPEG1VideoCD))
348 FIXME("MPEG-1 VideoCD streams not yet supported.\n");
349 else FIXME("%s\n", debugstr_guid(&pmt->subtype));
355 static HRESULT MPEGSplitter_init_audio(MPEGSplitterImpl *This, const BYTE *header, PIN_INFO *ppiOutput, AM_MEDIA_TYPE *pamt)
357 WAVEFORMATEX *format;
367 ZeroMemory(pamt, sizeof(*pamt));
368 ppiOutput->dir = PINDIR_OUTPUT;
369 ppiOutput->pFilter = (IBaseFilter*)This;
370 wsprintfW(ppiOutput->achName, wszAudioStream);
372 pamt->formattype = FORMAT_WaveFormatEx;
373 pamt->majortype = MEDIATYPE_Audio;
374 pamt->subtype = MEDIASUBTYPE_MPEG1AudioPayload;
376 pamt->lSampleSize = 0;
377 pamt->bFixedSizeSamples = FALSE;
378 pamt->bTemporalCompression = 0;
380 mpeg1 = (header[1]>>4)&0x1;
382 lsf = ((header[1]>>3)&0x1)^1;
384 layer = 4-((header[1]>>1)&0x3);
385 bitrate_index = ((header[2]>>4)&0xf);
386 freq_index = ((header[2]>>2)&0x3) + (mpeg1?(lsf*3):6);
387 mode = ((header[3]>>6)&0x3);
388 mode_ext = ((header[3]>>4)&0x3);
389 emphasis = ((header[3]>>0)&0x3);
393 /* Set to highest bitrate so samples will fit in for sure */
394 FIXME("Variable-bitrate audio not fully supported.\n");
398 pamt->cbFormat = ((layer==3)? sizeof(MPEGLAYER3WAVEFORMAT) :
399 sizeof(MPEG1WAVEFORMAT));
400 pamt->pbFormat = CoTaskMemAlloc(pamt->cbFormat);
402 return E_OUTOFMEMORY;
403 ZeroMemory(pamt->pbFormat, pamt->cbFormat);
404 format = (WAVEFORMATEX*)pamt->pbFormat;
406 format->wFormatTag = ((layer == 3) ? WAVE_FORMAT_MPEGLAYER3 :
408 format->nChannels = ((mode == 3) ? 1 : 2);
409 format->nSamplesPerSec = freqs[freq_index];
410 format->nAvgBytesPerSec = tabsel_123[lsf][layer-1][bitrate_index] * 1000 / 8;
413 format->nBlockAlign = format->nAvgBytesPerSec * 8 * 144 /
414 (format->nSamplesPerSec<<lsf) + 1;
416 format->nBlockAlign = format->nAvgBytesPerSec * 8 * 144 /
417 format->nSamplesPerSec + 1;
419 format->nBlockAlign = 4 * (format->nAvgBytesPerSec * 8 * 12 / format->nSamplesPerSec + 1);
421 format->wBitsPerSample = 0;
425 MPEGLAYER3WAVEFORMAT *mp3format = (MPEGLAYER3WAVEFORMAT*)format;
427 format->cbSize = MPEGLAYER3_WFX_EXTRA_BYTES;
429 mp3format->wID = MPEGLAYER3_ID_MPEG;
430 mp3format->fdwFlags = MPEGLAYER3_FLAG_PADDING_ON;
431 mp3format->nBlockSize = format->nBlockAlign;
432 mp3format->nFramesPerBlock = 1;
434 /* Beware the evil magic numbers. This struct is apparently horribly
435 * under-documented, and the only references I could find had it being
436 * set to this with no real explanation. It works fine though, so I'm
437 * not complaining (yet).
439 mp3format->nCodecDelay = 1393;
443 MPEG1WAVEFORMAT *mpgformat = (MPEG1WAVEFORMAT*)format;
447 mpgformat->fwHeadLayer = ((layer == 1) ? ACM_MPEG_LAYER1 :
448 ((layer == 2) ? ACM_MPEG_LAYER2 :
450 mpgformat->dwHeadBitrate = format->nAvgBytesPerSec * 8;
451 mpgformat->fwHeadMode = ((mode == 3) ? ACM_MPEG_SINGLECHANNEL :
452 ((mode == 2) ? ACM_MPEG_DUALCHANNEL :
453 ((mode == 1) ? ACM_MPEG_JOINTSTEREO :
455 mpgformat->fwHeadModeExt = ((mode == 1) ? 0x0F : (1<<mode_ext));
456 mpgformat->wHeadEmphasis = emphasis + 1;
457 mpgformat->fwHeadFlags = ACM_MPEG_ID_MPEG1;
459 pamt->subtype.Data1 = format->wFormatTag;
461 TRACE("MPEG audio stream detected:\n"
464 "\tChannels: %d (%d)\n"
465 "\tBytesPerSec: %d\n",
466 layer, format->wFormatTag, format->nSamplesPerSec,
467 format->nChannels, mode, format->nAvgBytesPerSec);
469 dump_AM_MEDIA_TYPE(pamt);
475 static HRESULT MPEGSplitter_pre_connect(IPin *iface, IPin *pConnectPin, ALLOCATOR_PROPERTIES *props)
477 PullPin *pPin = impl_PullPin_from_IPin(iface);
478 MPEGSplitterImpl *This = (MPEGSplitterImpl*)pPin->pin.pinInfo.pFilter;
480 LONGLONG pos = 0; /* in bytes */
483 LONGLONG total, avail;
487 IAsyncReader_Length(pPin->pReader, &total, &avail);
488 This->EndOfFile = total;
490 hr = IAsyncReader_SyncRead(pPin->pReader, pos, 4, header);
494 /* Skip ID3 v2 tag, if any */
495 if (SUCCEEDED(hr) && !memcmp("ID3", header, 3))
498 hr = IAsyncReader_SyncRead(pPin->pReader, pos, 6, header + 4);
502 TRACE("Found ID3 v2.%d.%d\n", header[3], header[4]);
503 if(header[3] <= 4 && header[4] != 0xff &&
504 (header[5]&0x0f) == 0 && (header[6]&0x80) == 0 &&
505 (header[7]&0x80) == 0 && (header[8]&0x80) == 0 &&
506 (header[9]&0x80) == 0)
508 length = (header[6]<<21) | (header[7]<<14) |
509 (header[8]<< 7) | (header[9] );
512 TRACE("Length: %u\n", length);
516 /* Read the real header for the mpeg splitter */
517 hr = IAsyncReader_SyncRead(pPin->pReader, pos, 4, header);
520 TRACE("%x:%x:%x:%x\n", header[0], header[1], header[2], header[3]);
523 while(SUCCEEDED(hr) && !(streamtype=MPEGSplitter_head_check(header)))
525 TRACE("%x:%x:%x:%x\n", header[0], header[1], header[2], header[3]);
526 /* No valid header yet; shift by a byte and check again */
527 memmove(header, header+1, 3);
528 hr = IAsyncReader_SyncRead(pPin->pReader, pos++, 1, header + 3);
533 This->begin_offset = pos;
534 memcpy(This->header, header, 4);
538 case MPEG_AUDIO_HEADER:
540 LONGLONG duration = 0;
541 WAVEFORMATEX *format;
543 hr = MPEGSplitter_init_audio(This, header, &piOutput, &amt);
546 format = (WAVEFORMATEX*)amt.pbFormat;
550 /* Make the output buffer a multiple of the frame size */
551 props->cbBuffer = 0x4000 / format->nBlockAlign *
554 hr = Parser_AddPin(&(This->Parser), &piOutput, props, &amt);
560 CoTaskMemFree(amt.pbFormat);
561 ERR("Could not create pin for MPEG audio stream (%x)\n", hr);
565 /* Check for idv1 tag, and remove it from stream if found */
566 hr = IAsyncReader_SyncRead(pPin->pReader, This->EndOfFile-128, 3, header);
569 if (!strncmp((char*)header, "TAG", 3))
570 This->EndOfFile -= 128;
571 This->Parser.pInputPin->rtStop = MEDIATIME_FROM_BYTES(This->EndOfFile);
572 This->Parser.pInputPin->rtStart = This->Parser.pInputPin->rtCurrent = MEDIATIME_FROM_BYTES(This->begin_offset);
574 duration = (This->EndOfFile-This->begin_offset) * 10000000 / format->nAvgBytesPerSec;
575 TRACE("Duration: %d seconds\n", (DWORD)(duration / 10000000));
577 This->Parser.sourceSeeking.llCurrent = 0;
578 This->Parser.sourceSeeking.llDuration = duration;
579 This->Parser.sourceSeeking.llStop = duration;
582 case MPEG_VIDEO_HEADER:
583 FIXME("MPEG video processing not yet supported!\n");
586 case MPEG_SYSTEM_HEADER:
587 FIXME("MPEG system streams not yet supported!\n");
599 static HRESULT MPEGSplitter_cleanup(LPVOID iface)
601 MPEGSplitterImpl *This = iface;
603 TRACE("(%p)\n", This);
608 static HRESULT WINAPI MPEGSplitter_seek(IMediaSeeking *iface)
610 MPEGSplitterImpl *This = impl_from_IMediaSeeking(iface);
611 PullPin *pPin = This->Parser.pInputPin;
612 LONGLONG newpos, timepos, bytepos;
613 HRESULT hr = E_INVALIDARG;
616 newpos = This->Parser.sourceSeeking.llCurrent;
617 if (This->position/1000000 == newpos/1000000)
619 TRACE("Requesting position %x%08x same as current position %x%08x\n", (DWORD)(newpos>>32), (DWORD)newpos, (DWORD)(This->position>>32), (DWORD)This->position);
623 bytepos = This->begin_offset;
625 /* http://mpgedit.org/mpgedit/mpeg_format/mpeghdr.htm has a whole read up on audio headers */
626 while (bytepos + 3 < This->EndOfFile)
628 LONGLONG duration = timepos;
630 hr = IAsyncReader_SyncRead(pPin->pReader, bytepos, 4, header);
633 while ((hr=parse_header(header, &length, &duration)) != S_OK &&
634 bytepos + 4 < This->EndOfFile)
636 /* No valid header yet; shift by a byte and check again */
637 memmove(header, header+1, 3);
638 hr = IAsyncReader_SyncRead(pPin->pReader, ++bytepos + 3, 1, header + 3);
642 if (hr != S_OK || duration > newpos)
650 PullPin *pin = This->Parser.pInputPin;
652 TRACE("Moving sound to %08u bytes!\n", (DWORD)bytepos);
654 EnterCriticalSection(&pin->thread_lock);
655 IPin_BeginFlush(&pin->pin.IPin_iface);
657 /* Make sure this is done while stopped, BeginFlush takes care of this */
658 EnterCriticalSection(&This->Parser.filter.csFilter);
659 memcpy(This->header, header, 4);
661 pin->rtStart = pin->rtCurrent = MEDIATIME_FROM_BYTES(bytepos);
662 pin->rtStop = MEDIATIME_FROM_BYTES((REFERENCE_TIME)This->EndOfFile);
664 This->position = newpos;
665 LeaveCriticalSection(&This->Parser.filter.csFilter);
667 TRACE("Done flushing\n");
668 IPin_EndFlush(&pin->pin.IPin_iface);
669 LeaveCriticalSection(&pin->thread_lock);
674 static HRESULT MPEGSplitter_disconnect(LPVOID iface)
676 /* TODO: Find memory leaks etc */
680 static HRESULT MPEGSplitter_first_request(LPVOID iface)
682 MPEGSplitterImpl *This = iface;
683 PullPin *pin = This->Parser.pInputPin;
686 IMediaSample *sample;
688 TRACE("Seeking? %d\n", This->seek);
690 hr = parse_header(This->header, &length, NULL);
693 if (pin->rtCurrent >= pin->rtStop)
695 /* Last sample has already been queued, request nothing more */
700 hr = IMemAllocator_GetBuffer(pin->pAlloc, &sample, NULL, NULL, 0);
702 pin->rtNext = pin->rtCurrent;
705 LONGLONG rtSampleStart = pin->rtNext;
706 /* Add 4 for the next header, which should hopefully work */
707 LONGLONG rtSampleStop = rtSampleStart + MEDIATIME_FROM_BYTES(length + 4);
709 if (rtSampleStop > pin->rtStop)
710 rtSampleStop = MEDIATIME_FROM_BYTES(ALIGNUP(BYTES_FROM_MEDIATIME(pin->rtStop), pin->cbAlign));
712 hr = IMediaSample_SetTime(sample, &rtSampleStart, &rtSampleStop);
714 IMediaSample_SetPreroll(sample, FALSE);
715 IMediaSample_SetDiscontinuity(sample, TRUE);
716 IMediaSample_SetSyncPoint(sample, 1);
719 hr = IAsyncReader_Request(pin->pReader, sample, 0);
722 pin->rtCurrent = pin->rtNext;
723 pin->rtNext = rtSampleStop;
726 IMediaSample_Release(sample);
729 ERR("Horsemen of the apocalypse came to bring error 0x%08x\n", hr);
734 static const IBaseFilterVtbl MPEGSplitter_Vtbl =
736 Parser_QueryInterface,
744 Parser_SetSyncSource,
745 Parser_GetSyncSource,
748 Parser_QueryFilterInfo,
749 Parser_JoinFilterGraph,
750 Parser_QueryVendorInfo
753 HRESULT MPEGSplitter_create(IUnknown * pUnkOuter, LPVOID * ppv)
755 MPEGSplitterImpl *This;
758 TRACE("(%p, %p)\n", pUnkOuter, ppv);
763 return CLASS_E_NOAGGREGATION;
765 This = CoTaskMemAlloc(sizeof(MPEGSplitterImpl));
767 return E_OUTOFMEMORY;
769 ZeroMemory(This, sizeof(MPEGSplitterImpl));
770 hr = Parser_Create(&(This->Parser), &MPEGSplitter_Vtbl, &CLSID_MPEG1Splitter, MPEGSplitter_process_sample, MPEGSplitter_query_accept, MPEGSplitter_pre_connect, MPEGSplitter_cleanup, MPEGSplitter_disconnect, MPEGSplitter_first_request, NULL, NULL, MPEGSplitter_seek, NULL);
778 /* Note: This memory is managed by the parser filter once created */