			gf_list_add(res, desc);
		}
	}
	gf_bs_del(bs_r);
	return res;
}

static void dasher_get_mime_and_ext(GF_DasherCtx *ctx, GF_DashStream *ds, const char **out_subtype, const char **out_ext)
{
	const char *subtype = NULL;
	const char *mux_ext = NULL;
	const char *cstr;

	if (ctx->muxtype!=DASHER_MUX_AUTO) {
		switch (ctx->muxtype) {
		case DASHER_MUX_ISOM: subtype = "mp4"; mux_ext = "mp4"; break;
		case DASHER_MUX_TS: subtype = "mp2t"; mux_ext = "ts"; break;
		case DASHER_MUX_MKV: subtype = "x-matroska"; mux_ext = "mkv"; break;
		case DASHER_MUX_WEBM: subtype = "webm"; mux_ext = "webm"; break;
		case DASHER_MUX_OGG: subtype = "ogg"; mux_ext = "ogg"; break;
		case DASHER_MUX_RAW:
			cstr = gf_codecid_mime(ds->codec_id);
			if (cstr) {
				subtype = strchr(cstr, '/');
				if (subtype) subtype++;
				else subtype = "raw";
			}
			if (out_ext) {
				cstr = gf_codecid_file_ext(ds->codec_id);
				if (cstr) *out_ext = cstr;
			}
			break;
		}
	} else if (ctx->initext) {
		mux_ext = ctx->initext;
		if (!strcmp(ctx->initext, "ts") || !strcmp(ctx->initext, "m2ts")) {
			subtype = "mp2t";
			ctx->muxtype = DASHER_MUX_TS;
		} else if (!strcmp(ctx->initext, "mkv") || !strcmp(ctx->initext, "mka") || !strcmp(ctx->initext, "mks") || !strcmp(ctx->initext, "mk3d")) {
			subtype = "x-matroska";
			ctx->muxtype = DASHER_MUX_MKV;
		} else if (!strcmp(ctx->initext, "webm") || !strcmp(ctx->initext, "weba")) {
			subtype = "webm";
			ctx->muxtype = DASHER_MUX_WEBM;
		} else if (!strcmp(ctx->initext, "ogg") || !strcmp(ctx->initext, "oga") || !strcmp(ctx->initext, "ogv") || !strcmp(ctx->initext, "spx") || !strcmp(ctx->initext, "oggm") || !strcmp(ctx->initext, "opus")) {
			subtype = "ogg";
			ctx->muxtype = DASHER_MUX_OGG;
		}
		else if (!strcmp(ctx->initext, "null")) {
			mux_ext = "mp4";
			ctx->muxtype = DASHER_MUX_ISOM;
			gf_list_add(res, desc);
		}
	}
	gf_bs_del(bs_r);
	return res;
}

static void dasher_get_mime_and_ext(GF_DasherCtx *ctx, GF_DashStream *ds, const char **out_subtype, const char **out_ext)
{
	const char *subtype = NULL;
	const char *mux_ext = NULL;
	const char *cstr;

	if (ctx->muxtype!=DASHER_MUX_AUTO) {
		switch (ctx->muxtype) {
		case DASHER_MUX_ISOM: subtype = "mp4"; mux_ext = "mp4"; break;
		case DASHER_MUX_TS: subtype = "mp2t"; mux_ext = "ts"; break;
		case DASHER_MUX_MKV: subtype = "x-matroska"; mux_ext = "mkv"; break;
		case DASHER_MUX_WEBM: subtype = "webm"; mux_ext = "webm"; break;
		case DASHER_MUX_OGG: subtype = "ogg"; mux_ext = "ogg"; break;
		case DASHER_MUX_RAW:
			cstr = gf_codecid_mime(ds->codec_id);
			if (cstr) {
				subtype = strchr(cstr, '/');
				if (subtype) subtype++;
				else subtype = "raw";
			}
			if (out_ext) {
				cstr = gf_codecid_file_ext(ds->codec_id);
				if (cstr) *out_ext = cstr;
			}
			break;
		}
	} else if (ctx->initext) {
		mux_ext = ctx->initext;
		if (!strcmp(ctx->initext, "ts") || !strcmp(ctx->initext, "m2ts")) {
			subtype = "mp2t";
			ctx->muxtype = DASHER_MUX_TS;
		} else if (!strcmp(ctx->initext, "mkv") || !strcmp(ctx->initext, "mka") || !strcmp(ctx->initext, "mks") || !strcmp(ctx->initext, "mk3d")) {
			subtype = "x-matroska";
			ctx->muxtype = DASHER_MUX_MKV;
		} else if (!strcmp(ctx->initext, "webm") || !strcmp(ctx->initext, "weba")) {
			subtype = "webm";
			ctx->muxtype = DASHER_MUX_WEBM;
		} else if (!strcmp(ctx->initext, "ogg") || !strcmp(ctx->initext, "oga") || !strcmp(ctx->initext, "ogv") || !strcmp(ctx->initext, "spx") || !strcmp(ctx->initext, "oggm") || !strcmp(ctx->initext, "opus")) {
			subtype = "ogg";
			ctx->muxtype = DASHER_MUX_OGG;
		}
		else if (!strcmp(ctx->initext, "null")) {
			mux_ext = "mp4";
			ctx->muxtype = DASHER_MUX_ISOM;