Changeset 3582 for pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-videodev/dshowclasses.cpp
- Timestamp:
- Jun 13, 2011 11:48:37 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-videodev/dshowclasses.cpp
r3470 r3582 22 22 #if PJMEDIA_VIDEO_DEV_HAS_DSHOW 23 23 24 #include <assert.h> 24 25 #include <streams.h> 25 26 … … 63 64 ALLOCATOR_PROPERTIES *ppropInputRequest); 64 65 66 CMediaType mediaType; 65 67 long bufSize; 66 68 }; … … 112 114 HRESULT hr; 113 115 IMediaSample *pSample; 116 VIDEOINFOHEADER *vi; 117 AM_MEDIA_TYPE *pmt; 114 118 BYTE *dst_buf; 115 119 … … 124 128 goto on_error; 125 129 130 pSample->GetMediaType(&pmt); 131 if (pmt) { 132 mediaType.Set(*pmt); 133 bufSize = pmt->lSampleSize; 134 } 135 126 136 pSample->GetPointer(&dst_buf); 127 memcpy(dst_buf, buf, size); 137 vi = (VIDEOINFOHEADER *)mediaType.pbFormat; 138 if (vi->rcSource.right == vi->bmiHeader.biWidth) { 139 assert(pSample->GetSize() >= size); 140 memcpy(dst_buf, buf, size); 141 } else { 142 unsigned i, bpp; 143 unsigned dststride, srcstride; 144 BYTE *src_buf = (BYTE *)buf; 145 146 bpp = size / abs(vi->bmiHeader.biHeight) / vi->rcSource.right; 147 dststride = vi->bmiHeader.biWidth * bpp; 148 srcstride = vi->rcSource.right * bpp; 149 for (i = abs(vi->bmiHeader.biHeight); i > 0; i--) { 150 memcpy(dst_buf, src_buf, srcstride); 151 dst_buf += dststride; 152 src_buf += srcstride; 153 } 154 } 128 155 pSample->SetActualDataLength(size); 129 156 … … 209 236 } 210 237 211 extern "C" void SourceFilter_SetBufferSize(SourceFilter *src, 212 long size) 213 { 214 ((OutputPin *)src->GetPin(0))->bufSize = size; 238 extern "C" void SourceFilter_SetMediaType(SourceFilter *src, 239 AM_MEDIA_TYPE *pmt) 240 { 241 ((OutputPin *)src->GetPin(0))->mediaType.Set(*pmt); 242 ((OutputPin *)src->GetPin(0))->bufSize = pmt->lSampleSize; 215 243 } 216 244
Note: See TracChangeset
for help on using the changeset viewer.