I'm getting the following error java.lang.RuntimeException: setDataSource failed: status = 0xFFFFFFEA and I'd like to know what this status is. I'm using the function MediaMetaDataRetriever.setDataSource(String filePath)
I got this error java.lang.RuntimeException: setDataSource failed: status = 0xFFFFFFEA when tried to call void setDataSource(String path) on an empty file. (0 bytes)
You need to be 100% sure that path for the file is not null, not empty, the file itself exists and valid.
I didn't have an empty file or any other of the here mentioned bugs in my code. The files I tried to use were fine. I don't exactly know why, but it worked for me when I simply used another overload of setDataSource.
The ones I used that threw this exception were MediaMetadataRetriever.setDataSource(String) and MediaMetadataRetriever.setDataSource(String, HashMap)
The one that simply worked was MediaMetadataRetriever.setDataSource(Context, URI).
It was very well buried but I found the source. Here is a link to the error codes
It's a build from ICS and I'm not sure where it is in the current build.
My error was a not supported error when I used a midi file.
Source:
/*
* Copyright (C) 2009 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MEDIA_ERRORS_H_
#define MEDIA_ERRORS_H_
#include <utils/Errors.h>
namespace android {
enum {
MEDIA_ERROR_BASE = -1000,
ERROR_ALREADY_CONNECTED = MEDIA_ERROR_BASE,
ERROR_NOT_CONNECTED = MEDIA_ERROR_BASE - 1,
ERROR_UNKNOWN_HOST = MEDIA_ERROR_BASE - 2,
ERROR_CANNOT_CONNECT = MEDIA_ERROR_BASE - 3,
ERROR_IO = MEDIA_ERROR_BASE - 4,
ERROR_CONNECTION_LOST = MEDIA_ERROR_BASE - 5,
ERROR_MALFORMED = MEDIA_ERROR_BASE - 7,
ERROR_OUT_OF_RANGE = MEDIA_ERROR_BASE - 8,
ERROR_BUFFER_TOO_SMALL = MEDIA_ERROR_BASE - 9,
ERROR_UNSUPPORTED = MEDIA_ERROR_BASE - 10,
ERROR_END_OF_STREAM = MEDIA_ERROR_BASE - 11,
// Not technically an error.
INFO_FORMAT_CHANGED = MEDIA_ERROR_BASE - 12,
INFO_DISCONTINUITY = MEDIA_ERROR_BASE - 13,
// The following constant values should be in sync with
// drm/drm_framework_common.h
DRM_ERROR_BASE = -2000,
ERROR_DRM_UNKNOWN = DRM_ERROR_BASE,
ERROR_DRM_NO_LICENSE = DRM_ERROR_BASE - 1,
ERROR_DRM_LICENSE_EXPIRED = DRM_ERROR_BASE - 2,
ERROR_DRM_SESSION_NOT_OPENED = DRM_ERROR_BASE - 3,
ERROR_DRM_DECRYPT_UNIT_NOT_INITIALIZED = DRM_ERROR_BASE - 4,
ERROR_DRM_DECRYPT = DRM_ERROR_BASE - 5,
ERROR_DRM_CANNOT_HANDLE = DRM_ERROR_BASE - 6,
ERROR_DRM_TAMPER_DETECTED = DRM_ERROR_BASE - 7,
// Heartbeat Error Codes
HEARTBEAT_ERROR_BASE = -3000,
ERROR_HEARTBEAT_AUTHENTICATION_FAILURE = HEARTBEAT_ERROR_BASE,
ERROR_HEARTBEAT_NO_ACTIVE_PURCHASE_AGREEMENT = HEARTBEAT_ERROR_BASE - 1,
ERROR_HEARTBEAT_CONCURRENT_PLAYBACK = HEARTBEAT_ERROR_BASE - 2,
ERROR_HEARTBEAT_UNUSUAL_ACTIVITY = HEARTBEAT_ERROR_BASE - 3,
ERROR_HEARTBEAT_STREAMING_UNAVAILABLE = HEARTBEAT_ERROR_BASE - 4,
ERROR_HEARTBEAT_CANNOT_ACTIVATE_RENTAL = HEARTBEAT_ERROR_BASE - 5,
ERROR_HEARTBEAT_TERMINATE_REQUESTED = HEARTBEAT_ERROR_BASE - 6,
};
} // namespace android
#endif // MEDIA_ERRORS_H_
I got this error: setDataSource failed: status = 0xFFFFFFEA because the file does not exist on my device.
Just adding this link to know more about error codes: https://kdave.github.io/errno.h/
By searching for FFEA, it tells that 0xFFFFFFEA is decimal value 22 as #AndrewOrobator said, the error is EINVAL invalid argument.
I'm catch this error when my audio file was brocken, it solved when I change file, you can try manually set different sources paths
I met this question when I try to use a 0 kb mp3 file,I solved it after I deleted that file.maybe you can catch this exception.
Related
I did the following method to center and underline a title in a console app:
public static void ShowTitle(string Title)
{
int SpacesBefore = ((Console.BufferWidth - 1) - Title.Length) / 2;
Console.WriteLine("{0}{1}\n{0}{2}\n", new string(' ', SpacesBefore), Title, new string('=', Title.Length));
}
Which compiles and works on Visual Studio 2017 (windows) but throws an error I can't debug on Mac.
The issue presumably lies with this calculation:
int SpacesBefore = ((Console.BufferWidth - 1) - Title.Length) / 2;
The problem is caused by one of two things: either the console character width (BufferWidth) is smaller on MacOS, or your Title is longer. Imagine that Title length of 5, and BufferWidth of 10:
SpacesBefore = ((10 - 1) - 5) / 2 = 2
Now imagine that on Mac OS BufferWidth is 4:
SpacesBefore = ((4 - 1) - 5) / 2 = -1
And now you want to use this to construct a string: new string(' ', -1), so you get your exception.
A quick fix might be to change your calculation to this, to ensure that the value is always >= 0, but I'll leave you to decide how to fix it:
int SpacesBefore = Math.Max(0, ((Console.BufferWidth - 1) - Title.Length) / 2);
I recommend learning how to use the debugger, since inspecting the value of SpacesBefore, and then BufferWidth would have allowed you to rapidly locate the source of the problem.
How to perform Change Point Analysis using R.NET. I am using below code
REngine.SetEnvironmentVariables();
REngine engine = REngine.GetInstance();
double[] data = new double[] { 1, 2, 3, 4, 5, 6 };
NumericVector vector = engine.CreateNumericVector(data);
engine.SetSymbol("mydatapoints", vector);
engine.Evaluate("library(changepoint)");
engine.Evaluate("chpoints = cpt.mean(mydatapoints, method="BinSeg")");
DynamicVector result = engine.Evaluate("x<-cpts(chpoints)").AsVector(); ;
engine.Dispose();
I am receiving below error on engine.Evaluate("library(changepoint)");
Error in library(changepoint) : there is no package called
'changepoint'
Edit # 1
The changepoint package is supposed to be installed explicitly, it is not there by default. Installed it using RGui -> Packages -> Load package.
Now the error has been changed to
Status Error for chpoints = cpt.mean(mydatapoints, method=”BinSeg”) :
unexpected input
Edit # 2
After fixing first two errors, the following one appears on second Evaluate statement.
Error in BINSEG(sumstat, pen = pen.value, cost_func = costfunc,
minseglen = minseglen, : Q is larger than the maximum number of
segments 4
The same error appears on R as well using these commands
value.ts <- c(29.89, 29.93, 29.72, 29.98)
chpoints = cpt.mean(value.ts, method="BinSeg")
The error is not in your calling code but rather in your use of R (as you apparently now realize.) So the labeling of this as something to do with rdotnet or c-sharp seems misleading:
mydatapoints <- c(1, 2, 3, 4, 5, 6 )
library(changepoint);
chpoints = cpt.mean(mydatapoints, method="BinSeg");
#Error in BINSEG(sumstat, pen = pen.value, cost_func = costfunc, minseglen = minseglen, :
# Q is larger than the maximum number of segments 4
I'm not sure what you intended. Change-point analysis generally requires paired datapoints ... x-y and all that jazz. And giving R regression functions perfectly linear data is also unwise. It often causes non-invertible matrices.
I suggest you search with https://stackoverflow.com/search?q=%5Br%5D+changepoint to find a simple bit of code to build into your REngine calling scheme.
The data points are supposed to be converted in Time Series.
REngine.SetEnvironmentVariables();
REngine engine = REngine.GetInstance();
double[] data = new double[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
NumericVector vector = engine.CreateNumericVector(data);
engine.Evaluate("library(changepoint)");
engine.SetSymbol("values", vector);
engine.Evaluate("values.ts = ts(values, frequency = 12, start = c(2017, 1))");
engine.Evaluate("chpoints = cpt.mean(values.ts, method=\"BinSeg\")");
var result = engine.GetSymbol("chpoints");
engine.Dispose();
Now looking for how to get the results back in C#, chpoints or result of plot(chpoints)
In an attempt to speed up some processing in a real time application of computer vision I'm developing for Android platforms, I'd like to undistort some key points, instead of entire frames. I've followed the documentation to the best of my abilities, but I'm receiving the following error:
OpenCV Error: Assertion failed (CV_IS_MAT(_cameraMatrix) && _cameraMatrix->rows == 3 && _cameraMatrix->cols == 3) in void cvUndistortPoints(const CvMat*, CvMat*, const CvMat*, const CvMat*, const CvMat*, const CvMat*), file /Volumes/Linux/builds/master_pack-android/opencv/modules/imgproc/src/undistort.cpp, line 301
The appropriate documentation is here: http://docs.opencv.org/2.4/modules/imgproc/doc/geometric_transformations.html#undistortpoints
In my code I define and populate the matrix elements individually since they're small. I was unable to find a way to populate MatofPoint2f gracefully, but searching led to me to convert from a list as you'll see below.
Mat camMtx = new Mat(1, 5, CvType.Cv64fc1, new Scalar(0));
Mat distCoef = new Mat(3, 3, CvType.Cv64fc1, new Scalar(0));
MatOfPoint2f uncalibpoints = new MatOfPoint2f();
MatOfPoint2f calibpoints = new MatOfPoint2f();
List<Point> points = new List<Point>();
points.Add(center); //Some previously stored point
points.Add(apex1); //Some previously stored point
points.Add(apex2); //Some previously stored point
points.Add(apex3); //Some previously stored point
uncalibpoints.FromList(points); //Convert list of points to MatofPoint2f
Console.WriteLine(uncalibpoints.Channels());
Console.WriteLine(uncalibpoints.Size());
Console.WriteLine(uncalibpoints.GetType());
//Manually setting the matrix values
distCoef.Put(0, 0, 0.51165764);
distCoef.Put(0, 1, -1.96134156);
distCoef.Put(0, 2, 0.00600294);
distCoef.Put(0, 3, 0.00643735);
distCoef.Put(0, 4, 2.59503145);
camMtx.Put(0, 0, 1551.700);
camMtx.Put(0, 1, 0.0);
camMtx.Put(0, 2, 962.237163);
camMtx.Put(1, 0, 0.0);
camMtx.Put(1, 1, 1536.170);
camMtx.Put(1, 2, 589.418432);
camMtx.Put(2, 0, 0.0);
camMtx.Put(2, 1, 0.0);
camMtx.Put(2, 2, 1.0);
Imgproc.UndistortPoints(uncalibpoints, calibpoints, camMtx, distCoef);`
Two issues with the above code:
Simple error in the allocation of the camMtx and distCoeff (reversed their allocation in a copy paste type error)
The Undistort Points call should look like this:
Imgproc.UndistortPoints(uncalibpoints, calibpoints, camMtx, distCoef, new Mat(), camMtx);
I'm using C# Excel Interop to create spreadsheets. I'm using formulas for a "totals" section at the bottom of a sheet. Here's the code I'm using for that:
var totalTotalOrdersCell = (Range)_xlSheetDelPerf.Cells[curDelPerfRow + 2, TOTAL_ORDERS_COLUMN];
totalTotalOrdersCell.Formula = string.Format("=SUM(J10:J{0})", curDelPerfRow);
var avgAvgWeeklyDeliveriesCell = (Range)_xlSheetDelPerf.Cells[curDelPerfRow + 2, AVG_WEEKLY_DELIVERIES_COLUMN];
avgAvgWeeklyDeliveriesCell.Formula = string.Format("=AVERAGE(K10:K{0})", curDelPerfRow);
var avgAvgOrderAmountCell = (Range)_xlSheetDelPerf.Cells[curDelPerfRow + 2, AVG_ORDER_AMOUNT_COLUMN];
avgAvgOrderAmountCell.Formula = string.Format("=AVERAGE(L10:L{0})", curDelPerfRow);
var avgAvgPackageCountCell = (Range)_xlSheetDelPerf.Cells[curDelPerfRow + 2, AVG_PACKAGE_AMOUNT_COLUMN];
avgAvgPackageCountCell.Formula = string.Format("=AVERAGE(M10:M{0})", curDelPerfRow);
var totalTotalSalesCell = (Range)_xlSheetDelPerf.Cells[curDelPerfRow + 2, TOTAL_SALES_COLUMN];
totalTotalSalesCell.Formula = string.Format("=SUM(N10:N{0})", curDelPerfRow);
var totalTotalPackageCountCell = (Range)_xlSheetDelPerf.Cells[curDelPerfRow + 2, TOTAL_PACKAGE_COUNT_COLUMN];
totalTotalPackageCountCell.Formula = string.Format("=SUM(O10:O{0})", curDelPerfRow);
This is what is being produced:
The monetary/currency vals are formatting just right, without any intervention from me - Excel is apparently smart about money.
As to the integers, though, not so much - it shows "20192" instead of "20,192" - but I already asked about that particular issue here.
My question now is - and it's a "bigger deal" - how can I restrict the decimal count on the averaged values? I want "15.23" not "15.23076923" and "34.17" not the much longer and more precise version of the value.
How can I tell the Formula former that two decimal points is enough?
Have you tried the =TEXT formula? - syntax is like this: =TEXT("412.24134","#,###.00") and the answer will be displayed as 412.24:
so wrt your code, something like this (has not been tested):
var avgAvgWeeklyDeliveriesCell = (Range)_xlSheetDelPerf.Cells[curDelPerfRow + 2, AVG_WEEKLY_DELIVERIES_COLUMN];
avgAvgWeeklyDeliveriesCell.Formula = string.Format("=TEXT(AVERAGE(K10:K{0})", curDelPerfRow),"#,###.00");
Is there anyway to "vectorize" the addition of elements across arrays in a SIMD fashion?
For example, I would like to turn:
var a = new[] { 1, 2, 3, 4 };
var b = new[] { 1, 2, 3, 4 };
var c = new[] { 1, 2, 3, 4 };
var d = new[] { 1, 2, 3, 4 };
var e = new int[4];
for (int i = 0; i < a.Length; i++)
{
e[i] = a[i] + b[i] + c[i] + d[i];
}
// e should equal { 4, 8, 12, 16 }
Into something like:
var e = VectorAdd(a,b,c,d);
I know something may exist in the C++ / XNA libraries, but I didn't know if we have it in the standard .Net libraries.
Thanks!
You will want to look at Mono.Simd:
http://tirania.org/blog/archive/2008/Nov-03.html
It supports SIMD in C#
using Mono.Simd;
//...
var a = new Vector4f( 1, 2, 3, 4 );
var b = new Vector4f( 1, 2, 3, 4 );
var c = new Vector4f( 1, 2, 3, 4 );
var d = new Vector4f( 1, 2, 3, 4 );
var e = a+b+c+d;
Mono provides a relatively decent SIMD API (as sehe mentions) but if Mono isn't an option I would probably write a C++/CLI interface library to do the heavy lifting. C# works pretty well for most problem sets but if you start getting into high performance code it's best to go to a language that gives you the control to really get dirty with performance.
Here at work we use P/Invoke to call image processing routines written in C++ from C#. P/Invoke has some overhead but if you make very few calls and do a lot of processing on the native side it can be worth it.
I guess it all depends on what you are doing, but if you are worried about vectorizing vector sums, you might want to take a look at a library such as Math.NET which provide optimized numerical computations.
From their website:
It targets Microsoft .Net 4.0, Mono and Silverlight 4, and in addition to a purely managed implementation will also support native hardware optimization (MKL, ATLAS).