0

I have a array of two dimensions object[,] data;. I want to convert the first column of my object into a list<string> or a list<object>. here you have my code :

List<string> resultsFields = new List<string>();

object tmp = oRtx.get_ListFields(this.Instrument.ElementAt(i).Key.ToString(), RT_FieldRowView.RT_FRV_EXISTING, RT_FieldColumnView.RT_FCV_VALUE);
if (tmp != null)
{
    object[,] data = (object[,])Convert.ChangeType(tmp, typeof(object[,]));
    for (int j = 0; j < numItems; j++)
         resultsFields.Add(data[j, 0].ToString());
}

in this code, I add each items on data[j, 0] into my list. I would like to know if there is a faster method to convert the first column of my object ([0]) into a list


IVideoWindow::put_WindowStyle throwing "No such interface supported"

I've got a C# control wrapped around the DirectShow libraries. Though I'm not certain it's relevant, I'm running on Windows CE 6.0R3. When trying to play a WMA audio file using the control, the following code throws an exception of "No such interface supported":

m_graph = new DShowGraph(mediaFile);
m_graphBuilder = m_graph.Open();
m_videoWindow = (IVideoWindow)m_graph.GetVideoWindow();

if (m_videoWindow == null)
{
    // this is not hit
}

try
{
    m_videoWindow.put_WindowStyle((int)(WS.CHILD | WS.VISIBLE | WS.CLIPSIBLINGS));
}
catch (Exception ex)
{
    // I end up here
}

The Open call looks like this (error handling, etc. trimmed):

private IGraphBuilder _graphBuilder;

internal IGraphBuilder Open()
{
    object filterGraph = ClassId.CoCreateInstance(ClassId.FilterGraph);
    _graphBuilder = (IGraphBuilder)filterGraph;
    _graphBuilder.RenderFile(_input, null);
    return _graphBuilder;
}

The GetVideoWindow call simply looks like this:

public IVideoWindow GetVideoWindow()
{
    if (_graphBuilder == null)
        return null;
    return (IVideoWindow)(_graphBuilder);
}

Strangely, this all works just fine with the same control DLL, same application and same media file when run under Windows CE 5.0.

My suspicion is that it might have something to do with the fact we're playing an audio-only file (checking to see if the same problem occurs with a video file now), but I'm not overly versed in Direct Show, so I'd like to understand exactly what's going on here.

One of the large challenges in debugging this is that I don't have the failing hardware in my office - it's at a customer's site, so I have to make changes, send them and wait for a reply. While that doesn't affect the question, it does affect my ability to quickly follow up with suggestions or follow on questions anyone might have.

EDIT1

Playing a WMV file works fine, so it is related to the file being audio-only. We can't test MP3 to see if it's a WMA codec issue becasu the device OEM does not include the MP3 codec in the OS due to their concerns over licensing.

4

1 回答 1

2

我能看到的唯一性能改进是创建具有指定容量的 List<>:

List<string> resultsFields = new List<string>(data.GetLength(0));
于 2012-06-14T15:02:29.287 回答