private void parseDevice(String fileName) {
    if (mCurPath.equals(mRoot) == false) mCurPath = mRoot;
    constructCurPath(fileName, true);
    DLNADevice device = mNameDeviceTable.get(fileName);
    if ((device.getType() != DLNADeviceType.DigitalMediaServer)
        && (device.getType() != DLNADeviceType.MobileDigitalMediaServer)) return;
    DLNATempFile fileins = new DLNATempFile(device);
    mTraceFile.push(fileins);
    mListContentName.clear();

    // mNameContentTable.clear();
    server = (MediaServer) device;
    server.setActionEventListener(mDLNAManager);

    if (localLOGV) NetLog.v(TAG, "start 1 browse : " + System.currentTimeMillis());

    REQUEST_MATCH_NUM = 0;
    currentID = MediaServer.OBJECT_ID;
    mBrowseHandle =
        server.browse(
            MediaServer.OBJECT_ID,
            MediaServer.BrowseFlag.BrowseDirectChildren,
            REQUEST_MATCH_NUM,
            BROWSE_REQUEST,
            MediaServer.FILTER_BASIC_INFO,
            MediaServer.SORT_ASCENDING_CRITERIA_TITLE);

    if (localLOGV) NetLog.v(TAG, "end 1 browse : " + System.currentTimeMillis());
    return;
  }
  private void parseContent(String fileName) throws Exception {
    int contentType = checkContent(fileName);
    Content content = null;
    if (contentType == CONTENT_UNKNOW) {
      if (localLOGV) NetLog.d(TAG, "Invalid parsing file name: " + fileName);
      throw new Exception();
    } else if (contentType == CONTENT_CHILD) {
      constructCurPath(fileName, true);
      content = mNameContentTable.get(fileName);
      DLNATempFile fileins = new DLNATempFile(content);
      mTraceFile.push(fileins);
    } else {
      content = mTraceFile.peek().getContent();
    }

    mListContentName.clear();

    // mNameContentTable.clear();
    server = content.getServer();
    server.setActionEventListener(mDLNAManager);

    if (localLOGV) NetLog.v(TAG, "start 2 browse : " + System.currentTimeMillis());

    REQUEST_MATCH_NUM = 0;
    currentID = content.getObjectId();
    mBrowseHandle =
        server.browse(
            content.getObjectId(),
            MediaServer.BrowseFlag.BrowseDirectChildren,
            REQUEST_MATCH_NUM,
            BROWSE_REQUEST,
            MediaServer.FILTER_BASIC_INFO,
            MediaServer.SORT_ASCENDING_CRITERIA_TITLE);

    if (localLOGV) NetLog.v(TAG, "end 2 browse : " + System.currentTimeMillis());
    return;
  }
  /**
   * Call back function, implement for com.mediatek.dlna.jar. Application should not use this API.
   *
   * @return.
   */
  public void notifyContentSuccessful(NormalContentEvent event) {

    if (localLOGV) NetLog.v(TAG, " notifyContentSuccessful : " + System.currentTimeMillis());

    if (event == null) {
      if (listener != null) {
        listener.onFileFound(new FileEvent(event, mListContentName));
      }
      return;
    }
    if (event.getTotalMatches() <= 0) {
      if (listener != null) {
        listener.onFileFound(new FileEvent(event, mListContentName));
      }
      return;
    }
    int listnum = event.getList().size();
    if (localLOGV)
      NetLog.v(TAG, " Last index is : " + REQUEST_MATCH_NUM + ", List num is: " + listnum);

    if (listnum <= 0) {
      if (localLOGV) NetLog.v(TAG, " List num is 0, return!");
      if (listener != null) {
        listener.onFileFound(new FileEvent(event, mListContentName));
      }
      return;
    }

    REQUEST_MATCH_NUM = REQUEST_MATCH_NUM + listnum;
    ArrayList<Content> items = event.getList();
    for (int i = 0; i < items.size(); i++) {
      Content cnt = items.get(i);
      String parent = null;
      String cname = cnt.getTitle();
      String tempParent = mCurPath;

      int index = tempParent.lastIndexOf("/");
      if (index == 0) {
        parent = mCurPath.substring(1, mCurPath.length());
      } else {
        parent = mCurPath.substring(index + 1, mCurPath.length());
      }

      StringBuffer pathBuf = new StringBuffer();
      pathBuf.append(mCurPath).append('/').append(cname);

      DLNAFile contentfile = new DLNAFile(cnt, pathBuf.toString(), parent);

      mListContentName.add(contentfile);

      mNameContentTable.put(cname, cnt);
    }
    // LinkedList<DLNAFile> cntList = new LinkedList<DLNAFile>();
    // int size = mNameContentTable.size();
    // for (int i = 0; i < size; i++)
    // cntList.add(mNameContentTable.get(mListContentName.get(i)));
    if (listener != null) {
      listener.onFileFound(new FileEvent(event, mListContentName));
    }

    if (localLOGV) NetLog.v(TAG, " notifyContentSuccessful end : " + System.currentTimeMillis());

    int total = event.getTotalMatches();
    mTotalNum = total;
    if (localLOGV)
      NetLog.v(TAG, " Current index is : " + REQUEST_MATCH_NUM + ", Total is: " + total);
    if (REQUEST_MATCH_NUM < total) {
      mBrowseHandle =
          server.browse(
              currentID,
              MediaServer.BrowseFlag.BrowseDirectChildren,
              REQUEST_MATCH_NUM,
              BROWSE_REQUEST,
              MediaServer.FILTER_BASIC_INFO,
              MediaServer.SORT_ASCENDING_CRITERIA_TITLE);
    }
  }