Skip to content
Snippets Groups Projects
Commit 7961f114 authored by Lyubomir Marinov's avatar Lyubomir Marinov
Browse files

Adds comments, braces.

parent 1aeb9af9
No related branches found
No related tags found
No related merge requests found
...@@ -157,9 +157,9 @@ public void outputVideoFrameWithSampleBuffer( ...@@ -157,9 +157,9 @@ public void outputVideoFrameWithSampleBuffer(
QTSampleBuffer sampleBuffer) QTSampleBuffer sampleBuffer)
{ {
captureOutputDidOutputVideoFrameWithSampleBuffer( captureOutputDidOutputVideoFrameWithSampleBuffer(
captureOutput, captureOutput,
videoFrame, videoFrame,
sampleBuffer); sampleBuffer);
} }
}); });
...@@ -314,13 +314,13 @@ protected Format doGetFormat() ...@@ -314,13 +314,13 @@ protected Format doGetFormat()
format format
= videoFormat.intersects( = videoFormat.intersects(
new VideoFormat( new VideoFormat(
null, /* encoding */ null,
new Dimension( new Dimension(
defaultSize.width, defaultSize.width,
defaultSize.height), defaultSize.height),
Format.NOT_SPECIFIED, /* maxDataLength */ Format.NOT_SPECIFIED,
Format.byteArray, /* dataType */ null,
Format.NOT_SPECIFIED)); /* frameRate */ Format.NOT_SPECIFIED));
} }
} }
} }
...@@ -361,34 +361,40 @@ private Format getCaptureOutputFormat() ...@@ -361,34 +361,40 @@ private Format getCaptureOutputFormat()
{ {
case CVPixelFormatType.kCVPixelFormatType_32ARGB: case CVPixelFormatType.kCVPixelFormatType_32ARGB:
if (captureOutputFormat instanceof AVFrameFormat) if (captureOutputFormat instanceof AVFrameFormat)
{
return return
new AVFrameFormat( new AVFrameFormat(
((width == 0) && (height == 0) ((width == 0) && (height == 0)
? null ? null
: new Dimension(width, height)), : new Dimension(width, height)),
Format.NOT_SPECIFIED, /* frameRate */ Format.NOT_SPECIFIED,
FFmpeg.PIX_FMT_ARGB, FFmpeg.PIX_FMT_ARGB,
CVPixelFormatType.kCVPixelFormatType_32ARGB); CVPixelFormatType.kCVPixelFormatType_32ARGB);
}
else else
{
return return
new RGBFormat( new RGBFormat(
((width == 0) && (height == 0) ((width == 0) && (height == 0)
? null ? null
: new Dimension(width, height)), : new Dimension(width, height)),
Format.NOT_SPECIFIED, /* maxDataLength */ Format.NOT_SPECIFIED,
Format.byteArray, Format.byteArray,
Format.NOT_SPECIFIED, /* frameRate */ Format.NOT_SPECIFIED,
32, 32,
2, 3, 4); 2, 3, 4);
}
case CVPixelFormatType.kCVPixelFormatType_420YpCbCr8Planar: case CVPixelFormatType.kCVPixelFormatType_420YpCbCr8Planar:
if ((width == 0) && (height == 0)) if ((width == 0) && (height == 0))
{ {
if (captureOutputFormat instanceof AVFrameFormat) if (captureOutputFormat instanceof AVFrameFormat)
{
return return
new AVFrameFormat( new AVFrameFormat(
FFmpeg.PIX_FMT_YUV420P, FFmpeg.PIX_FMT_YUV420P,
CVPixelFormatType CVPixelFormatType
.kCVPixelFormatType_420YpCbCr8Planar); .kCVPixelFormatType_420YpCbCr8Planar);
}
else else
return new YUVFormat(YUVFormat.YUV_420); return new YUVFormat(YUVFormat.YUV_420);
} }
...@@ -397,10 +403,10 @@ else if (captureOutputFormat instanceof AVFrameFormat) ...@@ -397,10 +403,10 @@ else if (captureOutputFormat instanceof AVFrameFormat)
return return
new AVFrameFormat( new AVFrameFormat(
new Dimension(width, height), new Dimension(width, height),
Format.NOT_SPECIFIED, /* frameRate */ Format.NOT_SPECIFIED,
FFmpeg.PIX_FMT_YUV420P, FFmpeg.PIX_FMT_YUV420P,
CVPixelFormatType. CVPixelFormatType
kCVPixelFormatType_420YpCbCr8Planar); .kCVPixelFormatType_420YpCbCr8Planar);
} }
else else
{ {
...@@ -413,9 +419,9 @@ else if (captureOutputFormat instanceof AVFrameFormat) ...@@ -413,9 +419,9 @@ else if (captureOutputFormat instanceof AVFrameFormat)
return return
new YUVFormat( new YUVFormat(
new Dimension(width, height), new Dimension(width, height),
Format.NOT_SPECIFIED, /* maxDataLength */ Format.NOT_SPECIFIED,
Format.byteArray, Format.byteArray,
Format.NOT_SPECIFIED, /* frameRate */ Format.NOT_SPECIFIED,
YUVFormat.YUV_420, YUVFormat.YUV_420,
strideY, strideUV, strideY, strideUV,
offsetY, offsetU, offsetV); offsetY, offsetU, offsetV);
...@@ -457,17 +463,18 @@ private Format getVideoFrameFormat(CVPixelBuffer videoFrame) ...@@ -457,17 +463,18 @@ private Format getVideoFrameFormat(CVPixelBuffer videoFrame)
Dimension size = ((VideoFormat) format).getSize(); Dimension size = ((VideoFormat) format).getSize();
if ((size == null) || ((size.width == 0) && (size.height == 0))) if ((size == null) || ((size.width == 0) && (size.height == 0)))
{
format format
= format = format.intersects(
.intersects(
new VideoFormat( new VideoFormat(
null, /* encoding */ null,
new Dimension( new Dimension(
videoFrame.getWidth(), videoFrame.getWidth(),
videoFrame.getHeight()), videoFrame.getHeight()),
Format.NOT_SPECIFIED, /* maxDataLength */ Format.NOT_SPECIFIED,
Format.byteArray, /* dataType */ null,
Format.NOT_SPECIFIED)); /* frameRate */ Format.NOT_SPECIFIED));
}
return format; return format;
} }
...@@ -494,17 +501,17 @@ public void read(Buffer buffer) ...@@ -494,17 +501,17 @@ public void read(Buffer buffer)
if (dataFormat != null) if (dataFormat != null)
buffer.setFormat(dataFormat); buffer.setFormat(dataFormat);
Format bufferFormat = buffer.getFormat(); Format format = buffer.getFormat();
if (bufferFormat == null) if (format == null)
{ {
bufferFormat = getFormat(); format = getFormat();
if (bufferFormat != null) if (format != null)
buffer.setFormat(bufferFormat); buffer.setFormat(format);
} }
if (bufferFormat instanceof AVFrameFormat) if (format instanceof AVFrameFormat)
{ {
if (AVFrame.read(buffer, bufferFormat, data) < 0) if (AVFrame.read(buffer, format, data) < 0)
data.free(); data.free();
/* /*
* XXX For the sake of safety, make sure that this instance does * XXX For the sake of safety, make sure that this instance does
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment