| Index: trunk/src/media/video/capture/win/sink_input_pin_win.cc
|
| ===================================================================
|
| --- trunk/src/media/video/capture/win/sink_input_pin_win.cc (revision 236934)
|
| +++ trunk/src/media/video/capture/win/sink_input_pin_win.cc (working copy)
|
| @@ -20,6 +20,8 @@
|
| SinkFilterObserver* observer)
|
| : observer_(observer),
|
| PinBase(filter) {
|
| + memset(&requested_capability_, 0, sizeof(requested_capability_));
|
| + memset(&resulting_capability_, 0, sizeof(resulting_capability_));
|
| }
|
|
|
| SinkInputPin::~SinkInputPin() {}
|
| @@ -36,9 +38,9 @@
|
| pvi->bmiHeader.biPlanes = 1;
|
| pvi->bmiHeader.biClrImportant = 0;
|
| pvi->bmiHeader.biClrUsed = 0;
|
| - if (requested_format_.frame_rate > 0) {
|
| - pvi->AvgTimePerFrame =
|
| - kSecondsToReferenceTime / requested_format_.frame_rate;
|
| + if (requested_capability_.frame_rate > 0) {
|
| + pvi->AvgTimePerFrame = kSecondsToReferenceTime /
|
| + requested_capability_.frame_rate;
|
| }
|
|
|
| media_type->majortype = MEDIATYPE_Video;
|
| @@ -49,28 +51,30 @@
|
| case 0: {
|
| pvi->bmiHeader.biCompression = MAKEFOURCC('I', '4', '2', '0');
|
| pvi->bmiHeader.biBitCount = 12; // bit per pixel
|
| - pvi->bmiHeader.biWidth = requested_format_.frame_size.width();
|
| - pvi->bmiHeader.biHeight = requested_format_.frame_size.height();
|
| - pvi->bmiHeader.biSizeImage =
|
| - requested_format_.frame_size.GetArea() * 3 / 2;
|
| + pvi->bmiHeader.biWidth = requested_capability_.width;
|
| + pvi->bmiHeader.biHeight = requested_capability_.height;
|
| + pvi->bmiHeader.biSizeImage = 3 * requested_capability_.height *
|
| + requested_capability_.width / 2;
|
| media_type->subtype = kMediaSubTypeI420;
|
| break;
|
| }
|
| case 1: {
|
| pvi->bmiHeader.biCompression = MAKEFOURCC('Y', 'U', 'Y', '2');
|
| pvi->bmiHeader.biBitCount = 16;
|
| - pvi->bmiHeader.biWidth = requested_format_.frame_size.width();
|
| - pvi->bmiHeader.biHeight = requested_format_.frame_size.height();
|
| - pvi->bmiHeader.biSizeImage = requested_format_.frame_size.GetArea() * 2;
|
| + pvi->bmiHeader.biWidth = requested_capability_.width;
|
| + pvi->bmiHeader.biHeight = requested_capability_.height;
|
| + pvi->bmiHeader.biSizeImage = 2 * requested_capability_.width *
|
| + requested_capability_.height;
|
| media_type->subtype = MEDIASUBTYPE_YUY2;
|
| break;
|
| }
|
| case 2: {
|
| pvi->bmiHeader.biCompression = BI_RGB;
|
| pvi->bmiHeader.biBitCount = 24;
|
| - pvi->bmiHeader.biWidth = requested_format_.frame_size.width();
|
| - pvi->bmiHeader.biHeight = requested_format_.frame_size.height();
|
| - pvi->bmiHeader.biSizeImage = requested_format_.frame_size.GetArea() * 3;
|
| + pvi->bmiHeader.biWidth = requested_capability_.width;
|
| + pvi->bmiHeader.biHeight = requested_capability_.height;
|
| + pvi->bmiHeader.biSizeImage = 3 * requested_capability_.height *
|
| + requested_capability_.width;
|
| media_type->subtype = MEDIASUBTYPE_RGB24;
|
| break;
|
| }
|
| @@ -100,27 +104,27 @@
|
| return false;
|
|
|
| // Store the incoming width and height.
|
| - resulting_format_.frame_size.SetSize(pvi->bmiHeader.biWidth,
|
| - abs(pvi->bmiHeader.biHeight));
|
| + resulting_capability_.width = pvi->bmiHeader.biWidth;
|
| + resulting_capability_.height = abs(pvi->bmiHeader.biHeight);
|
| if (pvi->AvgTimePerFrame > 0) {
|
| - resulting_format_.frame_rate =
|
| + resulting_capability_.frame_rate =
|
| static_cast<int>(kSecondsToReferenceTime / pvi->AvgTimePerFrame);
|
| } else {
|
| - resulting_format_.frame_rate = requested_format_.frame_rate;
|
| + resulting_capability_.frame_rate = requested_capability_.frame_rate;
|
| }
|
| if (sub_type == kMediaSubTypeI420 &&
|
| pvi->bmiHeader.biCompression == MAKEFOURCC('I', '4', '2', '0')) {
|
| - resulting_format_.pixel_format = PIXEL_FORMAT_I420;
|
| + resulting_capability_.color = PIXEL_FORMAT_I420;
|
| return true; // This format is acceptable.
|
| }
|
| if (sub_type == MEDIASUBTYPE_YUY2 &&
|
| pvi->bmiHeader.biCompression == MAKEFOURCC('Y', 'U', 'Y', '2')) {
|
| - resulting_format_.pixel_format = PIXEL_FORMAT_YUY2;
|
| + resulting_capability_.color = PIXEL_FORMAT_YUY2;
|
| return true; // This format is acceptable.
|
| }
|
| if (sub_type == MEDIASUBTYPE_RGB24 &&
|
| pvi->bmiHeader.biCompression == BI_RGB) {
|
| - resulting_format_.pixel_format = PIXEL_FORMAT_RGB24;
|
| + resulting_capability_.color = PIXEL_FORMAT_RGB24;
|
| return true; // This format is acceptable.
|
| }
|
| return false;
|
| @@ -136,15 +140,17 @@
|
| return S_OK;
|
| }
|
|
|
| -void SinkInputPin::SetRequestedMediaFormat(const VideoCaptureFormat& format) {
|
| - requested_format_ = format;
|
| - resulting_format_.frame_size.SetSize(0, 0);
|
| - resulting_format_.frame_rate = 0;
|
| - resulting_format_.pixel_format = PIXEL_FORMAT_UNKNOWN;
|
| +void SinkInputPin::SetRequestedMediaCapability(
|
| + const VideoCaptureCapability& capability) {
|
| + requested_capability_ = capability;
|
| + resulting_capability_.width = 0;
|
| + resulting_capability_.height = 0;
|
| + resulting_capability_.frame_rate = 0;
|
| + resulting_capability_.color = PIXEL_FORMAT_UNKNOWN;
|
| }
|
|
|
| -const VideoCaptureFormat& SinkInputPin::ResultingFormat() {
|
| - return resulting_format_;
|
| +const VideoCaptureCapability& SinkInputPin::ResultingCapability() {
|
| + return resulting_capability_;
|
| }
|
|
|
| } // namespace media
|
|
|