示例#1
0
static int ManagerAdd(Context_t  *context, Track_t track) {

    subtitle_mgr_printf(10, "%s::%s %s %s %d\n", FILENAME, __FUNCTION__, track.Name, track.Encoding, track.Id);

    if (Tracks == NULL) {
        Tracks = malloc(sizeof(Track_t) * TRACKWRAP);
    }

    if (Tracks == NULL)
    {
        subtitle_mgr_err("%s:%s malloc failed\n", FILENAME, __FUNCTION__);
        return cERR_SUBTITLE_MGR_ERROR;
    }

    if (TrackCount < TRACKWRAP) {
        copyTrack(&Tracks[TrackCount], &track);
        TrackCount++;
    } else {

        subtitle_mgr_err("%s:%s TrackCount out if range %d - %d\n", FILENAME, __FUNCTION__, TrackCount, TRACKWRAP);
        return cERR_SUBTITLE_MGR_ERROR;
    }

    if (TrackCount > 0)
        context->playback->isSubtitle = 1;

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

    return cERR_SUBTITLE_MGR_NO_ERROR;
}
示例#2
0
文件: video.c 项目: Audioniek/apps
static int ManagerAdd(Context_t  *context, Track_t track) {
    video_mgr_printf(10, "%s::%s\n", FILENAME, __FUNCTION__);

    if (Tracks == NULL) 
    {
        Tracks = malloc(sizeof(Track_t) * TRACKWRAP);
        int i;
        for (i = 0; i < TRACKWRAP; i++)
        {
            Tracks[i].Id = -1;
        }
    }

    if (Tracks == NULL)
    {
        video_mgr_err("%s:%s malloc failed\n", FILENAME, __FUNCTION__);
        return cERR_VIDEO_MGR_ERROR;
    }

    int i;
    for (i = 0; i < TRACKWRAP; i++) 
    {
        if (Tracks[i].Id == track.Id) 
        {
            Tracks[i].pending = 0;
            return cERR_VIDEO_MGR_NO_ERROR;
        }
    }

    if (TrackCount < TRACKWRAP)
    {
        copyTrack(&Tracks[TrackCount], &track);
        TrackCount++;
    } 
    else 
    {
        video_mgr_err("%s:%s TrackCount out if range %d - %d\n", FILENAME, __FUNCTION__, TrackCount, TRACKWRAP);
        return cERR_VIDEO_MGR_ERROR;
    }

    if (TrackCount > 0)
    {
        context->playback->isVideo = 1;
    }

    video_mgr_printf(10, "%s::%s\n", FILENAME, __FUNCTION__);
    return cERR_VIDEO_MGR_NO_ERROR;
}
示例#3
0
static int ManagerAdd(Context_t  *context, Track_t track)
{

	dvbsubtitle_mgr_printf(10, "%s::%s name=\"%s\" encoding=\"%s\" id=%d\n", FILENAME, __FUNCTION__, track.Name, track.Encoding, track.Id);

	if (Tracks == NULL)
	{
		Tracks = malloc(sizeof(Track_t) * TRACKWRAP);
		int i;
		for (i = 0; i < TRACKWRAP; i++)
			Tracks[i].Id = -1;
	}

	if (Tracks == NULL)
	{
		dvbsubtitle_mgr_err("%s:%s malloc failed\n", FILENAME, __FUNCTION__);
		return cERR_DVBSUBTITLE_MGR_ERROR;
	}

	int i;
	for (i = 0; i < TRACKWRAP; i++)
	{
		if (Tracks[i].Id == track.Id)
		{
			Tracks[i].pending = 0;
			return cERR_DVBSUBTITLE_MGR_NO_ERROR;
		}
	}

	if (TrackCount < TRACKWRAP)
	{
		copyTrack(&Tracks[TrackCount], &track);
		TrackCount++;
	}
	else
	{
		dvbsubtitle_mgr_err("%s:%s TrackCount out if range %d - %d\n", FILENAME, __FUNCTION__, TrackCount, TRACKWRAP);
		return cERR_DVBSUBTITLE_MGR_ERROR;
	}

	if (TrackCount > 0)
		context->playback->isDvbSubtitle = 1;

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

	return cERR_DVBSUBTITLE_MGR_NO_ERROR;
}
示例#4
0
static int ManagerAdd(struct TracksInfo *t, Context_t  *context, Track_t track)
{
	int i;
	mgr_printf(10, "%s::%s name=\"%s\" encoding=\"%s\" id=%d\n", FILENAME, __FUNCTION__, track.Name, track.Encoding, track.Id);
	for (i = 0; i < t->Count; i++)
	{
		if (t->Tracks[i].Id == track.Id)
			return cERR_MGR_NO_ERROR;
	}
	if (t->Count < TRACKWRAP)
	{
		copyTrack(&(t->Tracks[t->Count]), &track);
		t->Count++;
	}
	else
	{
		mgr_err("%s:%s TrackCount out if range %d - %d\n", FILENAME, __FUNCTION__, t->Count, TRACKWRAP);
		return cERR_MGR_ERROR;
	}
	if (t->Count > 0)
	{
		switch (t->Type)
		{
			case TRACK_TYPE_AUDIO:
				context->playback->isAudio = 1;
				break;
			case TRACK_TYPE_VIDEO:
				context->playback->isVideo = 1;
				break;
			case TRACK_TYPE_SUBTITLE:
				context->playback->isSubtitle = 1;
				break;
			default:
				break;
		}
	}
	mgr_printf(10, "%s::%s\n", FILENAME, __FUNCTION__);
	return cERR_MGR_NO_ERROR;
}
示例#5
0
void Bodyseq::update() {
    buttons.read();
    keypads.read();
    updatePosition();
    pots.update();

    switch(mode) {
        case 0:                 // NO_BUTTONS
            playTrack();
            break;
        case 1:                 // BUTTON_1
            selectNote();
            break;
        case 2:                 // BUTTON_2
            selectStep();
            break;
        case 3:                 // BUTTON_1_2
            selectOctave();
            break;
        case 4:                 // BUTTON_3
            selectTrack();
            break;
        case 5:                 // BUTTON_1_3
            chainTrack();
            break;
        case 6:                 // BUTTON_2_3
            copyTrack();
            break;
        case 7:                 // BUTTON_1_2_3
            clearTrack();
            break;
        default:
            break;
    }
    leds.update();
}