- Timestamp:
- Jun 13, 2011 11:48:37 AM (13 years ago)
- Location:
- pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-videodev
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-videodev/dshow_dev.c
r3580 r3582 54 54 IBaseFilter* SourceFilter_Create(SourceFilter **pSrc); 55 55 HRESULT SourceFilter_Deliver(SourceFilter *src, void *buf, long size); 56 void SourceFilter_Set BufferSize(SourceFilter *src, long size);56 void SourceFilter_SetMediaType(SourceFilter *src, AM_MEDIA_TYPE *pmt); 57 57 58 58 typedef struct dshow_fmt_info … … 66 66 {PJMEDIA_FORMAT_YUY2, &MEDIASUBTYPE_YUY2} , 67 67 {PJMEDIA_FORMAT_RGB24, &MEDIASUBTYPE_RGB24} , 68 //{PJMEDIA_FORMAT_RGB32, &MEDIASUBTYPE_RGB32} ,69 //{PJMEDIA_FORMAT_IYUV, &MEDIASUBTYPE_IYUV} ,68 {PJMEDIA_FORMAT_RGB32, &MEDIASUBTYPE_RGB32} , 69 {PJMEDIA_FORMAT_IYUV, &MEDIASUBTYPE_IYUV} , 70 70 }; 71 71 … … 675 675 mediatype->lSampleSize = DIBSIZE(video_info->bmiHeader); 676 676 if (graph->csource_filter) 677 SourceFilter_Set BufferSize(graph->csource_filter,678 mediatype->lSampleSize);677 SourceFilter_SetMediaType(graph->csource_filter, 678 mediatype); 679 679 680 680 hr = IFilterGraph_AddFilter(graph->filter_graph, -
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.