CARVIEW |
Navigation Menu
-
-
Notifications
You must be signed in to change notification settings - Fork 56.2k
Audio GStreamer: added support .wav .flac audio formats #21264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
break; | ||
} | ||
|
||
return !dst.empty(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
empty result is valid in case when video stream is longer than audio.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
empty result is valid in case when video stream is longer than audio.
Within the framework of this functionality, such a case is not possible. I think this case should be considered separately by adding an additional condition when will audio + video support be implemented.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anyway this error criteria is not correct. And the error handling above in "default:".
We just forget to change that properly (our testdata doesn't handle such cases).
/*! | ||
* \brief CvCapture_GStreamer::retrieveFrame | ||
* \return IplImage pointer. [Transfer Full] | ||
* Retrieve the previously grabbed buffer, and wrap it in an IPLImage structure | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove this outdated docstring
@@ -2417,4 +2727,4 @@ const OpenCV_VideoIO_Writer_Plugin_API* opencv_videoio_writer_plugin_init_v1(int | |||
return NULL; | |||
} | |||
|
|||
#endif // BUILD_PLUGIN | |||
#endif // BUILD_PLUGIN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return EOL back.
Don't introduce unnecessary whitespace changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return EOL back.
Don't introduce unnecessary whitespace changes.
Sorry, I do not quite understand what this is about
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you see changed code here? - yes
Is it indented and necessary change? - no
Then revert it.
case CV_8S: | ||
data = cv::Mat(1, audioFrame.rows, CV_8S); | ||
for (int i = 0; i < audioFrame.rows; i++) | ||
data.at<char>(0,i) = audioFrame.at<char>(i, index-audioBaseIndex); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(0,i)
Just (i)
.
.at(i)
is agnostic to vector-rows or vector-cols.
if (videoStream != -1) | ||
return retrieveVideoFrame(index, dst); | ||
else if (audioStream != -1) | ||
return retrieveAudioFrame(index, dst); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic is not correct. Checks must be "index"-based.
What is the problem to write correct logic once instead of rewriting them again with adding video support?
break; | ||
} | ||
|
||
return !dst.empty(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anyway this error criteria is not correct. And the error handling above in "default:".
We just forget to change that properly (our testdata doesn't handle such cases).
Mat(map_info.size/bpf, nAudioChannels, CV_32F, map_info.data).copyTo(audioFrame); | ||
return true; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing the error message about unsupported format
.
data = cv::Mat(1, audioFrame.rows, CV_8S); | ||
for (int i = 0; i < audioFrame.rows; i++) | ||
data.at<char>(0,i) = audioFrame.at<char>(i, index-audioBaseIndex); | ||
data.copyTo(dst); | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 data copies are happened here.
We should avoid that to keep OpenCV effective library.
Use:
dst.create()
data = dst.getMat()
- fill
data
First 2 calls could be done outside of switch for successful path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Audio GStreamer: added support .wav .flac audio formats * added support .wav, lossless compressed audio formats * fixed docs * fixes * videoio(gstreamer-audio): extra tests, improve error handling Co-authored-by: Alexander Alekhin <alexander.a.alekhin@gmail.com>
I added audio support wav and flac formats in Gstreamer backend