Пример #1
0
/* Compute the feature vector for a new frame by calling word_features as a
   special case: the tracks are of length 1 
*/
Features new_feature(enum part_of_speech pos, Box *new_d1, Box *new_d2, Box *new_d3, char **objects,
		     int ol, Flow *new_flow, Real scale, FeatureMedoid **fms, int mn){
  Track tr1 = allocTrack(1), tr2 = NULL, tr3 = NULL;
  Flow **one_flows = safe_malloc(sizeof *one_flows);
  Features new_feature = NULL;

  tr1->ds[0] = new_d1;
  if (new_d2){
    tr2 = allocTrack(1);
    tr2->ds[0] = new_d2;
  }
  if (new_d3){
    tr3 = allocTrack(1);
    tr3->ds[0] = new_d3;
  }
  one_flows[0] = new_flow;

  new_feature = word_features(pos, tr1, tr2, tr3, 2, 0, NULL, objects, ol, 0,
			      one_flows, 1, scale, fms, mn);
  freeTrack(tr1);
  if (tr2) freeTrack(tr2);
  if (tr3) freeTrack(tr3);
  free(one_flows);
  return new_feature;
}
Пример #2
0
static int ManagerDel(Context_t * context) {

    int i = 0;

    subtitle_mgr_printf(10, "%s::%s\n", FILENAME, __FUNCTION__);

    if(Tracks != NULL) {
        for (i = 0; i < TrackCount; i++) {
            freeTrack(&Tracks[i]);
        }

        free(Tracks);
        Tracks = NULL;
    } else
    {
        subtitle_mgr_err("%s::%s nothing to delete!\n", FILENAME, __FUNCTION__);
        return cERR_SUBTITLE_MGR_ERROR;
    }

    TrackCount = 0;
    CurrentTrack = -1;
    context->playback->isSubtitle = 0;

    subtitle_mgr_printf(10, "%s::%s return no error\n", FILENAME, __FUNCTION__);

    return cERR_SUBTITLE_MGR_NO_ERROR;
}
Пример #3
0
static int ManagerDel(struct TracksInfo *t, Context_t *context)
{
	int i = 0;
	mgr_printf(10, "%s::%s\n", FILENAME, __FUNCTION__);
	if (t->Tracks != NULL)
	{
		for (i = 0; i < t->Count; i++)
		{
			freeTrack(&(t->Tracks[i]));
		}
	}
	else
	{
		mgr_err("%s::%s nothing to delete!\n", FILENAME, __FUNCTION__);
		return cERR_MGR_ERROR;
	}
	t->Count = 0;
	switch (t->Type)
	{
		case TRACK_TYPE_AUDIO:
			context->playback->isAudio = 0;
			break;
		case TRACK_TYPE_VIDEO:
			context->playback->isVideo = 0;
			break;
		case TRACK_TYPE_SUBTITLE:
			context->playback->isSubtitle = 0;
			break;
		default:
			break;
	}
	t->Current = (TRACK_TYPE_AUDIO == t->Type || TRACK_TYPE_VIDEO == t->Type) ? 0 : -1;
	mgr_printf(10, "%s::%s return no error\n", FILENAME, __FUNCTION__);
	return cERR_MGR_NO_ERROR;
}