Exemplo n.º 1
0
void CIrcChannelTabCtrl::Init()
{
    //This adds the two static windows, Status and ChanneList
    NewChannel( GetResString(IDS_STATUS), 1 );
    NewChannel( GetResString(IDS_IRC_CHANNELLIST), 2);
    //Initialize the IRC window to be in the ChannelList
    m_pCurrentChannel = (Channel*)m_ptrlistChannel.GetTail();
    SetCurSel(0);
    OnTcnSelchangeTab2( NULL, NULL );
    SetAllIcons();
}
Exemplo n.º 2
0
/*setup channel, clock and query caps*/
M4Err ODM_SetupStream(ODManager *odm, ESDescriptor *esd, LPNETSERVICE serv)
{
	CapObject cap;
	Channel *ch;
	Clock *ck;
	Chain *ck_namespace;
	GenericCodec *dec;
	s8 flag;
	u16 clockID;
	M4Err e;
	InlineScene *is;

	/*find the clock for this new channel*/
	ck = NULL;
	flag = -1;

	/*get clocks namespace (eg, parent scene)*/
	is = odm->subscene ? odm->subscene : odm->parentscene;

	ck_namespace = odm->net_service->Clocks;
	/*little trick for non-OD addressing: if object is a remote one, and service owner already has clocks, 
	override OCR. This will solve addressing like file.avi#audio and file.avi#video*/
	if (odm->parent_OD && (ChainGetCount(ck_namespace)==1) ) {
		ck = ChainGetEntry(ck_namespace, 0);
		esd->OCRESID = ck->clockID;
	}
	/*for dynamic scene, force all streams to be sync on main OD stream (one timeline, no need to reload ressources)*/
	else if (odm->term->root_scene->is_dynamic_scene) {
		ODManager *root_od = odm->term->root_scene->root_od;
		while (root_od->remote_OD) root_od = root_od->remote_OD;
		if (ChainGetCount(root_od->net_service->Clocks)==1) {
			ck = ChainGetEntry(root_od->net_service->Clocks, 0);
			esd->OCRESID = ck->clockID;
			goto clock_setup;
		}
	}

	/*do we have an OCR specified*/
	clockID = esd->OCRESID;
	/*if OCR stream force self-synchro !!*/
	if (esd->decoderConfig->streamType==M4ST_OCR) clockID = esd->ESID;
	if (!clockID) {
		/*if no clock ID but depandancy, force the clock to be the base layer for AV but not systems (animation streams, ..)*/
		if ((esd->decoderConfig->streamType==M4ST_VISUAL) || (esd->decoderConfig->streamType==M4ST_AUDIO)) clockID = esd->dependsOnESID;
		if (!clockID) clockID = esd->ESID;
	}

	/*override clock dependencies if specified*/
	if (odm->term->force_single_clock) {
		if (is->scene_codec) {
			clockID = is->scene_codec->ck->clockID;
		} else if (is->od_codec) {
			clockID = is->od_codec->ck->clockID;
		}
		ck_namespace = odm->term->root_scene->root_od->net_service->Clocks;
	}
	/*if the Clock is the stream, check if we have embedded OCR in the stream...*/
	if (clockID == esd->ESID) {
		flag = (esd->slConfig && esd->slConfig->OCRLength > 0);
	}

	if (!esd->slConfig) {
		esd->slConfig = (SLConfigDescriptor *)OD_NewDescriptor(SLConfigDescriptor_Tag);
		esd->slConfig->timestampResolution = 1000;
	}

	/*attach clock in namespace*/
	ck = CK_AttachClock(ck_namespace, is, clockID, esd->ESID, flag);
	if (!ck) return M4OutOfMem;
	esd->OCRESID = ck->clockID;

clock_setup:
	/*create a channel for this stream*/
	ch = NewChannel(esd);
	if (!ch) return M4OutOfMem;
	ch->clock = ck;
	ch->service = serv;

	/*setup the decoder for this stream or find the existing one.*/
	e = M4OK;
	dec = NULL;
	switch (esd->decoderConfig->streamType) {
	case M4ST_OD:
		//OD - MUST be in inline
		if (!odm->subscene) {
			e = M4NonCompliantBitStream;
			break;
		}

		/*OD codec acts as main scene codec when used to generate scene graph*/
		if (esd->decoderConfig->objectTypeIndication==GPAC_STATIC_OD_OTI) {
			dec = odm->subscene->scene_codec = NewDecoder(odm, esd, odm->OD_PL, &e);
			MM_AddCodec(odm->term->mediaman, odm->subscene->scene_codec);
			odm->subscene->is_dynamic_scene = 1;
			dec->flags |= COD_IS_STATIC_OD;
		} else if (! odm->subscene->od_codec) {
			dec = odm->subscene->od_codec = NewDecoder(odm, esd, odm->OD_PL, &e);
			MM_AddCodec(odm->term->mediaman, odm->subscene->od_codec);
		}
		break;
	case M4ST_OCR:
		/*OD codec acts as main scene codec when used to generate scene graph*/
		dec = odm->ocr_codec = NewDecoder(odm, esd, odm->OD_PL, &e);
		MM_AddCodec(odm->term->mediaman, odm->ocr_codec);
		break;
	case M4ST_SCENE:
		/*animationStream */
		if (!odm->subscene) {
			if (!odm->codec) {
				odm->codec = NewDecoder(odm, esd, odm->Scene_PL, &e);
				MM_AddCodec(odm->term->mediaman, odm->codec);
			}
			dec = odm->codec;
		}
		/*inline scene*/
		else {
			if (! odm->subscene->scene_codec) {
				odm->subscene->scene_codec = NewDecoder(odm, esd, odm->Scene_PL, &e);
				MM_AddCodec(odm->term->mediaman, odm->subscene->scene_codec);
			}
			dec = odm->subscene->scene_codec;
		}
		break;
	case M4ST_OCI:
		/*OCI - only one per OD */
		if (odm->oci_codec) {
			e = M4NonCompliantBitStream;
		} else {
			odm->oci_codec = NewDecoder(odm, esd, odm->OD_PL, &e);
			odm->oci_codec->odm = odm;
			MM_AddCodec(odm->term->mediaman, odm->oci_codec);
		}
		break;

	case M4ST_AUDIO:
	case M4ST_VISUAL:
		/*we have a media or user-specific codec...*/
		if (!odm->codec) {
			odm->codec = NewDecoder(odm, esd, (esd->decoderConfig->streamType==M4ST_VISUAL) ? odm->Visual_PL : odm->Audio_PL, &e);
			if (!e) MM_AddCodec(odm->term->mediaman, odm->codec);
		}
		dec = odm->codec;
		break;

	/*interaction stream*/
	case M4ST_INTERACT:
		if (!odm->codec) {
			odm->codec = NewDecoder(odm, esd, odm->OD_PL, &e);
			if (!e) {
				IS_Configure(odm->codec->decio, odm->parentscene, esd->URLString ? 1 : 0);
				MM_AddCodec(odm->term->mediaman, odm->codec);
				/*register it*/
				ChainAddEntry(odm->term->input_streams, odm->codec);
			}
		}
		dec = odm->codec;
		break;

	case M4ST_PRIVATE_SCENE:
		if (odm->subscene) {
			assert(!odm->subscene->scene_codec);
			odm->subscene->scene_codec = NewDecoder(odm, esd, odm->Scene_PL, &e);
			if (odm->subscene->scene_codec) {
				MM_AddCodec(odm->term->mediaman, odm->subscene->scene_codec);
			}
			dec = odm->subscene->scene_codec;
		} else {
			/*this is a bit tricky: the scene decoder needs to ba called with the dummy streams of this 
			object, so we associate the main decoder to this object*/
			odm->codec = dec = Codec_UseDecoder(odm->parentscene->scene_codec, odm);
			MM_AddCodec(odm->term->mediaman, odm->codec);
		}
		break;
	/*all other cases*/
	default:
		if (!odm->codec) {
			odm->codec = NewDecoder(odm, esd, odm->OD_PL, &e);
			if (!e) MM_AddCodec(odm->term->mediaman, odm->codec);

		}
		dec = odm->codec;
		break;
	}

	/*if we have a decoder, set up the channel and co.*/
	if (!dec) {
		if (e) {
			DeleteChannel(ch);
			return e;
		}
	}

	/*setup scene decoder*/
	if (dec->decio && (dec->decio->InterfaceType==M4SCENEDECODERINTERFACE) ) {
		SceneDecoder *sdec = (SceneDecoder *) dec->decio;
		is = odm->subscene ? odm->subscene : odm->parentscene;
		if (sdec->AttachScene) sdec->AttachScene(sdec, is, (is->scene_codec==dec) ? 1: 0);
	}

	ch->es_state = ES_Setup;
	ch->odm = odm;

	/*one more channel to wait for*/
	odm->pending_channels++;

	/*get media padding BEFORE channel setup, since we use it on channel connect ack*/
	if (dec) {
		cap.CapCode = CAP_PADDING_BYTES;
		Codec_GetCap(dec, &cap);
		ch->media_padding_bytes = cap.cap.valueINT;

		cap.CapCode = CAP_HASRESILIENCE;
		Codec_GetCap(dec, &cap);
		ch->codec_resilient = cap.cap.valueINT;
	}

	/*service redirection*/
	if (esd->URLString) {
		ChannelSetup *cs;
		/*here we have a pb with the MPEG4 model: streams are supposed to be attachable as soon as the OD 
		update is recieved, but this is not true with ESD URLs, where service setup may take some time (file
		downloading, authentification, etc...). We therefore need to wait for the service connect response before 
		setting up the channel...*/
		cs = malloc(sizeof(ChannelSetup));
		cs->ch = ch;
		cs->dec = dec;
		Term_LockNet(odm->term, 1);
		ChainAddEntry(odm->term->channels_pending, cs);
		e = Term_ConnectChannelURL(odm->term, ch, esd->URLString);
		if (e) {
			s32 i = ChainFindEntry(odm->term->channels_pending, cs);
			if (i>=0) {
				ChainDeleteEntry(odm->term->channels_pending, (u32) i);
				free(cs);
				odm->pending_channels--;
				ODM_CheckChannelService(ch);
				DeleteChannel(ch);
			}
		}
		Term_LockNet(odm->term, 0);
		if (ch->service->owner) {
			ChainDeleteItem(odm->term->channels_pending, cs);
			free(cs);
			return ODM_SetupChannel(ch, dec, M4OK);
		}
		return e;
	}

	/*regular setup*/
	return ODM_SetupChannel(ch, dec, M4OK);
}